Fix overcloud status command

We started using a working-dir for overcloud intermediate
files since change I0d803f695c725c58ef2e6b655753b6c8248d1b2f
and this is a regression from it.

Change-Id: I59f9bc2952d82f4173dae92ca25370dd3ca0c47d
This commit is contained in:
ramishra 2021-03-18 09:15:35 +05:30
parent 4139b75157
commit add3c406cd
3 changed files with 23 additions and 6 deletions

View File

@ -2640,3 +2640,9 @@ def kill_heat(launcher, backup_db=True):
def rm_heat(launcher, backup_db=False):
launcher.rm_heat(backup_db)
def get_default_working_dir(stack):
return os.path.join(
os.path.expanduser('~'),
"overcloud-deploy-%s" % stack)

View File

@ -915,9 +915,8 @@ class DeployOvercloud(command.Command):
self.log.debug("take_action(%s)" % parsed_args)
if not parsed_args.working_dir:
self.working_dir = os.path.join(
os.path.expanduser('~'),
"overcloud-deploy-%s" % parsed_args.stack)
self.working_dir = utils.get_default_working_dir(
parsed_args.stack)
else:
self.working_dir = parsed_args.working_dir
utils.makedirs(self.working_dir)
@ -1137,15 +1136,27 @@ class GetDeploymentStatus(command.Command):
help=_('Name of the stack/plan. '
'(default: overcloud)'),
default='overcloud')
parser.add_argument(
'--working-dir',
action='store',
help=_('The working directory for the deployment where all '
'input, output, and generated files are stored.\n'
'Defaults to "$HOME/overcloud-deploy-<stack>"'))
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)" % parsed_args)
stack = parsed_args.plan
if not parsed_args.working_dir:
working_dir = utils.get_default_working_dir(stack)
else:
working_dir = parsed_args.working_dir
status = deployment.get_deployment_status(
self.app.client_manager,
stack
stack,
working_dir
)
if not status:

View File

@ -492,7 +492,7 @@ def get_horizon_url(stack, verbosity=0):
return f.read().strip()
def get_deployment_status(clients, stack_name):
def get_deployment_status(clients, stack_name, working_dir):
"""Return current deployment status."""
try:
@ -501,7 +501,7 @@ def get_deployment_status(clients, stack_name):
return None
try:
status_yaml = utils.get_status_yaml(stack_name)
status_yaml = utils.get_status_yaml(stack_name, working_dir)
with open(status_yaml, 'r') as status_stream:
return yaml.safe_load(status_stream)['deployment_status']
except Exception: