Added deprecation notice, and a bit of forwards compatibilty.
authorPete Vander Giessen <petevg@gmail.com>
Mon, 28 Nov 2016 21:39:31 +0000 (16:39 -0500)
committerPete Vander Giessen <petevg@gmail.com>
Mon, 28 Nov 2016 21:39:31 +0000 (16:39 -0500)
juju/constraints.py

index 43a80a3..43c048a 100644 (file)
@@ -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(" ")]}