mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
let chdir support relative path in more modules (#16736)
This commit is contained in:
@@ -2311,14 +2311,13 @@ class AnsibleModule(object):
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
|
||||
if cwd and os.path.isdir(cwd):
|
||||
kwargs['cwd'] = cwd
|
||||
|
||||
# store the pwd
|
||||
prev_dir = os.getcwd()
|
||||
|
||||
# make sure we're in the right working directory
|
||||
if cwd and os.path.isdir(cwd):
|
||||
cwd = os.path.abspath(os.path.expanduser(cwd))
|
||||
kwargs['cwd'] = cwd
|
||||
try:
|
||||
os.chdir(cwd)
|
||||
except (OSError, IOError):
|
||||
@@ -2330,7 +2329,6 @@ class AnsibleModule(object):
|
||||
old_umask = os.umask(umask)
|
||||
|
||||
try:
|
||||
|
||||
if self._debug:
|
||||
self.log('Executing: ' + clean_args)
|
||||
cmd = subprocess.Popen(args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user