From 06363f6edece62f4fd881213fce8f718205608c8 Mon Sep 17 00:00:00 2001 From: Tim Rupp Date: Fri, 3 Nov 2017 07:00:49 -0700 Subject: [PATCH] Removes bigip_snmp from skip file (#32530) --- lib/ansible/modules/network/f5/bigip_snmp.py | 104 +++++++++--------- test/sanity/import/skip.txt | 1 - .../modules/network/f5/test_bigip_snmp.py | 20 +--- 3 files changed, 53 insertions(+), 72 deletions(-) diff --git a/lib/ansible/modules/network/f5/bigip_snmp.py b/lib/ansible/modules/network/f5/bigip_snmp.py index 1ff40cc29e7..c9ef3953b7e 100644 --- a/lib/ansible/modules/network/f5/bigip_snmp.py +++ b/lib/ansible/modules/network/f5/bigip_snmp.py @@ -4,13 +4,17 @@ # 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_snmp -short_description: Manipulate general SNMP settings on a BIG-IP. +short_description: Manipulate general SNMP settings on a BIG-IP description: - Manipulate general SNMP settings on a BIG-IP. version_added: 2.4 @@ -56,61 +60,63 @@ author: - Tim Rupp (@caphrim007) ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Set snmp contact bigip_snmp: - contact: "Joe User" - password: "secret" - server: "lb.mydomain.com" - user: "admin" - validate_certs: "false" + contact: Joe User + password: secret + server: lb.mydomain.com + user: admin + validate_certs: false delegate_to: localhost - name: Set snmp location bigip_snmp: - location: "US West 1" - password: "secret" - server: "lb.mydomain.com" - user: "admin" - validate_certs: "false" + location: US West 1 + password: secret + server: lb.mydomain.com + user: admin + validate_certs: no delegate_to: localhost ''' -RETURN = ''' +RETURN = r''' agent_status_traps: - description: Value that the agent status traps was set to. - returned: changed - type: string - sample: "enabled" + description: Value that the agent status traps was set to. + returned: changed + type: string + sample: enabled agent_authentication_traps: - description: Value that the authentication status traps was set to. - returned: changed - type: string - sample: "enabled" + description: Value that the authentication status traps was set to. + returned: changed + type: string + sample: enabled device_warning_traps: - description: Value that the warning status traps was set to. - returned: changed - type: string - sample: "enabled" + description: Value that the warning status traps was set to. + returned: changed + type: string + sample: enabled contact: - description: The new value for the person who administers SNMP on the device. - returned: changed - type: string - sample: Joe User + description: The new value for the person who administers SNMP on the device. + returned: changed + type: string + sample: Joe User location: - description: The new value for the system's physical location. - returned: changed - type: string - sample: "US West 1a" + description: The new value for the system's physical location. + returned: changed + type: string + sample: US West 1a ''' -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): @@ -218,29 +224,17 @@ class ArgumentSpec(object): self.supports_check_mode = True self.choices = ['enabled', 'disabled'] self.argument_spec = dict( - contact=dict( - required=False, - default=None - ), + contact=dict(), agent_status_traps=dict( - required=False, - default=None, choices=self.choices ), agent_authentication_traps=dict( - required=False, - default=None, choices=self.choices ), device_warning_traps=dict( - required=False, - default=None, choices=self.choices ), - location=dict( - required=False, - default=None - ) + location=dict() ) self.f5_product_name = 'bigip' diff --git a/test/sanity/import/skip.txt b/test/sanity/import/skip.txt index 9d1baa82335..dba1e8b50f8 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_snmp.py lib/ansible/modules/network/ios/ios_static_route.py lib/ansible/modules/network/lenovo/cnos_backup.py lib/ansible/modules/network/lenovo/cnos_bgp.py diff --git a/test/units/modules/network/f5/test_bigip_snmp.py b/test/units/modules/network/f5/test_bigip_snmp.py index d44a8b67591..7c86f7d62c8 100644 --- a/test/units/modules/network/f5/test_bigip_snmp.py +++ b/test/units/modules/network/f5/test_bigip_snmp.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_snmp import Parameters from library.bigip_snmp import ModuleManager from library.bigip_snmp import ArgumentSpec + from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError except ImportError: try: from ansible.modules.network.f5.bigip_snmp import Parameters from ansible.modules.network.f5.bigip_snmp import ModuleManager from ansible.modules.network.f5.bigip_snmp import ArgumentSpec + from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError except ImportError: raise SkipTest("F5 Ansible modules require the f5-sdk Python library")