From 3934513121236ed8006e1deb549a71e8a8967e8d Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Fri, 7 Apr 2017 22:23:55 +0530 Subject: [PATCH] Fix a10 pylint issues (#23410) * Fix a10 pylint issues * Moving imports to standard location --- lib/ansible/modules/network/a10/a10_server.py | 12 +++++------- .../modules/network/a10/a10_server_axapi3.py | 13 ++++++------- .../modules/network/a10/a10_service_group.py | 12 +++++------- .../modules/network/a10/a10_virtual_server.py | 13 ++++++------- 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/lib/ansible/modules/network/a10/a10_server.py b/lib/ansible/modules/network/a10/a10_server.py index 5cd5d1b8cca..f654bd6df4f 100644 --- a/lib/ansible/modules/network/a10/a10_server.py +++ b/lib/ansible/modules/network/a10/a10_server.py @@ -116,7 +116,12 @@ content: type: string sample: "mynewserver" ''' +import json +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible.module_utils.a10 import axapi_call, a10_argument_spec, axapi_authenticate, axapi_failure +from ansible.module_utils.a10 import axapi_get_port_protocol, axapi_enabled_disabled, AXAPI_PORT_PROTOCOLS VALID_PORT_FIELDS = ['port_num', 'protocol', 'status'] @@ -295,12 +300,5 @@ def main(): axapi_call(module, session_url + '&method=session.close') module.exit_json(changed=changed, content=result) -# ansible module imports -import json -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.urls import url_argument_spec -from ansible.module_utils.a10 import axapi_call, a10_argument_spec, axapi_authenticate, axapi_failure, axapi_get_port_protocol, axapi_enabled_disabled - - if __name__ == '__main__': main() diff --git a/lib/ansible/modules/network/a10/a10_server_axapi3.py b/lib/ansible/modules/network/a10/a10_server_axapi3.py index 946a1d19721..29f68735a79 100644 --- a/lib/ansible/modules/network/a10/a10_server_axapi3.py +++ b/lib/ansible/modules/network/a10/a10_server_axapi3.py @@ -100,6 +100,12 @@ EXAMPLES = ''' protocol: TCP ''' +import json + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible.module_utils.a10 import axapi_call_v3, a10_argument_spec, axapi_authenticate_v3, axapi_failure +from ansible.module_utils.a10 import AXAPI_PORT_PROTOCOLS VALID_PORT_FIELDS = ['port-number', 'protocol', 'action'] @@ -245,12 +251,5 @@ def main(): axapi_call_v3(module, axapi_base_url + 'logoff/', method='POST', body='', signature=signature) module.exit_json(changed=changed, content=result) - -import json -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.urls import url_argument_spec -from ansible.module_utils.a10 import axapi_call_v3, a10_argument_spec, axapi_authenticate_v3, axapi_failure - - if __name__ == '__main__': main() diff --git a/lib/ansible/modules/network/a10/a10_service_group.py b/lib/ansible/modules/network/a10/a10_service_group.py index 5c38ac2045f..edba71f51cc 100644 --- a/lib/ansible/modules/network/a10/a10_service_group.py +++ b/lib/ansible/modules/network/a10/a10_service_group.py @@ -126,6 +126,11 @@ content: type: string sample: "mynewservicegroup" ''' +import json + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible.module_utils.a10 import axapi_call, a10_argument_spec, axapi_authenticate, axapi_failure, axapi_enabled_disabled VALID_SERVICE_GROUP_FIELDS = ['name', 'protocol', 'lb_method'] VALID_SERVER_FIELDS = ['server', 'port', 'status'] @@ -340,12 +345,5 @@ def main(): axapi_call(module, session_url + '&method=session.close') module.exit_json(changed=changed, content=result) -# standard ansible module imports -import json -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.urls import url_argument_spec -from ansible.module_utils.a10 import axapi_call, a10_argument_spec, axapi_authenticate, axapi_failure, axapi_enabled_disabled - - if __name__ == '__main__': main() diff --git a/lib/ansible/modules/network/a10/a10_virtual_server.py b/lib/ansible/modules/network/a10/a10_virtual_server.py index 665ab4b431d..5a741d4a901 100644 --- a/lib/ansible/modules/network/a10/a10_virtual_server.py +++ b/lib/ansible/modules/network/a10/a10_virtual_server.py @@ -114,6 +114,12 @@ content: type: string sample: "mynewvirtualserver" ''' +import json + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible.module_utils.a10 import axapi_call, a10_argument_spec, axapi_authenticate, axapi_failure +from ansible.module_utils.a10 import axapi_enabled_disabled, axapi_get_vport_protocol, AXAPI_VPORT_PROTOCOLS VALID_PORT_FIELDS = ['port', 'protocol', 'service_group', 'status'] @@ -284,12 +290,5 @@ def main(): axapi_call(module, session_url + '&method=session.close') module.exit_json(changed=changed, content=result) -# standard ansible module imports -import json -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.urls import url_argument_spec -from ansible.module_utils.a10 import axapi_call, a10_argument_spec, axapi_authenticate, axapi_failure, axapi_enabled_disabled, axapi_get_vport_protocol - - if __name__ == '__main__': main()