diff options
-rw-r--r-- | roles/lib_openshift/library/oc_env.py | 19 | ||||
-rw-r--r-- | roles/lib_openshift/src/class/oc_env.py | 12 | ||||
-rw-r--r-- | roles/lib_openshift/src/doc/env | 7 |
3 files changed, 24 insertions, 14 deletions
diff --git a/roles/lib_openshift/library/oc_env.py b/roles/lib_openshift/library/oc_env.py index fa4191d1e..06c242db6 100644 --- a/roles/lib_openshift/library/oc_env.py +++ b/roles/lib_openshift/library/oc_env.py @@ -98,6 +98,13 @@ options: - dc - pods aliases: [] + env_vars: + description: + - The environment variables to insert. The format is a dict of value pairs. + - e.g. {key1: value1, key2: value2}) + required: False + default: None + aliases: [] author: - "Kenny Woodson <kwoodson@redhat.com>" extends_documentation_fragment: [] @@ -1644,16 +1651,16 @@ class OCEnv(OpenShiftCLI): ''' setter function for resource var''' self._resource = data - def value_exists(self, key, value): + def key_value_exists(self, key, value): ''' return whether a key, value pair exists ''' return self.resource.exists_env_value(key, value) def key_exists(self, key): - ''' return whether a key, value pair exists ''' + ''' return whether a key exists ''' return self.resource.exists_env_key(key) def get(self): - '''return a environment variables ''' + '''return environment variables ''' result = self._get(self.kind, self.name) if result['returncode'] == 0: if self.kind == 'dc': @@ -1662,14 +1669,12 @@ class OCEnv(OpenShiftCLI): return result def delete(self): - '''return all pods ''' - #yed.put(OCEnv.container_path[self.kind], env_vars_array) + ''' delete environment variables ''' if self.resource.delete_env_var(self.env_vars.keys()): return self._replace_content(self.kind, self.name, self.resource.yaml_dict) return {'returncode': 0, 'changed': False} - # pylint: disable=too-many-function-args def put(self): '''place env vars into dc ''' for update_key, update_value in self.env_vars.items(): @@ -1721,7 +1726,7 @@ class OCEnv(OpenShiftCLI): # Create ######## for key, value in params.get('env_vars', {}).items(): - if not ocenv.value_exists(key, value): + if not ocenv.key_value_exists(key, value): if check_mode: return {'changed': False, diff --git a/roles/lib_openshift/src/class/oc_env.py b/roles/lib_openshift/src/class/oc_env.py index b5e78bf90..d34c8234e 100644 --- a/roles/lib_openshift/src/class/oc_env.py +++ b/roles/lib_openshift/src/class/oc_env.py @@ -42,16 +42,16 @@ class OCEnv(OpenShiftCLI): ''' setter function for resource var''' self._resource = data - def value_exists(self, key, value): + def key_value_exists(self, key, value): ''' return whether a key, value pair exists ''' return self.resource.exists_env_value(key, value) def key_exists(self, key): - ''' return whether a key, value pair exists ''' + ''' return whether a key exists ''' return self.resource.exists_env_key(key) def get(self): - '''return a environment variables ''' + '''return environment variables ''' result = self._get(self.kind, self.name) if result['returncode'] == 0: if self.kind == 'dc': @@ -60,14 +60,12 @@ class OCEnv(OpenShiftCLI): return result def delete(self): - '''return all pods ''' - #yed.put(OCEnv.container_path[self.kind], env_vars_array) + ''' delete environment variables ''' if self.resource.delete_env_var(self.env_vars.keys()): return self._replace_content(self.kind, self.name, self.resource.yaml_dict) return {'returncode': 0, 'changed': False} - # pylint: disable=too-many-function-args def put(self): '''place env vars into dc ''' for update_key, update_value in self.env_vars.items(): @@ -119,7 +117,7 @@ class OCEnv(OpenShiftCLI): # Create ######## for key, value in params.get('env_vars', {}).items(): - if not ocenv.value_exists(key, value): + if not ocenv.key_value_exists(key, value): if check_mode: return {'changed': False, diff --git a/roles/lib_openshift/src/doc/env b/roles/lib_openshift/src/doc/env index 0544014e6..36edcd211 100644 --- a/roles/lib_openshift/src/doc/env +++ b/roles/lib_openshift/src/doc/env @@ -52,6 +52,13 @@ options: - dc - pods aliases: [] + env_vars: + description: + - The environment variables to insert. The format is a dict of value pairs. + - e.g. {key1: value1, key2: value2}) + required: False + default: None + aliases: [] author: - "Kenny Woodson <kwoodson@redhat.com>" extends_documentation_fragment: [] |