Support getting the Tuskar plan by name or UUID when deploying
See https://bugzilla.redhat.com/show_bug.cgi?id=1233429 Change-Id: I574264e7c92d51aaeaad9bdd0d945b81bcf32169
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
|
||||
import mock
|
||||
|
||||
from tuskarclient.v2.plans import Plan
|
||||
|
||||
from rdomanager_oscplugin.tests.v1.overcloud_deploy import fakes
|
||||
from rdomanager_oscplugin.tests.v1.utils import (
|
||||
generate_overcloud_passwords_mock)
|
||||
@@ -134,10 +136,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_generate_overcloud_passwords,
|
||||
mock_get_key, mock_update_nodesjson):
|
||||
|
||||
arglist = ['--plan-uuid', 'UUID', '--output-dir', 'fake']
|
||||
arglist = ['--plan', 'undercloud', '--output-dir', 'fake']
|
||||
verifylist = [
|
||||
('use_tht', False),
|
||||
('plan_uuid', 'UUID'),
|
||||
('plan', 'undercloud'),
|
||||
('output_dir', 'fake'),
|
||||
]
|
||||
|
||||
@@ -145,6 +147,11 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
management = clients.rdomanager_oscplugin.management()
|
||||
|
||||
management.plans.templates.return_value = {}
|
||||
management.plans.resource_class = Plan
|
||||
|
||||
mock_plan = mock.Mock()
|
||||
mock_plan.configure_mock(name="undercloud")
|
||||
management.plans.list.return_value = [mock_plan, ]
|
||||
|
||||
mock_get_templte_contents.return_value = ({}, "template")
|
||||
mock_process_multiple_env.return_value = ({}, "envs")
|
||||
|
@@ -26,6 +26,7 @@ import uuid
|
||||
from cliff import command
|
||||
from heatclient.common import template_utils
|
||||
from heatclient.exc import HTTPNotFound
|
||||
from openstackclient.common import utils as oscutils
|
||||
from openstackclient.i18n import _
|
||||
from os_cloud_config import keystone_pki
|
||||
|
||||
@@ -379,8 +380,11 @@ class DeployOvercloud(command.Command):
|
||||
if not os.path.isdir(output_dir):
|
||||
os.mkdir(output_dir)
|
||||
|
||||
management_plan = oscutils.find_resource(
|
||||
management.plans, parsed_args.plan)
|
||||
|
||||
# retrieve templates
|
||||
templates = management.plans.templates(parsed_args.plan_uuid)
|
||||
templates = management.plans.templates(management_plan.plan_uuid)
|
||||
|
||||
parameters = self._update_paramaters(parsed_args, network_client)
|
||||
|
||||
@@ -520,9 +524,13 @@ class DeployOvercloud(command.Command):
|
||||
default=os.environ.get('no_proxy', '')
|
||||
)
|
||||
parser.add_argument(
|
||||
'--plan-uuid',
|
||||
'--plan-uuid', dest='plan',
|
||||
help=_("The UUID of the Tuskar plan to deploy.")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--plan',
|
||||
help=_("The Name or UUID of the Tuskar plan to deploy.")
|
||||
)
|
||||
parser.add_argument(
|
||||
'-O', '--output-dir', metavar='<OUTPUT DIR>',
|
||||
help=_('Directory to write Tuskar template files into. It will be '
|
||||
|
Reference in New Issue
Block a user