Remove the unused tripleo.plan.gather_roles Mistral action
Change-Id: I19f4b2a789a5e0996b18afa52d7a8443964f6e1f
This commit is contained in:
parent
5c19663bc4
commit
2ec71e3a53
|
@ -128,7 +128,6 @@ mistral.actions =
|
|||
tripleo.plan.update_from_dir = tripleo_common.actions.plan:UpdatePlanFromDirAction
|
||||
tripleo.plan.update_networks = tripleo_common.actions.plan:UpdateNetworksAction
|
||||
tripleo.plan.update_plan_environment = tripleo_common.actions.plan:UpdatePlanEnvironmentAction
|
||||
tripleo.plan.gather_roles = tripleo_common.actions.plan:GatherRolesAction
|
||||
tripleo.plan.update_roles = tripleo_common.actions.plan:UpdateRolesAction
|
||||
tripleo.plan.validate_roles = tripleo_common.actions.plan:ValidateRolesDataAction
|
||||
tripleo.plan.remove_noop_deploystep = tripleo_common.actions.plan:RemoveNoopDeployStepAction
|
||||
|
|
|
@ -451,35 +451,6 @@ class UpdateRolesAction(base.TripleOAction):
|
|||
return actions.Result(data={'roles': save_roles})
|
||||
|
||||
|
||||
class GatherRolesAction(actions.Action):
|
||||
"""Gather role definitions
|
||||
|
||||
Check each role name from the input, check if it exists in
|
||||
roles_data.yaml, if yes, use that role definition, if not, get the
|
||||
role definition from roles directory. Return the gathered role
|
||||
definitions.
|
||||
"""
|
||||
|
||||
def __init__(self, role_names, current_roles, available_roles):
|
||||
super(GatherRolesAction, self).__init__()
|
||||
self.role_names = role_names
|
||||
self.current_roles = current_roles
|
||||
self.available_roles = available_roles
|
||||
|
||||
def run(self, context):
|
||||
err_msgs = []
|
||||
# merge the two lists of dicts in the proper order. last in wins, so
|
||||
# a current role shall be favored over an available role.
|
||||
gathered_roles = [role for role in {
|
||||
x['name']: x for x in self.available_roles + self.current_roles
|
||||
}.values() if role['name'] in self.role_names]
|
||||
|
||||
if err_msgs:
|
||||
return actions.Result(error="/n".join(err_msgs))
|
||||
|
||||
return actions.Result(data={'gathered_roles': gathered_roles})
|
||||
|
||||
|
||||
class RemoveNoopDeployStepAction(base.TripleOAction):
|
||||
"""Remove all the pre, post and deploy step in the plan-environment.
|
||||
|
||||
|
|
|
@ -598,26 +598,6 @@ class UpdateRolesActionTest(base.TestCase):
|
|||
self.assertEqual(result.data, {'roles': [UPDATED_ROLE_OBJ, ]})
|
||||
|
||||
|
||||
class GatherRolesActionTest(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(GatherRolesActionTest, self).setUp()
|
||||
self.container = 'overcloud'
|
||||
self.ctx = mock.MagicMock()
|
||||
self.current_roles = [SAMPLE_ROLE_OBJ, SAMPLE_ROLE_2_OBJ]
|
||||
self.available_role = SAMPLE_ROLE_OBJ.copy()
|
||||
self.available_role['name'] = 'test'
|
||||
|
||||
def test_roles_gathered(self):
|
||||
action = plan.GatherRolesAction(['sample', 'test'], self.current_roles,
|
||||
[self.available_role])
|
||||
result = action.run(self.ctx)
|
||||
|
||||
# assert that a role was loaded from self.current_roles
|
||||
self.assertTrue(result.data['gathered_roles'],
|
||||
[SAMPLE_ROLE_OBJ, self.available_role])
|
||||
|
||||
|
||||
class RemoveNoopDeployStepActionTest(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
Loading…
Reference in New Issue