Code review comment for lp:~bac/charms/precise/juju-gui/support-constraints

Revision history for this message
Brad Crittenden (bac) wrote :

Reviewers: mp+206006_code.launchpad.net,

Message:
Please take a look.

Description:
Support for juju core constraints

All juju core constraints should be supported by Juju GUI.
See https://juju.ubuntu.com/docs/reference-constraints.html
The 'tags' constraint was not implemented as it is only supported for
MaaS
deployments.

https://code.launchpad.net/~bac/charms/precise/juju-gui/support-constraints/+merge/206006

(do not edit description out of merge proposal)

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

Affected files (+14, -1 lines):
   [revision details]
   server/guiserver/bundles/utils.py
   server/guiserver/tests/bundles/test_utils.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: server/guiserver/bundles/utils.py
=== modified file 'server/guiserver/bundles/utils.py'
--- server/guiserver/bundles/utils.py 2013-11-27 19:25:54 +0000
+++ server/guiserver/bundles/utils.py 2014-02-12 13:55:47 +0000
@@ -39,7 +39,16 @@
  COMPLETED = 'completed'
  # Define a sequence of allowed constraints to be used in the process of
  # preparing the bundle object. See the _prepare_constraints function below.
-ALLOWED_CONSTRAINTS = ('arch', 'cpu-cores', 'cpu-power', 'mem')
+ALLOWED_CONSTRAINTS = (
+ 'arch',
+ 'container',
+ 'cpu-cores',
+ 'cpu-power',
+ 'mem',
+ 'root-disk',
+ # tags are supported by MaaS only so they are not currently supported.
+ # 'tags',
+)

  def create_change(deployment_id, status, queue=None, error=None):

Index: server/guiserver/tests/bundles/test_utils.py
=== modified file 'server/guiserver/tests/bundles/test_utils.py'
--- server/guiserver/tests/bundles/test_utils.py 2013-11-27 19:28:03 +0000
+++ server/guiserver/tests/bundles/test_utils.py 2014-02-12 13:55:47 +0000
@@ -278,6 +278,8 @@
              'cpu-cores': 4,
              'cpu-power': 2,
              'mem': 2000,
+ 'root-disk': '1G',
+ 'container': 'lxc',
          }
          self.assertEqual(constraints,
utils._prepare_constraints(constraints))

« Back to merge proposal