From d703653028e7ea25da20f205b9ff341c75694e33 Mon Sep 17 00:00:00 2001 From: Pete Vander Giessen Date: Mon, 28 Nov 2016 16:39:31 -0500 Subject: [PATCH] Added deprecation notice, and a bit of forwards compatibilty. --- juju/constraints.py | 7 +++++++ 1 file changed, 7 insertions(+) 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(" ")]} -- 2.17.1