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
a2cfe877
Commit
a2cfe877
authored
Aug 19, 2014
by
Serge van Ginderachter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inventory: fix logic mistake in loading/retrieving variables for groups
parent
47f4dec6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
lib/ansible/inventory/__init__.py
+8
-9
No files found.
lib/ansible/inventory/__init__.py
View file @
a2cfe877
...
...
@@ -146,7 +146,7 @@ class Inventory(object):
# get host vars from host_vars/ files and vars plugins
for
host
in
self
.
get_hosts
():
host
.
vars
=
utils
.
combine_vars
(
host
.
vars
,
self
.
get_variables
(
host
.
name
,
vault_password
=
self
.
_vault_password
))
host
.
vars
=
utils
.
combine_vars
(
host
.
vars
,
self
.
get_
host_
variables
(
host
.
name
,
vault_password
=
self
.
_vault_password
))
def
_match
(
self
,
str
,
pattern_str
):
...
...
@@ -429,20 +429,22 @@ class Inventory(object):
if
updated
is
not
None
:
vars
=
utils
.
combine_vars
(
vars
,
updated
)
# get group variables set by Inventory Parsers
vars
=
utils
.
combine_vars
(
vars
,
group
.
get_variables
())
# Read group_vars/ files
vars
=
utils
.
combine_vars
(
vars
,
self
.
get_group_vars
(
group
))
return
vars
def
get_variables
(
self
,
hostname
,
update_cached
=
False
,
vault_password
=
None
):
return
self
.
get_host
(
hostname
)
.
get_variables
()
def
get_host_variables
(
self
,
hostname
,
update_cached
=
False
,
vault_password
=
None
):
if
hostname
not
in
self
.
_vars_per_host
or
update_cached
:
self
.
_vars_per_host
[
hostname
]
=
self
.
_get_variables
(
hostname
,
vault_password
=
vault_password
)
self
.
_vars_per_host
[
hostname
]
=
self
.
_get_
host_
variables
(
hostname
,
vault_password
=
vault_password
)
return
self
.
_vars_per_host
[
hostname
]
def
_get_variables
(
self
,
hostname
,
vault_password
=
None
):
def
_get_
host_
variables
(
self
,
hostname
,
vault_password
=
None
):
host
=
self
.
get_host
(
hostname
)
if
host
is
None
:
...
...
@@ -466,9 +468,6 @@ class Inventory(object):
if
updated
is
not
None
:
vars
=
utils
.
combine_vars
(
vars
,
updated
)
# get host variables set by Inventory Parsers
vars
=
utils
.
combine_vars
(
vars
,
host
.
get_variables
())
# still need to check InventoryParser per host vars
# which actually means InventoryScript per host,
# which is not performant
...
...
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