exec_config must be of type ConfigNode because we depend on safe_get(self, key) to correctly handle optional exec provider config parameters.
(self, exec_config, cwd, cluster=None)
| 32 | """ |
| 33 | |
| 34 | def __init__(self, exec_config, cwd, cluster=None): |
| 35 | """ |
| 36 | exec_config must be of type ConfigNode because we depend on |
| 37 | safe_get(self, key) to correctly handle optional exec provider |
| 38 | config parameters. |
| 39 | """ |
| 40 | for key in ['command', 'apiVersion']: |
| 41 | if key not in exec_config: |
| 42 | raise ConfigException( |
| 43 | 'exec: malformed request. missing key \'%s\'' % key) |
| 44 | self.api_version = exec_config['apiVersion'] |
| 45 | self.args = [exec_config['command']] |
| 46 | if exec_config.safe_get('args'): |
| 47 | self.args.extend(exec_config['args']) |
| 48 | self.env = os.environ.copy() |
| 49 | if exec_config.safe_get('env'): |
| 50 | additional_vars = {} |
| 51 | for item in exec_config['env']: |
| 52 | name = item['name'] |
| 53 | value = item['value'] |
| 54 | additional_vars[name] = value |
| 55 | self.env.update(additional_vars) |
| 56 | if exec_config.safe_get('provideClusterInfo'): |
| 57 | self.cluster = cluster |
| 58 | else: |
| 59 | self.cluster = None |
| 60 | self.cwd = cwd or None |
| 61 | |
| 62 | @property |
| 63 | def shell(self): |
nothing calls this directly
no test coverage detected