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
This commit is contained in:
Tim Rupp 2017-10-13 22:06:19 -07:00 committed by GitHub
parent a969a529ab
commit 53445ded84
2 changed files with 44 additions and 38 deletions

View file

@ -4,14 +4,18 @@
# Copyright (c) 2017 F5 Networks Inc. # Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # 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', ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'], 'status': ['preview'],
'supported_by': 'community'} 'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = r'''
--- ---
module: bigip_partition module: bigip_partition
short_description: Manage BIG-IP partitions. short_description: Manage BIG-IP partitions
description: description:
- Manage BIG-IP partitions. - Manage BIG-IP partitions.
version_added: "2.5" version_added: "2.5"
@ -42,70 +46,70 @@ author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
''' '''
EXAMPLES = ''' EXAMPLES = r'''
- name: Create partition "foo" using the default route domain - name: Create partition "foo" using the default route domain
bigip_partition: bigip_partition:
name: "foo" name: foo
password: "secret" password: secret
server: "lb.mydomain.com" server: lb.mydomain.com
user: "admin" user: admin
delegate_to: localhost delegate_to: localhost
- name: Create partition "bar" using a custom route domain - name: Create partition "bar" using a custom route domain
bigip_partition: bigip_partition:
name: "bar" name: bar
route_domain: 3 route_domain: 3
password: "secret" password: secret
server: "lb.mydomain.com" server: lb.mydomain.com
user: "admin" user: admin
delegate_to: localhost delegate_to: localhost
- name: Change route domain of partition "foo" - name: Change route domain of partition "foo"
bigip_partition: bigip_partition:
name: "foo" name: foo
route_domain: 8 route_domain: 8
password: "secret" password: secret
server: "lb.mydomain.com" server: lb.mydomain.com
user: "admin" user: admin
delegate_to: localhost delegate_to: localhost
- name: Set a description for partition "foo" - name: Set a description for partition "foo"
bigip_partition: bigip_partition:
name: "foo" name: foo
description: "Tenant CompanyA" description: Tenant CompanyA
password: "secret" password: secret
server: "lb.mydomain.com" server: lb.mydomain.com
user: "admin" user: admin
delegate_to: localhost delegate_to: localhost
- name: Delete the "foo" partition - name: Delete the "foo" partition
bigip_partition: bigip_partition:
name: "foo" name: foo
password: "secret" password: secret
server: "lb.mydomain.com" server: lb.mydomain.com
user: "admin" user: admin
state: "absent" state: absent
delegate_to: localhost delegate_to: localhost
''' '''
RETURN = ''' RETURN = r'''
route_domain: route_domain:
description: Name of the route domain associated with the partition. description: Name of the route domain associated with the partition.
returned: changed and success returned: changed and success
type: int type: int
sample: 0 sample: 0
description: description:
description: The description of the partition. description: The description of the partition.
returned: changed and success returned: changed and success
type: string type: string
sample: "Example partition" sample: Example partition
''' '''
from ansible.module_utils.f5_utils import AnsibleF5Client from ansible.module_utils.f5_utils import AnsibleF5Client
from ansible.module_utils.f5_utils import AnsibleF5Parameters from ansible.module_utils.f5_utils import AnsibleF5Parameters
from ansible.module_utils.f5_utils import F5ModuleError from ansible.module_utils.f5_utils import F5ModuleError
from ansible.module_utils.f5_utils import iteritems from ansible.module_utils.six import iteritems
from ansible.module_utils.f5_utils import defaultdict from collections import defaultdict
try: try:
from ansible.module_utils.f5_utils import HAS_F5SDK from ansible.module_utils.f5_utils import HAS_F5SDK

View file

@ -38,11 +38,13 @@ try:
from library.bigip_partition import Parameters from library.bigip_partition import Parameters
from library.bigip_partition import ModuleManager from library.bigip_partition import ModuleManager
from library.bigip_partition import ArgumentSpec from library.bigip_partition import ArgumentSpec
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
except ImportError: except ImportError:
try: try:
from ansible.modules.network.f5.bigip_partition import Parameters 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 ModuleManager
from ansible.modules.network.f5.bigip_partition import ArgumentSpec from ansible.modules.network.f5.bigip_partition import ArgumentSpec
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
except ImportError: except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library") raise SkipTest("F5 Ansible modules require the f5-sdk Python library")