From abf524405a5547de320f1205198205337cd5f1d1 Mon Sep 17 00:00:00 2001 From: Reed Murphy Date: Fri, 27 Apr 2012 11:25:43 +1000 Subject: [PATCH] shlex.split() tries to read from stdin if passed None --- lib/ansible/utils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/ansible/utils.py b/lib/ansible/utils.py index 86569bdbf8b..4740a7d4e32 100644 --- a/lib/ansible/utils.py +++ b/lib/ansible/utils.py @@ -267,11 +267,12 @@ def parse_yaml_from_file(path): def parse_kv(args): ''' convert a string of key/value items to a dict ''' options = {} - vargs = shlex.split(args, posix=True) - for x in vargs: - if x.find("=") != -1: - k, v = x.split("=") - options[k]=v + if not args is None: + vargs = shlex.split(args, posix=True) + for x in vargs: + if x.find("=") != -1: + k, v = x.split("=") + options[k]=v return options class SortedOptParser(optparse.OptionParser):