Merge "Send ID of task to Astute"
This commit is contained in:
commit
62f8c8be2e
|
@ -144,6 +144,7 @@ def make_sync_scripts_task(uids, src, dst):
|
|||
|
||||
def make_shell_task(uids, task):
|
||||
return {
|
||||
'id': task.get('id'),
|
||||
'type': consts.ORCHESTRATOR_TASK_TYPES.shell,
|
||||
'uids': uids,
|
||||
'parameters': {
|
||||
|
@ -174,6 +175,7 @@ def make_apt_update_task(uids):
|
|||
|
||||
def make_puppet_task(uids, task):
|
||||
return {
|
||||
'id': task.get('id'),
|
||||
'type': consts.ORCHESTRATOR_TASK_TYPES.puppet,
|
||||
'uids': uids,
|
||||
'parameters': {
|
||||
|
@ -185,6 +187,7 @@ def make_puppet_task(uids, task):
|
|||
|
||||
def make_generic_task(uids, task):
|
||||
task = {
|
||||
'id': task.get('id'),
|
||||
'type': task['type'],
|
||||
'uids': uids,
|
||||
'fail_on_error': task.get('fail_on_error', True),
|
||||
|
@ -197,6 +200,7 @@ def make_generic_task(uids, task):
|
|||
|
||||
def make_reboot_task(uids, task):
|
||||
return {
|
||||
'id': task.get('id'),
|
||||
'type': consts.ORCHESTRATOR_TASK_TYPES.reboot,
|
||||
'uids': uids,
|
||||
'parameters': {
|
||||
|
@ -293,6 +297,7 @@ def make_noop_task(uids, task):
|
|||
:param task: the task instance
|
||||
"""
|
||||
return {
|
||||
'id': task.get('id'),
|
||||
'type': consts.ORCHESTRATOR_TASK_TYPES.skipped,
|
||||
'uids': uids,
|
||||
'fail_on_error': False
|
||||
|
|
|
@ -1050,7 +1050,7 @@ class TestRolesSerializationWithPlugins(BaseDeploymentSerializer,
|
|||
strategy:
|
||||
type: one_by_one
|
||||
|
||||
- id: do-something
|
||||
- id: deployment_task_id
|
||||
type: puppet
|
||||
groups: [test_role]
|
||||
required_for: [deploy_end]
|
||||
|
@ -1119,6 +1119,7 @@ class TestRolesSerializationWithPlugins(BaseDeploymentSerializer,
|
|||
'priority': 100,
|
||||
'type': 'puppet',
|
||||
'uids': [self.cluster.nodes[0].uid],
|
||||
'id': 'deployment_task_id'
|
||||
}])
|
||||
|
||||
def test_tasks_were_not_serialized(self):
|
||||
|
@ -1141,6 +1142,7 @@ class TestRolesSerializationWithPlugins(BaseDeploymentSerializer,
|
|||
serializer = self._get_serializer(self.cluster)
|
||||
serialized_data = serializer.serialize(
|
||||
self.cluster, self.cluster.nodes)
|
||||
self.maxDiff = None
|
||||
self.assertItemsEqual(serialized_data[0]['tasks'], [
|
||||
{
|
||||
'parameters': {
|
||||
|
@ -1151,6 +1153,7 @@ class TestRolesSerializationWithPlugins(BaseDeploymentSerializer,
|
|||
'cwd': '/'},
|
||||
'priority': 100,
|
||||
'type': 'puppet',
|
||||
'id': 'netconfig',
|
||||
'uids': [self.cluster.nodes[0].uid],
|
||||
}, {
|
||||
'parameters': {
|
||||
|
@ -1160,6 +1163,7 @@ class TestRolesSerializationWithPlugins(BaseDeploymentSerializer,
|
|||
'timeout': 3600},
|
||||
'priority': 200,
|
||||
'type': 'puppet',
|
||||
'id': 'deploy_legacy',
|
||||
'uids': [self.cluster.nodes[0].uid],
|
||||
}, {
|
||||
'parameters': {
|
||||
|
@ -1170,6 +1174,7 @@ class TestRolesSerializationWithPlugins(BaseDeploymentSerializer,
|
|||
'cwd': '/'},
|
||||
'priority': 300,
|
||||
'type': 'puppet',
|
||||
'id': 'globals',
|
||||
'uids': [self.cluster.nodes[0].uid],
|
||||
}])
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ class TestBasePluginDeploymentHooksSerializer(base.BaseTestCase):
|
|||
|
||||
result = self.hook.deployment_tasks([plugin], stage)
|
||||
expecting_format = {
|
||||
'id': None,
|
||||
'diagnostic_name': 'plugin_name',
|
||||
'fail_on_error': True,
|
||||
'parameters': {'timeout': 15},
|
||||
|
|
|
@ -114,6 +114,7 @@ class TestDeleteIBPImagesTask(BaseTestCase):
|
|||
|
||||
self.assertEqual(rpc_message, {
|
||||
'tasks': [{
|
||||
'id': None,
|
||||
'type': 'shell',
|
||||
'uids': [consts.MASTER_NODE_UID],
|
||||
'parameters': {
|
||||
|
|
|
@ -348,6 +348,7 @@ class TestNoopSerializer(BaseTestCase):
|
|||
|
||||
self.assertEqual(
|
||||
{
|
||||
'id': 'deploy_start',
|
||||
'type': consts.ORCHESTRATOR_TASK_TYPES.skipped,
|
||||
'uids': [None],
|
||||
'fail_on_error': False
|
||||
|
|
|
@ -107,11 +107,12 @@ class TestMakeTask(base.BaseTestCase):
|
|||
def test_make_reboot_task(self):
|
||||
result = tasks_templates.make_reboot_task(
|
||||
[1, 2, 3],
|
||||
{'parameters': {'timeout': 10}})
|
||||
{'id': 'reboot', 'parameters': {'timeout': 10}})
|
||||
|
||||
self.assertEqual(
|
||||
result,
|
||||
{'type': 'reboot',
|
||||
{'id': 'reboot',
|
||||
'type': 'reboot',
|
||||
'uids': [1, 2, 3],
|
||||
'parameters': {
|
||||
'timeout': 10}})
|
||||
|
@ -174,6 +175,7 @@ class TestMakeTask(base.BaseTestCase):
|
|||
cid=123)
|
||||
cmd_path = "/etc/puppet/modules/osnailyfacter/modular/astute/"
|
||||
self.assertEqual(result, {
|
||||
'id': None,
|
||||
'type': 'shell',
|
||||
'uids': [1, 2, 3],
|
||||
'parameters': {
|
||||
|
@ -199,6 +201,7 @@ class TestMakeTask(base.BaseTestCase):
|
|||
ssh_keys = "/var/lib/fuel/keys/{0}/ironic/ironic.pub".format(cid)
|
||||
|
||||
self.assertEqual(result, {
|
||||
'id': None,
|
||||
'type': 'shell',
|
||||
'uids': [1, 2, 3],
|
||||
'parameters': {
|
||||
|
@ -244,6 +247,7 @@ class TestMakeTask(base.BaseTestCase):
|
|||
'local': local_initrd})
|
||||
|
||||
self.assertEqual(result, {
|
||||
'id': None,
|
||||
'type': 'shell',
|
||||
'uids': [1, 2, 3],
|
||||
'parameters': {
|
||||
|
|
Loading…
Reference in New Issue