summaryrefslogtreecommitdiff
path: root/cloud
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2016-10-23 12:36:17 -0700
committerMichael Scherer <mscherer@users.noreply.github.com>2016-10-23 22:16:15 +0200
commit7ce17ab49ef232af2064d2a680dc6ca78c2211f5 (patch)
tree12955d3e7ba54ddc9375c14239acbc568971077c /cloud
parent65ba526c9f9a37d28d7842b9912dd6deb7c19c6b (diff)
downloadansible-modules-extras-7ce17ab49ef232af2064d2a680dc6ca78c2211f5.tar.gz
Fix remaining centurylink modules for py3
Also update the imports to take advantage of the Ansiballz imports
Diffstat (limited to 'cloud')
-rw-r--r--cloud/centurylink/clc_aa_policy.py9
-rw-r--r--cloud/centurylink/clc_group.py9
-rw-r--r--cloud/centurylink/clc_publicip.py9
3 files changed, 18 insertions, 9 deletions
diff --git a/cloud/centurylink/clc_aa_policy.py b/cloud/centurylink/clc_aa_policy.py
index 681e71cb..5ba0ac35 100644
--- a/cloud/centurylink/clc_aa_policy.py
+++ b/cloud/centurylink/clc_aa_policy.py
@@ -131,6 +131,8 @@ policy:
__version__ = '${version}'
+import os
+
from distutils.version import LooseVersion
try:
@@ -153,6 +155,8 @@ except ImportError:
else:
CLC_FOUND = True
+from ansible.module_utils.basic import AnsibleModule
+
class ClcAntiAffinityPolicy:
@@ -267,7 +271,7 @@ class ClcAntiAffinityPolicy:
return self.clc.v2.AntiAffinity.Create(
name=p['name'],
location=p['location'])
- except CLCException, ex:
+ except CLCException as ex:
self.module.fail_json(msg='Failed to create anti affinity policy : {0}. {1}'.format(
p['name'], ex.response_text
))
@@ -281,7 +285,7 @@ class ClcAntiAffinityPolicy:
try:
policy = self.policy_dict[p['name']]
policy.Delete()
- except CLCException, ex:
+ except CLCException as ex:
self.module.fail_json(msg='Failed to delete anti affinity policy : {0}. {1}'.format(
p['name'], ex.response_text
))
@@ -346,6 +350,5 @@ def main():
clc_aa_policy = ClcAntiAffinityPolicy(module)
clc_aa_policy.process_request()
-from ansible.module_utils.basic import * # pylint: disable=W0614
if __name__ == '__main__':
main()
diff --git a/cloud/centurylink/clc_group.py b/cloud/centurylink/clc_group.py
index f30b37d6..661196b7 100644
--- a/cloud/centurylink/clc_group.py
+++ b/cloud/centurylink/clc_group.py
@@ -212,6 +212,7 @@ group:
__version__ = '${version}'
+import os
from distutils.version import LooseVersion
try:
@@ -234,6 +235,8 @@ except ImportError:
else:
CLC_FOUND = True
+from ansible.module_utils.basic import AnsibleModule
+
class ClcGroup(object):
@@ -362,7 +365,7 @@ class ClcGroup(object):
group, parent = self.group_dict.get(group_name)
try:
response = group.Delete()
- except CLCException, ex:
+ except CLCException as ex:
self.module.fail_json(msg='Failed to delete group :{0}. {1}'.format(
group_name, ex.response_text
))
@@ -423,7 +426,7 @@ class ClcGroup(object):
(parent, grandparent) = self.group_dict[parent]
try:
response = parent.Create(name=group, description=description)
- except CLCException, ex:
+ except CLCException as ex:
self.module.fail_json(msg='Failed to create group :{0}. {1}'.format(
group, ex.response_text))
return response
@@ -508,6 +511,6 @@ def main():
clc_group = ClcGroup(module)
clc_group.process_request()
-from ansible.module_utils.basic import * # pylint: disable=W0614
+
if __name__ == '__main__':
main()
diff --git a/cloud/centurylink/clc_publicip.py b/cloud/centurylink/clc_publicip.py
index 9c21a9a6..98e2e15d 100644
--- a/cloud/centurylink/clc_publicip.py
+++ b/cloud/centurylink/clc_publicip.py
@@ -124,6 +124,7 @@ server_ids:
__version__ = '${version}'
+import os
from distutils.version import LooseVersion
try:
@@ -146,6 +147,8 @@ except ImportError:
else:
CLC_FOUND = True
+from ansible.module_utils.basic import AnsibleModule
+
class ClcPublicIp(object):
clc = clc_sdk
@@ -241,7 +244,7 @@ class ClcPublicIp(object):
result = None
try:
result = server.PublicIPs().Add(ports_to_expose)
- except CLCException, ex:
+ except CLCException as ex:
self.module.fail_json(msg='Failed to add public ip to the server : {0}. {1}'.format(
server.id, ex.response_text
))
@@ -278,7 +281,7 @@ class ClcPublicIp(object):
try:
for ip_address in server.PublicIPs().public_ips:
result = ip_address.Delete()
- except CLCException, ex:
+ except CLCException as ex:
self.module.fail_json(msg='Failed to remove public ip from the server : {0}. {1}'.format(
server.id, ex.response_text
))
@@ -358,6 +361,6 @@ def main():
clc_public_ip = ClcPublicIp(module)
clc_public_ip.process_request()
-from ansible.module_utils.basic import * # pylint: disable=W0614
+
if __name__ == '__main__':
main()