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
b81e77cf
Commit
b81e77cf
authored
Aug 21, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak error language in dict validation
parent
3a228b9d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
lib/ansible/utils/__init__.py
+7
-3
No files found.
lib/ansible/utils/__init__.py
View file @
b81e77cf
...
@@ -699,16 +699,20 @@ def parse_kv(args):
...
@@ -699,16 +699,20 @@ def parse_kv(args):
def
_validate_both_dicts
(
a
,
b
):
def
_validate_both_dicts
(
a
,
b
):
if
not
(
isinstance
(
a
,
dict
)
and
isinstance
(
b
,
dict
)):
if
not
(
isinstance
(
a
,
dict
)
and
isinstance
(
b
,
dict
)):
raise
errors
.
AnsibleError
(
"Failed to combine two values which are not "
raise
errors
.
AnsibleError
(
"both hashes, got these differing values now:
\n\n
%
s
\n
and
\n
%
s"
%
(
a
,
b
))
"failed to combine variables, expected dicts but got a '
%
s' and a '
%
s'"
%
(
type
(
a
)
.
__name__
,
type
(
b
)
.
__name__
)
)
def
merge_hash
(
a
,
b
):
def
merge_hash
(
a
,
b
):
''' recursively merges hash b into a
''' recursively merges hash b into a
keys from b take precedence over keys from a '''
keys from b take precedence over keys from a '''
_validate_both_dicts
(
a
,
b
)
result
=
{}
result
=
{}
# we check here as well as in combine_vars() since this
# function can work recursively with nested dicts
_validate_both_dicts
(
a
,
b
)
for
dicts
in
a
,
b
:
for
dicts
in
a
,
b
:
# next, iterate over b keys and values
# next, iterate over b keys and values
for
k
,
v
in
dicts
.
iteritems
():
for
k
,
v
in
dicts
.
iteritems
():
...
...
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