Add --dry-run option to undercloud install
This will help greatly with the development of the --use-heat path by printing the underlying "undercloud deploy" command instead of executing it. This may also help debug undercloud install issues in the field. Change-Id: I42ce297e5663ff782cfb6afa9058daf8abdf389b Blueprint: containerized-undercloud
This commit is contained in:
parent
fedd1b26f8
commit
068ebe0306
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- The ``openstack undercloud install`` command now has a ``--dry-run``
|
||||||
|
argument which will print the resulting install command instead of
|
||||||
|
executing it.
|
@ -44,7 +44,7 @@ class TestUndercloudInstall(TestPluginV1):
|
|||||||
# DisplayCommandBase.take_action() returns two tuples
|
# DisplayCommandBase.take_action() returns two tuples
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
mock_subprocess.assert_called_with('instack-install-undercloud')
|
mock_subprocess.assert_called_with(['instack-install-undercloud'])
|
||||||
|
|
||||||
@mock.patch('subprocess.check_call', autospec=True)
|
@mock.patch('subprocess.check_call', autospec=True)
|
||||||
def test_undercloud_install_with_heat(self, mock_subprocess):
|
def test_undercloud_install_with_heat(self, mock_subprocess):
|
||||||
|
@ -52,6 +52,13 @@ class InstallUndercloud(command.Command):
|
|||||||
default=False,
|
default=False,
|
||||||
help=_("Do not perform undercloud configuration validations"),
|
help=_("Do not perform undercloud configuration validations"),
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--dry-run',
|
||||||
|
dest='dry_run',
|
||||||
|
action='store_true',
|
||||||
|
default=False,
|
||||||
|
help=_("Print the install command instead of running it"),
|
||||||
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
@ -59,13 +66,15 @@ class InstallUndercloud(command.Command):
|
|||||||
|
|
||||||
utils.ensure_run_as_normal_user()
|
utils.ensure_run_as_normal_user()
|
||||||
if parsed_args.use_heat:
|
if parsed_args.use_heat:
|
||||||
|
no_validations = parsed_args.dry_run or parsed_args.no_validations
|
||||||
cmd = undercloud_config.\
|
cmd = undercloud_config.\
|
||||||
prepare_undercloud_deploy(no_validations=parsed_args.
|
prepare_undercloud_deploy(no_validations=no_validations)
|
||||||
no_validations)
|
|
||||||
print("Running: %s" % ' '.join(cmd))
|
|
||||||
subprocess.check_call(cmd)
|
|
||||||
else:
|
else:
|
||||||
subprocess.check_call("instack-install-undercloud")
|
cmd = ["instack-install-undercloud"]
|
||||||
|
if parsed_args.dry_run:
|
||||||
|
print(' '.join(cmd))
|
||||||
|
else:
|
||||||
|
subprocess.check_call(cmd)
|
||||||
|
|
||||||
|
|
||||||
class UpgradeUndercloud(InstallUndercloud):
|
class UpgradeUndercloud(InstallUndercloud):
|
||||||
|
Loading…
Reference in New Issue
Block a user