← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~allenap/maas/default-to-production-config into lp:maas

 

Gavin Panella has proposed merging lp:~allenap/maas/default-to-production-config into lp:maas.

Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~allenap/maas/default-to-production-config/+merge/121080
-- 
https://code.launchpad.net/~allenap/maas/default-to-production-config/+merge/121080
Your team MAAS Maintainers is requested to review the proposed merge of lp:~allenap/maas/default-to-production-config into lp:maas.
=== modified file 'etc/pserv.yaml'
--- etc/pserv.yaml	2012-08-21 17:03:50 +0000
+++ etc/pserv.yaml	2012-08-23 20:05:40 +0000
@@ -32,9 +32,11 @@
 #
 tftp:
   # root: /var/lib/tftpboot
-  # port: 5244
+  # port: 69
+  port: 5244
   ## The URL to be contacted to generate PXE configurations.
-  # generator: http://localhost:5243/api/1.0/pxeconfig/
+  # generator: http://localhost/MAAS/api/1.0/pxeconfig/
+  generator: http://localhost:5243/api/1.0/pxeconfig/
 
 ## Boot configuration.
 boot:

=== modified file 'required-packages/base'
--- required-packages/base	2012-08-16 02:37:01 +0000
+++ required-packages/base	2012-08-23 20:05:40 +0000
@@ -34,3 +34,4 @@
 rabbitmq-server
 syslinux-common
 tgt
+wget

=== modified file 'src/provisioningserver/config.py'
--- src/provisioningserver/config.py	2012-08-21 17:03:50 +0000
+++ src/provisioningserver/config.py	2012-08-23 20:05:40 +0000
@@ -25,7 +25,6 @@
     Int,
     RequireIfPresent,
     String,
-    URL,
     )
 import yaml
 
@@ -61,11 +60,8 @@
     if_key_missing = None
 
     root = String(if_missing="/var/lib/tftpboot")
-    port = Int(min=1, max=65535, if_missing=5244)
-    generator = URL(
-        add_http=True, require_tld=False,
-        if_missing=b"http://localhost:5243/api/1.0/pxeconfig/";,
-        )
+    port = Int(min=1, max=65535, if_missing=69)
+    generator = String(if_missing=b"http://localhost/MAAS/api/1.0/pxeconfig/";)
 
 
 class ConfigBootEphemeral(Schema):

=== modified file 'src/provisioningserver/tests/test_config.py'
--- src/provisioningserver/tests/test_config.py	2012-08-21 17:03:50 +0000
+++ src/provisioningserver/tests/test_config.py	2012-08-23 20:05:40 +0000
@@ -12,6 +12,7 @@
 __metaclass__ = type
 __all__ = []
 
+from copy import deepcopy
 from functools import partial
 from getpass import getuser
 import os
@@ -100,33 +101,42 @@
 class TestConfig(TestCase):
     """Tests for `provisioningserver.config.Config`."""
 
+    default_production_config = {
+        'boot': {
+            'ephemeral': {
+                'directory': '/var/lib/maas/ephemeral',
+                },
+            },
+        'broker': {
+            'host': 'localhost',
+            'port': 5673,
+            'username': getuser(),
+            'password': 'test',
+            'vhost': '/',
+            },
+        'logfile': 'pserv.log',
+        'oops': {
+            'directory': '',
+            'reporter': '',
+            },
+        'tftp': {
+            'generator': 'http://localhost/MAAS/api/1.0/pxeconfig/',
+            'port': 69,
+            'root': "/var/lib/tftpboot",
+            },
+        }
+
+    default_development_config = deepcopy(default_production_config)
+    default_development_config.update(logfile="/dev/null")
+    default_development_config["oops"].update(
+        directory="logs/oops", reporter="maas-pserv")
+    default_development_config["tftp"].update(
+        port=5244, generator="http://localhost:5243/api/1.0/pxeconfig/";)
+
     def test_defaults(self):
-        expected = {
-            'boot': {
-                'ephemeral': {
-                    'directory': '/var/lib/maas/ephemeral',
-                    },
-                },
-            'broker': {
-                'host': 'localhost',
-                'port': 5673,
-                'username': getuser(),
-                'password': 'test',
-                'vhost': '/',
-                },
-            'logfile': 'pserv.log',
-            'oops': {
-                'directory': '',
-                'reporter': '',
-                },
-            'tftp': {
-                'generator': 'http://localhost:5243/api/1.0/pxeconfig/',
-                'port': 5244,
-                'root': "/var/lib/tftpboot",
-                },
-            }
+        # The default configuration is production-ready.
         observed = Config.to_python({})
-        self.assertEqual(expected, observed)
+        self.assertEqual(self.default_production_config, observed)
 
     def test_parse(self):
         # Configuration can be parsed from a snippet of YAML.
@@ -143,11 +153,13 @@
         self.assertEqual("/some/where.log", observed["logfile"])
 
     def test_load_example(self):
-        # The example configuration can be loaded and validated.
+        # The example configuration is designed for development.
         filename = os.path.join(
             os.path.dirname(__file__), os.pardir,
             os.pardir, os.pardir, "etc", "pserv.yaml")
-        Config.load(filename)
+        self.assertEqual(
+            self.default_development_config,
+            Config.load(filename))
 
     def test_load_from_cache(self):
         # A config loaded by Config.load_from_cache() is never reloaded.