launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #08047
[Merge] lp:~julian-edwards/maas/celery-settings into lp:maas
Julian Edwards has proposed merging lp:~julian-edwards/maas/celery-settings into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~julian-edwards/maas/celery-settings/+merge/106568
The build is currently broken because pserv is importing django settings (and failing). This branch moves the new setting POWER_TEMPLATES_DIR into the celery configs.
I don't know if this is what we want long term but it unbreaks the build for now.
--
https://code.launchpad.net/~julian-edwards/maas/celery-settings/+merge/106568
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~julian-edwards/maas/celery-settings into lp:maas.
=== modified file 'src/maas/celeryconfig.py'
--- src/maas/celeryconfig.py 2012-05-21 04:24:55 +0000
+++ src/maas/celeryconfig.py 2012-05-21 06:00:27 +0000
@@ -15,9 +15,16 @@
__metaclass__ = type
+import os
from maas import import_settings
+# Location of power action templates. Use an absolute path.
+POWER_TEMPLATES_DIR = os.path.join(
+ os.path.dirname(__file__), os.pardir, "provisioningserver", "power",
+ "templates")
+
+
try:
import user_maasceleryconfig
except ImportError:
=== modified file 'src/maas/settings.py'
--- src/maas/settings.py 2012-05-18 02:42:40 +0000
+++ src/maas/settings.py 2012-05-21 06:00:27 +0000
@@ -280,10 +280,5 @@
# to have failed and mark it as FAILED_TESTS.
COMMISSIONING_TIMEOUT = 60
-# Location of power action templates. Use an absolute path.
-POWER_TEMPLATES_DIR = os.path.join(
- os.path.dirname(__file__), os.pardir, "provisioningserver", "power",
- "templates")
-
# Allow the user to override settings in maas_local_settings.
import_local_settings()
=== modified file 'src/provisioningserver/power/poweraction.py'
--- src/provisioningserver/power/poweraction.py 2012-05-21 04:24:55 +0000
+++ src/provisioningserver/power/poweraction.py 2012-05-21 06:00:27 +0000
@@ -20,7 +20,7 @@
import os
import subprocess
-from django.conf import settings
+from maas.celeryconfig import POWER_TEMPLATES_DIR
class UnknownPowerType(Exception):
@@ -42,7 +42,7 @@
"""
def __init__(self, power_type):
- basedir = settings.POWER_TEMPLATES_DIR
+ basedir = POWER_TEMPLATES_DIR
self.path = os.path.join(basedir, power_type + ".template")
if not os.path.exists(self.path):
raise UnknownPowerType
=== modified file 'src/provisioningserver/power/tests/test_poweraction.py'
--- src/provisioningserver/power/tests/test_poweraction.py 2012-05-21 01:29:58 +0000
+++ src/provisioningserver/power/tests/test_poweraction.py 2012-05-21 06:00:27 +0000
@@ -19,7 +19,7 @@
from testtools.matchers import FileContains
from textwrap import dedent
-from django.conf import settings
+from maas.celeryconfig import POWER_TEMPLATES_DIR
from provisioningserver.enum import POWER_TYPE
from provisioningserver.power.poweraction import (
PowerAction,
@@ -43,7 +43,7 @@
def test_init_stores_template_path(self):
power_type = POWER_TYPE.WAKE_ON_LAN
- basedir = settings.POWER_TEMPLATES_DIR
+ basedir = POWER_TEMPLATES_DIR
path = os.path.join(basedir, power_type + ".template")
pa = PowerAction(power_type)
self.assertEqual(path, pa.path)