Keep original behavior of `overcloud deploy`
Merging change Ib96f4f5078ec1c45981d051e546bf931d2885ae2 made both `overcloud deploy` and `overcloud update stack` try to persist user-environment.yaml. But we don't persist `user-files` directory, so user-environment.yaml could then point to non-existing files. This means both `overcloud deploy` and `overcloud update stack` commands are now broken for some cases. This patch partially reverts the previous changes. The plan persistence logic no longer affects `overcloud deploy`, and only focuses on `overcloud update stack`. This way we'll make sure we don't introduce backward incompatibility to `overcloud deploy` command at this point. Also it might be useful to have a stable `deploy` command as a fallback in case the new `overcloud update stack` file preservation approach misbehaves. And persisting `user-files` directory might have a side effect of accumulating garbage files over time (files no longer referenced from anywhere), which is another reason to only do that in the `update` command for now, not `deploy`. If we implement garbage collection for user-files, we could start persisting everything for `deploy` too. Alternatively we might also do a complete overhaul of how we approach deployment plan on CLI to sync closer with UI. Change-Id: I7da71e92af0a6d7ac2d62786d100a1781a4a4fe9 Partial-Bug: #1749700
This commit is contained in:
parent
ba106753ec
commit
78e24e21c4
|
@ -49,6 +49,13 @@ class DeployOvercloud(command.Command):
|
|||
predeploy_warnings = 0
|
||||
_password_cache = None
|
||||
|
||||
# This may be switched on by default in the future, but for now
|
||||
# we'll want this behavior only in `overcloud update stack` and
|
||||
# `overcloud upgrade stack`, as enabling it here by default might
|
||||
# mean e.g. it might mean never deleting files under user-files/
|
||||
# directory in the plan.
|
||||
_keep_env_on_update = False
|
||||
|
||||
def _setup_clients(self, parsed_args):
|
||||
self.clients = self.app.client_manager
|
||||
self.object_client = self.clients.tripleoclient.object_store
|
||||
|
@ -436,7 +443,8 @@ class DeployOvercloud(command.Command):
|
|||
self.clients, parsed_args.stack, tht_root,
|
||||
parsed_args.roles_file, generate_passwords,
|
||||
parsed_args.plan_environment_file,
|
||||
parsed_args.networks_file)
|
||||
parsed_args.networks_file,
|
||||
type(self)._keep_env_on_update)
|
||||
else:
|
||||
plan_management.create_plan_from_templates(
|
||||
self.clients, parsed_args.stack, tht_root,
|
||||
|
|
|
@ -32,6 +32,11 @@ class UpdateOvercloud(DeployOvercloud):
|
|||
|
||||
log = logging.getLogger(__name__ + ".UpdateOvercloud")
|
||||
|
||||
# enable preservation of all important files (plan env, user env,
|
||||
# roles/network data, user files) so that we don't have to pass
|
||||
# all env files on update command
|
||||
_keep_env_on_update = True
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UpdateOvercloud, self).get_parser(prog_name)
|
||||
parser.add_argument('--init-update',
|
||||
|
|
|
@ -145,7 +145,7 @@ def create_plan_from_templates(clients, name, tht_root, roles_file=None,
|
|||
|
||||
def update_plan_from_templates(clients, name, tht_root, roles_file=None,
|
||||
generate_passwords=True, plan_env_file=None,
|
||||
networks_file=None):
|
||||
networks_file=None, keep_env=False):
|
||||
swift_client = clients.tripleoclient.object_store
|
||||
|
||||
# If the plan environment was migrated to Swift, save the generated
|
||||
|
@ -191,16 +191,20 @@ def update_plan_from_templates(clients, name, tht_root, roles_file=None,
|
|||
print("Uploading new plan files")
|
||||
_upload_templates(swift_client, name, tht_root, roles_file, plan_env_file,
|
||||
networks_file)
|
||||
# Update password and user parameters into swift
|
||||
_update_passwords(swift_client, name, passwords)
|
||||
|
||||
for filename in keep_file_contents:
|
||||
_upload_file_content(swift_client, name, filename,
|
||||
keep_file_contents[filename])
|
||||
if keep_env:
|
||||
for filename in keep_file_contents:
|
||||
_upload_file_content(swift_client, name, filename,
|
||||
keep_file_contents[filename])
|
||||
|
||||
update_deployment_plan(clients, container=name,
|
||||
generate_passwords=generate_passwords,
|
||||
source_url=None, plan_environment=env)
|
||||
update_deployment_plan(clients, container=name,
|
||||
generate_passwords=generate_passwords,
|
||||
source_url=None, plan_environment=env)
|
||||
else:
|
||||
_update_passwords(swift_client, name, passwords)
|
||||
update_deployment_plan(clients, container=name,
|
||||
generate_passwords=generate_passwords,
|
||||
source_url=None)
|
||||
|
||||
|
||||
def _load_content_or_file(swift_client, container, remote_and_local_map):
|
||||
|
|
Loading…
Reference in New Issue