Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
a348f672
Commit
a348f672
authored
Mar 13, 2014
by
James Tanner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reset the current directory after running subprocess.Popen
parent
69ff3557
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
lib/ansible/module_utils/basic.py
+12
-3
No files found.
lib/ansible/module_utils/basic.py
View file @
a348f672
...
...
@@ -1074,12 +1074,17 @@ class AnsibleModule(object):
if
cwd
and
os
.
path
.
isdir
(
cwd
):
kwargs
[
'cwd'
]
=
cwd
# store the pwd
prev_dir
=
os
.
getcwd
()
try
:
# make sure we're in the right working directory
if
cwd
and
os
.
path
.
isdir
(
cwd
)
:
# make sure we're in the right working directory
if
cwd
and
os
.
path
.
isdir
(
cwd
):
try
:
os
.
chdir
(
cwd
)
except
(
OSError
,
IOError
),
e
:
self
.
fail_json
(
rc
=
e
.
errno
,
msg
=
"Could not open
%
s ,
%
s"
%
(
cwd
,
str
(
e
)))
try
:
cmd
=
subprocess
.
Popen
(
args
,
**
kwargs
)
if
data
:
...
...
@@ -1094,6 +1099,10 @@ class AnsibleModule(object):
if
rc
!=
0
and
check_rc
:
msg
=
err
.
rstrip
()
self
.
fail_json
(
cmd
=
clean_args
,
rc
=
rc
,
stdout
=
out
,
stderr
=
err
,
msg
=
msg
)
# reset the pwd
os
.
chdir
(
prev_dir
)
return
(
rc
,
out
,
err
)
def
append_to_file
(
self
,
filename
,
str
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment