Fix dangerous default args. (#29839)

This commit is contained in:
Matt Clay 2017-09-12 00:11:13 -07:00 committed by GitHub
parent 5caa47feb9
commit 68aeaa58a8
50 changed files with 253 additions and 87 deletions

View file

@ -2156,7 +2156,7 @@ class AnsibleModule(object):
# and we don't want to break modules unnecessarily
return None
def get_bin_path(self, arg, required=False, opt_dirs=[]):
def get_bin_path(self, arg, required=False, opt_dirs=None):
'''
find system executable in PATH.
Optional arguments:
@ -2164,6 +2164,8 @@ class AnsibleModule(object):
- opt_dirs: optional list of directories to search in addition to PATH
if found return full path; otherwise return None
'''
opt_dirs = [] if opt_dirs is None else opt_dirs
sbin_paths = ['/sbin', '/usr/sbin', '/usr/local/sbin']
paths = []
for d in opt_dirs: