Exemplo n.º 1
0
 def test__get_steps_from_deployment_templates(self):
     template1 = obj_utils.get_test_deploy_template(self.context)
     template2 = obj_utils.get_test_deploy_template(
         self.context, name='CUSTOM_DT2', uuid=uuidutils.generate_uuid(),
         steps=[{'interface': 'bios', 'step': 'apply_configuration',
                 'args': {}, 'priority': 1}])
     step1 = template1.steps[0]
     step2 = template2.steps[0]
     expected = [
         {
             'interface': step1['interface'],
             'step': step1['step'],
             'args': step1['args'],
             'priority': step1['priority'],
         },
         {
             'interface': step2['interface'],
             'step': step2['step'],
             'args': step2['args'],
             'priority': step2['priority'],
         }
     ]
     with task_manager.acquire(
             self.context, self.node.uuid, shared=False) as task:
         steps = conductor_steps._get_steps_from_deployment_templates(
             task, [template1, template2])
         self.assertEqual(expected, steps)
Exemplo n.º 2
0
 def test__get_steps_from_deployment_templates(self):
     template1 = obj_utils.get_test_deploy_template(self.context)
     template2 = obj_utils.get_test_deploy_template(
         self.context,
         name='CUSTOM_DT2',
         uuid=uuidutils.generate_uuid(),
         steps=[{
             'interface': 'bios',
             'step': 'apply_configuration',
             'args': {},
             'priority': 1
         }])
     step1 = template1.steps[0]
     step2 = template2.steps[0]
     expected = [{
         'interface': step1['interface'],
         'step': step1['step'],
         'args': step1['args'],
         'priority': step1['priority'],
     }, {
         'interface': step2['interface'],
         'step': step2['step'],
         'args': step2['args'],
         'priority': step2['priority'],
     }]
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=False) as task:
         steps = conductor_steps._get_steps_from_deployment_templates(
             task, [template1, template2])
         self.assertEqual(expected, steps)
Exemplo n.º 3
0
    def test_sensitive_data_masked(self):
        template = obj_utils.get_test_deploy_template(self.context)
        template.steps[0]['args']['password'] = '******'
        template.create()
        data = self.get_json('/deploy_templates/%s' % template.uuid,
                             headers=self.headers)

        self.assertEqual("******", data['steps'][0]['args']['password'])
Exemplo n.º 4
0
 def test__get_deployment_templates(self, mock_list):
     traits = ['CUSTOM_DT1', 'CUSTOM_DT2']
     node = obj_utils.create_test_node(
         self.context, uuid=uuidutils.generate_uuid(),
         instance_info={'traits': traits})
     template1 = obj_utils.get_test_deploy_template(self.context)
     template2 = obj_utils.get_test_deploy_template(
         self.context, name='CUSTOM_DT2', uuid=uuidutils.generate_uuid(),
         steps=[{'interface': 'bios', 'step': 'apply_configuration',
                 'args': {}, 'priority': 1}])
     mock_list.return_value = [template1, template2]
     expected = [template1, template2]
     with task_manager.acquire(
             self.context, node.uuid, shared=False) as task:
         templates = conductor_steps._get_deployment_templates(task)
         self.assertEqual(expected, templates)
         mock_list.assert_called_once_with(task.context, traits)
Exemplo n.º 5
0
 def test__get_deployment_templates(self, mock_list):
     traits = ['CUSTOM_DT1', 'CUSTOM_DT2']
     node = obj_utils.create_test_node(
         self.context, uuid=uuidutils.generate_uuid(),
         instance_info={'traits': traits})
     template1 = obj_utils.get_test_deploy_template(self.context)
     template2 = obj_utils.get_test_deploy_template(
         self.context, name='CUSTOM_DT2', uuid=uuidutils.generate_uuid(),
         steps=[{'interface': 'bios', 'step': 'apply_configuration',
                 'args': {}, 'priority': 1}])
     mock_list.return_value = [template1, template2]
     expected = [template1, template2]
     with task_manager.acquire(
             self.context, node.uuid, shared=False) as task:
         templates = conductor_steps._get_deployment_templates(task)
         self.assertEqual(expected, templates)
         mock_list.assert_called_once_with(task.context, traits)
    def test_sensitive_data_masked(self):
        template = obj_utils.get_test_deploy_template(self.context)
        template.steps[0]['args']['password'] = '******'
        template.create()
        data = self.get_json('/deploy_templates/%s' % template.uuid,
                             headers=self.headers)

        self.assertEqual("******", data['steps'][0]['args']['password'])
Exemplo n.º 7
0
 def setUp(self):
     super(GetValidatedStepsFromTemplatesTestCase, self).setUp()
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake-hardware')
     self.template = obj_utils.get_test_deploy_template(self.context)
Exemplo n.º 8
0
 def setUp(self):
     super(GetValidatedStepsFromTemplatesTestCase, self).setUp()
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake-hardware')
     self.template = obj_utils.get_test_deploy_template(self.context)