diff options
author | Tom Melendez <tom@supertom.com> | 2016-10-13 05:33:13 -0700 |
---|---|---|
committer | Ryan Brown <sb@ryansb.com> | 2016-10-13 08:33:13 -0400 |
commit | c6d8cb6cab9fdfd9cd382048bbf419dfbc2dc164 (patch) | |
tree | 80cb38da21142ad3e70f540ce5c4047d6b905e13 | |
parent | 454835622bafc5d44926ab32716b440446f1c7ba (diff) | |
download | ansible-modules-core-c6d8cb6cab9fdfd9cd382048bbf419dfbc2dc164.tar.gz |
Added libcloud guard for Managed Instance Groups. (#4911)
-rw-r--r-- | cloud/google/gce_mig.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cloud/google/gce_mig.py b/cloud/google/gce_mig.py index 7762eaed..bb44be1f 100644 --- a/cloud/google/gce_mig.py +++ b/cloud/google/gce_mig.py @@ -596,7 +596,6 @@ def get_mig(gce, name, zone): def main(): - module = AnsibleModule(argument_spec=dict( name=dict(required=True), template=dict(), @@ -619,7 +618,13 @@ def main(): msg="GCE module requires python's 'ast' module, python v2.6+") if not HAS_LIBCLOUD: module.fail_json( - msg='libcloud with GCE Managed Instance Group support (1.1+) required for this module.') + msg='libcloud with GCE Managed Instance Group support (1.2+) required for this module.') + + gce = gce_connect(module) + if not hasattr(gce, 'ex_create_instancegroupmanager'): + module.fail_json( + msg='libcloud with GCE Managed Instance Group support (1.2+) required for this module.', + changed=False) params = {} params['state'] = module.params.get('state') @@ -634,7 +639,6 @@ def main(): if not valid_autoscaling: module.fail_json(msg=as_msg, changed=False) - gce = gce_connect(module) changed = False json_output = {'state': params['state'], 'zone': params['zone']} mig = get_mig(gce, params['name'], params['zone']) |