From 3c44e4293825b8f3aafa80bb60599476de3be57d Mon Sep 17 00:00:00 2001 From: Andrew Butcher Date: Mon, 27 Feb 2017 13:30:37 -0500 Subject: [oc_obj] Move namespace argument to end of command. --- roles/lib_openshift/library/oadm_manage_node.py | 4 ++-- roles/lib_openshift/library/oc_adm_ca_server_cert.py | 4 ++-- roles/lib_openshift/library/oc_adm_registry.py | 4 ++-- roles/lib_openshift/library/oc_adm_router.py | 4 ++-- roles/lib_openshift/library/oc_edit.py | 4 ++-- roles/lib_openshift/library/oc_env.py | 4 ++-- roles/lib_openshift/library/oc_label.py | 4 ++-- roles/lib_openshift/library/oc_obj.py | 4 ++-- roles/lib_openshift/library/oc_process.py | 4 ++-- roles/lib_openshift/library/oc_route.py | 4 ++-- roles/lib_openshift/library/oc_scale.py | 4 ++-- roles/lib_openshift/library/oc_secret.py | 4 ++-- roles/lib_openshift/library/oc_service.py | 4 ++-- roles/lib_openshift/library/oc_serviceaccount.py | 4 ++-- roles/lib_openshift/library/oc_serviceaccount_secret.py | 4 ++-- roles/lib_openshift/library/oc_version.py | 4 ++-- roles/lib_openshift/src/lib/base.py | 4 ++-- roles/lib_openshift/src/test/unit/test_oc_env.py | 6 +++--- roles/lib_openshift/src/test/unit/test_oc_route.py | 8 ++++---- roles/lib_openshift/src/test/unit/test_oc_secret.py | 4 ++-- .../lib_openshift/src/test/unit/test_oc_serviceaccount.py | 6 +++--- .../src/test/unit/test_oc_serviceaccount_secret.py | 14 +++++++------- 22 files changed, 53 insertions(+), 53 deletions(-) (limited to 'roles/lib_openshift') diff --git a/roles/lib_openshift/library/oadm_manage_node.py b/roles/lib_openshift/library/oadm_manage_node.py index ced04bf3d..6a3543742 100644 --- a/roles/lib_openshift/library/oadm_manage_node.py +++ b/roles/lib_openshift/library/oadm_manage_node.py @@ -1015,13 +1015,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None 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 0b4a019f3..5b1f417b8 100644 --- a/roles/lib_openshift/library/oc_adm_ca_server_cert.py +++ b/roles/lib_openshift/library/oc_adm_ca_server_cert.py @@ -1023,13 +1023,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_adm_registry.py b/roles/lib_openshift/library/oc_adm_registry.py index 1575b023f..e404f0e0e 100644 --- a/roles/lib_openshift/library/oc_adm_registry.py +++ b/roles/lib_openshift/library/oc_adm_registry.py @@ -1119,13 +1119,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_adm_router.py b/roles/lib_openshift/library/oc_adm_router.py index 52863b5f3..8bbe50ea3 100644 --- a/roles/lib_openshift/library/oc_adm_router.py +++ b/roles/lib_openshift/library/oc_adm_router.py @@ -1144,13 +1144,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_edit.py b/roles/lib_openshift/library/oc_edit.py index 8901042ac..36d9394e1 100644 --- a/roles/lib_openshift/library/oc_edit.py +++ b/roles/lib_openshift/library/oc_edit.py @@ -1043,13 +1043,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_env.py b/roles/lib_openshift/library/oc_env.py index a84b9f074..65b2bf860 100644 --- a/roles/lib_openshift/library/oc_env.py +++ b/roles/lib_openshift/library/oc_env.py @@ -1010,13 +1010,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_label.py b/roles/lib_openshift/library/oc_label.py index 7a4d6959a..ad2b5b5ed 100644 --- a/roles/lib_openshift/library/oc_label.py +++ b/roles/lib_openshift/library/oc_label.py @@ -1019,13 +1019,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_obj.py b/roles/lib_openshift/library/oc_obj.py index 0f56ce983..68e882167 100644 --- a/roles/lib_openshift/library/oc_obj.py +++ b/roles/lib_openshift/library/oc_obj.py @@ -1022,13 +1022,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_process.py b/roles/lib_openshift/library/oc_process.py index 4f53bb5d6..bf4a08c52 100644 --- a/roles/lib_openshift/library/oc_process.py +++ b/roles/lib_openshift/library/oc_process.py @@ -1011,13 +1011,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_route.py b/roles/lib_openshift/library/oc_route.py index a2cbd9b93..9d95fcdbb 100644 --- a/roles/lib_openshift/library/oc_route.py +++ b/roles/lib_openshift/library/oc_route.py @@ -1053,13 +1053,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_scale.py b/roles/lib_openshift/library/oc_scale.py index a7e3e111e..17e2d87c3 100644 --- a/roles/lib_openshift/library/oc_scale.py +++ b/roles/lib_openshift/library/oc_scale.py @@ -997,13 +997,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_secret.py b/roles/lib_openshift/library/oc_secret.py index db9a3a7ec..bf1f788eb 100644 --- a/roles/lib_openshift/library/oc_secret.py +++ b/roles/lib_openshift/library/oc_secret.py @@ -1043,13 +1043,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_service.py b/roles/lib_openshift/library/oc_service.py index c8d4b3040..c789bbdac 100644 --- a/roles/lib_openshift/library/oc_service.py +++ b/roles/lib_openshift/library/oc_service.py @@ -1049,13 +1049,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_serviceaccount.py b/roles/lib_openshift/library/oc_serviceaccount.py index 3e650b5f2..2d485aec2 100644 --- a/roles/lib_openshift/library/oc_serviceaccount.py +++ b/roles/lib_openshift/library/oc_serviceaccount.py @@ -995,13 +995,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_serviceaccount_secret.py b/roles/lib_openshift/library/oc_serviceaccount_secret.py index 749cf2d8e..0aa4d9017 100644 --- a/roles/lib_openshift/library/oc_serviceaccount_secret.py +++ b/roles/lib_openshift/library/oc_serviceaccount_secret.py @@ -995,13 +995,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/library/oc_version.py b/roles/lib_openshift/library/oc_version.py index e9b970967..13b4504c7 100644 --- a/roles/lib_openshift/library/oc_version.py +++ b/roles/lib_openshift/library/oc_version.py @@ -967,13 +967,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/src/lib/base.py b/roles/lib_openshift/src/lib/base.py index 2e822d8ef..53b9f9947 100644 --- a/roles/lib_openshift/src/lib/base.py +++ b/roles/lib_openshift/src/lib/base.py @@ -255,13 +255,13 @@ class OpenShiftCLI(object): if oadm: cmds.append('adm') + cmds.extend(cmd) + if self.all_namespaces: cmds.extend(['--all-namespaces']) elif self.namespace is not None and self.namespace.lower() not in ['none', 'emtpy']: # E501 cmds.extend(['-n', self.namespace]) - cmds.extend(cmd) - rval = {} results = '' err = None diff --git a/roles/lib_openshift/src/test/unit/test_oc_env.py b/roles/lib_openshift/src/test/unit/test_oc_env.py index dab5099c2..45a3ef1eb 100755 --- a/roles/lib_openshift/src/test/unit/test_oc_env.py +++ b/roles/lib_openshift/src/test/unit/test_oc_env.py @@ -147,7 +147,7 @@ class OCEnvTest(unittest.TestCase): # Making sure our mocks were called as we expected mock_cmd.assert_has_calls([ - mock.call(['oc', '-n', 'default', 'get', 'dc', 'router', '-o', 'json'], None), + mock.call(['oc', 'get', 'dc', 'router', '-o', 'json', '-n', 'default'], None), ]) @mock.patch('oc_env.locate_oc_binary') @@ -333,7 +333,7 @@ class OCEnvTest(unittest.TestCase): # Making sure our mocks were called as we expected mock_cmd.assert_has_calls([ - mock.call(['oc', '-n', 'default', 'get', 'dc', 'router', '-o', 'json'], None), + mock.call(['oc', 'get', 'dc', 'router', '-o', 'json', '-n', 'default'], None), ]) @mock.patch('oc_env.locate_oc_binary') @@ -448,7 +448,7 @@ class OCEnvTest(unittest.TestCase): # Making sure our mocks were called as we expected mock_cmd.assert_has_calls([ - mock.call(['oc', '-n', 'default', 'get', 'dc', 'router', '-o', 'json'], None), + mock.call(['oc', 'get', 'dc', 'router', '-o', 'json', '-n', 'default'], None), ]) @unittest.skipIf(six.PY3, 'py2 test only') diff --git a/roles/lib_openshift/src/test/unit/test_oc_route.py b/roles/lib_openshift/src/test/unit/test_oc_route.py index ea94bfabd..e0f6d2f3c 100755 --- a/roles/lib_openshift/src/test/unit/test_oc_route.py +++ b/roles/lib_openshift/src/test/unit/test_oc_route.py @@ -135,7 +135,7 @@ class OCRouteTest(unittest.TestCase): # Making sure our mock was called as we expected mock_cmd.assert_has_calls([ - mock.call(['oc', '-n', 'default', 'get', 'route', 'test', '-o', 'json'], None), + mock.call(['oc', 'get', 'route', 'test', '-o', 'json', '-n', 'default'], None), ]) @mock.patch('oc_route.locate_oc_binary') @@ -265,9 +265,9 @@ metadata: # Making sure our mock was called as we expected mock_cmd.assert_has_calls([ - mock.call(['oc', '-n', 'default', 'get', 'route', 'test', '-o', 'json'], None), - mock.call(['oc', '-n', 'default', 'create', '-f', mock.ANY], None), - mock.call(['oc', '-n', 'default', 'get', 'route', 'test', '-o', 'json'], None), + mock.call(['oc', 'get', 'route', 'test', '-o', 'json', '-n', 'default'], None), + mock.call(['oc', 'create', '-f', mock.ANY, '-n', 'default'], None), + mock.call(['oc', 'get', 'route', 'test', '-o', 'json', '-n', 'default'], None), ]) @unittest.skipIf(six.PY3, 'py2 test only') diff --git a/roles/lib_openshift/src/test/unit/test_oc_secret.py b/roles/lib_openshift/src/test/unit/test_oc_secret.py index 087c62dcf..bf496769a 100755 --- a/roles/lib_openshift/src/test/unit/test_oc_secret.py +++ b/roles/lib_openshift/src/test/unit/test_oc_secret.py @@ -85,8 +85,8 @@ class OCSecretTest(unittest.TestCase): # Making sure our mock was called as we expected mock_cmd.assert_has_calls([ - mock.call(['oc', '-n', 'default', 'get', 'secrets', 'testsecretname', '-o', 'json'], None), - mock.call(['oc', '-n', 'default', 'secrets', 'new', 'testsecretname', mock.ANY], None), + mock.call(['oc', 'get', 'secrets', 'testsecretname', '-o', 'json', '-n', 'default'], None), + mock.call(['oc', 'secrets', 'new', 'testsecretname', mock.ANY, '-n', 'default'], None), ]) mock_write.assert_has_calls([ diff --git a/roles/lib_openshift/src/test/unit/test_oc_serviceaccount.py b/roles/lib_openshift/src/test/unit/test_oc_serviceaccount.py index b02b37053..3572a6728 100755 --- a/roles/lib_openshift/src/test/unit/test_oc_serviceaccount.py +++ b/roles/lib_openshift/src/test/unit/test_oc_serviceaccount.py @@ -111,9 +111,9 @@ class OCServiceAccountTest(unittest.TestCase): # Making sure our mock was called as we expected mock_cmd.assert_has_calls([ - mock.call(['oc', '-n', 'default', 'get', 'sa', 'testserviceaccountname', '-o', 'json'], None), - mock.call(['oc', '-n', 'default', 'create', '-f', mock.ANY], None), - mock.call(['oc', '-n', 'default', 'get', 'sa', 'testserviceaccountname', '-o', 'json'], None), + mock.call(['oc', 'get', 'sa', 'testserviceaccountname', '-o', 'json', '-n', 'default'], None), + mock.call(['oc', 'create', '-f', mock.ANY, '-n', 'default'], None), + mock.call(['oc', 'get', 'sa', 'testserviceaccountname', '-o', 'json', '-n', 'default'], None), ]) @unittest.skipIf(six.PY3, 'py2 test only') diff --git a/roles/lib_openshift/src/test/unit/test_oc_serviceaccount_secret.py b/roles/lib_openshift/src/test/unit/test_oc_serviceaccount_secret.py index ab8ccd18c..d78349e34 100755 --- a/roles/lib_openshift/src/test/unit/test_oc_serviceaccount_secret.py +++ b/roles/lib_openshift/src/test/unit/test_oc_serviceaccount_secret.py @@ -181,10 +181,10 @@ secrets: # Making sure our mocks were called as we expected mock_cmd.assert_has_calls([ - mock.call(['oc', '-n', 'default', 'get', 'sa', 'builder', '-o', 'json'], None), - mock.call(['oc', '-n', 'default', 'get', 'sa', 'builder', '-o', 'json'], None), - mock.call(['oc', '-n', 'default', 'replace', '-f', mock.ANY], None), - mock.call(['oc', '-n', 'default', 'get', 'sa', 'builder', '-o', 'json'], None) + mock.call(['oc', 'get', 'sa', 'builder', '-o', 'json', '-n', 'default'], None), + mock.call(['oc', 'get', 'sa', 'builder', '-o', 'json', '-n', 'default'], None), + mock.call(['oc', 'replace', '-f', mock.ANY, '-n', 'default'], None), + mock.call(['oc', 'get', 'sa', 'builder', '-o', 'json', '-n', 'default'], None) ]) yaml_file = builder_pyyaml_file @@ -304,9 +304,9 @@ secrets: # Making sure our mocks were called as we expected mock_cmd.assert_has_calls([ - mock.call(['oc', '-n', 'default', 'get', 'sa', 'builder', '-o', 'json'], None), - mock.call(['oc', '-n', 'default', 'get', 'sa', 'builder', '-o', 'json'], None), - mock.call(['oc', '-n', 'default', 'replace', '-f', mock.ANY], None), + mock.call(['oc', 'get', 'sa', 'builder', '-o', 'json', '-n', 'default'], None), + mock.call(['oc', 'get', 'sa', 'builder', '-o', 'json', '-n', 'default'], None), + mock.call(['oc', 'replace', '-f', mock.ANY, '-n', 'default'], None), ]) yaml_file = builder_pyyaml_file -- cgit v1.2.3