projects
/
osm
/
N2VC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #31 from juju/tweaks
[osm/N2VC.git]
/
juju
/
constraints.py
diff --git
a/juju/constraints.py
b/juju/constraints.py
index
d713774
..
43c048a
100644
(file)
--- a/
juju/constraints.py
+++ b/
juju/constraints.py
@@
-1,5
+1,5
@@
#
#
-#
Library to parse
constraints
+#
Module that parses
constraints
#
# The current version of juju core expects the client to take
# constraints given in the form "mem=10G foo=bar" and parse them into
#
# The current version of juju core expects the client to take
# constraints given in the form "mem=10G foo=bar" and parse them into
@@
-11,6
+11,9
@@
# constraints keys are valid, and that we can successfully dump the
# constraints dict to json.
#
# constraints keys are valid, and that we can successfully dump the
# constraints dict to json.
#
+# Once https://bugs.launchpad.net/juju/+bug/1645402 is addressed, this
+# module should be deprecated.
+#
import re
import re
@@
-34,6
+37,10
@@
def parse(constraints):
if constraints is None:
return None
if constraints is None:
return None
+ if type(constraints) is dict:
+ # Fowards compatibilty: already parsed
+ return constraints
+
constraints = {
normalize_key(k): normalize_value(v) for k, v in [
s.split("=") for s in constraints.split(" ")]}
constraints = {
normalize_key(k): normalize_value(v) for k, v in [
s.split("=") for s in constraints.split(" ")]}