|
|
@ -28,7 +28,11 @@
|
|
|
|
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils._text import to_text
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
from cs import CloudStack, CloudStackException, read_config
|
|
|
|
from cs import CloudStack, CloudStackException, read_config
|
|
|
|
HAS_LIB_CS = True
|
|
|
|
HAS_LIB_CS = True
|
|
|
@ -47,6 +51,9 @@ CS_HYPERVISORS = [
|
|
|
|
'Simulator', 'simulator',
|
|
|
|
'Simulator', 'simulator',
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if sys.version_info > (3,):
|
|
|
|
|
|
|
|
long = int
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def cs_argument_spec():
|
|
|
|
def cs_argument_spec():
|
|
|
|
return dict(
|
|
|
|
return dict(
|
|
|
@ -184,20 +191,23 @@ class AnsibleCloudStack(object):
|
|
|
|
self.result['diff']['after'][key] = value
|
|
|
|
self.result['diff']['after'][key] = value
|
|
|
|
result = True
|
|
|
|
result = True
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
|
|
|
|
before_value = to_text(current_dict[key])
|
|
|
|
|
|
|
|
after_value = to_text(value)
|
|
|
|
|
|
|
|
|
|
|
|
if self.case_sensitive_keys and key in self.case_sensitive_keys:
|
|
|
|
if self.case_sensitive_keys and key in self.case_sensitive_keys:
|
|
|
|
if value != current_dict[key].encode('utf-8'):
|
|
|
|
if before_value != after_value:
|
|
|
|
self.result['diff']['before'][key] = current_dict[key].encode('utf-8')
|
|
|
|
self.result['diff']['before'][key] = before_value
|
|
|
|
self.result['diff']['after'][key] = value
|
|
|
|
self.result['diff']['after'][key] = after_value
|
|
|
|
result = True
|
|
|
|
result = True
|
|
|
|
|
|
|
|
|
|
|
|
# Test for diff in case insensitive way
|
|
|
|
# Test for diff in case insensitive way
|
|
|
|
elif value.lower() != current_dict[key].encode('utf-8').lower():
|
|
|
|
elif before_value.lower() != after_value.lower():
|
|
|
|
self.result['diff']['before'][key] = current_dict[key].encode('utf-8')
|
|
|
|
self.result['diff']['before'][key] = before_value
|
|
|
|
self.result['diff']['after'][key] = value
|
|
|
|
self.result['diff']['after'][key] = after_value
|
|
|
|
result = True
|
|
|
|
result = True
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self.result['diff']['before'][key] = None
|
|
|
|
self.result['diff']['before'][key] = None
|
|
|
|
self.result['diff']['after'][key] = value
|
|
|
|
self.result['diff']['after'][key] = to_text(value)
|
|
|
|
result = True
|
|
|
|
result = True
|
|
|
|
return result
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|