1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

cloudstack: add get_or_failback()

This commit is contained in:
Rene Moser 2015-06-10 21:22:57 +02:00
parent 9911a947ed
commit b9b1e294d7
2 changed files with 16 additions and 0 deletions

View file

@ -77,6 +77,14 @@ class AnsibleCloudStack:
else: else:
self.cs = CloudStack(**read_config()) self.cs = CloudStack(**read_config())
def get_or_fallback(self, key=None, fallback_key=None):
value = self.module.params.get(key)
if not value:
value = self.module.params.get(fallback_key)
return value
# TODO: for backward compatibility only, remove if not used anymore # TODO: for backward compatibility only, remove if not used anymore
def _has_changed(self, want_dict, current_dict, only_keys=None): def _has_changed(self, want_dict, current_dict, only_keys=None):
return self.has_changed(want_dict=want_dict, current_dict=current_dict, only_keys=only_keys) return self.has_changed(want_dict=want_dict, current_dict=current_dict, only_keys=only_keys)

View file

@ -77,6 +77,14 @@ class AnsibleCloudStack:
else: else:
self.cs = CloudStack(**read_config()) self.cs = CloudStack(**read_config())
def get_or_fallback(self, key=None, fallback_key=None):
value = self.module.params.get(key)
if not value:
value = self.module.params.get(fallback_key)
return value
# TODO: for backward compatibility only, remove if not used anymore # TODO: for backward compatibility only, remove if not used anymore
def _has_changed(self, want_dict, current_dict, only_keys=None): def _has_changed(self, want_dict, current_dict, only_keys=None):
return self.has_changed(want_dict=want_dict, current_dict=current_dict, only_keys=only_keys) return self.has_changed(want_dict=want_dict, current_dict=current_dict, only_keys=only_keys)