diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2017-02-24 11:50:33 -0500 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2017-02-24 13:28:38 -0500 |
commit | 51dd7e556b3dafab88b571b370ecbfc99bcd0ae0 (patch) | |
tree | bd373f1b5fd9f76281e74b2e4ebe97f4cb9e19ed | |
parent | 315657e7befc62502e446dd889f96cfa4c0f5458 (diff) | |
download | openshift-51dd7e556b3dafab88b571b370ecbfc99bcd0ae0.tar.gz openshift-51dd7e556b3dafab88b571b370ecbfc99bcd0ae0.tar.bz2 openshift-51dd7e556b3dafab88b571b370ecbfc99bcd0ae0.tar.xz openshift-51dd7e556b3dafab88b571b370ecbfc99bcd0ae0.zip |
Adding get_env_var to deploymentconfig.
-rw-r--r-- | roles/lib_openshift/library/oc_adm_registry.py | 31 | ||||
-rw-r--r-- | roles/lib_openshift/library/oc_adm_router.py | 24 | ||||
-rw-r--r-- | roles/lib_openshift/library/oc_env.py | 24 | ||||
-rw-r--r-- | roles/lib_openshift/library/oc_scale.py | 24 | ||||
-rw-r--r-- | roles/lib_openshift/src/class/oc_adm_registry.py | 7 | ||||
-rw-r--r-- | roles/lib_openshift/src/lib/deploymentconfig.py | 24 |
6 files changed, 68 insertions, 66 deletions
diff --git a/roles/lib_openshift/library/oc_adm_registry.py b/roles/lib_openshift/library/oc_adm_registry.py index 7f0b7f212..501f710c9 100644 --- a/roles/lib_openshift/library/oc_adm_registry.py +++ b/roles/lib_openshift/library/oc_adm_registry.py @@ -1571,6 +1571,18 @@ spec: return False + def get_env_var(self, key): + '''return a environment variables ''' + results = self.get(DeploymentConfig.env_path) or [] + if not results: + return None + + for env_var in results: + if env_var['name'] == key: + return env_var + + return None + def get_env_vars(self): '''return a environment variables ''' return self.get(DeploymentConfig.env_path) or [] @@ -1655,18 +1667,6 @@ spec: return None - def get_env_var(self, key): - '''return a environment variables ''' - results = self.get(DeploymentConfig.env_path) or [] - if not results: - return None - - for env_var in results: - if env_var['name'] == key: - return env_var - - return None - def get_replicas(self): ''' return replicas setting ''' return self.get(DeploymentConfig.replicas_path) @@ -2369,9 +2369,10 @@ class Registry(OpenShiftCLI): # The environment variable for REGISTRY_HTTP_SECRET is autogenerated # We should set the generated deploymentconfig to the in memory version # the following modifications will overwrite if needed - result = self.deploymentconfig.get_env_var('REGISTRY_HTTP_SECRET') - if result: - deploymentconfig.update_env_var('REGISTRY_HTTP_SECRET', result['value']) + if self.deploymentconfig: + result = self.deploymentconfig.get_env_var('REGISTRY_HTTP_SECRET') + if result: + deploymentconfig.update_env_var('REGISTRY_HTTP_SECRET', result['value']) # Currently we know that our deployment of a registry requires a few extra modifications # Modification 1 diff --git a/roles/lib_openshift/library/oc_adm_router.py b/roles/lib_openshift/library/oc_adm_router.py index 0cb824790..7debc80ff 100644 --- a/roles/lib_openshift/library/oc_adm_router.py +++ b/roles/lib_openshift/library/oc_adm_router.py @@ -1724,6 +1724,18 @@ spec: return False + def get_env_var(self, key): + '''return a environment variables ''' + results = self.get(DeploymentConfig.env_path) or [] + if not results: + return None + + for env_var in results: + if env_var['name'] == key: + return env_var + + return None + def get_env_vars(self): '''return a environment variables ''' return self.get(DeploymentConfig.env_path) or [] @@ -1808,18 +1820,6 @@ spec: return None - def get_env_var(self, key): - '''return a environment variables ''' - results = self.get(DeploymentConfig.env_path) or [] - if not results: - return None - - for env_var in results: - if env_var['name'] == key: - return env_var - - return None - def get_replicas(self): ''' return replicas setting ''' return self.get(DeploymentConfig.replicas_path) diff --git a/roles/lib_openshift/library/oc_env.py b/roles/lib_openshift/library/oc_env.py index 684d0f626..db24ef71f 100644 --- a/roles/lib_openshift/library/oc_env.py +++ b/roles/lib_openshift/library/oc_env.py @@ -1462,6 +1462,18 @@ spec: return False + def get_env_var(self, key): + '''return a environment variables ''' + results = self.get(DeploymentConfig.env_path) or [] + if not results: + return None + + for env_var in results: + if env_var['name'] == key: + return env_var + + return None + def get_env_vars(self): '''return a environment variables ''' return self.get(DeploymentConfig.env_path) or [] @@ -1546,18 +1558,6 @@ spec: return None - def get_env_var(self, key): - '''return a environment variables ''' - results = self.get(DeploymentConfig.env_path) or [] - if not results: - return None - - for env_var in results: - if env_var['name'] == key: - return env_var - - return None - def get_replicas(self): ''' return replicas setting ''' return self.get(DeploymentConfig.replicas_path) diff --git a/roles/lib_openshift/library/oc_scale.py b/roles/lib_openshift/library/oc_scale.py index 7b80710d7..b1fc0e3d2 100644 --- a/roles/lib_openshift/library/oc_scale.py +++ b/roles/lib_openshift/library/oc_scale.py @@ -1449,6 +1449,18 @@ spec: return False + def get_env_var(self, key): + '''return a environment variables ''' + results = self.get(DeploymentConfig.env_path) or [] + if not results: + return None + + for env_var in results: + if env_var['name'] == key: + return env_var + + return None + def get_env_vars(self): '''return a environment variables ''' return self.get(DeploymentConfig.env_path) or [] @@ -1533,18 +1545,6 @@ spec: return None - def get_env_var(self, key): - '''return a environment variables ''' - results = self.get(DeploymentConfig.env_path) or [] - if not results: - return None - - for env_var in results: - if env_var['name'] == key: - return env_var - - return None - def get_replicas(self): ''' return replicas setting ''' return self.get(DeploymentConfig.replicas_path) diff --git a/roles/lib_openshift/src/class/oc_adm_registry.py b/roles/lib_openshift/src/class/oc_adm_registry.py index 069d58d9b..35b417059 100644 --- a/roles/lib_openshift/src/class/oc_adm_registry.py +++ b/roles/lib_openshift/src/class/oc_adm_registry.py @@ -235,9 +235,10 @@ class Registry(OpenShiftCLI): # The environment variable for REGISTRY_HTTP_SECRET is autogenerated # We should set the generated deploymentconfig to the in memory version # the following modifications will overwrite if needed - result = self.deploymentconfig.get_env_var('REGISTRY_HTTP_SECRET') - if result: - deploymentconfig.update_env_var('REGISTRY_HTTP_SECRET', result['value']) + if self.deploymentconfig: + result = self.deploymentconfig.get_env_var('REGISTRY_HTTP_SECRET') + if result: + deploymentconfig.update_env_var('REGISTRY_HTTP_SECRET', result['value']) # Currently we know that our deployment of a registry requires a few extra modifications # Modification 1 diff --git a/roles/lib_openshift/src/lib/deploymentconfig.py b/roles/lib_openshift/src/lib/deploymentconfig.py index 6a0920d37..327c8386d 100644 --- a/roles/lib_openshift/src/lib/deploymentconfig.py +++ b/roles/lib_openshift/src/lib/deploymentconfig.py @@ -105,6 +105,18 @@ spec: return False + def get_env_var(self, key): + '''return a environment variables ''' + results = self.get(DeploymentConfig.env_path) or [] + if not results: + return None + + for env_var in results: + if env_var['name'] == key: + return env_var + + return None + def get_env_vars(self): '''return a environment variables ''' return self.get(DeploymentConfig.env_path) or [] @@ -189,18 +201,6 @@ spec: return None - def get_env_var(self, key): - '''return a environment variables ''' - results = self.get(DeploymentConfig.env_path) or [] - if not results: - return None - - for env_var in results: - if env_var['name'] == key: - return env_var - - return None - def get_replicas(self): ''' return replicas setting ''' return self.get(DeploymentConfig.replicas_path) |