launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #13618
[Merge] lp:~julian-edwards/maas/mipf-celery-job into lp:maas
Julian Edwards has proposed merging lp:~julian-edwards/maas/mipf-celery-job into lp:maas.
Commit message:
Add a celery task wrapper around maas-import-pxe-files so that future revisions can call this script in the cluster controller.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~julian-edwards/maas/mipf-celery-job/+merge/130948
--
https://code.launchpad.net/~julian-edwards/maas/mipf-celery-job/+merge/130948
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~julian-edwards/maas/mipf-celery-job into lp:maas.
=== modified file 'src/provisioningserver/tasks.py'
--- src/provisioningserver/tasks.py 2012-10-11 13:25:43 +0000
+++ src/provisioningserver/tasks.py 2012-10-23 08:35:28 +0000
@@ -347,6 +347,11 @@
UPDATE_NODE_TAGS_RETRY_DELAY = 2
+# =====================================================================
+# Tags-related tasks
+# =====================================================================
+
+
@task(max_retries=UPDATE_NODE_TAGS_MAX_RETRY)
def update_node_tags(tag_name, tag_definition, retry=True):
"""Update the nodes for a new/changed tag definition.
@@ -363,3 +368,12 @@
exc=exc, countdown=UPDATE_NODE_TAGS_RETRY_DELAY)
else:
raise
+
+
+# =====================================================================
+# Image importing-related tasks
+# =====================================================================
+
+@task
+def import_pxe_files():
+ check_call(['maas-import-pxe-files'])
=== modified file 'src/provisioningserver/tests/test_tasks.py'
--- src/provisioningserver/tests/test_tasks.py 2012-10-08 08:24:11 +0000
+++ src/provisioningserver/tests/test_tasks.py 2012-10-23 08:35:28 +0000
@@ -24,6 +24,7 @@
from apiclient.creds import convert_tuple_to_string
from apiclient.maas_client import MAASClient
from apiclient.testing.credentials import make_api_credentials
+from celery.task import Task
from celery.app import app_or_default
from maastesting.celery import CeleryFixture
from maastesting.factory import factory
@@ -59,6 +60,7 @@
from provisioningserver.tags import MissingCredentials
from provisioningserver.tasks import (
add_new_dhcp_host_map,
+ import_pxe_files,
Omshell,
power_off,
power_on,
@@ -534,3 +536,12 @@
self.assertRaises(
MissingCredentials, update_node_tags.delay, tag,
'//node', retry=True)
+
+
+class TestImportPxeFiles(PservTestCase):
+
+ def test_import_pxe_files(self):
+ recorder = self.patch(tasks, 'check_call', Mock())
+ import_pxe_files()
+ recorder.assert_called_once_with(['maas-import-pxe-files'])
+ self.assertIsInstance(import_pxe_files, Task)