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
461ba572
Commit
461ba572
authored
May 10, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #351 from cocoy/bug-264
Fix for bug #264
parents
61199889
f8244f31
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
lib/ansible/playbook.py
+11
-6
No files found.
lib/ansible/playbook.py
View file @
461ba572
...
...
@@ -399,19 +399,23 @@ class PlayBook(object):
# *****************************************************
def
_do_conditional_imports
(
self
,
vars_files
):
def
_do_conditional_imports
(
self
,
vars_files
,
pattern
=
None
):
''' handle the vars_files section, which can contain variables '''
# FIXME: save parsed variable results in memory to avoid excessive re-reading/parsing
# FIXME: currently parses imports for hosts not in the pattern, that is not wrong, but it's
# not super optimized yet either, because we wouldn't have hit them, ergo
# it will raise false errors if there is no defaults variable file without any $vars
# in it, which could happen on uncontacted hosts.
if
type
(
vars_files
)
!=
list
:
raise
errors
.
AnsibleError
(
"vars_files must be a list"
)
for
host
in
self
.
inventory
.
list_hosts
():
cache_vars
=
SETUP_CACHE
.
get
(
host
,{})
host_list
=
[
h
for
h
in
self
.
inventory
.
list_hosts
(
pattern
)
if
not
(
h
in
self
.
stats
.
failures
or
h
in
self
.
stats
.
dark
)
]
for
host
in
host_list
:
cache_vars
=
SETUP_CACHE
.
get
(
host
,{})
SETUP_CACHE
[
host
]
=
cache_vars
for
filename
in
vars_files
:
if
type
(
filename
)
==
list
:
...
...
@@ -453,12 +457,13 @@ class PlayBook(object):
if
vars_files
is
not
None
:
self
.
callbacks
.
on_setup_secondary
()
self
.
_do_conditional_imports
(
vars_files
)
self
.
_do_conditional_imports
(
vars_files
,
pattern
)
else
:
self
.
callbacks
.
on_setup_primary
()
host_list
=
[
h
for
h
in
self
.
inventory
.
list_hosts
(
pattern
)
if
not
(
h
in
self
.
stats
.
failures
or
h
in
self
.
stats
.
dark
)
]
self
.
inventory
.
restrict_to
(
host_list
)
# push any variables down to the system
...
...
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