diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index 3178b23aec..aab3bb3fed 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -41,9 +41,13 @@ class Task(object): def __init__(self, play, ds, module_vars=None): ''' constructor loads from a task or handler datastructure ''' + + # code to allow for saying "modulename: args" versus "action: modulename args" + modules_list = set() for path in C.DEFAULT_MODULE_PATH.split(pathsep): - modules_list.update(os.listdir(path)) + if os.path.exists(path): + modules_list.update(os.listdir(path)) modules_list = list(modules_list) for x in ds.keys(): if x in modules_list: @@ -77,10 +81,10 @@ class Task(object): # delegate_to can use variables if not (self.delegate_to is None): - self.delegate_to = utils.template(None, self.delegate_to, self.module_vars) - # delegate_to: localhost should use local transport - if self.delegate_to in ['127.0.0.1', 'localhost']: - self.transport = 'local' + self.delegate_to = utils.template(None, self.delegate_to, self.module_vars) + # delegate_to: localhost should use local transport + if self.delegate_to in ['127.0.0.1', 'localhost']: + self.transport = 'local' # notified by is used by Playbook code to flag which hosts # need to run a notifier diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 5a0f1f32cd..2b56e9df53 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -467,7 +467,7 @@ class Runner(object): data2 = utils.last_non_blank_line(data) try: return data2.split()[0] - except: + except IndexError: sys.stderr.write("warning: md5sum command failed unusually, please report this to the list so it can be fixed\n") sys.stderr.write("command: %s\n" % md5s) sys.stderr.write("----\n")