mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Test for directory existance, fix exception catching granularity
This commit is contained in:
parent
448c89a06d
commit
f3d7294690
2 changed files with 10 additions and 6 deletions
|
@ -41,8 +41,12 @@ class Task(object):
|
||||||
|
|
||||||
def __init__(self, play, ds, module_vars=None):
|
def __init__(self, play, ds, module_vars=None):
|
||||||
''' constructor loads from a task or handler datastructure '''
|
''' constructor loads from a task or handler datastructure '''
|
||||||
|
|
||||||
|
# code to allow for saying "modulename: args" versus "action: modulename args"
|
||||||
|
|
||||||
modules_list = set()
|
modules_list = set()
|
||||||
for path in C.DEFAULT_MODULE_PATH.split(pathsep):
|
for path in C.DEFAULT_MODULE_PATH.split(pathsep):
|
||||||
|
if os.path.exists(path):
|
||||||
modules_list.update(os.listdir(path))
|
modules_list.update(os.listdir(path))
|
||||||
modules_list = list(modules_list)
|
modules_list = list(modules_list)
|
||||||
for x in ds.keys():
|
for x in ds.keys():
|
||||||
|
|
|
@ -467,7 +467,7 @@ class Runner(object):
|
||||||
data2 = utils.last_non_blank_line(data)
|
data2 = utils.last_non_blank_line(data)
|
||||||
try:
|
try:
|
||||||
return data2.split()[0]
|
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("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("command: %s\n" % md5s)
|
||||||
sys.stderr.write("----\n")
|
sys.stderr.write("----\n")
|
||||||
|
|
Loading…
Reference in a new issue