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
ff04b2b5
Commit
ff04b2b5
authored
Jul 04, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow empty yaml vars files
Fixes #7843
parent
51e014d9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
lib/ansible/inventory/vars_plugins/group_vars.py
+4
-4
lib/ansible/playbook/play.py
+0
-1
lib/ansible/runner/action_plugins/include_vars.py
+3
-1
No files found.
lib/ansible/inventory/vars_plugins/group_vars.py
View file @
ff04b2b5
...
...
@@ -91,10 +91,10 @@ def _load_vars_from_path(path, results, vault_password=None):
# regular file
elif
stat
.
S_ISREG
(
pathstat
.
st_mode
):
data
=
utils
.
parse_yaml_from_file
(
path
,
vault_password
=
vault_password
)
if
type
(
data
)
!=
dict
:
raise
errors
.
AnsibleError
(
"
%
s must be stored as a dictionary/hash"
%
path
)
if
data
and
type
(
data
)
!=
dict
:
raise
errors
.
AnsibleError
(
"
%
s must be stored as a dictionary/hash"
%
path
)
elif
data
is
None
:
data
=
{}
# combine vars overrides by default but can be configured to do a
# hash merge in settings
results
=
utils
.
combine_vars
(
results
,
data
)
...
...
lib/ansible/playbook/play.py
View file @
ff04b2b5
...
...
@@ -332,7 +332,6 @@ class Play(object):
if
new_default_vars
:
if
type
(
new_default_vars
)
!=
dict
:
raise
errors
.
AnsibleError
(
"
%
s must be stored as dictionary/hash:
%
s"
%
(
filename
,
type
(
new_default_vars
)))
default_vars
=
utils
.
combine_vars
(
default_vars
,
new_default_vars
)
return
default_vars
...
...
lib/ansible/runner/action_plugins/include_vars.py
View file @
ff04b2b5
...
...
@@ -44,8 +44,10 @@ class ActionModule(object):
if
os
.
path
.
exists
(
source
):
data
=
utils
.
parse_yaml_from_file
(
source
,
vault_password
=
self
.
runner
.
vault_pass
)
if
type
(
data
)
!=
dict
:
if
data
and
type
(
data
)
!=
dict
:
raise
errors
.
AnsibleError
(
"
%
s must be stored as a dictionary/hash"
%
source
)
elif
data
is
None
:
data
=
{}
result
=
dict
(
ansible_facts
=
data
)
return
ReturnData
(
conn
=
conn
,
comm_ok
=
True
,
result
=
result
)
else
:
...
...
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