From 53445ded84a1e6320a2bc0c90f094a0953e0adeb Mon Sep 17 00:00:00 2001 From: Tim Rupp Date: Fri, 13 Oct 2017 22:06:19 -0700 Subject: [PATCH] Fixes documentation related bugs (#31730) New conventions for ansible warrant fixes to accomodate those in bigip_partition. This patch also includes an import fix that can raise an error when Ansible unit tests run --- .../modules/network/f5/bigip_partition.py | 80 ++++++++++--------- .../network/f5/test_bigip_partition.py | 2 + 2 files changed, 44 insertions(+), 38 deletions(-) diff --git a/lib/ansible/modules/network/f5/bigip_partition.py b/lib/ansible/modules/network/f5/bigip_partition.py index 1fc5bb2506e..2efed47ba8e 100644 --- a/lib/ansible/modules/network/f5/bigip_partition.py +++ b/lib/ansible/modules/network/f5/bigip_partition.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_partition -short_description: Manage BIG-IP partitions. +short_description: Manage BIG-IP partitions description: - Manage BIG-IP partitions. version_added: "2.5" @@ -42,70 +46,70 @@ author: - Tim Rupp (@caphrim007) ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Create partition "foo" using the default route domain bigip_partition: - name: "foo" - password: "secret" - server: "lb.mydomain.com" - user: "admin" + name: foo + password: secret + server: lb.mydomain.com + user: admin delegate_to: localhost - name: Create partition "bar" using a custom route domain bigip_partition: - name: "bar" - route_domain: 3 - password: "secret" - server: "lb.mydomain.com" - user: "admin" + name: bar + route_domain: 3 + password: secret + server: lb.mydomain.com + user: admin delegate_to: localhost - name: Change route domain of partition "foo" bigip_partition: - name: "foo" - route_domain: 8 - password: "secret" - server: "lb.mydomain.com" - user: "admin" + name: foo + route_domain: 8 + password: secret + server: lb.mydomain.com + user: admin delegate_to: localhost - name: Set a description for partition "foo" bigip_partition: - name: "foo" - description: "Tenant CompanyA" - password: "secret" - server: "lb.mydomain.com" - user: "admin" + name: foo + description: Tenant CompanyA + password: secret + server: lb.mydomain.com + user: admin delegate_to: localhost - name: Delete the "foo" partition bigip_partition: - name: "foo" - password: "secret" - server: "lb.mydomain.com" - user: "admin" - state: "absent" + name: foo + password: secret + server: lb.mydomain.com + user: admin + state: absent delegate_to: localhost ''' -RETURN = ''' +RETURN = r''' route_domain: - description: Name of the route domain associated with the partition. - returned: changed and success - type: int - sample: 0 + description: Name of the route domain associated with the partition. + returned: changed and success + type: int + sample: 0 description: - description: The description of the partition. - returned: changed and success - type: string - sample: "Example partition" + description: The description of the partition. + returned: changed and success + type: string + sample: Example partition ''' from ansible.module_utils.f5_utils import AnsibleF5Client from ansible.module_utils.f5_utils import AnsibleF5Parameters from ansible.module_utils.f5_utils import F5ModuleError -from ansible.module_utils.f5_utils import iteritems -from ansible.module_utils.f5_utils import defaultdict +from ansible.module_utils.six import iteritems +from collections import defaultdict try: from ansible.module_utils.f5_utils import HAS_F5SDK diff --git a/test/units/modules/network/f5/test_bigip_partition.py b/test/units/modules/network/f5/test_bigip_partition.py index 0049d74cdb7..cd2ea1b0194 100644 --- a/test/units/modules/network/f5/test_bigip_partition.py +++ b/test/units/modules/network/f5/test_bigip_partition.py @@ -38,11 +38,13 @@ try: from library.bigip_partition import Parameters from library.bigip_partition import ModuleManager from library.bigip_partition import ArgumentSpec + from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError except ImportError: try: from ansible.modules.network.f5.bigip_partition import Parameters from ansible.modules.network.f5.bigip_partition import ModuleManager from ansible.modules.network.f5.bigip_partition import ArgumentSpec + from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError except ImportError: raise SkipTest("F5 Ansible modules require the f5-sdk Python library")