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
d9833f22
Commit
d9833f22
authored
Aug 12, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure cached data from file loads isn't impacted by modifications
Fixes #11893
parent
6bceee9a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
lib/ansible/parsing/__init__.py
+10
-8
No files found.
lib/ansible/parsing/__init__.py
View file @
d9833f22
...
...
@@ -19,6 +19,7 @@
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
import
copy
import
json
import
os
...
...
@@ -100,16 +101,17 @@ class DataLoader():
# if the file has already been read in and cached, we'll
# return those results to avoid more file/vault operations
if
file_name
in
self
.
_FILE_CACHE
:
return
self
.
_FILE_CACHE
[
file_name
]
# read the file contents and load the data structure from them
(
file_data
,
show_content
)
=
self
.
_get_file_contents
(
file_name
)
parsed_data
=
self
.
load
(
data
=
file_data
,
file_name
=
file_name
,
show_content
=
show_content
)
parsed_data
=
self
.
_FILE_CACHE
[
file_name
]
else
:
# read the file contents and load the data structure from them
(
file_data
,
show_content
)
=
self
.
_get_file_contents
(
file_name
)
parsed_data
=
self
.
load
(
data
=
file_data
,
file_name
=
file_name
,
show_content
=
show_content
)
# cache the file contents for next time
self
.
_FILE_CACHE
[
file_name
]
=
parsed_data
# cache the file contents for next time
self
.
_FILE_CACHE
[
file_name
]
=
parsed_data
return
parsed_data
# return a deep copy here, so the cache is not affected
return
copy
.
deepcopy
(
parsed_data
)
def
path_exists
(
self
,
path
):
path
=
self
.
path_dwim
(
path
)
...
...
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