Merge "Remove instack-undercloud and --use-heat"

This commit is contained in:
Zuul 2018-09-27 04:34:06 +00:00 committed by Gerrit Code Review
commit 87c2877cce
3 changed files with 42 additions and 103 deletions

View File

@ -0,0 +1,7 @@
---
upgrade:
- The --use-heat option from undercloud install has been removed along with
the ability to deploy an undercloud on baremetal using instack-undercloud
via 'openstack undercloud install'. Manual deployment may still be possible
by directly invoking the instack-undercloud scripts but it is no longer
available via the 'openstack undercloud install' command.

View File

@ -110,17 +110,6 @@ class TestUndercloudInstall(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/'
'undercloud-stack-vstate-dropin.yaml'])
@mock.patch('subprocess.check_call', autospec=True)
def test_undercloud_install_with_heat_disabled(self, mock_subprocess):
arglist = ['--use-heat=False']
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
mock_subprocess.assert_called_with(['instack-install-undercloud'])
# TODO(cjeanner) drop once we have proper oslo.privsep
@mock.patch('getpass.getuser', return_value='stack')
@mock.patch('shutil.copy')
@ -133,7 +122,7 @@ class TestUndercloudInstall(TestPluginV1):
self.conf.config(output_dir='/foo')
self.conf.config(templates='/usertht')
self.conf.config(roles_file='foo/roles.yaml')
arglist = ['--use-heat', '--no-validations', '--force-stack-update']
arglist = ['--no-validations', '--force-stack-update']
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -270,7 +259,7 @@ class TestUndercloudInstall(TestPluginV1):
env = mock.Mock()
env.get_template = mock.Mock(return_value=Template(instack_net_conf))
mock_get_j2.return_value = (env, None)
arglist = ['--use-heat', '--no-validations']
arglist = ['--no-validations']
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -358,7 +347,7 @@ class TestUndercloudInstall(TestPluginV1):
mock_os, mock_copy,
mock_open, mock_user):
self.conf.config(undercloud_log_file='/foo/bar')
arglist = ['--use-heat', '--no-validations']
arglist = ['--no-validations']
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -425,7 +414,7 @@ class TestUndercloudInstall(TestPluginV1):
mock_os, mock_copy,
mock_open, mock_user):
self.conf.config(undercloud_log_file='/foo/bar')
arglist = ['--use-heat=True', '--no-validations']
arglist = ['--no-validations']
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -485,7 +474,7 @@ class TestUndercloudInstall(TestPluginV1):
def test_undercloud_install_with_swift_encryption(self, mock_subprocess,
mock_wr, mock_os,
mock_copy, mock_user):
arglist = ['--use-heat', '--no-validations']
arglist = ['--no-validations']
verifylist = []
self.conf.set_default('enable_swift_encryption', True)
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -618,29 +607,6 @@ class TestUndercloudUpgrade(TestPluginV1):
'/usr/share/openstack-tripleo-heat-templates/'
'undercloud-stack-vstate-dropin.yaml'])
@mock.patch('os.mkdir')
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
@mock.patch('subprocess.check_call', autospec=True)
def test_undercloud_upgrade_with_heat_disabled(self, mock_subprocess,
mock_wr, mock_os):
arglist = ['--use-heat=False']
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
mock_subprocess.assert_has_calls(
[
mock.call(['sudo', 'yum', 'update', '-y',
'instack-undercloud']),
mock.call('instack-pre-upgrade-undercloud'),
mock.call('instack-upgrade-undercloud'),
mock.call(['sudo', 'systemctl', 'restart',
'openstack-nova-api'])
]
)
# TODO(cjeanner) drop once we have proper oslo.privsep
@mock.patch('getpass.getuser', return_value='stack')
@mock.patch('shutil.copy')
@ -650,7 +616,7 @@ class TestUndercloudUpgrade(TestPluginV1):
def test_undercloud_upgrade_with_heat_enabled(self, mock_subprocess,
mock_wr, mock_os,
mock_copy, mock_user):
arglist = ['--use-heat', '--no-validations']
arglist = ['--no-validations']
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -713,7 +679,7 @@ class TestUndercloudUpgrade(TestPluginV1):
def test_undercloud_upgrade_with_heat_true(self, mock_subprocess,
mock_wr, mock_os,
mock_copy, mock_user):
arglist = ['--use-heat=True', '--no-validations']
arglist = ['--no-validations']
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -776,7 +742,7 @@ class TestUndercloudUpgrade(TestPluginV1):
def test_undercloud_upgrade_with_heat_and_yes(self, mock_subprocess,
mock_wr, mock_os,
mock_user, mock_copy):
arglist = ['--use-heat', '--no-validations', '-y']
arglist = ['--no-validations', '-y']
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -840,7 +806,7 @@ class TestUndercloudUpgrade(TestPluginV1):
def test_undercloud_upgrade_with_heat_and_debug(self, mock_subprocess,
mock_wr, mock_os,
mock_copy, mock_user):
arglist = ['--use-heat', '--no-validations']
arglist = ['--no-validations']
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)

View File

@ -84,16 +84,6 @@ class InstallUndercloud(command.Command):
prog=prog_name,
add_help=False
)
parser.add_argument(
'--use-heat',
dest='use_heat',
nargs='?',
default=None,
const="true",
help=_('This option is deprecated in Rocky. It makes sure that we '
'perform undercloud deploy using ephemeral '
'(one-time create and forget) heat stack and ansible.'),
)
parser.add_argument('--force-stack-update',
dest='force_stack_update',
action='store_true',
@ -130,21 +120,12 @@ class InstallUndercloud(command.Command):
self.log.debug("take_action(%s)" % parsed_args)
utils.ensure_run_as_normal_user()
if parsed_args.use_heat is not None:
self.log.warning('--use-heat is deprecated in Rocky')
if parsed_args.use_heat is not None and \
parsed_args.use_heat.lower() == "false":
self.log.warning(_('Non-containerized undercloud deployment is '
'deprecated in Rocky cycle.'))
cmd = ["instack-install-undercloud"]
else:
no_validations = parsed_args.dry_run or parsed_args.no_validations
cmd = undercloud_config.\
prepare_undercloud_deploy(
no_validations=no_validations,
verbose_level=self.app_args.verbose_level,
force_stack_update=parsed_args.force_stack_update,
dry_run=parsed_args.dry_run)
no_validations = parsed_args.dry_run or parsed_args.no_validations
cmd = undercloud_config.prepare_undercloud_deploy(
no_validations=no_validations,
verbose_level=self.app_args.verbose_level,
force_stack_update=parsed_args.force_stack_update,
dry_run=parsed_args.dry_run)
self.log.warning("Running: %s" % ' '.join(cmd))
if not parsed_args.dry_run:
@ -175,38 +156,23 @@ class UpgradeUndercloud(InstallUndercloud):
self.log.debug("take action(%s)" % parsed_args)
utils.ensure_run_as_normal_user()
if parsed_args.use_heat is not None:
self.log.warning('--use-heat is deprecated in Rocky')
if parsed_args.use_heat is not None and \
parsed_args.use_heat.lower() == "false":
self.log.warning(_('Non-containerized undercloud deployment is '
'deprecated in Rocky cycle.'))
subprocess.check_call(['sudo', 'yum', 'update', '-y',
'instack-undercloud'])
subprocess.check_call("instack-pre-upgrade-undercloud")
subprocess.check_call("instack-upgrade-undercloud")
# restart nova-api
# https://bugzilla.redhat.com/show_bug.cgi?id=1315467
subprocess.check_call(['sudo', 'systemctl', 'restart',
'openstack-nova-api'])
else:
cmd = undercloud_config.\
prepare_undercloud_deploy(
upgrade=True,
yes=parsed_args.yes,
no_validations=parsed_args.
no_validations,
verbose_level=self.app_args.verbose_level,
force_stack_update=parsed_args.force_stack_update)
self.log.warning("Running: %s" % ' '.join(cmd))
if not parsed_args.dry_run:
try:
subprocess.check_call(cmd)
self.log.warning(
UNDERCLOUD_UPGRADE_COMPLETION_MESSAGE.format(
'~/undercloud-passwords.conf',
'~/stackrc'))
except Exception as e:
self.log.error(UNDERCLOUD_FAILURE_MESSAGE)
self.log.error(e)
raise exceptions.DeploymentError(e)
cmd = undercloud_config.\
prepare_undercloud_deploy(
upgrade=True,
yes=parsed_args.yes,
no_validations=parsed_args.
no_validations,
verbose_level=self.app_args.verbose_level,
force_stack_update=parsed_args.force_stack_update)
self.log.warning("Running: %s" % ' '.join(cmd))
if not parsed_args.dry_run:
try:
subprocess.check_call(cmd)
self.log.warning(
UNDERCLOUD_UPGRADE_COMPLETION_MESSAGE.format(
'~/undercloud-passwords.conf',
'~/stackrc'))
except Exception as e:
self.log.error(UNDERCLOUD_FAILURE_MESSAGE)
self.log.error(e)
raise exceptions.DeploymentError(e)