From 29f803b16ac17f787c3b32961132540ca0f87b4f Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Wed, 8 Jun 2016 15:35:36 +0200 Subject: [PATCH] cloudstack: remove duplicate import cs handling, already in utils. --- .../modules/extras/cloud/cloudstack/cs_account.py | 9 --------- .../extras/cloud/cloudstack/cs_affinitygroup.py | 9 --------- .../modules/extras/cloud/cloudstack/cs_cluster.py | 9 --------- .../extras/cloud/cloudstack/cs_configuration.py | 9 --------- .../modules/extras/cloud/cloudstack/cs_domain.py | 9 --------- .../modules/extras/cloud/cloudstack/cs_firewall.py | 9 --------- .../modules/extras/cloud/cloudstack/cs_instance.py | 9 --------- .../extras/cloud/cloudstack/cs_instance_facts.py | 9 --------- .../extras/cloud/cloudstack/cs_instancegroup.py | 9 --------- .../modules/extras/cloud/cloudstack/cs_ip_address.py | 10 ---------- lib/ansible/modules/extras/cloud/cloudstack/cs_iso.py | 9 --------- .../extras/cloud/cloudstack/cs_loadbalancer_rule.py | 9 --------- .../cloud/cloudstack/cs_loadbalancer_rule_member.py | 9 --------- .../modules/extras/cloud/cloudstack/cs_network.py | 9 --------- lib/ansible/modules/extras/cloud/cloudstack/cs_pod.py | 9 --------- .../modules/extras/cloud/cloudstack/cs_portforward.py | 9 --------- .../modules/extras/cloud/cloudstack/cs_project.py | 9 --------- .../extras/cloud/cloudstack/cs_resourcelimit.py | 9 --------- .../modules/extras/cloud/cloudstack/cs_router.py | 9 --------- .../extras/cloud/cloudstack/cs_securitygroup.py | 9 --------- .../extras/cloud/cloudstack/cs_securitygroup_rule.py | 9 --------- .../modules/extras/cloud/cloudstack/cs_sshkeypair.py | 10 ---------- .../modules/extras/cloud/cloudstack/cs_staticnat.py | 10 ---------- .../modules/extras/cloud/cloudstack/cs_template.py | 9 --------- lib/ansible/modules/extras/cloud/cloudstack/cs_user.py | 9 --------- .../modules/extras/cloud/cloudstack/cs_vmsnapshot.py | 9 --------- .../modules/extras/cloud/cloudstack/cs_volume.py | 9 --------- lib/ansible/modules/extras/cloud/cloudstack/cs_zone.py | 9 --------- .../modules/extras/cloud/cloudstack/cs_zone_facts.py | 9 --------- 29 files changed, 264 deletions(-) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_account.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_account.py index 5699dcffe7..1610400feb 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_account.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_account.py @@ -172,12 +172,6 @@ domain: sample: ROOT ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -365,9 +359,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_acc = AnsibleCloudStackAccount(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_affinitygroup.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_affinitygroup.py index a3ac1b0696..6860081391 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_affinitygroup.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_affinitygroup.py @@ -102,12 +102,6 @@ affinity_type: sample: host anti-affinity ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -214,9 +208,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_ag = AnsibleCloudStackAffinityGroup(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_cluster.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_cluster.py index 6041d65081..66aec535a8 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_cluster.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_cluster.py @@ -226,12 +226,6 @@ pod: sample: pod01 ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -406,9 +400,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_cluster = AnsibleCloudStackCluster(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_configuration.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_configuration.py index b3e68c6a78..9c62daeba7 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_configuration.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_configuration.py @@ -148,12 +148,6 @@ storage: sample: storage01 ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -278,9 +272,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_configuration = AnsibleCloudStackConfiguration(module) configuration = acs_configuration.present_configuration() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_domain.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_domain.py index 0d8b7deaab..17a5870f27 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_domain.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_domain.py @@ -106,12 +106,6 @@ network_domain: sample: example.local ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -254,9 +248,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_dom = AnsibleCloudStackDomain(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_firewall.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_firewall.py index 628e9f9733..d81c78d644 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_firewall.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_firewall.py @@ -203,12 +203,6 @@ network: sample: my_network ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -405,9 +399,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_fw = AnsibleCloudStackFirewall(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py index 6079aec683..87e26ad228 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py @@ -397,12 +397,6 @@ instance_name: import base64 -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -967,9 +961,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_instance = AnsibleCloudStackInstance(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_instance_facts.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_instance_facts.py index bfed5c8572..f405debca3 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_instance_facts.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_instance_facts.py @@ -178,12 +178,6 @@ cloudstack_instance.instance_name: import base64 -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -270,9 +264,6 @@ def main(): supports_check_mode=False, ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - cs_instance_facts = AnsibleCloudStackInstanceFacts(module=module).run() cs_facts_result = dict(changed=False, ansible_facts=cs_instance_facts) module.exit_json(**cs_facts_result) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_instancegroup.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_instancegroup.py index 4ffda0ede1..38e6d1f9d7 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_instancegroup.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_instancegroup.py @@ -102,12 +102,6 @@ project: sample: example project ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -185,9 +179,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_ig = AnsibleCloudStackInstanceGroup(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_ip_address.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_ip_address.py index 1aa0ac0045..345d793a65 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_ip_address.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_ip_address.py @@ -127,13 +127,6 @@ domain: sample: example domain ''' - -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -252,9 +245,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_ip_address = AnsibleCloudStackIPAddress(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_iso.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_iso.py index 98a06f6cd9..80c255ace7 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_iso.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_iso.py @@ -197,12 +197,6 @@ project: sample: example project ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -319,9 +313,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_iso = AnsibleCloudStackIso(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_loadbalancer_rule.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_loadbalancer_rule.py index 297bc218b2..7255704b76 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_loadbalancer_rule.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_loadbalancer_rule.py @@ -217,12 +217,6 @@ state: sample: "Add" ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -364,9 +358,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_lb_rule = AnsibleCloudStackLBRule(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_loadbalancer_rule_member.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_loadbalancer_rule_member.py index 3790bb50c9..93026ad68b 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_loadbalancer_rule_member.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_loadbalancer_rule_member.py @@ -200,12 +200,6 @@ state: sample: "Add" ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -344,9 +338,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_lb_rule_member = AnsibleCloudStackLBRuleMember(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_network.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_network.py index 6dea3dd3ca..6f97240b8e 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_network.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_network.py @@ -318,12 +318,6 @@ network_offering: sample: DefaultIsolatedNetworkOfferingWithSourceNatService ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -560,9 +554,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_network = AnsibleCloudStackNetwork(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_pod.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_pod.py index 8bf33ec6a0..e78eb2844c 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_pod.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_pod.py @@ -150,12 +150,6 @@ zone: sample: ch-gva-2 ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -286,9 +280,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_pod = AnsibleCloudStackPod(module) state = module.params.get('state') diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_portforward.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_portforward.py index 97841dd01b..f0c1b048f0 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_portforward.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_portforward.py @@ -203,12 +203,6 @@ vm_guest_ip: sample: 10.101.65.152 ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -391,9 +385,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_pf = AnsibleCloudStackPortforwarding(module) state = module.params.get('state') diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_project.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_project.py index ba13fc5bcb..fed2cd0c5f 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_project.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_project.py @@ -141,12 +141,6 @@ tags: sample: '[ { "key": "foo", "value": "bar" } ]' ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -287,9 +281,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_project = AnsibleCloudStackProject(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_resourcelimit.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_resourcelimit.py index b53b3fb233..40567165c5 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_resourcelimit.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_resourcelimit.py @@ -115,12 +115,6 @@ project: sample: example project ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -206,9 +200,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_resource_limit = AnsibleCloudStackResourceLimit(module) resource_limit = acs_resource_limit.update_resource_limit() diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_router.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_router.py index 7209ef19a7..29ac096c15 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_router.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_router.py @@ -160,12 +160,6 @@ account: sample: admin ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -358,9 +352,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_router = AnsibleCloudStackRouter(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup.py index ec30c757e7..cf5ac80bd1 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup.py @@ -111,12 +111,6 @@ account: sample: example account ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -201,9 +195,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_sg = AnsibleCloudStackSecurityGroup(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup_rule.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup_rule.py index 782d7870df..d08649511c 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup_rule.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_securitygroup_rule.py @@ -180,12 +180,6 @@ end_port: sample: 80 ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -404,9 +398,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_sg_rule = AnsibleCloudStackSecurityGroupRule(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_sshkeypair.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_sshkeypair.py index 7e665cd62f..182c00f762 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_sshkeypair.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_sshkeypair.py @@ -99,13 +99,6 @@ private_key: sample: "-----BEGIN RSA PRIVATE KEY-----\nMIICXQIBAAKBgQCkeFYjI+4k8bWfIRMzp4pCzhlopNydbbwRu824P5ilD4ATWMUG\nvEtuCQ2Mp5k5Bma30CdYHgh2/SbxC5RxXSUKTUJtTKpoJUy8PAhb1nn9dnfkC2oU\naRVi9NRUgypTIZxMpgooHOxvAzWxbZCyh1W+91Ld3FNaGxTLqTgeevY84wIDAQAB\nAoGAcwQwgLyUwsNB1vmjWwE0QEmvHS4FlhZyahhi4hGfZvbzAxSWHIK7YUT1c8KU\n9XsThEIN8aJ3GvcoL3OAqNKRnoNb14neejVHkYRadhxqc0GVN6AUIyCqoEMpvhFI\nQrinM572ORzv5ffRjCTbvZcYlW+sqFKNo5e8pYIB8TigpFECQQDu7bg9vkvg8xPs\nkP1K+EH0vsR6vUfy+m3euXjnbJtiP7RoTkZk0JQMOmexgy1qQhISWT0e451wd62v\nJ7M0trl5AkEAsDivJnMIlCCCypwPN4tdNUYpe9dtidR1zLmb3SA7wXk5xMUgLZI9\ncWPjBCMt0KKShdDhQ+hjXAyKQLF7iAPuOwJABjdHCMwvmy2XwhrPjCjDRoPEBtFv\n0sFzJE08+QBZVogDwIbwy+SlRWArnHGmN9J6N+H8dhZD3U4vxZPJ1MBAOQJBAJxO\nCv1dt1Q76gbwmYa49LnWO+F+2cgRTVODpr5iYt5fOmBQQRRqzFkRMkFvOqn+KVzM\nQ6LKM6dn8BEl295vLhUCQQCVDWzoSk3GjL3sOjfAUTyAj8VAXM69llaptxWWySPM\nE9pA+8rYmHfohYFx7FD5/KWCO+sfmxTNB48X0uwyE8tO\n-----END RSA PRIVATE KEY-----\n" ''' - -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - try: import sshpubkeys has_lib_sshpubkeys = True @@ -221,9 +214,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - if not has_lib_sshpubkeys: module.fail_json(msg="python library sshpubkeys required: pip install sshpubkeys") diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_staticnat.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_staticnat.py index b67f619488..da17c76a57 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_staticnat.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_staticnat.py @@ -146,13 +146,6 @@ domain: sample: example domain ''' - -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -285,9 +278,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_static_nat = AnsibleCloudStackStaticNat(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_template.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_template.py index a48f9586e9..2a2a6e29be 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_template.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_template.py @@ -375,12 +375,6 @@ project: sample: Production ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -643,9 +637,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_tpl = AnsibleCloudStackTemplate(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_user.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_user.py index 2ac97059cd..06d44d82f7 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_user.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_user.py @@ -197,12 +197,6 @@ domain: sample: ROOT ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -424,9 +418,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_acc = AnsibleCloudStackUser(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_vmsnapshot.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_vmsnapshot.py index 5a4c51885f..d404df2c81 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_vmsnapshot.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_vmsnapshot.py @@ -161,12 +161,6 @@ project: sample: Production ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -281,9 +275,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_vmsnapshot = AnsibleCloudStackVmSnapshot(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_volume.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_volume.py index ccf844eec9..844a16a3f6 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_volume.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_volume.py @@ -230,12 +230,6 @@ device_id: sample: 1 ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -471,9 +465,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_vol = AnsibleCloudStackVolume(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_zone.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_zone.py index 84aad34726..2a343e0b97 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_zone.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_zone.py @@ -226,12 +226,6 @@ tags: sample: [ { "key": "foo", "value": "bar" } ] ''' -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -386,9 +380,6 @@ def main(): supports_check_mode=True ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - try: acs_zone = AnsibleCloudStackZone(module) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_zone_facts.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_zone_facts.py index 9989796731..7b5076659f 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_zone_facts.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_zone_facts.py @@ -138,12 +138,6 @@ cloudstack_zone.tags: import base64 -try: - from cs import CloudStack, CloudStackException, read_config - has_lib_cs = True -except ImportError: - has_lib_cs = False - # import cloudstack common from ansible.module_utils.cloudstack import * @@ -197,9 +191,6 @@ def main(): supports_check_mode=False, ) - if not has_lib_cs: - module.fail_json(msg="python library cs required: pip install cs") - cs_zone_facts = AnsibleCloudStackZoneFacts(module=module).run() cs_facts_result = dict(changed=False, ansible_facts=cs_zone_facts) module.exit_json(**cs_facts_result)