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
6354ca07
Commit
6354ca07
authored
Apr 24, 2015
by
Rene Moser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cloudstack: add _has_changed() to utils
Generic method to compare values in dict.
parent
765c8fe3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
lib/ansible/module_utils/cloudstack.py
+21
-0
No files found.
lib/ansible/module_utils/cloudstack.py
View file @
6354ca07
...
@@ -69,6 +69,27 @@ class AnsibleCloudStack:
...
@@ -69,6 +69,27 @@ class AnsibleCloudStack:
self
.
cs
=
CloudStack
(
**
read_config
())
self
.
cs
=
CloudStack
(
**
read_config
())
def
_has_changed
(
self
,
want_dict
,
current_dict
,
only_keys
=
None
):
for
key
,
value
in
want_dict
.
iteritems
():
# Optionally limit by a list of keys
if
only_keys
and
key
not
in
only_keys
:
continue
;
if
key
in
current_dict
:
# API returns string for int in some cases, just to make sure
if
isinstance
(
value
,
int
):
current_dict
[
key
]
=
int
(
current_dict
[
key
])
elif
isinstance
(
value
,
str
):
current_dict
[
key
]
=
str
(
current_dict
[
key
])
# Only need to detect a singe change, not every item
if
value
!=
current_dict
[
key
]:
return
True
return
False
def
_get_by_key
(
self
,
key
=
None
,
my_dict
=
{}):
def
_get_by_key
(
self
,
key
=
None
,
my_dict
=
{}):
if
key
:
if
key
:
if
key
in
my_dict
:
if
key
in
my_dict
:
...
...
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