community.general/lib/ansible/modules/network/f5
cclauss d30554bc90 Network F5: Adjust for Python 3 scoping rules (#37554)
This PR makes and adjustment for Python 3 scoping rules which differ from Python 2.  In Python 3, the variable __ex__ goes out of scope at the exit of the __try-except__ block.  This means that when __ex__ is referred to on the lines that follow, it would be an _undefined name_ causing a __NameError__ to be raised instead of the expected __ConnectionError__.

flake8 testing of https://github.com/ansible/ansible on Python 3.6.3
The command "echo ; echo -n "flake8 testing of ${URL} on " ; python -V" exited with 0.
130.72s$ time flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
./lib/ansible/module_utils/api.py:114:21: F823 local variable 'retry_count' (defined in enclosing scope on line 107) referenced before assignment
                    retry_count += 1  # pylint: disable=undefined-variable
                    ^
./lib/ansible/module_utils/six/__init__.py:54:20: F821 undefined name 'basestring'
    string_types = basestring,
                   ^
./lib/ansible/module_utils/six/__init__.py:55:27: F821 undefined name 'long'
    integer_types = (int, long)
                          ^
./lib/ansible/module_utils/six/__init__.py:57:17: F821 undefined name 'unicode'
    text_type = unicode
                ^
./lib/ansible/module_utils/six/__init__.py:658:16: F821 undefined name 'unicode'
        return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape")
               ^
./lib/ansible/module_utils/six/__init__.py:754:37: F821 undefined name 'basestring'
            if not isinstance(data, basestring):
                                    ^
./lib/ansible/module_utils/six/__init__.py:757:32: F821 undefined name 'file'
            if (isinstance(fp, file) and
                               ^
./lib/ansible/module_utils/six/__init__.py:758:38: F821 undefined name 'unicode'
                    isinstance(data, unicode) and
                                     ^
./lib/ansible/module_utils/six/__init__.py:768:32: F821 undefined name 'unicode'
            if isinstance(sep, unicode):
                               ^
./lib/ansible/module_utils/six/__init__.py:774:32: F821 undefined name 'unicode'
            if isinstance(end, unicode):
                               ^
./lib/ansible/module_utils/six/__init__.py:782:36: F821 undefined name 'unicode'
                if isinstance(arg, unicode):
                                   ^
./lib/ansible/module_utils/six/__init__.py:786:23: F821 undefined name 'unicode'
            newline = unicode("\n")
                      ^
./lib/ansible/module_utils/six/__init__.py:787:21: F821 undefined name 'unicode'
            space = unicode(" ")
                    ^
./lib/ansible/modules/cloud/misc/rhevm.py:594:24: F821 undefined name 'e'
            setMsg(str(e))
                       ^
./lib/ansible/modules/cloud/openstack/os_user.py:202:38: F821 undefined name 'shade'
    if description and StrictVersion(shade.__version__) < StrictVersion('1.13.0'):
                                     ^
./lib/ansible/modules/cloud/openstack/os_volume.py:153:27: F821 undefined name 'shade'
            StrictVersion(shade.__version__) < StrictVersion('1.22')):
                          ^
./lib/ansible/modules/files/archive.py:391:92: F821 undefined name 'e'
                module.fail_json(dest=dest, msg='Error deleting some source files: ' + str(e), files=errors)
                                                                                           ^
./lib/ansible/modules/network/dellos9/dellos9_facts.py:379:24: F821 undefined name 'key'
                parsed[key] += '\n%s' % line
                       ^
./lib/ansible/modules/network/dellos9/dellos9_facts.py:399:24: F821 undefined name 'key'
                parsed[key] += '\n%s' % line
                       ^
./lib/ansible/modules/network/dellos9/dellos9_facts.py:403:24: F821 undefined name 'key'
                parsed[key] += '\n%s' % line
                       ^
./lib/ansible/modules/network/dellos9/dellos9_facts.py:418:24: F821 undefined name 'key'
                parsed[key] += '\n%s' % line
                       ^
./lib/ansible/modules/network/f5/bigip_device_httpd.py:461:40: F821 undefined name 'ex'
        if 'Connection aborted' in str(ex) and 'redirectHttpToHttps' in params:
                                       ^
./lib/ansible/modules/network/f5/bigip_device_httpd.py:465:33: F821 undefined name 'ex'
        raise F5ModuleError(str(ex))
                                ^
./lib/ansible/modules/network/ironware/ironware_facts.py:274:24: F821 undefined name 'key'
                parsed[key] += '\n%s' % line
                       ^
./lib/ansible/modules/network/ironware/ironware_facts.py:514:24: F821 undefined name 'key'
                parsed[key] += '\n%s' % line
                       ^
24    F821 undefined name 'basestring'
1     F823 local variable 'retry_count' (defined in enclosing scope on line 107) referenced before assignment
25
2018-03-17 19:19:43 -07:00
..
__init__.py
bigip_asm_policy.py Fixes bigip_asm_policy (#35154) 2018-01-21 10:11:27 -08:00
bigip_command.py More bug fixes before 2.5 (#35260) 2018-01-24 08:15:37 -08:00
bigip_config.py Detects errors in bigip_config (#34965) 2018-01-16 20:10:36 -08:00
bigip_configsync_action.py Various fixes (#34815) 2018-01-12 12:08:49 -08:00
bigip_device_connectivity.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_device_dns.py Various fixes (#34815) 2018-01-12 12:08:49 -08:00
bigip_device_group.py Adds bigip_ucs_fetch module (#35113) 2018-01-19 20:25:47 -08:00
bigip_device_group_member.py Adds module for bigip_device_group_member (#35121) 2018-01-19 20:57:41 -08:00
bigip_device_httpd.py Network F5: Adjust for Python 3 scoping rules (#37554) 2018-03-17 19:19:43 -07:00
bigip_device_ntp.py Various fixes (#34815) 2018-01-12 12:08:49 -08:00
bigip_device_sshd.py Various fixes (#34815) 2018-01-12 12:08:49 -08:00
bigip_device_trust.py More bug fixes before 2.5 (#35260) 2018-01-24 08:15:37 -08:00
bigip_facts.py Clean up module documentation (#36909) 2018-03-15 22:15:24 +01:00
bigip_gtm_datacenter.py Various fixes and changes for F5 (#34817) 2018-01-12 13:23:19 -08:00
bigip_gtm_facts.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_gtm_pool.py Various fixes and changes for F5 (#34817) 2018-01-12 13:23:19 -08:00
bigip_gtm_server.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_gtm_virtual_server.py Adds bigip_ucs_fetch module (#35113) 2018-01-19 20:25:47 -08:00
bigip_gtm_wide_ip.py Various fixes and changes for F5 (#34817) 2018-01-12 13:23:19 -08:00
bigip_hostname.py Various fixes and changes for F5 (#34817) 2018-01-12 13:23:19 -08:00
bigip_iapp_service.py Various fixes and changes for F5 (#34817) 2018-01-12 13:23:19 -08:00
bigip_iapp_template.py Various fixes and changes for F5 (#34817) 2018-01-12 13:23:19 -08:00
bigip_iapplx_package.py Various fixes and changes for F5 (#34817) 2018-01-12 13:23:19 -08:00
bigip_irule.py Various fixes and changes for F5 (#34817) 2018-01-12 13:23:19 -08:00
bigip_monitor_http.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_monitor_https.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_monitor_snmp_dca.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_monitor_tcp.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_monitor_tcp_echo.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_monitor_tcp_half_open.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_monitor_udp.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_node.py Various F5 related fixes for traceback raising (#34820) 2018-01-12 14:43:35 -08:00
bigip_partition.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_policy.py Various F5 related fixes for traceback raising (#34820) 2018-01-12 14:43:35 -08:00
bigip_policy_rule.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_pool.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_pool_member.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_profile_client_ssl.py Adds refactors for more f5 modules (#34824) 2018-01-12 21:49:12 -08:00
bigip_provision.py Adds refactors for more f5 modules (#34824) 2018-01-12 21:49:12 -08:00
bigip_qkview.py Adds refactors for more f5 modules (#34824) 2018-01-12 21:49:12 -08:00
bigip_remote_syslog.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_routedomain.py Adds bigip_ucs_fetch module (#35113) 2018-01-19 20:25:47 -08:00
bigip_security_address_list.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_security_port_list.py Adds refactors for more f5 modules (#34824) 2018-01-12 21:49:12 -08:00
bigip_selfip.py More bug fixes before 2.5 (#35260) 2018-01-24 08:15:37 -08:00
bigip_snat_pool.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_snmp.py Adds refactors for more f5 modules (#34824) 2018-01-12 21:49:12 -08:00
bigip_snmp_trap.py Adds refactors for more f5 modules (#34824) 2018-01-12 21:49:12 -08:00
bigip_software_update.py Adds refactors for more f5 modules (#34824) 2018-01-12 21:49:12 -08:00
bigip_ssl_certificate.py Adds refactors for more f5 modules (#34824) 2018-01-12 21:49:12 -08:00
bigip_ssl_key.py Adds refactors for more f5 modules (#34824) 2018-01-12 21:49:12 -08:00
bigip_static_route.py Adds bigip_static_route module (#34859) 2018-01-14 17:40:59 -08:00
bigip_sys_db.py Refactors and deprecation removals (#34830) 2018-01-12 23:03:41 -08:00
bigip_sys_global.py Refactors and deprecation removals (#34830) 2018-01-12 23:03:41 -08:00
bigip_traffic_group.py Refactors and deprecation removals (#34830) 2018-01-12 23:03:41 -08:00
bigip_ucs.py Refactors and deprecation removals (#34830) 2018-01-12 23:03:41 -08:00
bigip_ucs_fetch.py Adds bigip_ucs_fetch module (#35113) 2018-01-19 20:25:47 -08:00
bigip_user.py Refactors and deprecation removals (#34830) 2018-01-12 23:03:41 -08:00
bigip_vcmp_guest.py Refactors and deprecation removals (#34830) 2018-01-12 23:03:41 -08:00
bigip_virtual_address.py Refactors and deprecation removals (#34830) 2018-01-12 23:03:41 -08:00
bigip_virtual_server.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_vlan.py Fixes some bugs and things (#35122) 2018-01-20 10:40:20 -08:00
bigip_wait.py Refactors and deprecation removals (#34830) 2018-01-12 23:03:41 -08:00
bigiq_regkey_license.py Refactors and deprecation removals (#34830) 2018-01-12 23:03:41 -08:00
bigiq_regkey_pool.py Refactors and deprecation removals (#34830) 2018-01-12 23:03:41 -08:00