From e2bad8efff2aaee4906575bc523c57bffa924715 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Tue, 7 Mar 2017 16:39:52 -0500 Subject: Fix to OpenshiftCLIConfig to support an ordereddict. This was breaking test cases. --- roles/lib_openshift/library/oadm_manage_node.py | 3 ++- roles/lib_openshift/library/oc_adm_ca_server_cert.py | 3 ++- roles/lib_openshift/library/oc_adm_policy_group.py | 3 ++- roles/lib_openshift/library/oc_adm_policy_user.py | 3 ++- roles/lib_openshift/library/oc_adm_registry.py | 7 ++++--- roles/lib_openshift/library/oc_adm_router.py | 3 ++- roles/lib_openshift/library/oc_edit.py | 3 ++- roles/lib_openshift/library/oc_env.py | 3 ++- roles/lib_openshift/library/oc_label.py | 3 ++- roles/lib_openshift/library/oc_obj.py | 3 ++- roles/lib_openshift/library/oc_objectvalidator.py | 3 ++- roles/lib_openshift/library/oc_process.py | 3 ++- roles/lib_openshift/library/oc_project.py | 3 ++- roles/lib_openshift/library/oc_route.py | 3 ++- roles/lib_openshift/library/oc_scale.py | 3 ++- roles/lib_openshift/library/oc_secret.py | 3 ++- roles/lib_openshift/library/oc_service.py | 3 ++- roles/lib_openshift/library/oc_serviceaccount.py | 3 ++- roles/lib_openshift/library/oc_serviceaccount_secret.py | 3 ++- roles/lib_openshift/library/oc_version.py | 3 ++- 20 files changed, 42 insertions(+), 22 deletions(-) (limited to 'roles/lib_openshift/library') diff --git a/roles/lib_openshift/library/oadm_manage_node.py b/roles/lib_openshift/library/oadm_manage_node.py index 8c0a29ac7..612f62e81 100644 --- a/roles/lib_openshift/library/oadm_manage_node.py +++ b/roles/lib_openshift/library/oadm_manage_node.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1344,7 +1345,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_adm_ca_server_cert.py b/roles/lib_openshift/library/oc_adm_ca_server_cert.py index bbcd9d0c5..775fefb05 100644 --- a/roles/lib_openshift/library/oc_adm_ca_server_cert.py +++ b/roles/lib_openshift/library/oc_adm_ca_server_cert.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1352,7 +1353,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_adm_policy_group.py b/roles/lib_openshift/library/oc_adm_policy_group.py index 0ab1c8d49..be32d42e0 100644 --- a/roles/lib_openshift/library/oc_adm_policy_group.py +++ b/roles/lib_openshift/library/oc_adm_policy_group.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1330,7 +1331,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_adm_policy_user.py b/roles/lib_openshift/library/oc_adm_policy_user.py index 91bd85122..f76295fb9 100644 --- a/roles/lib_openshift/library/oc_adm_policy_user.py +++ b/roles/lib_openshift/library/oc_adm_policy_user.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1330,7 +1331,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_adm_registry.py b/roles/lib_openshift/library/oc_adm_registry.py index dcfc326a9..dc9aadf36 100644 --- a/roles/lib_openshift/library/oc_adm_registry.py +++ b/roles/lib_openshift/library/oc_adm_registry.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1448,7 +1449,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): @@ -2266,7 +2267,6 @@ class Registry(OpenShiftCLI): def exists(self): '''does the object exist?''' - self.get() if self.deploymentconfig and self.service: return True @@ -2327,7 +2327,8 @@ class Registry(OpenShiftCLI): service.put('spec.portalIP', self.portal_ip) # the dry-run doesn't apply the selector correctly - service.put('spec.selector', self.service.get_selector()) + if self.service: + service.put('spec.selector', self.service.get_selector()) # need to create the service and the deploymentconfig service_file = Utils.create_tmp_file_from_contents('service', service.yaml_dict) diff --git a/roles/lib_openshift/library/oc_adm_router.py b/roles/lib_openshift/library/oc_adm_router.py index 68b797577..00a1015a9 100644 --- a/roles/lib_openshift/library/oc_adm_router.py +++ b/roles/lib_openshift/library/oc_adm_router.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1473,7 +1474,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_edit.py b/roles/lib_openshift/library/oc_edit.py index 0347644eb..ae19a9094 100644 --- a/roles/lib_openshift/library/oc_edit.py +++ b/roles/lib_openshift/library/oc_edit.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1372,7 +1373,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_env.py b/roles/lib_openshift/library/oc_env.py index e343c70df..40240b17d 100644 --- a/roles/lib_openshift/library/oc_env.py +++ b/roles/lib_openshift/library/oc_env.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1339,7 +1340,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_label.py b/roles/lib_openshift/library/oc_label.py index c4ed42bbe..e0147790b 100644 --- a/roles/lib_openshift/library/oc_label.py +++ b/roles/lib_openshift/library/oc_label.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1348,7 +1349,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_obj.py b/roles/lib_openshift/library/oc_obj.py index 863443517..54914d484 100644 --- a/roles/lib_openshift/library/oc_obj.py +++ b/roles/lib_openshift/library/oc_obj.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1351,7 +1352,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_objectvalidator.py b/roles/lib_openshift/library/oc_objectvalidator.py index f6802a9b3..3b005f1b7 100644 --- a/roles/lib_openshift/library/oc_objectvalidator.py +++ b/roles/lib_openshift/library/oc_objectvalidator.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1283,7 +1284,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_process.py b/roles/lib_openshift/library/oc_process.py index 03c9d2044..f215b09a7 100644 --- a/roles/lib_openshift/library/oc_process.py +++ b/roles/lib_openshift/library/oc_process.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1340,7 +1341,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_project.py b/roles/lib_openshift/library/oc_project.py index 812c67de5..147813693 100644 --- a/roles/lib_openshift/library/oc_project.py +++ b/roles/lib_openshift/library/oc_project.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1337,7 +1338,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_route.py b/roles/lib_openshift/library/oc_route.py index 2ce3824e9..e487147dc 100644 --- a/roles/lib_openshift/library/oc_route.py +++ b/roles/lib_openshift/library/oc_route.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1382,7 +1383,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_scale.py b/roles/lib_openshift/library/oc_scale.py index c9e9b1790..8257040b3 100644 --- a/roles/lib_openshift/library/oc_scale.py +++ b/roles/lib_openshift/library/oc_scale.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1326,7 +1327,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_secret.py b/roles/lib_openshift/library/oc_secret.py index 6058f0ee2..cff27083f 100644 --- a/roles/lib_openshift/library/oc_secret.py +++ b/roles/lib_openshift/library/oc_secret.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1372,7 +1373,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_service.py b/roles/lib_openshift/library/oc_service.py index 8f6303a66..5b4a8271e 100644 --- a/roles/lib_openshift/library/oc_service.py +++ b/roles/lib_openshift/library/oc_service.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1378,7 +1379,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_serviceaccount.py b/roles/lib_openshift/library/oc_serviceaccount.py index 7d78c96d0..ea178f4ee 100644 --- a/roles/lib_openshift/library/oc_serviceaccount.py +++ b/roles/lib_openshift/library/oc_serviceaccount.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1324,7 +1325,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_serviceaccount_secret.py b/roles/lib_openshift/library/oc_serviceaccount_secret.py index c058c555b..39d2c3ef8 100644 --- a/roles/lib_openshift/library/oc_serviceaccount_secret.py +++ b/roles/lib_openshift/library/oc_serviceaccount_secret.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1324,7 +1325,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): diff --git a/roles/lib_openshift/library/oc_version.py b/roles/lib_openshift/library/oc_version.py index 4e65b8a0a..e4e4833c0 100644 --- a/roles/lib_openshift/library/oc_version.py +++ b/roles/lib_openshift/library/oc_version.py @@ -33,6 +33,7 @@ from __future__ import print_function import atexit +import collections import copy import json import os @@ -1296,7 +1297,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = options + self._options = collections.OrderedDict(options) @property def config_options(self): -- cgit v1.2.3 From 49f46a7686cab15eb2ec9335ca00e9cd7eb547b3 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Wed, 8 Mar 2017 13:03:35 -0500 Subject: Removing ordereddict. Replaced with sorted keys. --- roles/lib_openshift/library/oadm_manage_node.py | 8 ++++---- roles/lib_openshift/library/oc_adm_ca_server_cert.py | 8 ++++---- roles/lib_openshift/library/oc_adm_policy_group.py | 8 ++++---- roles/lib_openshift/library/oc_adm_policy_user.py | 8 ++++---- roles/lib_openshift/library/oc_adm_registry.py | 10 +++++----- roles/lib_openshift/library/oc_adm_router.py | 10 +++++----- roles/lib_openshift/library/oc_edit.py | 8 ++++---- roles/lib_openshift/library/oc_env.py | 8 ++++---- roles/lib_openshift/library/oc_label.py | 8 ++++---- roles/lib_openshift/library/oc_obj.py | 8 ++++---- roles/lib_openshift/library/oc_objectvalidator.py | 8 ++++---- roles/lib_openshift/library/oc_process.py | 8 ++++---- roles/lib_openshift/library/oc_project.py | 8 ++++---- roles/lib_openshift/library/oc_route.py | 8 ++++---- roles/lib_openshift/library/oc_scale.py | 8 ++++---- roles/lib_openshift/library/oc_secret.py | 8 ++++---- roles/lib_openshift/library/oc_service.py | 8 ++++---- roles/lib_openshift/library/oc_serviceaccount.py | 8 ++++---- roles/lib_openshift/library/oc_serviceaccount_secret.py | 8 ++++---- roles/lib_openshift/library/oc_version.py | 8 ++++---- 20 files changed, 82 insertions(+), 82 deletions(-) (limited to 'roles/lib_openshift/library') diff --git a/roles/lib_openshift/library/oadm_manage_node.py b/roles/lib_openshift/library/oadm_manage_node.py index 612f62e81..8bb0538c0 100644 --- a/roles/lib_openshift/library/oadm_manage_node.py +++ b/roles/lib_openshift/library/oadm_manage_node.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1345,7 +1344,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1359,10 +1358,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_adm_ca_server_cert.py b/roles/lib_openshift/library/oc_adm_ca_server_cert.py index 775fefb05..4ecfd2bff 100644 --- a/roles/lib_openshift/library/oc_adm_ca_server_cert.py +++ b/roles/lib_openshift/library/oc_adm_ca_server_cert.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1353,7 +1352,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1367,10 +1366,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_adm_policy_group.py b/roles/lib_openshift/library/oc_adm_policy_group.py index be32d42e0..28df1cf94 100644 --- a/roles/lib_openshift/library/oc_adm_policy_group.py +++ b/roles/lib_openshift/library/oc_adm_policy_group.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1331,7 +1330,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1345,10 +1344,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_adm_policy_user.py b/roles/lib_openshift/library/oc_adm_policy_user.py index f76295fb9..9b26a2159 100644 --- a/roles/lib_openshift/library/oc_adm_policy_user.py +++ b/roles/lib_openshift/library/oc_adm_policy_user.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1331,7 +1330,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1345,10 +1344,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_adm_registry.py b/roles/lib_openshift/library/oc_adm_registry.py index dc9aadf36..c398c5551 100644 --- a/roles/lib_openshift/library/oc_adm_registry.py +++ b/roles/lib_openshift/library/oc_adm_registry.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1449,7 +1448,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1463,10 +1462,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval @@ -2293,7 +2293,7 @@ class Registry(OpenShiftCLI): ''' prepare a registry for instantiation ''' options = self.config.to_option_list() - cmd = ['registry', '-n', self.config.namespace] + cmd = ['registry'] cmd.extend(options) cmd.extend(['--dry-run=True', '-o', 'json']) diff --git a/roles/lib_openshift/library/oc_adm_router.py b/roles/lib_openshift/library/oc_adm_router.py index 00a1015a9..ab06a5141 100644 --- a/roles/lib_openshift/library/oc_adm_router.py +++ b/roles/lib_openshift/library/oc_adm_router.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1474,7 +1473,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1488,10 +1487,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval @@ -2730,7 +2730,7 @@ class Router(OpenShiftCLI): options = self.config.to_option_list() - cmd = ['router', self.config.name, '-n', self.config.namespace] + cmd = ['router', self.config.name] cmd.extend(options) cmd.extend(['--dry-run=True', '-o', 'json']) diff --git a/roles/lib_openshift/library/oc_edit.py b/roles/lib_openshift/library/oc_edit.py index ae19a9094..7a7eaf40a 100644 --- a/roles/lib_openshift/library/oc_edit.py +++ b/roles/lib_openshift/library/oc_edit.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1373,7 +1372,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1387,10 +1386,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_env.py b/roles/lib_openshift/library/oc_env.py index 40240b17d..a1994b0f1 100644 --- a/roles/lib_openshift/library/oc_env.py +++ b/roles/lib_openshift/library/oc_env.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1340,7 +1339,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1354,10 +1353,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_label.py b/roles/lib_openshift/library/oc_label.py index e0147790b..109a78184 100644 --- a/roles/lib_openshift/library/oc_label.py +++ b/roles/lib_openshift/library/oc_label.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1349,7 +1348,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1363,10 +1362,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_obj.py b/roles/lib_openshift/library/oc_obj.py index 54914d484..bd6e77c2a 100644 --- a/roles/lib_openshift/library/oc_obj.py +++ b/roles/lib_openshift/library/oc_obj.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1352,7 +1351,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1366,10 +1365,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_objectvalidator.py b/roles/lib_openshift/library/oc_objectvalidator.py index 3b005f1b7..e691c2ea7 100644 --- a/roles/lib_openshift/library/oc_objectvalidator.py +++ b/roles/lib_openshift/library/oc_objectvalidator.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1284,7 +1283,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1298,10 +1297,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_process.py b/roles/lib_openshift/library/oc_process.py index f215b09a7..14d519e52 100644 --- a/roles/lib_openshift/library/oc_process.py +++ b/roles/lib_openshift/library/oc_process.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1341,7 +1340,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1355,10 +1354,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_project.py b/roles/lib_openshift/library/oc_project.py index 147813693..4f82abcfe 100644 --- a/roles/lib_openshift/library/oc_project.py +++ b/roles/lib_openshift/library/oc_project.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1338,7 +1337,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1352,10 +1351,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_route.py b/roles/lib_openshift/library/oc_route.py index e487147dc..97dd310bc 100644 --- a/roles/lib_openshift/library/oc_route.py +++ b/roles/lib_openshift/library/oc_route.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1383,7 +1382,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1397,10 +1396,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_scale.py b/roles/lib_openshift/library/oc_scale.py index 8257040b3..56e4e38f7 100644 --- a/roles/lib_openshift/library/oc_scale.py +++ b/roles/lib_openshift/library/oc_scale.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1327,7 +1326,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1341,10 +1340,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_secret.py b/roles/lib_openshift/library/oc_secret.py index cff27083f..ad32d4900 100644 --- a/roles/lib_openshift/library/oc_secret.py +++ b/roles/lib_openshift/library/oc_secret.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1373,7 +1372,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1387,10 +1386,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_service.py b/roles/lib_openshift/library/oc_service.py index 5b4a8271e..a4d0ca3f3 100644 --- a/roles/lib_openshift/library/oc_service.py +++ b/roles/lib_openshift/library/oc_service.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1379,7 +1378,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1393,10 +1392,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_serviceaccount.py b/roles/lib_openshift/library/oc_serviceaccount.py index ea178f4ee..b6586fca9 100644 --- a/roles/lib_openshift/library/oc_serviceaccount.py +++ b/roles/lib_openshift/library/oc_serviceaccount.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1325,7 +1324,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1339,10 +1338,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_serviceaccount_secret.py b/roles/lib_openshift/library/oc_serviceaccount_secret.py index 39d2c3ef8..925a5a088 100644 --- a/roles/lib_openshift/library/oc_serviceaccount_secret.py +++ b/roles/lib_openshift/library/oc_serviceaccount_secret.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1325,7 +1324,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1339,10 +1338,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval diff --git a/roles/lib_openshift/library/oc_version.py b/roles/lib_openshift/library/oc_version.py index e4e4833c0..8f59d4d7e 100644 --- a/roles/lib_openshift/library/oc_version.py +++ b/roles/lib_openshift/library/oc_version.py @@ -33,7 +33,6 @@ from __future__ import print_function import atexit -import collections import copy import json import os @@ -1297,7 +1296,7 @@ class OpenShiftCLIConfig(object): self.kubeconfig = kubeconfig self.name = rname self.namespace = namespace - self._options = collections.OrderedDict(options) + self._options = options @property def config_options(self): @@ -1311,10 +1310,11 @@ class OpenShiftCLIConfig(object): def stringify(self): ''' return the options hash as cli params in a string ''' rval = [] - for key, data in self.config_options.items(): + for key in sorted(self.config_options.keys()): + data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--%s=%s' % (key.replace('_', '-'), data['value'])) + rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) return rval -- cgit v1.2.3