X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=juju%2Fconstraints.py;h=43c048ae4fb87cc0e1434540b0725a22d31c1da1;hb=2cafbe27c9fa355963e1f711c55183ac92ed0caf;hp=43a80a358e16e662b1ee16f042b70cb18c06cf4d;hpb=ea587bcc29128652a98b0a7c1327dd3336f4f484;p=osm%2FN2VC.git diff --git a/juju/constraints.py b/juju/constraints.py index 43a80a3..43c048a 100644 --- a/juju/constraints.py +++ b/juju/constraints.py @@ -11,6 +11,9 @@ # 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 @@ -34,6 +37,10 @@ def parse(constraints): 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(" ")]}