Remove default plan-environment.yaml references
Now, we only use it to specify the derive parameter playbooks. Change-Id: Icfa40c7e92b5adeb57017c037aeb3409e840f425
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
The --plan-environment-file option of openstack tripleo deploy command
|
||||
is now deprecated and not used.
|
||||
@@ -45,9 +45,6 @@ DEFAULT_HEAT_CONTAINER = ('{}/{}/openstack-heat-all:{}'.format(
|
||||
DEFAULT_CONTAINER_TAG))
|
||||
|
||||
|
||||
# The name of the file which holds the plan environment contents
|
||||
PLAN_ENVIRONMENT = 'plan-environment.yaml'
|
||||
USER_ENVIRONMENT = 'user-environment.yaml'
|
||||
USER_PARAMETERS = 'user-environments/tripleoclient-parameters.yaml'
|
||||
|
||||
# This directory may contain additional environments to use during deploy
|
||||
|
||||
@@ -32,12 +32,6 @@ class DeploymentWorkflowFixture(fixtures.Fixture):
|
||||
).mock
|
||||
|
||||
|
||||
class PlanManagementFixture(fixtures.Fixture):
|
||||
|
||||
def _setUp(self):
|
||||
super(PlanManagementFixture, self)._setUp()
|
||||
|
||||
|
||||
class UtilsOvercloudFixture(fixtures.Fixture):
|
||||
|
||||
def _setUp(self):
|
||||
|
||||
@@ -167,8 +167,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
orchestration_client = clients.orchestration
|
||||
mock_stack = fakes.create_tht_stack()
|
||||
orchestration_client.stacks.get.return_value = mock_stack
|
||||
plane_management_fixture = deployment.PlanManagementFixture()
|
||||
self.useFixture(plane_management_fixture)
|
||||
utils_fixture = deployment.UtilsFixture()
|
||||
self.useFixture(utils_fixture)
|
||||
arglist = ['--templates']
|
||||
@@ -282,8 +280,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_stack_data):
|
||||
fixture = deployment.DeploymentWorkflowFixture()
|
||||
self.useFixture(fixture)
|
||||
plane_management_fixture = deployment.PlanManagementFixture()
|
||||
self.useFixture(plane_management_fixture)
|
||||
utils_fixture = deployment.UtilsFixture()
|
||||
self.useFixture(utils_fixture)
|
||||
utils_overcloud_fixture = deployment.UtilsOvercloudFixture()
|
||||
@@ -385,8 +381,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_rc_params, mock_stack_data):
|
||||
fixture = deployment.DeploymentWorkflowFixture()
|
||||
self.useFixture(fixture)
|
||||
plane_management_fixture = deployment.PlanManagementFixture()
|
||||
self.useFixture(plane_management_fixture)
|
||||
utils_fixture = deployment.UtilsFixture()
|
||||
self.useFixture(utils_fixture)
|
||||
utils_overcloud_fixture = deployment.UtilsOvercloudFixture()
|
||||
@@ -470,8 +464,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_stack_data):
|
||||
fixture = deployment.DeploymentWorkflowFixture()
|
||||
self.useFixture(fixture)
|
||||
plane_management_fixture = deployment.PlanManagementFixture()
|
||||
self.useFixture(plane_management_fixture)
|
||||
utils_fixture = deployment.UtilsFixture()
|
||||
self.useFixture(utils_fixture)
|
||||
|
||||
@@ -552,8 +544,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_process_env, mock_rc_params):
|
||||
fixture = deployment.DeploymentWorkflowFixture()
|
||||
self.useFixture(fixture)
|
||||
plane_management_fixture = deployment.PlanManagementFixture()
|
||||
self.useFixture(plane_management_fixture)
|
||||
utils_overcloud_fixture = deployment.UtilsOvercloudFixture()
|
||||
self.useFixture(utils_overcloud_fixture)
|
||||
|
||||
@@ -762,8 +752,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
orchestration_client = clients.orchestration
|
||||
mock_stack = fakes.create_tht_stack()
|
||||
orchestration_client.stacks.get.return_value = mock_stack
|
||||
plane_management_fixture = deployment.PlanManagementFixture()
|
||||
self.useFixture(plane_management_fixture)
|
||||
utils_fixture = deployment.UtilsOvercloudFixture()
|
||||
self.useFixture(utils_fixture)
|
||||
|
||||
@@ -860,8 +848,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_image_prepare,
|
||||
mock_generate_password,
|
||||
mock_rc_params):
|
||||
plane_management_fixture = deployment.PlanManagementFixture()
|
||||
self.useFixture(plane_management_fixture)
|
||||
clients = self.app.client_manager
|
||||
orchestration_client = clients.orchestration
|
||||
mock_stack = fakes.create_tht_stack()
|
||||
@@ -942,8 +928,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_stack_data):
|
||||
fixture = deployment.DeploymentWorkflowFixture()
|
||||
self.useFixture(fixture)
|
||||
plane_management_fixture = deployment.PlanManagementFixture()
|
||||
self.useFixture(plane_management_fixture)
|
||||
utils_fixture = deployment.UtilsFixture()
|
||||
self.useFixture(utils_fixture)
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
import os
|
||||
import sys
|
||||
@@ -149,34 +148,6 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
networks_file = self.cmd._get_networks_file_path(parsed_args)
|
||||
self.assertEqual('/dev/null', networks_file)
|
||||
|
||||
def test_get_plan_env_file_path(self):
|
||||
parsed_args = self.check_parser(self.cmd,
|
||||
['--local-ip', '127.0.0.1/8'], [])
|
||||
|
||||
plan_env_file = self.cmd._get_plan_env_file_path(parsed_args)
|
||||
self.assertEqual(plan_env_file,
|
||||
'/usr/share/openstack-tripleo-heat-templates/'
|
||||
'plan-environment.yaml')
|
||||
|
||||
def test_get_plan_env_file_path_custom_file(self):
|
||||
parsed_args = self.check_parser(self.cmd,
|
||||
['--local-ip', '127.0.0.1/8',
|
||||
'--templates', '/tmp/thtroot',
|
||||
'--plan-environment-file',
|
||||
'foobar.yaml'], [])
|
||||
|
||||
plan_env_file = self.cmd._get_plan_env_file_path(parsed_args)
|
||||
self.assertEqual(plan_env_file, 'foobar.yaml')
|
||||
|
||||
def test_get_plan_env_file_path_custom_templates(self):
|
||||
parsed_args = self.check_parser(self.cmd,
|
||||
['--local-ip', '127.0.0.1/8',
|
||||
'--templates', '/tmp/thtroot'], [])
|
||||
|
||||
plan_env_file = self.cmd._get_plan_env_file_path(parsed_args)
|
||||
self.assertEqual(plan_env_file,
|
||||
'/tmp/thtroot/plan-environment.yaml')
|
||||
|
||||
@mock.patch('os.path.exists')
|
||||
@mock.patch('tripleoclient.utils.fetch_roles_file')
|
||||
def test_get_primary_role_name(self, mock_data, mock_exists):
|
||||
@@ -666,83 +637,10 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
self.assertTrue(found_dropin)
|
||||
self.assertTrue(found_identifier)
|
||||
|
||||
@mock.patch('heatclient.common.template_utils.'
|
||||
'process_environment_and_files', return_value=({}, {}),
|
||||
autospec=True)
|
||||
@mock.patch('heatclient.common.template_utils.'
|
||||
'get_template_contents', return_value=({}, {}),
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.'
|
||||
'process_multiple_environments', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||
'_process_hieradata_overrides', return_value='hiera_or.yaml',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||
'_update_passwords_env', autospec=True)
|
||||
@mock.patch('tripleoclient.utils.'
|
||||
'run_command_and_log', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||
'_get_primary_role_name', autospec=True)
|
||||
def test_setup_heat_environments_default_plan_env(
|
||||
self, mock_prim, mock_run, mock_update_pass_env,
|
||||
mock_process_hiera, mock_process_multiple_environments,
|
||||
mock_hc_get_templ_cont, mock_hc_process):
|
||||
|
||||
tmpdir = self.useFixture(fixtures.TempDir()).path
|
||||
tht_from = os.path.join(tmpdir, 'tht-from')
|
||||
os.mkdir(tht_from)
|
||||
plan_env_path = os.path.join(tht_from, 'plan-environment.yaml')
|
||||
with open(plan_env_path, mode='w') as plan_file:
|
||||
yaml.dump({'environments': [{'path': 'env.yaml'}]}, plan_file)
|
||||
self.assertTrue(os.path.exists(plan_env_path))
|
||||
self._setup_heat_environments(tmpdir, tht_from, plan_env_path,
|
||||
mock_update_pass_env, mock_run)
|
||||
|
||||
@mock.patch('heatclient.common.template_utils.'
|
||||
'process_environment_and_files', return_value=({}, {}),
|
||||
autospec=True)
|
||||
@mock.patch('heatclient.common.template_utils.'
|
||||
'get_template_contents', return_value=({}, {}),
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.utils.'
|
||||
'process_multiple_environments', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||
'_process_hieradata_overrides', return_value='hiera_or.yaml',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||
'_update_passwords_env', autospec=True)
|
||||
@mock.patch('tripleoclient.utils.'
|
||||
'run_command_and_log', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||
'_get_primary_role_name', autospec=True)
|
||||
def test_setup_heat_environments_non_default_plan_env(
|
||||
self, mock_prim, mock_run, mock_update_pass_env,
|
||||
mock_process_hiera, mock_process_multiple_environments,
|
||||
mock_hc_get_templ_cont, mock_hc_process):
|
||||
|
||||
tmpdir = self.useFixture(fixtures.TempDir()).path
|
||||
tht_from = os.path.join(tmpdir, 'tht-from')
|
||||
os.mkdir(tht_from)
|
||||
default_plan_env_path = os.path.join(tht_from, 'plan-environment.yaml')
|
||||
with open(default_plan_env_path, mode='w') as plan_file:
|
||||
yaml.dump({'environments': [{'path': 'env.yaml'}]}, plan_file)
|
||||
plan_env_path = os.path.join(tmpdir, 'plan-environment.yaml')
|
||||
with open(plan_env_path, mode='w') as plan_file:
|
||||
yaml.dump({'environments': [{'path': 'notenv.yaml'}]}, plan_file)
|
||||
self.assertTrue(os.path.exists(plan_env_path))
|
||||
with open(os.path.join(tht_from, 'notenv.yaml'),
|
||||
mode='w') as env_file:
|
||||
yaml.dump({}, env_file)
|
||||
cmd_extra = ['-p', plan_env_path]
|
||||
self._setup_heat_environments(tmpdir, tht_from, plan_env_path,
|
||||
mock_update_pass_env, mock_run,
|
||||
cmd_extra, 'notenv.yaml')
|
||||
|
||||
def _setup_heat_environments(self, tmpdir, tht_from, plan_env_path,
|
||||
def _setup_heat_environments(self, tmpdir, tht_from,
|
||||
mock_update_pass_env, mock_run,
|
||||
extra_cmd=None, plan_env_env=None):
|
||||
extra_cmd=None):
|
||||
cmd_extra = extra_cmd or []
|
||||
plan_env_env_name = plan_env_env or 'env.yaml'
|
||||
|
||||
tht_outside = os.path.join(tmpdir, 'tht-outside')
|
||||
os.mkdir(tht_outside)
|
||||
@@ -764,11 +662,8 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
mock_run.return_value = 0
|
||||
original_abs = os.path.abspath
|
||||
|
||||
# Stub abspath for default plan and envs to return the tht_render base
|
||||
def abs_path_stub(*args, **kwargs):
|
||||
if 'plan-environment.yaml' in args:
|
||||
return plan_env_path
|
||||
elif 'notenv.yaml' in args:
|
||||
if 'notenv.yaml' in args:
|
||||
return os.path.join(tht_render, 'notenv.yaml')
|
||||
elif 'env.yaml' in args:
|
||||
return os.path.join(tht_render, 'env.yaml')
|
||||
@@ -794,7 +689,8 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
'outside.yaml'),
|
||||
] + cmd_extra, [])
|
||||
expected_env = [
|
||||
os.path.join(tht_render, plan_env_env_name),
|
||||
os.path.join(tht_render,
|
||||
'overcloud-resource-registry-puppet.yaml'),
|
||||
os.path.join(tht_render, 'passwords.yaml'),
|
||||
os.path.join(tht_render,
|
||||
'environments/deployed-server-noop-ctlplane.yaml'),
|
||||
@@ -914,12 +810,9 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
@mock.patch('os.geteuid', return_value=0)
|
||||
@mock.patch('os.environ', return_value='CREATE_COMPLETE')
|
||||
@mock.patch('tripleoclient.utils.wait_for_stack_ready', return_value=True)
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||
'_set_default_plan')
|
||||
@mock.patch('ansible_runner.utils.dump_artifact', autospec=True,
|
||||
return_value="/foo/inventory.yaml")
|
||||
def test_take_action_standalone(self, mock_dump_artifact,
|
||||
mock_def_plan, mock_poll,
|
||||
def test_take_action_standalone(self, mock_dump_artifact, mock_poll,
|
||||
mock_environ, mock_geteuid, mock_puppet,
|
||||
mock_killheat, mock_launchheat,
|
||||
mock_download, mock_tht,
|
||||
@@ -1012,12 +905,9 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
@mock.patch('os.geteuid', return_value=0)
|
||||
@mock.patch('os.environ', return_value='CREATE_COMPLETE')
|
||||
@mock.patch('tripleoclient.utils.wait_for_stack_ready', return_value=True)
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||
'_set_default_plan')
|
||||
@mock.patch('ansible_runner.utils.dump_artifact', autospec=True,
|
||||
return_value="/foo/inventory.yaml")
|
||||
def test_take_action_ansible_err(self, mock_dump_artifact,
|
||||
mock_def_plan, mock_poll,
|
||||
def test_take_action_ansible_err(self, mock_dump_artifact, mock_poll,
|
||||
mock_environ, mock_geteuid, mock_puppet,
|
||||
mock_killheat, mock_launchheat,
|
||||
mock_download, mock_tht,
|
||||
@@ -1099,10 +989,7 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
@mock.patch('os.geteuid', return_value=0)
|
||||
@mock.patch('os.environ', return_value='CREATE_COMPLETE')
|
||||
@mock.patch('tripleoclient.utils.wait_for_stack_ready', return_value=True)
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||
'_set_default_plan')
|
||||
def test_take_action_other_err(self,
|
||||
mock_def_plan, mock_poll,
|
||||
def test_take_action_other_err(self, mock_poll,
|
||||
mock_environ, mock_geteuid, mock_puppet,
|
||||
mock_killheat, mock_launchheat,
|
||||
mock_download, mock_tht,
|
||||
@@ -1259,11 +1146,8 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
@mock.patch('os.geteuid', return_value=0)
|
||||
@mock.patch('os.environ', return_value='CREATE_COMPLETE')
|
||||
@mock.patch('tripleoclient.utils.wait_for_stack_ready', return_value=True)
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||
'_set_default_plan')
|
||||
def test_standalone_deploy_rc_output_only(
|
||||
self,
|
||||
mock_def_plan, mock_poll,
|
||||
self, mock_poll,
|
||||
mock_environ, mock_geteuid, mock_puppet,
|
||||
mock_killheat, mock_launchheat,
|
||||
mock_download, mock_tht,
|
||||
@@ -1321,11 +1205,8 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
@mock.patch('os.geteuid', return_value=0)
|
||||
@mock.patch('os.environ', return_value='CREATE_COMPLETE')
|
||||
@mock.patch('tripleoclient.utils.wait_for_stack_ready', return_value=True)
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||
'_set_default_plan')
|
||||
def test_standalone_deploy_transport(
|
||||
self,
|
||||
mock_def_plan, mock_poll,
|
||||
self, mock_poll,
|
||||
mock_environ, mock_geteuid, mock_puppet,
|
||||
mock_killheat, mock_launchheat,
|
||||
mock_download, mock_tht,
|
||||
|
||||
@@ -666,8 +666,7 @@ class DeployOvercloud(command.Command):
|
||||
)
|
||||
parser.add_argument(
|
||||
'--plan-environment-file', '-p',
|
||||
help=_('Plan Environment file, overrides the default %s in the '
|
||||
'--templates directory') % constants.PLAN_ENVIRONMENT
|
||||
help=_('Plan Environment file for derived parameters.')
|
||||
)
|
||||
parser.add_argument(
|
||||
'--no-cleanup', action='store_true',
|
||||
|
||||
@@ -192,15 +192,6 @@ class Deploy(command.Command):
|
||||
else:
|
||||
return parsed_args.networks_file
|
||||
|
||||
def _get_plan_env_file_path(self, parsed_args):
|
||||
"""Return plan_environment_file for the deployment"""
|
||||
if not parsed_args.plan_environment_file:
|
||||
plan_env = os.path.join(parsed_args.templates,
|
||||
constants.PLAN_ENVIRONMENT)
|
||||
else:
|
||||
plan_env = parsed_args.plan_environment_file
|
||||
return plan_env
|
||||
|
||||
def _get_primary_role_name(self, roles_file_path, templates):
|
||||
"""Return the primary role name"""
|
||||
roles_data = utils.fetch_roles_file(
|
||||
@@ -255,13 +246,6 @@ class Deploy(command.Command):
|
||||
shutil.copytree(source_templates_dir, self.tht_render,
|
||||
symlinks=True)
|
||||
|
||||
def _set_default_plan(self):
|
||||
"""Populate default plan-environment.yaml."""
|
||||
if not os.path.isfile(os.path.join(self.tht_render,
|
||||
'plan-environment.yaml')):
|
||||
shutil.copy(os.path.join(self.tht_render, 'plan-samples',
|
||||
'openstack', 'plan-environment.yaml'), self.tht_render)
|
||||
|
||||
def _cleanup_working_dirs(self, cleanup=False, user=None):
|
||||
"""Cleanup temporary working directories
|
||||
|
||||
@@ -632,13 +616,8 @@ class Deploy(command.Command):
|
||||
# so we have to include them at the front of our environment list so a
|
||||
# user can override anything in them.
|
||||
|
||||
# Include any environments from the plan-environment.yaml
|
||||
plan_env_path = utils.rel_or_abs_path(
|
||||
self._get_plan_env_file_path(parsed_args), self.tht_render)
|
||||
with open(plan_env_path, 'r') as f:
|
||||
plan_env_data = yaml.safe_load(f)
|
||||
environments = [utils.rel_or_abs_path(e.get('path'), self.tht_render)
|
||||
for e in plan_env_data.get('environments', {})]
|
||||
environments = [os.path.join(self.tht_render,
|
||||
constants.DEFAULT_RESOURCE_REGISTRY)]
|
||||
|
||||
# this will allow the user to overwrite passwords with custom envs
|
||||
# or pick instack legacy passwords as is, if upgrading from instack
|
||||
@@ -965,8 +944,7 @@ class Deploy(command.Command):
|
||||
)
|
||||
parser.add_argument(
|
||||
'--plan-environment-file', '-p',
|
||||
help=_('Plan Environment file, overrides the default %s in the '
|
||||
'--templates directory') % constants.PLAN_ENVIRONMENT
|
||||
help=_('DEPRECATED: Plan Environment file, Not supported')
|
||||
)
|
||||
parser.add_argument(
|
||||
'--heat-api-port', metavar='<HEAT_API_PORT>',
|
||||
@@ -1242,9 +1220,6 @@ class Deploy(command.Command):
|
||||
self._populate_templates_dir(parsed_args.templates,
|
||||
parsed_args.stack.lower())
|
||||
|
||||
# Set default plan if not specified by user
|
||||
self._set_default_plan()
|
||||
|
||||
is_complete = False
|
||||
try:
|
||||
# NOTE(bogdando): Look for the unique virtual update mark matching
|
||||
|
||||
Reference in New Issue
Block a user