Merge "Don't assume ansible_dir in finally clause"
This commit is contained in:
commit
5097bf795a
|
@ -89,6 +89,7 @@ class Deploy(command.Command):
|
||||||
stack_update_mark = None
|
stack_update_mark = None
|
||||||
stack_action = 'CREATE'
|
stack_action = 'CREATE'
|
||||||
deployment_user = None
|
deployment_user = None
|
||||||
|
ansible_dir = None
|
||||||
|
|
||||||
# NOTE(cjeanner) Quick'n'dirty way before we have proper
|
# NOTE(cjeanner) Quick'n'dirty way before we have proper
|
||||||
# escalation support through oslo.privsep
|
# escalation support through oslo.privsep
|
||||||
|
@ -1070,7 +1071,7 @@ class Deploy(command.Command):
|
||||||
raise exceptions.DeploymentError(message)
|
raise exceptions.DeploymentError(message)
|
||||||
|
|
||||||
# download the ansible playbooks and execute them.
|
# download the ansible playbooks and execute them.
|
||||||
ansible_dir = \
|
self.ansible_dir = \
|
||||||
self._download_ansible_playbooks(orchestration_client,
|
self._download_ansible_playbooks(orchestration_client,
|
||||||
parsed_args.stack,
|
parsed_args.stack,
|
||||||
parsed_args.standalone_role)
|
parsed_args.standalone_role)
|
||||||
|
@ -1085,14 +1086,14 @@ class Deploy(command.Command):
|
||||||
# FIXME(bogdando): unhardcode key/transport for future
|
# FIXME(bogdando): unhardcode key/transport for future
|
||||||
# multi-node
|
# multi-node
|
||||||
ansible.write_default_ansible_cfg(
|
ansible.write_default_ansible_cfg(
|
||||||
ansible_dir,
|
self.ansible_dir,
|
||||||
parsed_args.deployment_user,
|
parsed_args.deployment_user,
|
||||||
ssh_private_key=None,
|
ssh_private_key=None,
|
||||||
transport='local')
|
transport='local')
|
||||||
else:
|
else:
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
_('Using the existing %s for deployment') % ansible_config)
|
_('Using the existing %s for deployment') % ansible_config)
|
||||||
shutil.copy(ansible_config, ansible_dir)
|
shutil.copy(ansible_config, self.ansible_dir)
|
||||||
|
|
||||||
# Kill heat, we're done with it now.
|
# Kill heat, we're done with it now.
|
||||||
if not parsed_args.keep_running:
|
if not parsed_args.keep_running:
|
||||||
|
@ -1100,10 +1101,10 @@ class Deploy(command.Command):
|
||||||
if not parsed_args.output_only:
|
if not parsed_args.output_only:
|
||||||
# Run Upgrade tasks before the deployment
|
# Run Upgrade tasks before the deployment
|
||||||
if parsed_args.upgrade:
|
if parsed_args.upgrade:
|
||||||
rc = self._launch_ansible_upgrade(ansible_dir)
|
rc = self._launch_ansible_upgrade(self.ansible_dir)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
raise exceptions.DeploymentError('Upgrade failed')
|
raise exceptions.DeploymentError('Upgrade failed')
|
||||||
rc = self._launch_ansible_deploy(ansible_dir)
|
rc = self._launch_ansible_deploy(self.ansible_dir)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.error("Exception: %s" % six.text_type(e))
|
self.log.error("Exception: %s" % six.text_type(e))
|
||||||
raise exceptions.DeploymentError(six.text_type(e))
|
raise exceptions.DeploymentError(six.text_type(e))
|
||||||
|
@ -1112,8 +1113,9 @@ class Deploy(command.Command):
|
||||||
self._kill_heat(parsed_args)
|
self._kill_heat(parsed_args)
|
||||||
tar_filename = \
|
tar_filename = \
|
||||||
self._create_install_artifact(parsed_args.deployment_user)
|
self._create_install_artifact(parsed_args.deployment_user)
|
||||||
|
if self.ansible_dir:
|
||||||
self._dump_ansible_errors(
|
self._dump_ansible_errors(
|
||||||
os.path.join(ansible_dir,
|
os.path.join(self.ansible_dir,
|
||||||
tc_constants.ANSIBLE_ERRORS_FILE),
|
tc_constants.ANSIBLE_ERRORS_FILE),
|
||||||
parsed_args.stack)
|
parsed_args.stack)
|
||||||
self._cleanup_working_dirs(
|
self._cleanup_working_dirs(
|
||||||
|
|
Loading…
Reference in New Issue