Merge lp:~allenap/maas/mpontillo--allow-commissioning-non-lts into lp:~maas-committers/maas/trunk

Proposed by Gavin Panella
Status: Rejected
Rejected by: MAAS Lander
Proposed branch: lp:~allenap/maas/mpontillo--allow-commissioning-non-lts
Merge into: lp:~maas-committers/maas/trunk
Prerequisite: lp:~mpontillo/maas/allow-commissioning-non-lts
Diff against target: 95 lines (+29/-12)
4 files modified
src/provisioningserver/config.py (+1/-1)
src/provisioningserver/drivers/osystem/tests/test_ubuntu.py (+0/-1)
src/provisioningserver/utils/config.py (+5/-4)
src/provisioningserver/utils/tests/test_config.py (+23/-6)
To merge this branch: bzr merge lp:~allenap/maas/mpontillo--allow-commissioning-non-lts
Reviewer Review Type Date Requested Status
MAAS Maintainers Pending
Review via email: mp+307918@code.launchpad.net
To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

Transitioned to Git.

lp:maas has now moved from Bzr to Git.
Please propose your branches with Launchpad using Git.

git clone https://git.launchpad.net/maas

Unmerged revisions

5462. By Gavin Panella

Fix lint.

5461. By Gavin Panella

Fix DirectoryString's validation.

5460. By Mike Pontillo

Fix tests, address incorrect assumption.

5459. By Mike Pontillo

Add configuraiton option for commissioning on a non-LTS release. Drive-by fix for a problem that prevented correct usage of python conversions in rackd.conf.

5458. By Mike Pontillo

Add a constant to allow commissioning non-LTS releases.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/provisioningserver/config.py'
--- src/provisioningserver/config.py 2016-10-07 09:03:34 +0000
+++ src/provisioningserver/config.py 2016-10-07 09:03:34 +0000
@@ -770,7 +770,7 @@
770 tftp_root = ConfigurationOption(770 tftp_root = ConfigurationOption(
771 "tftp_root", "The root directory for TFTP resources.",771 "tftp_root", "The root directory for TFTP resources.",
772 DirectoryString(772 DirectoryString(
773 if_missing=get_tentative_path(773 if_missing=get_tentative_path(
774 "/var/lib/maas/boot-resources/current")))774 "/var/lib/maas/boot-resources/current")))
775775
776 allow_commissioning_non_lts = ConfigurationOption(776 allow_commissioning_non_lts = ConfigurationOption(
777777
=== modified file 'src/provisioningserver/drivers/osystem/tests/test_ubuntu.py'
--- src/provisioningserver/drivers/osystem/tests/test_ubuntu.py 2016-10-07 09:03:34 +0000
+++ src/provisioningserver/drivers/osystem/tests/test_ubuntu.py 2016-10-07 09:03:34 +0000
@@ -18,7 +18,6 @@
18from testtools.matchers import Contains18from testtools.matchers import Contains
1919
2020
21
22class TestUbuntuOS(MAASTestCase):21class TestUbuntuOS(MAASTestCase):
2322
24 def get_lts_release(self):23 def get_lts_release(self):
2524
=== modified file 'src/provisioningserver/utils/config.py'
--- src/provisioningserver/utils/config.py 2016-08-19 10:22:29 +0000
+++ src/provisioningserver/utils/config.py 2016-10-07 09:03:34 +0000
@@ -124,11 +124,12 @@
124 "notDir": "%(value)r does not exist or is not a directory",124 "notDir": "%(value)r does not exist or is not a directory",
125 }125 }
126126
127 def _validate_other(self, value, state=None):127 def from_python(self, value, state=None):
128 # Only validate on the way _in_; it's not the store's fault if it128 # Only validate on the way _in_; it's not the store's fault if it
129 # contains a directory which has since been removed.129 # contains a directory which has since been removed. Check that the
130 if os.path.isdir(value):130 # original as-Python value represents a directory.
131 return value131 if self.is_empty(value) or os.path.isdir(value):
132 return super(DirectoryString, self).from_python(value, state)
132 else:133 else:
133 raise formencode.Invalid(134 raise formencode.Invalid(
134 self.message("notDir", state, value=value),135 self.message("notDir", state, value=value),
135136
=== modified file 'src/provisioningserver/utils/tests/test_config.py'
--- src/provisioningserver/utils/tests/test_config.py 2016-08-19 10:22:29 +0000
+++ src/provisioningserver/utils/tests/test_config.py 2016-10-07 09:03:34 +0000
@@ -146,22 +146,39 @@
146class TestDirectory(MAASTestCase):146class TestDirectory(MAASTestCase):
147 """Tests for `DirectoryString`."""147 """Tests for `DirectoryString`."""
148148
149 def test__validation_succeeds_when_directory_exists(self):149 def test__converting_succeeds_when_directory_exists(self):
150 directory = self.make_dir()150 directory = self.make_dir()
151 validator = config.DirectoryString(accept_python=False)151 validator = config.DirectoryString()
152 self.assertEqual(directory, validator.from_python(directory))152 self.assertEqual(directory, validator.from_python(directory))
153 self.assertEqual(directory, validator.to_python(directory))153 self.assertEqual(directory, validator.to_python(directory))
154154
155 def test__validation_fails_when_directory_does_not_exist(self):155 def test__converting_from_python_fails_when_directory_not_exists(self):
156 directory = os.path.join(self.make_dir(), "not-here")156 directory = os.path.join(self.make_dir(), "not-here")
157 validator = config.DirectoryString(accept_python=False)157 validator = config.DirectoryString()
158 expected_exception = ExpectedException(158 expected_exception = ExpectedException(
159 formencode.validators.Invalid, "^%s$" % re.escape(159 formencode.validators.Invalid, "^%s$" % re.escape(
160 "%r does not exist or is not a directory" % directory))160 "%r does not exist or is not a directory" % directory))
161 with expected_exception:161 with expected_exception:
162 validator.from_python(directory)162 validator.from_python(directory)
163 with expected_exception:163
164 validator.to_python(directory)164 def test__converting_to_python_succeeds_when_directory_not_exists(self):
165 directory = os.path.join(self.make_dir(), "not-here")
166 validator = config.DirectoryString()
167 self.assertEqual(directory, validator.to_python(directory))
168
169 def test__converting_succeeds_when_empty(self):
170 validator = config.DirectoryString()
171 self.assertIsNone(validator.from_python(None))
172 self.assertIsNone(validator.to_python(None))
173
174 def test__converting_fails_when_empty_and_not_empty_set(self):
175 validator = config.DirectoryString(not_empty=True)
176 expected_exception = ExpectedException(
177 formencode.validators.Invalid, "^Please enter a value$")
178 with expected_exception:
179 self.assertIsNone(validator.from_python(None))
180 with expected_exception:
181 self.assertIsNone(validator.to_python(None))
165182
166183
167class TestExtendedURL(MAASTestCase):184class TestExtendedURL(MAASTestCase):