From 582f83a995c70b24917494c2a2416784811635e4 Mon Sep 17 00:00:00 2001 From: Michael DeHaan <michael.dehaan@gmail.com> Date: Wed, 21 Mar 2012 20:00:48 -0400 Subject: [PATCH] Allow variable expressions to be stored as variables themselves, do some things to allow setup strings to more easily contain spaces without being mangled, which is neccessary because of the above. --- setup | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup b/setup index 6ab82f1a9d0..a2b90b7400d 100755 --- a/setup +++ b/setup @@ -33,12 +33,18 @@ except ImportError: if len(sys.argv) == 1: sys.exit(1) + argfile = sys.argv[1] if not os.path.exists(argfile): sys.exit(1) + input_data = shlex.split(open(argfile, 'r').read()) -new_options = dict([ x.split('=') for x in input_data ]) +# turn urlencoded k=v string (space delimited) to regular k=v directionary +splitted = [x.split('=',1) for x in input_data ] +splitted = [ (x[0], x[1].replace("~~~"," ")) for x in splitted ] +new_options = dict(splitted) + ansible_file = new_options.get('metadata', DEFAULT_ANSIBLE_SETUP) ansible_dir = os.path.dirname(ansible_file)