diff --git a/tripleoclient/command.py b/tripleoclient/command.py index 204ff9ea1..797e18d37 100644 --- a/tripleoclient/command.py +++ b/tripleoclient/command.py @@ -45,12 +45,11 @@ class DeprecatedActionStore(_StoreAction): if len(self.option_strings) == 1: message = 'The option {option} is deprecated, it will be removed'\ ' in a future version'.format( - option=self.option_strings[0]) + option=self.option_strings[0]) else: option = ', '.join(self.option_strings) message = 'The options {option} is deprecated, it will be removed'\ - ' in a future version'.format( - option=option) + ' in a future version'.format(option=option) self.log.warning(message) super(DeprecatedActionStore, self).__call__( diff --git a/tripleoclient/tests/v1/test_container_image.py b/tripleoclient/tests/v1/test_container_image.py index 7c087f62f..9a3af7370 100644 --- a/tripleoclient/tests/v1/test_container_image.py +++ b/tripleoclient/tests/v1/test_container_image.py @@ -187,12 +187,14 @@ class TestContainerImagePrepare(TestPluginV1): mock_bsf.return_value = set(['OS::TripleO::Services::AodhEvaluator']) resource_registry = { - 'parameter_defaults': { - 'NeutronMechanismDrivers': 'ovn', - }, 'resource_registry': { - 'OS::TripleO::Services::AodhEvaluator': aodh_file, - 'OS::TripleO::Services::AodhApi': aodh_file - }} + 'parameter_defaults': { + 'NeutronMechanismDrivers': 'ovn', + }, + 'resource_registry': { + 'OS::TripleO::Services::AodhEvaluator': aodh_file, + 'OS::TripleO::Services::AodhApi': aodh_file + } + } pmef.return_value = None, resource_registry arglist = [ diff --git a/tripleoclient/v1/overcloud_update.py b/tripleoclient/v1/overcloud_update.py index 7aed493d9..e770218c2 100644 --- a/tripleoclient/v1/overcloud_update.py +++ b/tripleoclient/v1/overcloud_update.py @@ -107,11 +107,12 @@ class UpdateRun(command.Command): "a specific node or list (comma separated string) of nodes.") ) nodes_or_roles_or_limit.add_argument( - '--limit', action='store', help=_( - "A string that identifies a single node or comma-separated" - " list of nodes to be upgraded in parallel in this upgrade" - " run invocation. For example: --limit \"compute-0," - " compute-1, compute-5\".")) + '--limit', action='store', help=_( + "A string that identifies a single node or comma-separated" + " list of nodes to be upgraded in parallel in this upgrade" + " run invocation. For example: --limit \"compute-0," + " compute-1, compute-5\".") + ) parser.add_argument('--playbook', action="store", default="all", diff --git a/tripleoclient/v1/overcloud_upgrade.py b/tripleoclient/v1/overcloud_upgrade.py index 55c7c5f57..f88776ae7 100644 --- a/tripleoclient/v1/overcloud_upgrade.py +++ b/tripleoclient/v1/overcloud_upgrade.py @@ -127,11 +127,12 @@ class UpgradeRun(command.Command): "a specific node or list (comma separated string) of nodes.") ) nodes_or_roles_or_limit.add_argument( - '--limit', action='store', help=_( - "A string that identifies a single node or comma-separated" - "list of nodes to be upgraded in parallel in this upgrade" - " run invocation. For example: --limit \"compute-0," - " compute-1, compute-5\".")) + '--limit', action='store', help=_( + "A string that identifies a single node or comma-separated" + "list of nodes to be upgraded in parallel in this upgrade" + " run invocation. For example: --limit \"compute-0," + " compute-1, compute-5\".") + ) parser.add_argument('--playbook', action="store", default="all", diff --git a/tripleoclient/v1/tripleo_deploy.py b/tripleoclient/v1/tripleo_deploy.py index bd985198c..0ee8a2cbc 100644 --- a/tripleoclient/v1/tripleo_deploy.py +++ b/tripleoclient/v1/tripleo_deploy.py @@ -106,19 +106,26 @@ class Deploy(command.Command): ansible_playbook_cmd = "ansible-playbook-{}".format(python_version) python_cmd = "python{}".format(python_version) - # https://bugs.launchpad.net/tripleo/+bug/1812837 - if os.getuid() == 0: - if not os.path.exists('/usr/bin/ansible-playbook'): - if os.path.exists('/usr/bin/' + ansible_playbook_cmd): - if not os.path.exists('/usr/local/bin/ansible-playbook'): - os.symlink('/usr/bin/' + ansible_playbook_cmd, - '/usr/local/bin/ansible-playbook') + def __new__(cls, *args, **kwargs): + # https://bugs.launchpad.net/tripleo/+bug/1812837 + if os.getuid() != 0: + cls.log.warning('Will not consider symlink creation (E_NOROOT).') else: - if not os.path.exists('/usr/bin/' + ansible_playbook_cmd): - if not os.path.exists( - '/usr/local/bin/' + ansible_playbook_cmd): - os.symlink('/usr/bin/ansible-playbook', - '/usr/local/bin/' + ansible_playbook_cmd) + if not os.path.exists('/usr/bin/ansible-playbook'): + if os.path.exists('/usr/bin/' + cls.ansible_playbook_cmd): + if not os.path.exists('/usr/bin/ansible-playbook'): + os.symlink('/usr/bin/' + cls.ansible_playbook_cmd, + '/usr/bin/ansible-playbook') + else: + if not os.path.exists('/usr/bin/' + cls.ansible_playbook_cmd): + if not os.path.exists( + '/usr/bin/' + cls.ansible_playbook_cmd): + os.symlink('/usr/bin/ansible-playbook', + '/usr/bin/' + cls.ansible_playbook_cmd) + if cls.python_version == 3: + return super().__new__(cls) + else: + return super(Deploy, cls).__new__(cls, *args, **kwargs) def _is_undercloud_deploy(self, parsed_args): return parsed_args.standalone_role == 'Undercloud' and \