diff --git a/lib/ansible/modules/cloud/openstack/os_client_config.py b/lib/ansible/modules/cloud/openstack/os_client_config.py index d137438618..6ad250fa4f 100644 --- a/lib/ansible/modules/cloud/openstack/os_client_config.py +++ b/lib/ansible/modules/cloud/openstack/os_client_config.py @@ -1,19 +1,11 @@ #!/usr/bin/python # Copyright (c) 2015 Hewlett-Packard Development Company, L.P. -# -# This module is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + + +from __future__ import absolute_import, division, print_function +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -54,14 +46,24 @@ EXAMPLES = ''' - mordred ''' -import os_client_config -from os_client_config import exceptions +from ansible.module_utils.basic import AnsibleModule + +try: + import os_client_config + from os_client_config import exceptions + HAS_OS_CLIENT_CONFIG = True +except ImportError: + HAS_OS_CLIENT_CONFIG = False def main(): module = AnsibleModule(argument_spec=dict( clouds=dict(required=False, type='list', default=[]), )) + + if not HAS_OS_CLIENT_CONFIG: + module.fail_json(msg='os-client-config is required for this module') + p = module.params try: @@ -75,8 +77,6 @@ def main(): except exceptions.OpenStackConfigException as e: module.fail_json(msg=str(e)) -# import module snippets -from ansible.module_utils.basic import * if __name__ == "__main__": main() diff --git a/test/sanity/import/skip.txt b/test/sanity/import/skip.txt index 4bfb02f7f1..f5a4ae42f9 100644 --- a/test/sanity/import/skip.txt +++ b/test/sanity/import/skip.txt @@ -44,7 +44,6 @@ lib/ansible/modules/cloud/google/gc_storage.py lib/ansible/modules/cloud/google/gcdns_record.py lib/ansible/modules/cloud/google/gcdns_zone.py lib/ansible/modules/cloud/misc/serverless.py -lib/ansible/modules/cloud/openstack/os_client_config.py lib/ansible/modules/cloud/ovirt/ovirt_disks.py lib/ansible/modules/cloud/univention/udm_user.py lib/ansible/modules/cloud/webfaction/webfaction_app.py