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
d977da5b
Commit
d977da5b
authored
Jul 13, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing up fact_cache use in VariableManager
parent
932d1e57
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
lib/ansible/plugins/cache/jsonfile.py
+1
-1
lib/ansible/vars/__init__.py
+10
-5
No files found.
lib/ansible/plugins/cache/jsonfile.py
View file @
d977da5b
...
@@ -73,7 +73,7 @@ class CacheModule(BaseCacheModule):
...
@@ -73,7 +73,7 @@ class CacheModule(BaseCacheModule):
except
ValueError
:
except
ValueError
:
# FIXME: this is in display now, but cache plugins don't have that
# FIXME: this is in display now, but cache plugins don't have that
#utils.warning("error while trying to write to %s : %s" % (cachefile, str(e)))
#utils.warning("error while trying to write to %s : %s" % (cachefile, str(e)))
r
eturn
dict
()
r
aise
KeyError
finally
:
finally
:
f
.
close
()
f
.
close
()
...
...
lib/ansible/vars/__init__.py
View file @
d977da5b
...
@@ -181,7 +181,10 @@ class VariableManager:
...
@@ -181,7 +181,10 @@ class VariableManager:
all_vars
=
self
.
_combine_vars
(
all_vars
,
host
.
get_vars
())
all_vars
=
self
.
_combine_vars
(
all_vars
,
host
.
get_vars
())
# next comes the facts cache and the vars cache, respectively
# next comes the facts cache and the vars cache, respectively
all_vars
=
self
.
_combine_vars
(
all_vars
,
self
.
_fact_cache
.
get
(
host
.
get_name
(),
dict
()))
try
:
all_vars
=
self
.
_combine_vars
(
all_vars
,
self
.
_fact_cache
.
get
(
host
.
name
,
dict
()))
except
KeyError
:
pass
if
play
:
if
play
:
all_vars
=
self
.
_combine_vars
(
all_vars
,
play
.
get_vars
())
all_vars
=
self
.
_combine_vars
(
all_vars
,
play
.
get_vars
())
...
@@ -345,11 +348,13 @@ class VariableManager:
...
@@ -345,11 +348,13 @@ class VariableManager:
assert
isinstance
(
facts
,
dict
)
assert
isinstance
(
facts
,
dict
)
host_name
=
host
.
get_name
()
if
host
.
name
not
in
self
.
_fact_cache
:
if
host_name
not
in
self
.
_fact_cache
:
self
.
_fact_cache
[
host
.
name
]
=
facts
self
.
_fact_cache
[
host_name
]
=
facts
else
:
else
:
self
.
_fact_cache
[
host_name
]
.
update
(
facts
)
try
:
self
.
_fact_cache
[
host
.
name
]
.
update
(
facts
)
except
KeyError
:
self
.
_fact_cache
[
host
.
name
]
=
facts
def
set_host_variable
(
self
,
host
,
varname
,
value
):
def
set_host_variable
(
self
,
host
,
varname
,
value
):
'''
'''
...
...
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