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
7f21f270
Commit
7f21f270
authored
May 08, 2015
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be more lenient in instance check: MutableMapping is more general than dict
parent
3a87b272
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
lib/ansible/vars/__init__.py
+3
-2
No files found.
lib/ansible/vars/__init__.py
View file @
7f21f270
...
@@ -22,6 +22,7 @@ __metaclass__ = type
...
@@ -22,6 +22,7 @@ __metaclass__ = type
import
os
import
os
from
collections
import
defaultdict
from
collections
import
defaultdict
from
collections
import
MutableMapping
try
:
try
:
from
hashlib
import
sha1
from
hashlib
import
sha1
...
@@ -73,7 +74,7 @@ class VariableManager:
...
@@ -73,7 +74,7 @@ class VariableManager:
def
set_extra_vars
(
self
,
value
):
def
set_extra_vars
(
self
,
value
):
''' ensures a clean copy of the extra_vars are used to set the value '''
''' ensures a clean copy of the extra_vars are used to set the value '''
assert
isinstance
(
value
,
dict
)
assert
isinstance
(
value
,
MutableMapping
)
self
.
_extra_vars
=
value
.
copy
()
self
.
_extra_vars
=
value
.
copy
()
def
set_inventory
(
self
,
inventory
):
def
set_inventory
(
self
,
inventory
):
...
@@ -83,7 +84,7 @@ class VariableManager:
...
@@ -83,7 +84,7 @@ class VariableManager:
'''
'''
Validates that both arguments are dictionaries, or an error is raised.
Validates that both arguments are dictionaries, or an error is raised.
'''
'''
if
not
(
isinstance
(
a
,
dict
)
and
isinstance
(
b
,
dict
)):
if
not
(
isinstance
(
a
,
MutableMapping
)
and
isinstance
(
b
,
MutableMapping
)):
raise
AnsibleError
(
"failed to combine variables, expected dicts but got a '
%
s' and a '
%
s'"
%
(
type
(
a
)
.
__name__
,
type
(
b
)
.
__name__
))
raise
AnsibleError
(
"failed to combine variables, expected dicts but got a '
%
s' and a '
%
s'"
%
(
type
(
a
)
.
__name__
,
type
(
b
)
.
__name__
))
def
_combine_vars
(
self
,
a
,
b
):
def
_combine_vars
(
self
,
a
,
b
):
...
...
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