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
1b8d912d
Commit
1b8d912d
authored
Nov 06, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1541 from dhozac/fix-first_available_file
Fix first_available_file and add test-case
parents
89b7fe66
40af8eff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
lib/ansible/runner/action_plugins/template.py
+6
-6
test/TestPlayBook.py
+1
-1
test/playbook1.yml
+4
-1
No files found.
lib/ansible/runner/action_plugins/template.py
View file @
1b8d912d
...
...
@@ -56,17 +56,17 @@ class ActionModule(object):
if
'first_available_file'
in
inject
:
found
=
False
for
fn
in
self
.
runner
.
module_vars
.
get
(
'first_available_file'
):
fn
=
utils
.
template
(
self
.
runner
.
basedir
,
fn
,
inject
)
fn
=
utils
.
path_dwim
(
self
.
runner
.
basedir
,
fn
)
if
os
.
path
.
exists
(
fn
):
source
=
fn
fn
t
=
utils
.
template
(
self
.
runner
.
basedir
,
fn
,
inject
)
fn
d
=
utils
.
path_dwim
(
self
.
runner
.
basedir
,
fnt
)
if
os
.
path
.
exists
(
fn
d
):
source
=
fn
t
found
=
True
break
if
not
found
:
result
=
dict
(
failed
=
True
,
msg
=
"could not find src in first_available_file list"
)
return
ReturnData
(
conn
=
conn
,
comm_ok
=
False
,
result
=
result
)
source
=
utils
.
template
(
self
.
runner
.
basedir
,
source
,
inject
)
else
:
source
=
utils
.
template
(
self
.
runner
.
basedir
,
source
,
inject
)
# template the source data locally & transfer
try
:
...
...
test/TestPlayBook.py
View file @
1b8d912d
...
...
@@ -130,7 +130,7 @@ class TestPlaybook(unittest.TestCase):
return
result
def
test_one
(
self
):
pb
=
os
.
path
.
join
(
self
.
test_dir
,
'playbook1.yml'
)
pb
=
'test/playbook1.yml'
actual
=
self
.
_run
(
pb
)
# if different, this will output to screen
...
...
test/playbook1.yml
View file @
1b8d912d
...
...
@@ -41,7 +41,10 @@
# not be triggered twice because it's already triggered
-
name
:
test template
action
:
template src=sample.j2 dest=/tmp/ansible_test_data_template.out
action
:
template src=$item dest=/tmp/ansible_test_data_template.out
first_available_file
:
-
nonexistantfile
-
sample.j2
notify
:
-
on change 1
-
on change 2
...
...
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