diff --git a/lib/ansible/modules/network/f5/bigip_hostname.py b/lib/ansible/modules/network/f5/bigip_hostname.py index 6a31389438..da4d8e0a89 100644 --- a/lib/ansible/modules/network/f5/bigip_hostname.py +++ b/lib/ansible/modules/network/f5/bigip_hostname.py @@ -4,14 +4,18 @@ # Copyright (c) 2017 F5 Networks Inc. # 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.1', 'status': ['preview'], 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: bigip_hostname -short_description: Manage the hostname of a BIG-IP. +short_description: Manage the hostname of a BIG-IP description: - Manage the hostname of a BIG-IP. version_added: "2.3" @@ -31,31 +35,33 @@ author: - Matthew Lam (@mryanlam) ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Set the hostname of the BIG-IP bigip_hostname: - hostname: "bigip.localhost.localdomain" - password: "admin" - server: "bigip.localhost.localdomain" - user: "admin" + hostname: bigip.localhost.localdomain + password: secret + server: lb.mydomain.com + user: admin delegate_to: localhost ''' -RETURN = ''' +RETURN = r''' hostname: - description: The new hostname of the device - returned: changed - type: string - sample: "big-ip01.internal" + description: The new hostname of the device + returned: changed + type: string + sample: big-ip01.internal ''' -from ansible.module_utils.f5_utils import ( - AnsibleF5Client, - AnsibleF5Parameters, - HAS_F5SDK, - F5ModuleError, - iControlUnexpectedHTTPError -) +from ansible.module_utils.f5_utils import AnsibleF5Client +from ansible.module_utils.f5_utils import AnsibleF5Parameters +from ansible.module_utils.f5_utils import HAS_F5SDK +from ansible.module_utils.f5_utils import F5ModuleError + +try: + from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError +except ImportError: + HAS_F5SDK = False class Parameters(AnsibleF5Parameters): diff --git a/test/sanity/import/skip.txt b/test/sanity/import/skip.txt index 2155696c19..db5f30b14f 100644 --- a/test/sanity/import/skip.txt +++ b/test/sanity/import/skip.txt @@ -14,7 +14,6 @@ lib/ansible/modules/cloud/webfaction/webfaction_mailbox.py lib/ansible/modules/cloud/webfaction/webfaction_site.py lib/ansible/modules/clustering/consul_acl.py lib/ansible/modules/network/cloudengine/ce_file_copy.py -lib/ansible/modules/network/f5/bigip_hostname.py lib/ansible/modules/network/f5/bigip_iapp_service.py lib/ansible/modules/network/f5/bigip_iapp_template.py lib/ansible/modules/network/f5/bigip_irule.py diff --git a/test/units/modules/network/f5/test_bigip_hostname.py b/test/units/modules/network/f5/test_bigip_hostname.py index c53d2d995a..49db8c341a 100644 --- a/test/units/modules/network/f5/test_bigip_hostname.py +++ b/test/units/modules/network/f5/test_bigip_hostname.py @@ -1,21 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright 2017 F5 Networks Inc. -# -# This file is part of Ansible -# -# Ansible 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. -# -# Ansible 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 Ansible. If not, see . +# Copyright (c) 2017 F5 Networks Inc. +# 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 @@ -38,11 +24,13 @@ try: from library.bigip_hostname import Parameters from library.bigip_hostname import ModuleManager from library.bigip_hostname import ArgumentSpec + from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError except ImportError: try: from ansible.modules.network.f5.bigip_hostname import Parameters from ansible.modules.network.f5.bigip_hostname import ModuleManager from ansible.modules.network.f5.bigip_hostname import ArgumentSpec + from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError except ImportError: raise SkipTest("F5 Ansible modules require the f5-sdk Python library")