Remove --container-registry-file parameter from * upgrade clis
Currently the container image registry references are passed with
--container-registry-file in prepare but as -e in converge for
the upgrade/update/ffwd-upgrade/ceph-upgrade clis.
There is no special handling of the file, and it is ultimately
included as any other environment file [1].
This removes the --container-registry-file parameter from
openstack overcloud [upgrade|update|ffwd-upgrade|ceph-upgrade]
prepare.
The related tripleo-common review is for removal of the parameter
from the mistral workflow and action
The related tripleo-docs patch is for updating the operator
instructions to include the container image registry references
using -e as any other environment file.
[1] 2c83dc964b/tripleo_common/actions/package_update.py (L60)
Related: https://review.openstack.org/570903 tripleo-docs
Partial-Bug: #1785825
Co-Authored-By: Jiri Stransky <jistr@jistr.com>
Depends-On: https://review.openstack.org/571186
Change-Id: Id2811dbef59d1be2a35cea062eb7116648f52145
This commit is contained in:
parent
cf740bfcfa
commit
ac44a85937
@ -69,16 +69,13 @@ class TestFFWDUpgradePrepare(fakes.TestFFWDUpgradePrepare):
|
||||
mock_stack = mock.Mock()
|
||||
mock_stack.stack_name = 'mystack'
|
||||
mock_get_stack.return_value = mock_stack
|
||||
mock_abspath.return_value = '/home/fake/my-fake-registry.yaml'
|
||||
mock_yaml.return_value = {'fake_container': 'fake_value'}
|
||||
|
||||
argslist = ['--stack', 'mystack', '--templates',
|
||||
'--container-registry-file', 'my-fake-registry.yaml',
|
||||
'--yes']
|
||||
verifylist = [
|
||||
('stack', 'mystack'),
|
||||
('templates', constants.TRIPLEO_HEAT_TEMPLATES),
|
||||
('container_registry_file', 'my-fake-registry.yaml'),
|
||||
('yes', True),
|
||||
]
|
||||
|
||||
@ -87,7 +84,6 @@ class TestFFWDUpgradePrepare(fakes.TestFFWDUpgradePrepare):
|
||||
mock_ffwd_upgrade.assert_called_once_with(
|
||||
self.app.client_manager,
|
||||
container='mystack',
|
||||
container_registry={'fake_container': 'fake_value'},
|
||||
)
|
||||
|
||||
mock_overcloudrc.assert_called_once_with(mock.ANY,
|
||||
@ -108,15 +104,12 @@ class TestFFWDUpgradePrepare(fakes.TestFFWDUpgradePrepare):
|
||||
self, mock_deploy, mock_copy, mock_yaml, mock_abspath, mock_open,
|
||||
mock_ffwd_upgrade, mock_prepend_env):
|
||||
mock_ffwd_upgrade.side_effect = exceptions.DeploymentError()
|
||||
mock_abspath.return_value = '/home/fake/my-fake-registry.yaml'
|
||||
mock_yaml.return_value = {'fake_container': 'fake_value'}
|
||||
argslist = ['--stack', 'overcloud', '--templates',
|
||||
'--container-registry-file', 'my-fake-registry.yaml',
|
||||
'--yes', ]
|
||||
verifylist = [
|
||||
('stack', 'overcloud'),
|
||||
('templates', constants.TRIPLEO_HEAT_TEMPLATES),
|
||||
('container_registry_file', 'my-fake-registry.yaml'),
|
||||
('yes', True),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||
|
@ -54,15 +54,13 @@ class TestOvercloudUpdatePrepare(fakes.TestOvercloudUpdatePrepare):
|
||||
mock_stack = mock.Mock()
|
||||
mock_stack.stack_name = 'overcloud'
|
||||
mock_get_stack.return_value = mock_stack
|
||||
mock_abspath.return_value = '/home/fake/my-fake-registry.yaml'
|
||||
mock_yaml.return_value = {'fake_container': 'fake_value'}
|
||||
|
||||
argslist = ['--stack', 'overcloud', '--templates',
|
||||
'--container-registry-file', 'my-fake-registry.yaml']
|
||||
argslist = ['--stack', 'overcloud', '--templates']
|
||||
|
||||
verifylist = [
|
||||
('stack', 'overcloud'),
|
||||
('templates', constants.TRIPLEO_HEAT_TEMPLATES),
|
||||
('container_registry_file', 'my-fake-registry.yaml')
|
||||
]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||
@ -74,7 +72,6 @@ class TestOvercloudUpdatePrepare(fakes.TestOvercloudUpdatePrepare):
|
||||
mock_update.assert_called_once_with(
|
||||
self.app.client_manager,
|
||||
container='overcloud',
|
||||
container_registry={'fake_container': 'fake_value'},
|
||||
)
|
||||
|
||||
@mock.patch('tripleoclient.workflows.package_update.update',
|
||||
@ -88,14 +85,11 @@ class TestOvercloudUpdatePrepare(fakes.TestOvercloudUpdatePrepare):
|
||||
def test_update_failed(self, mock_deploy, mock_copy, mock_yaml,
|
||||
mock_abspath, mock_open, mock_update):
|
||||
mock_update.side_effect = exceptions.DeploymentError()
|
||||
mock_abspath.return_value = '/home/fake/my-fake-registry.yaml'
|
||||
mock_yaml.return_value = {'fake_container': 'fake_value'}
|
||||
argslist = ['--stack', 'overcloud', '--templates',
|
||||
'--container-registry-file', 'my-fake-registry.yaml']
|
||||
argslist = ['--stack', 'overcloud', '--templates', ]
|
||||
verifylist = [
|
||||
('stack', 'overcloud'),
|
||||
('templates', constants.TRIPLEO_HEAT_TEMPLATES),
|
||||
('container_registry_file', 'my-fake-registry.yaml')
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||
|
||||
|
@ -68,16 +68,13 @@ class TestOvercloudUpgradePrepare(fakes.TestOvercloudUpgradePrepare):
|
||||
mock_stack = mock.Mock()
|
||||
mock_stack.stack_name = 'overcloud'
|
||||
mock_get_stack.return_value = mock_stack
|
||||
mock_abspath.return_value = '/home/fake/my-fake-registry.yaml'
|
||||
mock_yaml.return_value = {'fake_container': 'fake_value'}
|
||||
add_env = mock.Mock()
|
||||
add_env.return_value = True
|
||||
argslist = ['--stack', 'overcloud', '--templates',
|
||||
'--container-registry-file', 'my-fake-registry.yaml']
|
||||
argslist = ['--stack', 'overcloud', '--templates', ]
|
||||
verifylist = [
|
||||
('stack', 'overcloud'),
|
||||
('templates', constants.TRIPLEO_HEAT_TEMPLATES),
|
||||
('container_registry_file', 'my-fake-registry.yaml'),
|
||||
]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||
@ -85,7 +82,6 @@ class TestOvercloudUpgradePrepare(fakes.TestOvercloudUpgradePrepare):
|
||||
mock_upgrade.assert_called_once_with(
|
||||
self.app.client_manager,
|
||||
container='overcloud',
|
||||
container_registry={'fake_container': 'fake_value'},
|
||||
)
|
||||
|
||||
mock_overcloudrc.assert_called_once_with(mock.ANY,
|
||||
@ -105,16 +101,13 @@ class TestOvercloudUpgradePrepare(fakes.TestOvercloudUpgradePrepare):
|
||||
def test_upgrade_failed(self, mock_deploy, mock_copy, mock_yaml,
|
||||
mock_abspath, mock_open, mock_upgrade, add_env):
|
||||
mock_upgrade.side_effect = exceptions.DeploymentError()
|
||||
mock_abspath.return_value = '/home/fake/my-fake-registry.yaml'
|
||||
mock_yaml.return_value = {'fake_container': 'fake_value'}
|
||||
add_env = mock.Mock()
|
||||
add_env.return_value = True
|
||||
argslist = ['--stack', 'overcloud', '--templates',
|
||||
'--container-registry-file', 'my-fake-registry.yaml']
|
||||
argslist = ['--stack', 'overcloud', '--templates', ]
|
||||
verifylist = [
|
||||
('stack', 'overcloud'),
|
||||
('templates', constants.TRIPLEO_HEAT_TEMPLATES),
|
||||
('container_registry_file', 'my-fake-registry.yaml'),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||
|
||||
|
@ -1051,21 +1051,6 @@ def prepend_environment(environment_files, templates_dir, environment):
|
||||
return environment_files
|
||||
|
||||
|
||||
def load_container_registry(log, path):
|
||||
registry = None
|
||||
if path:
|
||||
with open(os.path.abspath(path)) as content:
|
||||
registry = yaml.load(content.read())
|
||||
else:
|
||||
log.warning(_(
|
||||
"You have not provided a container registry file. Note "
|
||||
"that none of the containers on your environment will be "
|
||||
"updated. If you want to update your containers you have "
|
||||
"to re-run this command and provide the registry file "
|
||||
"with: --container-registry-file option."))
|
||||
return registry
|
||||
|
||||
|
||||
def get_short_hostname():
|
||||
"""Returns the local short hostname
|
||||
|
||||
|
@ -48,12 +48,6 @@ class FFWDUpgradePrepare(DeployOvercloud):
|
||||
"required before any ffwd-upgrade "
|
||||
"operation. Use this with caution! "),
|
||||
)
|
||||
parser.add_argument('--container-registry-file',
|
||||
dest='container_registry_file',
|
||||
default=None,
|
||||
help=_("File which contains the container "
|
||||
"registry data for the upgrade"),
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@ -74,8 +68,6 @@ class FFWDUpgradePrepare(DeployOvercloud):
|
||||
config=constants.FFWD_UPGRADE_PREPARE_SCRIPT, group='script',
|
||||
queue_name=constants.FFWD_UPGRADE_QUEUE)
|
||||
|
||||
registry = oooutils.load_container_registry(
|
||||
self.log, parsed_args.container_registry_file)
|
||||
# In case of update and upgrade we need to force the
|
||||
# update_plan_only. The heat stack update is done by the
|
||||
# packag_update mistral action
|
||||
@ -91,8 +83,7 @@ class FFWDUpgradePrepare(DeployOvercloud):
|
||||
constants.FFWD_UPGRADE_PREPARE_ENV)
|
||||
|
||||
super(FFWDUpgradePrepare, self).take_action(parsed_args)
|
||||
package_update.update(clients, container=stack_name,
|
||||
container_registry=registry)
|
||||
package_update.update(clients, container=stack_name)
|
||||
package_update.get_config(clients, container=stack_name)
|
||||
|
||||
overcloudrcs = deployment.create_overcloudrc(
|
||||
|
@ -41,12 +41,6 @@ class UpdatePrepare(DeployOvercloud):
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UpdatePrepare, self).get_parser(prog_name)
|
||||
parser.add_argument('--container-registry-file',
|
||||
dest='container_registry_file',
|
||||
default=None,
|
||||
help=_("File which contains the container "
|
||||
"registry data for the update"),
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@ -57,8 +51,6 @@ class UpdatePrepare(DeployOvercloud):
|
||||
parsed_args.stack)
|
||||
|
||||
stack_name = stack.stack_name
|
||||
registry = oooutils.load_container_registry(
|
||||
self.log, parsed_args.container_registry_file)
|
||||
|
||||
# In case of update and upgrade we need to force the
|
||||
# update_plan_only. The heat stack update is done by the
|
||||
@ -73,8 +65,7 @@ class UpdatePrepare(DeployOvercloud):
|
||||
constants.UPDATE_PREPARE_ENV)
|
||||
|
||||
super(UpdatePrepare, self).take_action(parsed_args)
|
||||
package_update.update(clients, container=stack_name,
|
||||
container_registry=registry)
|
||||
package_update.update(clients, container=stack_name)
|
||||
package_update.get_config(clients, container=stack_name)
|
||||
self.log.info("Update init on stack {0} complete.".format(
|
||||
parsed_args.stack))
|
||||
|
@ -43,12 +43,6 @@ class UpgradePrepare(DeployOvercloud):
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UpgradePrepare, self).get_parser(prog_name)
|
||||
parser.add_argument('--container-registry-file',
|
||||
dest='container_registry_file',
|
||||
default=None,
|
||||
help=_("File which contains the container "
|
||||
"registry data for the upgrade"),
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@ -59,8 +53,6 @@ class UpgradePrepare(DeployOvercloud):
|
||||
parsed_args.stack)
|
||||
|
||||
stack_name = stack.stack_name
|
||||
registry = oooutils.load_container_registry(
|
||||
self.log, parsed_args.container_registry_file)
|
||||
|
||||
# In case of update and upgrade we need to force the
|
||||
# update_plan_only. The heat stack update is done by the
|
||||
@ -73,8 +65,7 @@ class UpgradePrepare(DeployOvercloud):
|
||||
parsed_args.environment_files, templates_dir,
|
||||
constants.UPGRADE_PREPARE_ENV)
|
||||
super(UpgradePrepare, self).take_action(parsed_args)
|
||||
package_update.update(clients, container=stack_name,
|
||||
container_registry=registry)
|
||||
package_update.update(clients, container=stack_name)
|
||||
package_update.get_config(clients, container=stack_name)
|
||||
|
||||
overcloudrcs = deployment.create_overcloudrc(
|
||||
@ -237,10 +228,8 @@ class UpgradeConvergeOvercloud(DeployOvercloud):
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
clients = self.app.client_manager
|
||||
|
||||
stack = oooutils.get_stack(clients.orchestration,
|
||||
parsed_args.stack)
|
||||
|
||||
# Add the converge environment into the args to unset noop etc
|
||||
templates_dir = (parsed_args.templates or
|
||||
constants.TRIPLEO_HEAT_TEMPLATES)
|
||||
|
Loading…
Reference in New Issue
Block a user