Merge lp:~fwereade/pyjuju/warn-ignored-constraints into lp:~fwereade/pyjuju/shadow-trunk-1204
Proposed by
William Reade
Status: | Merged |
---|---|
Approved by: | William Reade |
Approved revision: | 520 |
Merged at revision: | 514 |
Proposed branch: | lp:~fwereade/pyjuju/warn-ignored-constraints |
Merge into: | lp:~fwereade/pyjuju/shadow-trunk-1204 |
Prerequisite: | lp:~fwereade/pyjuju/block-legacy-constraints-usage |
Diff against target: |
51 lines (+15/-5) 2 files modified
juju/machine/constraints.py (+8/-0) juju/machine/tests/test_constraints.py (+7/-5) |
To merge this branch: | bzr merge lp:~fwereade/pyjuju/warn-ignored-constraints |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Reade | Pending | ||
Review via email: mp+99861@code.launchpad.net |
Description of the change
ConstraintSet.parse now logs on ignored constraints
To post a comment you must log in.
Reviewers: mp+99861_ code.launchpad. net,
Message:
Please take a look.
Description:
ConstraintSet.parse now logs on ignored constraints
https:/ /code.launchpad .net/~fwereade/ juju/warn- ignored- constraints/ +merge/ 99861
Requires: /code.launchpad .net/~fwereade/ juju/block- legacy- constraints- usage/+ merge/99856
https:/
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/5956044/
Affected files: constraints. py tests/test_ constraints. py
A [revision details]
M juju/machine/
M juju/machine/
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/machine/ constraints. py constraints. py' constraints. py 2012-03-28 18:11:37 +0000 constraints. py 2012-03-29 03:35:45 +0000
=== modified file 'juju/machine/
--- juju/machine/
+++ juju/machine/
@@ -1,8 +1,11 @@
+import logging
import operator
from UserDict import DictMixin
from juju.errors import ConstraintError, UnknownConstrai ntError
+log = logging. getLogger( "juju.machine. constraints" )
name, value = s.split("=", 1)
constraint = self.get(name)
if constraint is None:
continue
if value == "any":
value = None
+
# To allow providers to construct ConstraintSets which silently ignore
known-
# but-inapplicable constraints (ec2-zone on orchestra, for example), we
keep
# a hardcoded global registry here. It will not be hard to remember to
update
@@ -165,6 +168,8 @@
+ log.warn(
+ "ignored irrelevant %r constraint", name)
Index: juju/machine/ tests/test_ constraints. py tests/test_ constraints. py' tests/test_ constraints. py 2012-03-28 14:40:14 +0000 tests/test_ constraints. py 2012-03-29 03:35:45 +0000
self. assertTrue( c2.can_ satisfy( c1))
=== modified file 'juju/machine/
--- juju/machine/
+++ juju/machine/
@@ -243,12 +243,13 @@
def test_unregister ed_name( self): names(" foo", "blob") names(" foo", "bar", "baz") "provider" ) ls(c1[" foo"], "1") e("blob" in c1) logging( ) "ignored irrelevant 'foo' constraint", "ignored irrelevant 'baz' constraint",
- self.allow_
+ self.allow_
cs = ConstraintSet(
- cs.register("foo")
- c1 = cs.parse(["foo=1", "blob=2"])
- self.assertEqua
- self.assertFals
+ cs.register("bar")
+ output = self.capture_
+ cs.parse(["foo=1", "bar=2", "baz=3"])
+ self.assertIn(
output.getvalue())
+ self.assertIn(
output.getvalue())
def test_register_ invisible( self):
self. allow_names( "foo")