(self)
| 80 | |
| 81 | |
| 82 | def GenerateConfig(self): |
| 83 | cfg = [] |
| 84 | for opt_key, opt_val in self.__opts.items(): |
| 85 | if opt_key in ['daemon', 'dco', 'profile_override']: |
| 86 | # Don't put profile overrides, 'daemon' or 'dco' into the |
| 87 | # generated config. These are not a valid configuration |
| 88 | # options and are sent to the configuration manager |
| 89 | # separately |
| 90 | continue; |
| 91 | |
| 92 | key = opt_key.replace('_', '-') |
| 93 | if isinstance(opt_val, bool): |
| 94 | if opt_val is True: |
| 95 | cfg.append(key) |
| 96 | elif isinstance(opt_val, list): |
| 97 | for v in opt_val: |
| 98 | cfg.append('%s %s' %(key, v)) |
| 99 | elif opt_val is not None: |
| 100 | processed = False |
| 101 | if key in ('ca', 'cert', 'extra-certs', 'http-proxy-user-pass', |
| 102 | 'key', 'tls-auth', 'tls-crypt', 'tls-crypt-v2', |
| 103 | 'auth-user-pass'): |
| 104 | # Embedded files should not be prefixed by the key value |
| 105 | # |
| 106 | # First, check if it is an embedded file here |
| 107 | if len(opt_val) > 0 and opt_val[0] == '<' and opt_val[-1:] == '>': |
| 108 | cfg.append(opt_val) |
| 109 | processed = True |
| 110 | |
| 111 | if not processed: |
| 112 | cfg.append('%s %s' % (key, opt_val)) |
| 113 | |
| 114 | return '\n'.join(cfg) |
| 115 | |
| 116 | |
| 117 | def GetConfigName(self): |
no outgoing calls
no test coverage detected