MCPcopy Index your code
hub / github.com/kubernetes-client/python / __init__

Method __init__

kubernetes/base/config/exec_provider.py:34–60  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 3

ConfigExceptionClass · 0.70
safe_getMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected