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
2d3c9452
Commit
2d3c9452
authored
Oct 26, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1456 from dagwieers/command-fix
Make sure we always return 'rc' from the command module
parents
8dbe6b6a
63fa33b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
library/command
+5
-5
No files found.
library/command
View file @
2d3c9452
...
@@ -84,7 +84,7 @@ def main():
...
@@ -84,7 +84,7 @@ def main():
args
=
module
.
params
[
'args'
]
args
=
module
.
params
[
'args'
]
if
args
.
strip
()
==
''
:
if
args
.
strip
()
==
''
:
module
.
fail_json
(
msg
=
"no command given"
)
module
.
fail_json
(
rc
=
255
,
msg
=
"no command given"
)
if
chdir
:
if
chdir
:
os
.
chdir
(
os
.
path
.
expanduser
(
chdir
))
os
.
chdir
(
os
.
path
.
expanduser
(
chdir
))
...
@@ -97,9 +97,9 @@ def main():
...
@@ -97,9 +97,9 @@ def main():
cmd
=
subprocess
.
Popen
(
args
,
shell
=
shell
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
cmd
=
subprocess
.
Popen
(
args
,
shell
=
shell
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
out
,
err
=
cmd
.
communicate
()
out
,
err
=
cmd
.
communicate
()
except
(
OSError
,
IOError
),
e
:
except
(
OSError
,
IOError
),
e
:
module
.
fail_json
(
cmd
=
args
,
msg
=
str
(
e
)
)
module
.
fail_json
(
rc
=
e
.
errno
,
msg
=
str
(
e
),
cmd
=
args
)
except
:
except
:
module
.
fail_json
(
msg
=
traceback
.
format_exc
()
)
module
.
fail_json
(
rc
=
254
,
msg
=
traceback
.
format_exc
(),
cmd
=
args
)
endd
=
datetime
.
datetime
.
now
()
endd
=
datetime
.
datetime
.
now
()
delta
=
endd
-
startd
delta
=
endd
-
startd
...
@@ -178,9 +178,9 @@ class CommandModule(AnsibleModule):
...
@@ -178,9 +178,9 @@ class CommandModule(AnsibleModule):
elif
m
.
group
(
2
)
==
"chdir"
:
elif
m
.
group
(
2
)
==
"chdir"
:
v
=
os
.
path
.
expanduser
(
v
)
v
=
os
.
path
.
expanduser
(
v
)
if
not
(
os
.
path
.
exists
(
v
)
and
os
.
path
.
isdir
(
v
)):
if
not
(
os
.
path
.
exists
(
v
)
and
os
.
path
.
isdir
(
v
)):
self
.
fail_json
(
msg
=
"cannot change to directory '
%
s': path does not exist"
%
v
)
self
.
fail_json
(
rc
=
253
,
msg
=
"cannot change to directory '
%
s': path does not exist"
%
v
)
elif
v
[
0
]
!=
'/'
:
elif
v
[
0
]
!=
'/'
:
self
.
fail_json
(
msg
=
"the path for 'chdir' argument must be fully qualified"
)
self
.
fail_json
(
rc
=
252
,
msg
=
"the path for 'chdir' argument must be fully qualified"
)
params
[
'chdir'
]
=
v
params
[
'chdir'
]
=
v
args
=
r
.
sub
(
""
,
args
)
args
=
r
.
sub
(
""
,
args
)
params
[
'args'
]
=
args
params
[
'args'
]
=
args
...
...
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