Remove rhsm cli options
The code behind these options has been removed in tripleo-heat-templates so we no longer need these cli options. Additionally we do not want folks using them since they do nothing. https://review.opendev.org/#/c/669951/ Change-Id: Ib1444f8b21d90a00dd1d775f5eac633c43f39741
This commit is contained in:
parent
c3fb3cb662
commit
1be46111e6
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
The rhel registration options that were part of the `openstack overcloud deploy`
|
||||||
|
have been removed. Please use the `RhsmVars` option in an environment file
|
||||||
|
to deploy. See https://docs.openstack.org/tripleo-docs/latest/install/advanced_deployment/rhsm.html
|
@ -30,8 +30,6 @@ UNDERCLOUD_CONF_PATH = os.path.join(UNDERCLOUD_OUTPUT_DIR, "undercloud.conf")
|
|||||||
OVERCLOUD_NETWORKS_FILE = "network_data.yaml"
|
OVERCLOUD_NETWORKS_FILE = "network_data.yaml"
|
||||||
STANDALONE_NETWORKS_FILE = "/dev/null"
|
STANDALONE_NETWORKS_FILE = "/dev/null"
|
||||||
UNDERCLOUD_NETWORKS_FILE = "network_data_undercloud.yaml"
|
UNDERCLOUD_NETWORKS_FILE = "network_data_undercloud.yaml"
|
||||||
RHEL_REGISTRATION_EXTRACONFIG_NAME = (
|
|
||||||
"extraconfig/pre_deploy/rhel-registration/")
|
|
||||||
|
|
||||||
# The name of the file which holds the plan environment contents
|
# The name of the file which holds the plan environment contents
|
||||||
PLAN_ENVIRONMENT = 'plan-environment.yaml'
|
PLAN_ENVIRONMENT = 'plan-environment.yaml'
|
||||||
|
@ -576,31 +576,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||||||
|
|
||||||
mock_create_tempest_deployer_input.assert_called_with()
|
mock_create_tempest_deployer_input.assert_called_with()
|
||||||
|
|
||||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
|
||||||
'_deploy_tripleo_heat_templates', autospec=True)
|
|
||||||
def test_missing_sat_url(self, mock_deploy_tht):
|
|
||||||
clients = self.app.client_manager
|
|
||||||
orchestration_client = clients.orchestration
|
|
||||||
mock_stack = fakes.create_tht_stack()
|
|
||||||
orchestration_client.stacks.get.return_value = mock_stack
|
|
||||||
|
|
||||||
arglist = ['--templates', '--rhel-reg',
|
|
||||||
'--reg-method', 'satellite', '--reg-org', '123456789',
|
|
||||||
'--reg-activation-key', 'super-awesome-key']
|
|
||||||
verifylist = [
|
|
||||||
('templates', '/usr/share/openstack-tripleo-heat-templates/'),
|
|
||||||
('rhel_reg', True),
|
|
||||||
('reg_method', 'satellite'),
|
|
||||||
('reg_org', '123456789'),
|
|
||||||
('reg_activation_key', 'super-awesome-key')
|
|
||||||
]
|
|
||||||
|
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
||||||
self.assertRaises(exceptions.DeploymentError,
|
|
||||||
self.cmd.take_action,
|
|
||||||
parsed_args)
|
|
||||||
self.assertFalse(mock_deploy_tht.called)
|
|
||||||
|
|
||||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||||
'_deploy_tripleo_heat_templates', autospec=True)
|
'_deploy_tripleo_heat_templates', autospec=True)
|
||||||
def test_jinja2_env_path(self, mock_deploy_tht):
|
def test_jinja2_env_path(self, mock_deploy_tht):
|
||||||
@ -825,179 +800,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||||||
parsed_args)
|
parsed_args)
|
||||||
self.assertIn('/tmp/notthere', str(error))
|
self.assertIn('/tmp/notthere', str(error))
|
||||||
|
|
||||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
|
||||||
'_deploy_tripleo_heat_templates', autospec=True)
|
|
||||||
def test_rhel_reg_params_provided(self, mock_deploy_tht):
|
|
||||||
fixture = deployment.DeploymentWorkflowFixture()
|
|
||||||
self.useFixture(fixture)
|
|
||||||
utils_fixture = deployment.UtilsOvercloudFixture()
|
|
||||||
self.useFixture(utils_fixture)
|
|
||||||
|
|
||||||
clients = self.app.client_manager
|
|
||||||
orchestration_client = clients.orchestration
|
|
||||||
mock_stack = fakes.create_tht_stack()
|
|
||||||
orchestration_client.stacks.get.return_value = mock_stack
|
|
||||||
|
|
||||||
workflow_client = clients.workflow_engine
|
|
||||||
workflow_client.action_executions.create.return_value = mock.MagicMock(
|
|
||||||
output='{"result":[]}')
|
|
||||||
|
|
||||||
arglist = ['--templates', '--rhel-reg',
|
|
||||||
'--reg-sat-url', 'https://example.com',
|
|
||||||
'--reg-method', 'satellite', '--reg-org', '123456789',
|
|
||||||
'--reg-activation-key', 'super-awesome-key']
|
|
||||||
verifylist = [
|
|
||||||
('templates', '/usr/share/openstack-tripleo-heat-templates/'),
|
|
||||||
('rhel_reg', True),
|
|
||||||
('reg_sat_url', 'https://example.com'),
|
|
||||||
('reg_method', 'satellite'),
|
|
||||||
('reg_org', '123456789'),
|
|
||||||
('reg_activation_key', 'super-awesome-key')
|
|
||||||
]
|
|
||||||
|
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
||||||
self.cmd.take_action(parsed_args)
|
|
||||||
self.assertTrue(mock_deploy_tht.called)
|
|
||||||
self.assertTrue(utils_fixture.mock_create_ocrc.called)
|
|
||||||
|
|
||||||
utils_fixture.mock_deploy_tht.assert_called_with()
|
|
||||||
|
|
||||||
@mock.patch('tripleoclient.utils.check_stack_network_matches_env_files')
|
|
||||||
@mock.patch("heatclient.common.event_utils.get_events", autospec=True)
|
|
||||||
@mock.patch('tripleo_common.update.add_breakpoints_cleanup_into_env',
|
|
||||||
autospec=True)
|
|
||||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
|
||||||
'_deploy_postconfig', autospec=True)
|
|
||||||
@mock.patch('tripleoclient.utils.create_tempest_deployer_input',
|
|
||||||
autospec=True)
|
|
||||||
@mock.patch('heatclient.common.template_utils.get_template_contents',
|
|
||||||
autospec=True)
|
|
||||||
@mock.patch('tempfile.mkdtemp', autospec=True)
|
|
||||||
@mock.patch('shutil.rmtree', autospec=True)
|
|
||||||
def test_deploy_rhel_reg(self, mock_rmtree,
|
|
||||||
mock_tmpdir,
|
|
||||||
mock_get_template_contents,
|
|
||||||
mock_create_tempest_deployer_input,
|
|
||||||
mock_deploy_postconfig,
|
|
||||||
mock_breakpoints_cleanup,
|
|
||||||
mock_events, mock_stack_network_check):
|
|
||||||
clients = self.app.client_manager
|
|
||||||
orchestration_client = clients.orchestration
|
|
||||||
mock_stack = fakes.create_tht_stack()
|
|
||||||
orchestration_client.stacks.get.return_value = mock_stack
|
|
||||||
fixture = deployment.DeploymentWorkflowFixture()
|
|
||||||
self.useFixture(fixture)
|
|
||||||
plane_management_fixture = deployment.PlanManagementFixture()
|
|
||||||
self.useFixture(plane_management_fixture)
|
|
||||||
utils_fixture = deployment.UtilsFixture()
|
|
||||||
self.useFixture(utils_fixture)
|
|
||||||
|
|
||||||
arglist = ['--templates', '--rhel-reg',
|
|
||||||
'--reg-sat-url', 'https://example.com',
|
|
||||||
'--reg-method', 'satellite', '--reg-org', '123456789',
|
|
||||||
'--reg-activation-key', 'super-awesome-key']
|
|
||||||
verifylist = [
|
|
||||||
('templates', '/usr/share/openstack-tripleo-heat-templates/'),
|
|
||||||
('rhel_reg', True),
|
|
||||||
('reg_sat_url', 'https://example.com'),
|
|
||||||
('reg_method', 'satellite'),
|
|
||||||
('reg_org', '123456789'),
|
|
||||||
('reg_activation_key', 'super-awesome-key')
|
|
||||||
]
|
|
||||||
|
|
||||||
mock_tmpdir.return_value = self.tmp_dir.path
|
|
||||||
test_env = self.tmp_dir.join(
|
|
||||||
'tripleo-heat-templates/extraconfig/pre_deploy/rhel-registration/'
|
|
||||||
'rhel-registration-resource-registry.yaml')
|
|
||||||
os.makedirs(os.path.dirname(test_env))
|
|
||||||
with open(test_env, 'w') as temp_file:
|
|
||||||
temp_file.write('resource_registry:\n Test: OS::Heat::None')
|
|
||||||
mock_get_template_contents.return_value = [{}, "template"]
|
|
||||||
|
|
||||||
bp_cleanup_env = {'resource_registry': {'Cleanup': 'OS::Heat::None'}}
|
|
||||||
|
|
||||||
def _fake_bp_cleanup(env):
|
|
||||||
env.update(bp_cleanup_env)
|
|
||||||
|
|
||||||
mock_breakpoints_cleanup.side_effect = _fake_bp_cleanup
|
|
||||||
|
|
||||||
clients = self.app.client_manager
|
|
||||||
orchestration_client = clients.orchestration
|
|
||||||
orchestration_client.stacks.get.return_value = fakes.create_tht_stack()
|
|
||||||
mock_events.return_value = []
|
|
||||||
workflow_client = clients.workflow_engine
|
|
||||||
workflow_client.action_executions.create.return_value = mock.MagicMock(
|
|
||||||
output='{"result":[]}')
|
|
||||||
|
|
||||||
object_client = clients.tripleoclient.object_store
|
|
||||||
object_client.get_object = mock.Mock()
|
|
||||||
mock_env = yaml.safe_dump({'environments': []})
|
|
||||||
object_client.get_object.return_value = ({}, mock_env)
|
|
||||||
|
|
||||||
clients.network.api.find_attr.return_value = {
|
|
||||||
"id": "network id"
|
|
||||||
}
|
|
||||||
|
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
||||||
|
|
||||||
baremetal = clients.baremetal
|
|
||||||
baremetal.node.list.return_value = range(10)
|
|
||||||
|
|
||||||
self.cmd.take_action(parsed_args)
|
|
||||||
|
|
||||||
user_env = {
|
|
||||||
'environments': [],
|
|
||||||
'resource_registry': {'Test': 'OS::Heat::None',
|
|
||||||
'Cleanup': 'OS::Heat::None'}}
|
|
||||||
parameters_env = {
|
|
||||||
'parameter_defaults': {
|
|
||||||
'StackAction': 'UPDATE',
|
|
||||||
'UpdateIdentifier': '',
|
|
||||||
'DeployIdentifier': ''}}
|
|
||||||
reg_env = {
|
|
||||||
'parameter_defaults': {
|
|
||||||
'rhel_reg_activation_key': 'super-awesome-key',
|
|
||||||
'rhel_reg_force': False,
|
|
||||||
'rhel_reg_method': 'satellite',
|
|
||||||
'rhel_reg_org': '123456789',
|
|
||||||
'rhel_reg_sat_url': 'https://example.com'}}
|
|
||||||
|
|
||||||
calls = [
|
|
||||||
mock.call('overcloud',
|
|
||||||
'user-environments/tripleoclient-parameters.yaml',
|
|
||||||
yaml.safe_dump(parameters_env,
|
|
||||||
default_flow_style=False)),
|
|
||||||
mock.call('overcloud',
|
|
||||||
'user-environments/'
|
|
||||||
'tripleoclient-registration-parameters.yaml',
|
|
||||||
yaml.safe_dump(reg_env,
|
|
||||||
default_flow_style=False)),
|
|
||||||
mock.call('overcloud',
|
|
||||||
'user-environments/'
|
|
||||||
'tripleoclient-breakpoint-cleanup.yaml',
|
|
||||||
yaml.safe_dump(bp_cleanup_env,
|
|
||||||
default_flow_style=False)),
|
|
||||||
mock.call('overcloud',
|
|
||||||
'user-environment.yaml',
|
|
||||||
yaml.safe_dump(user_env,
|
|
||||||
default_flow_style=False)),
|
|
||||||
mock.call('overcloud',
|
|
||||||
'plan-environment.yaml',
|
|
||||||
yaml.safe_dump({'environments':
|
|
||||||
[{'path': 'user-environment.yaml'}]},
|
|
||||||
default_flow_style=False))]
|
|
||||||
|
|
||||||
object_client = clients.tripleoclient.object_store
|
|
||||||
object_client.put_object.assert_has_calls(calls)
|
|
||||||
tmp_param_env = self.tmp_dir.join(
|
|
||||||
'tripleo-heat-templates',
|
|
||||||
'user-environments/tripleoclient-parameters.yaml')
|
|
||||||
self.assertTrue(os.path.isfile(tmp_param_env))
|
|
||||||
with open(tmp_param_env, 'r') as f:
|
|
||||||
env_map = yaml.safe_load(f)
|
|
||||||
self.assertEqual(env_map.get('parameter_defaults'),
|
|
||||||
parameters_env.get('parameter_defaults'))
|
|
||||||
|
|
||||||
@mock.patch('tripleoclient.tests.v1.overcloud_deploy.fakes.'
|
@mock.patch('tripleoclient.tests.v1.overcloud_deploy.fakes.'
|
||||||
'FakeObjectClient.get_object', autospec=True)
|
'FakeObjectClient.get_object', autospec=True)
|
||||||
def test_validate_args_missing_environment_files(self, mock_obj):
|
def test_validate_args_missing_environment_files(self, mock_obj):
|
||||||
|
@ -127,25 +127,6 @@ class DeployOvercloud(command.Command):
|
|||||||
container_name)
|
container_name)
|
||||||
return bp_env
|
return bp_env
|
||||||
|
|
||||||
def _create_registration_env(self, args, tht_root):
|
|
||||||
user_tht_root = args.templates
|
|
||||||
registry = os.path.join(
|
|
||||||
user_tht_root,
|
|
||||||
constants.RHEL_REGISTRATION_EXTRACONFIG_NAME,
|
|
||||||
'rhel-registration-resource-registry.yaml')
|
|
||||||
user_env = {'rhel_reg_method': args.reg_method,
|
|
||||||
'rhel_reg_org': args.reg_org,
|
|
||||||
'rhel_reg_force': args.reg_force,
|
|
||||||
'rhel_reg_sat_url': args.reg_sat_url,
|
|
||||||
'rhel_reg_activation_key': args.reg_activation_key}
|
|
||||||
parameter_defaults = {"parameter_defaults": user_env}
|
|
||||||
env_path, swift_path = self._write_user_environment(
|
|
||||||
parameter_defaults,
|
|
||||||
'tripleoclient-registration-parameters.yaml',
|
|
||||||
tht_root,
|
|
||||||
args.stack)
|
|
||||||
return [registry], {"parameter_defaults": user_env}
|
|
||||||
|
|
||||||
def _create_parameters_env(self, parameters, tht_root, container_name):
|
def _create_parameters_env(self, parameters, tht_root, container_name):
|
||||||
parameter_defaults = {"parameter_defaults": parameters}
|
parameter_defaults = {"parameter_defaults": parameters}
|
||||||
env_path, swift_path = self._write_user_environment(
|
env_path, swift_path = self._write_user_environment(
|
||||||
@ -429,11 +410,6 @@ class DeployOvercloud(command.Command):
|
|||||||
template_utils.deep_update(env, self._create_parameters_env(
|
template_utils.deep_update(env, self._create_parameters_env(
|
||||||
parameters, tht_root, parsed_args.stack))
|
parameters, tht_root, parsed_args.stack))
|
||||||
|
|
||||||
if parsed_args.rhel_reg:
|
|
||||||
reg_env_files, reg_env = self._create_registration_env(
|
|
||||||
parsed_args, tht_root)
|
|
||||||
created_env_files.extend(reg_env_files)
|
|
||||||
template_utils.deep_update(env, reg_env)
|
|
||||||
if parsed_args.environment_files:
|
if parsed_args.environment_files:
|
||||||
created_env_files.extend(parsed_args.environment_files)
|
created_env_files.extend(parsed_args.environment_files)
|
||||||
|
|
||||||
@ -782,39 +758,6 @@ class DeployOvercloud(command.Command):
|
|||||||
'that the software configuration does not need to be '
|
'that the software configuration does not need to be '
|
||||||
'run, such as when scaling out certain roles.')
|
'run, such as when scaling out certain roles.')
|
||||||
)
|
)
|
||||||
reg_group = parser.add_argument_group('Registration Parameters')
|
|
||||||
reg_group.add_argument(
|
|
||||||
'--rhel-reg',
|
|
||||||
action='store_true',
|
|
||||||
help=_('Register overcloud nodes to the customer portal or a '
|
|
||||||
'satellite.')
|
|
||||||
)
|
|
||||||
reg_group.add_argument(
|
|
||||||
'--reg-method',
|
|
||||||
choices=['satellite', 'portal'],
|
|
||||||
default='satellite',
|
|
||||||
help=_('RHEL registration method to use for the overcloud nodes.')
|
|
||||||
)
|
|
||||||
reg_group.add_argument(
|
|
||||||
'--reg-org',
|
|
||||||
default='',
|
|
||||||
help=_('Organization key to use for registration.')
|
|
||||||
)
|
|
||||||
reg_group.add_argument(
|
|
||||||
'--reg-force',
|
|
||||||
action='store_true',
|
|
||||||
help=_('Register the system even if it is already registered.')
|
|
||||||
)
|
|
||||||
reg_group.add_argument(
|
|
||||||
'--reg-sat-url',
|
|
||||||
default='',
|
|
||||||
help=_('Satellite server to register overcloud nodes.')
|
|
||||||
)
|
|
||||||
reg_group.add_argument(
|
|
||||||
'--reg-activation-key',
|
|
||||||
default='',
|
|
||||||
help=_('Activation key to use for registration.')
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--answers-file',
|
'--answers-file',
|
||||||
help=_('Path to a YAML file with arguments and parameters.')
|
help=_('Path to a YAML file with arguments and parameters.')
|
||||||
@ -928,25 +871,6 @@ class DeployOvercloud(command.Command):
|
|||||||
else:
|
else:
|
||||||
self.log.info("Stack found, will be doing a stack update")
|
self.log.info("Stack found, will be doing a stack update")
|
||||||
|
|
||||||
if parsed_args.rhel_reg:
|
|
||||||
if parsed_args.reg_method == 'satellite':
|
|
||||||
sat_required_args = (parsed_args.reg_org and
|
|
||||||
parsed_args.reg_sat_url and
|
|
||||||
parsed_args.reg_activation_key)
|
|
||||||
if not sat_required_args:
|
|
||||||
raise exceptions.DeploymentError(
|
|
||||||
"ERROR: In order to use satellite registration, "
|
|
||||||
"you must specify --reg-org, --reg-sat-url, and "
|
|
||||||
"--reg-activation-key.")
|
|
||||||
else:
|
|
||||||
portal_required_args = (parsed_args.reg_org and
|
|
||||||
parsed_args.reg_activation_key)
|
|
||||||
if not portal_required_args:
|
|
||||||
raise exceptions.DeploymentError(
|
|
||||||
"ERROR: In order to use portal registration, you "
|
|
||||||
"must specify --reg-org, and "
|
|
||||||
"--reg-activation-key.")
|
|
||||||
|
|
||||||
if parsed_args.dry_run:
|
if parsed_args.dry_run:
|
||||||
print("Validation Finished")
|
print("Validation Finished")
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user