From 6b6df43eaeac169fe91050737434ffc7f6070233 Mon Sep 17 00:00:00 2001 From: Tim Rupp Date: Thu, 2 Nov 2017 07:47:28 -0700 Subject: [PATCH] Removes bigip_iapp_template from the skip file (#32488) --- .../modules/network/f5/bigip_iapp_template.py | 73 ++++++++++--------- test/sanity/import/skip.txt | 1 - .../network/f5/test_bigip_iapp_template.py | 20 +---- 3 files changed, 42 insertions(+), 52 deletions(-) diff --git a/lib/ansible/modules/network/f5/bigip_iapp_template.py b/lib/ansible/modules/network/f5/bigip_iapp_template.py index a424d778ee..4873176de5 100644 --- a/lib/ansible/modules/network/f5/bigip_iapp_template.py +++ b/lib/ansible/modules/network/f5/bigip_iapp_template.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_iapp_template -short_description: Manages TCL iApp templates on a BIG-IP. +short_description: Manages TCL iApp templates on a BIG-IP description: - Manages TCL iApp templates on a BIG-IP. This module will allow you to deploy iApp templates to the BIG-IP and manage their lifecycle. The @@ -52,7 +56,7 @@ options: be provided when creating new templates. state: description: - - Whether the iRule should exist or not. + - Whether the iApp template should exist or not. default: present choices: - present @@ -60,8 +64,7 @@ options: partition: description: - Device partition to manage resources on. - required: False - default: 'Common' + default: Common notes: - Requires the f5-sdk Python package on the host. This is as easy as pip install f5-sdk. @@ -70,55 +73,55 @@ author: - Tim Rupp (@caphrim007) ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Add the iApp contained in template iapp.tmpl bigip_iapp_template: - content: "{{ lookup('template', 'iapp.tmpl') }}" - password: "secret" - server: "lb.mydomain.com" - state: "present" - user: "admin" + content: "{{ lookup('template', 'iapp.tmpl') }}" + password: secret + server: lb.mydomain.com + state: present + user: admin delegate_to: localhost - name: Update a template in place bigip_iapp_template: - content: "{{ lookup('template', 'iapp-new.tmpl') }}" - password: "secret" - server: "lb.mydomain.com" - state: "present" - user: "admin" + content: "{{ lookup('template', 'iapp-new.tmpl') }}" + password: secret + server: lb.mydomain.com + state: present + user: admin delegate_to: localhost - name: Update a template in place that has existing services created from it. bigip_iapp_template: - content: "{{ lookup('template', 'iapp-new.tmpl') }}" - force: yes - password: "secret" - server: "lb.mydomain.com" - state: "present" - user: "admin" + content: "{{ lookup('template', 'iapp-new.tmpl') }}" + force: yes + password: secret + server: lb.mydomain.com + state: present + user: admin delegate_to: localhost ''' -RETURN = ''' +RETURN = r''' # only common fields returned ''' import re import uuid -from ansible.module_utils.f5_utils import ( - AnsibleF5Client, - AnsibleF5Parameters, - HAS_F5SDK, - F5ModuleError, - iteritems, - defaultdict, - iControlUnexpectedHTTPError -) -from f5.utils.iapp_parser import ( - NonextantTemplateNameException -) +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 +from ansible.module_utils.six import iteritems +from collections import defaultdict + +try: + from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError + from f5.utils.iapp_parser import NonextantTemplateNameException +except ImportError: + HAS_F5SDK = False try: from StringIO import StringIO diff --git a/test/sanity/import/skip.txt b/test/sanity/import/skip.txt index cc88841b98..0427d480fc 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_iapp_template.py lib/ansible/modules/network/f5/bigip_irule.py lib/ansible/modules/network/f5/bigip_pool.py lib/ansible/modules/network/f5/bigip_provision.py diff --git a/test/units/modules/network/f5/test_bigip_iapp_template.py b/test/units/modules/network/f5/test_bigip_iapp_template.py index 866d3df27b..5378bd94f0 100644 --- a/test/units/modules/network/f5/test_bigip_iapp_template.py +++ b/test/units/modules/network/f5/test_bigip_iapp_template.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_iapp_template import Parameters from library.bigip_iapp_template import ModuleManager from library.bigip_iapp_template import ArgumentSpec + from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError except ImportError: try: from ansible.modules.network.f5.bigip_iapp_template import Parameters from ansible.modules.network.f5.bigip_iapp_template import ArgumentSpec from ansible.modules.network.f5.bigip_iapp_template import ModuleManager + from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError except ImportError: raise SkipTest("F5 Ansible modules require the f5-sdk Python library")