Merge lp:~gz/pyjuju/os_remove_placement_config_really into lp:pyjuju

Proposed by Martin Packman
Status: Merged
Approved by: Kapil Thangavelu
Approved revision: 564
Merged at revision: 574
Proposed branch: lp:~gz/pyjuju/os_remove_placement_config_really
Merge into: lp:pyjuju
Diff against target: 71 lines (+45/-1)
2 files modified
juju/environment/config.py (+0/-1)
juju/environment/tests/test_config.py (+45/-0)
To merge this branch: bzr merge lp:~gz/pyjuju/os_remove_placement_config_really
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+122301@code.launchpad.net

Description of the change

Really remove placement from openstack environment config

Missed the most important line in the previous branch killing
'placement' as a config key in the openstack provider.

As penance have added the testing that should have existed previously.
Note that default-series and default-instance-type are still required
in config, but could perhaps be optional now.

https://codereview.appspot.com/6493069/

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :
Download full text (4.1 KiB)

Reviewers: mp+122301_code.launchpad.net,

Message:
Please take a look.

Description:
Really remove placement from openstack environment config

Missed the most important line in the previous branch killing
'placement' as a config key in the openstack provider.

As penance have added the testing that should have existed previously.
Note that default-series and default-instance-type are still required
in config, but could perhaps be optional now.

https://code.launchpad.net/~gz/juju/os_remove_placement_config_really/+merge/122301

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/6493069/

Affected files:
   A [revision details]
   M juju/environment/config.py
   M juju/environment/tests/test_config.py

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>

Index: juju/environment/config.py
=== modified file 'juju/environment/config.py'
--- juju/environment/config.py 2012-08-29 16:41:48 +0000
+++ juju/environment/config.py 2012-08-31 15:03:31 +0000
@@ -67,7 +67,6 @@
              "auth-url": String(),
              "project-name": String(),
              "use-floating-ip": Bool(),
- "placement": _EITHER_PLACEMENT,
              "auth-mode": _OPENSTACK_AUTH_MODE,
              "region": String(),
              "default-series": String(),

Index: juju/environment/tests/test_config.py
=== modified file 'juju/environment/tests/test_config.py'
--- juju/environment/tests/test_config.py 2012-04-13 18:01:18 +0000
+++ juju/environment/tests/test_config.py 2012-08-31 15:05:28 +0000
@@ -59,6 +59,17 @@
       default-series: oneiric
  """

+SAMPLE_OPENSTACK = """
+environments:
+ sample:
+ type: openstack
+ admin-secret: sekret
+ control-bucket: container
+ default-image-id: 42
+ default-instance-type: m1-sample
+ default-series: precise
+"""
+

  class EnvironmentsConfigTestBase(TestCase):

@@ -750,3 +761,37 @@
          error = self.assertRaises(
              EnvironmentsConfigError, self.config.load, self.other_path)
          self.assertIn("expected 'local', got 'unassigned'", str(error))
+
+ def test_openstack_requires_default_image_id(self):
+ """A VM image must be supplied for openstack provider."""
+ config = yaml.load(SAMPLE_OPENSTACK)
+ del config["environments"]["sample"]["default-image-id"]
+ self.write_config(yaml.dump(config), other_path=True)
+ error = self.assertRaises(
+ EnvironmentsConfigError, self.config.load, self.other_path)
+ self.assertIn("default-image-id: required value not found",
str(error))
+
+ def test_openstack_ignores_placement(self):
+ """The placement config is not verified for openstack provider."""
+ config = yaml.load(SAMPLE_OPENSTACK)
+ config["environments"]["sample"]["type"] = "openstack_s3"
+ config["environments"]["sample"]["placement"] = "whatever"
+ self.writ...

Read more...

564. By Martin Packman

Rearrange added tests so names match up with reality

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'juju/environment/config.py'
2--- juju/environment/config.py 2012-08-29 16:41:48 +0000
3+++ juju/environment/config.py 2012-08-31 15:19:18 +0000
4@@ -67,7 +67,6 @@
5 "auth-url": String(),
6 "project-name": String(),
7 "use-floating-ip": Bool(),
8- "placement": _EITHER_PLACEMENT,
9 "auth-mode": _OPENSTACK_AUTH_MODE,
10 "region": String(),
11 "default-series": String(),
12
13=== modified file 'juju/environment/tests/test_config.py'
14--- juju/environment/tests/test_config.py 2012-04-13 18:01:18 +0000
15+++ juju/environment/tests/test_config.py 2012-08-31 15:19:18 +0000
16@@ -59,6 +59,17 @@
17 default-series: oneiric
18 """
19
20+SAMPLE_OPENSTACK = """
21+environments:
22+ sample:
23+ type: openstack
24+ admin-secret: sekret
25+ control-bucket: container
26+ default-image-id: 42
27+ default-instance-type: m1-sample
28+ default-series: precise
29+"""
30+
31
32 class EnvironmentsConfigTestBase(TestCase):
33
34@@ -750,3 +761,37 @@
35 error = self.assertRaises(
36 EnvironmentsConfigError, self.config.load, self.other_path)
37 self.assertIn("expected 'local', got 'unassigned'", str(error))
38+
39+ def test_openstack_requires_default_image_id(self):
40+ """A VM image must be supplied for openstack provider."""
41+ config = yaml.load(SAMPLE_OPENSTACK)
42+ del config["environments"]["sample"]["default-image-id"]
43+ self.write_config(yaml.dump(config), other_path=True)
44+ error = self.assertRaises(
45+ EnvironmentsConfigError, self.config.load, self.other_path)
46+ self.assertIn("default-image-id: required value not found", str(error))
47+
48+ def test_openstack_ignores_placement(self):
49+ """The placement config is not verified for openstack provider."""
50+ config = yaml.load(SAMPLE_OPENSTACK)
51+ config["environments"]["sample"]["placement"] = "whatever"
52+ self.write_config(yaml.dump(config), other_path=True)
53+ self.config.load(self.other_path)
54+
55+ def test_openstack_s3_requires_default_image_id(self):
56+ """A VM image must be supplied for openstack_s3 provider."""
57+ config = yaml.load(SAMPLE_OPENSTACK)
58+ config["environments"]["sample"]["type"] = "openstack_s3"
59+ del config["environments"]["sample"]["default-image-id"]
60+ self.write_config(yaml.dump(config), other_path=True)
61+ error = self.assertRaises(
62+ EnvironmentsConfigError, self.config.load, self.other_path)
63+ self.assertIn("default-image-id: required value not found", str(error))
64+
65+ def test_openstack_s3_ignores_placement(self):
66+ """The placement config is not verified for openstack_s3 provider."""
67+ config = yaml.load(SAMPLE_OPENSTACK)
68+ config["environments"]["sample"]["type"] = "openstack_s3"
69+ config["environments"]["sample"]["placement"] = "whatever"
70+ self.write_config(yaml.dump(config), other_path=True)
71+ self.config.load(self.other_path)

Subscribers

People subscribed via source and target branches

to status/vote changes: