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
369b9cde
Commit
369b9cde
authored
Apr 04, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for template module and make 'dark' errors clearer if we get output back and the JSON
is not parseable
parent
c86b3888
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
lib/ansible/runner.py
+5
-5
No files found.
lib/ansible/runner.py
View file @
369b9cde
...
...
@@ -162,16 +162,16 @@ class Runner(object):
return
[
True
,
ssh
]
except
Exception
,
e
:
# it failed somehow, return the failure string
return
[
False
,
str
(
e
)
]
return
[
False
,
"FAILED:
%
s"
%
str
(
e
)
]
def
_return_from_module
(
self
,
conn
,
host
,
result
):
''' helper function to handle JSON parsing of results '''
try
:
# try to parse the JSON response
return
[
host
,
True
,
json
.
loads
(
result
)
]
except
:
except
Exception
,
e
:
# it failed, say so, but return the string anyway
return
[
host
,
False
,
result
]
return
[
host
,
False
,
"
%
s/
%
s"
%
(
str
(
e
),
result
)
]
def
_delete_remote_files
(
self
,
conn
,
files
):
''' deletes one or more remote files '''
...
...
@@ -279,11 +279,11 @@ class Runner(object):
self
.
_transfer_file
(
conn
,
source
,
temppath
)
# install the template module
module
=
self
.
_transfer_module
(
conn
,
tmp
,
'template'
)
template_
module
=
self
.
_transfer_module
(
conn
,
tmp
,
'template'
)
# run the template module
args
=
[
"src=
%
s"
%
temppath
,
"dest=
%
s"
%
dest
,
"metadata=
%
s"
%
metadata
]
result
=
self
.
_execute_module
(
conn
,
tmp
,
module
,
args
)
result
=
self
.
_execute_module
(
conn
,
tmp
,
template_
module
,
args
)
self
.
_delete_remote_files
(
conn
,
[
tpath
])
return
self
.
_return_from_module
(
conn
,
host
,
result
)
...
...
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