cloudstack: add get_or_failback()
This commit is contained in:
parent
9911a947ed
commit
b9b1e294d7
2 changed files with 16 additions and 0 deletions
|
@ -77,6 +77,14 @@ class AnsibleCloudStack:
|
|||
else:
|
||||
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
|
||||
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)
|
||||
|
|
|
@ -77,6 +77,14 @@ class AnsibleCloudStack:
|
|||
else:
|
||||
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
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue