summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2018-09-07 17:59:46 -0700
committerToshio Kuratomi <a.badger@gmail.com>2018-12-16 15:03:19 -0800
commit3fba0062078cc04eabb460ec1eb13a4739235199 (patch)
tree9c09103ce103a90f97ccf3736ca6c2502d7860f8
parent5147e792d398258a5a87c3271ea89c1c4fd2f4d3 (diff)
downloadansible-3fba0062078cc04eabb460ec1eb13a4739235199.tar.gz
Update bare exceptions to specify Exception.
This will keep us from accidentally catching program-exiting exceptions like KeyboardInterupt and SystemExit.
-rwxr-xr-xbin/ansible-connection2
-rwxr-xr-xcontrib/inventory/abiquo.py4
-rwxr-xr-xcontrib/inventory/apstra_aos.py12
-rwxr-xr-xcontrib/inventory/azure_rm.py6
-rwxr-xr-xcontrib/inventory/brook.py2
-rwxr-xr-xcontrib/inventory/collins.py12
-rwxr-xr-xcontrib/inventory/consul_io.py2
-rwxr-xr-xcontrib/inventory/docker.py2
-rwxr-xr-xcontrib/inventory/gce.py6
-rwxr-xr-xcontrib/inventory/linode.py2
-rwxr-xr-xcontrib/inventory/lxd.py2
-rwxr-xr-xcontrib/inventory/nsot.py2
-rwxr-xr-xcontrib/inventory/rackhd.py6
-rwxr-xr-xcontrib/inventory/rax.py2
-rwxr-xr-xcontrib/inventory/rudder.py2
-rwxr-xr-xcontrib/inventory/stacki.py2
-rwxr-xr-xcontrib/inventory/vbox.py6
-rwxr-xr-xcontrib/inventory/zabbix.py2
-rwxr-xr-xcontrib/vault/azure_vault.py6
-rwxr-xr-xdocs/bin/generate_man.py4
-rwxr-xr-xhacking/test-module2
-rwxr-xr-xhacking/tests/gen_distribution_version_testcase.py2
-rw-r--r--lib/ansible/cli/config.py2
-rw-r--r--lib/ansible/executor/process/worker.py4
-rw-r--r--lib/ansible/galaxy/api.py4
-rw-r--r--lib/ansible/galaxy/login.py4
-rw-r--r--lib/ansible/galaxy/role.py10
-rw-r--r--lib/ansible/module_utils/api.py2
-rw-r--r--lib/ansible/module_utils/azure_rm_common.py2
-rw-r--r--lib/ansible/module_utils/basic.py14
-rw-r--r--lib/ansible/module_utils/common/sys_info.py2
-rw-r--r--lib/ansible/module_utils/ec2.py2
-rw-r--r--lib/ansible/module_utils/infinibox.py2
-rw-r--r--lib/ansible/module_utils/known_hosts.py4
-rw-r--r--lib/ansible/module_utils/netapp.py6
-rw-r--r--lib/ansible/module_utils/netapp_elementsw_module.py2
-rw-r--r--lib/ansible/module_utils/network/a10/a10.py4
-rw-r--r--lib/ansible/module_utils/network/aci/aci.py6
-rw-r--r--lib/ansible/module_utils/network/aci/msc.py2
-rw-r--r--lib/ansible/module_utils/network/aos/aos.py4
-rw-r--r--lib/ansible/module_utils/network/cnos/cnos.py6
-rw-r--r--lib/ansible/module_utils/network/common/utils.py2
-rw-r--r--lib/ansible/module_utils/network/fortios/fortios.py4
-rw-r--r--lib/ansible/module_utils/network/meraki/meraki.py2
-rw-r--r--lib/ansible/module_utils/rax.py2
-rw-r--r--lib/ansible/module_utils/redfish_utils.py8
-rw-r--r--lib/ansible/module_utils/remote_management/ucs.py2
-rw-r--r--lib/ansible/module_utils/urls.py14
-rw-r--r--lib/ansible/modules/cloud/amazon/aws_direct_connect_connection.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/aws_direct_connect_link_aggregation_group.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/aws_kms.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/aws_s3_cors.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/aws_ssm_parameter_store.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/cloudformation.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/ec2.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/ec2_asg.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/ec2_elb_lb.py6
-rw-r--r--lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/ec2_tag.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/ecs_ecr.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/elb_classic_lb.py6
-rw-r--r--lib/ansible/modules/cloud/amazon/lambda_policy.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/sqs_queue.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_aks_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_appserviceplan_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_availabilityset_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_cdnprofile_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_deployment.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_dnsrecordset_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_dnszone_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_functionapp_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_image_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_loadbalancer_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_networkinterface_facts.py4
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_publicipaddress_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_resource.py4
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_resource_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_resourcegroup_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_routetable_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_securitygroup_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_storageaccount_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_trafficmanagerendpoint_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_trafficmanagerprofile_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_scaleset_facts.py8
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_virtualmachineimage_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork_facts.py2
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_webapp_facts.py2
-rw-r--r--lib/ansible/modules/cloud/cloudstack/cs_facts.py2
-rw-r--r--lib/ansible/modules/cloud/docker/docker_container.py2
-rw-r--r--lib/ansible/modules/cloud/docker/docker_network.py2
-rw-r--r--lib/ansible/modules/cloud/docker/docker_swarm_service.py4
-rw-r--r--lib/ansible/modules/cloud/google/gce.py4
-rw-r--r--lib/ansible/modules/cloud/google/gce_lb.py2
-rw-r--r--lib/ansible/modules/cloud/google/gce_pd.py4
-rw-r--r--lib/ansible/modules/cloud/google/gcp_backend_service.py4
-rw-r--r--lib/ansible/modules/cloud/google/gcp_forwarding_rule.py8
-rw-r--r--lib/ansible/modules/cloud/google/gcp_healthcheck.py8
-rw-r--r--lib/ansible/modules/cloud/google/gcp_target_proxy.py6
-rw-r--r--lib/ansible/modules/cloud/google/gcp_url_map.py14
-rw-r--r--lib/ansible/modules/cloud/misc/ovirt.py10
-rw-r--r--lib/ansible/modules/cloud/misc/rhevm.py2
-rw-r--r--lib/ansible/modules/cloud/misc/virt.py2
-rw-r--r--lib/ansible/modules/cloud/misc/virt_net.py16
-rw-r--r--lib/ansible/modules/cloud/misc/virt_pool.py22
-rw-r--r--lib/ansible/modules/cloud/openstack/os_keystone_domain_facts.py2
-rw-r--r--lib/ansible/modules/cloud/openstack/os_project.py4
-rw-r--r--lib/ansible/modules/cloud/openstack/os_project_facts.py2
-rw-r--r--lib/ansible/modules/cloud/openstack/os_user.py4
-rw-r--r--lib/ansible/modules/cloud/openstack/os_user_facts.py2
-rw-r--r--lib/ansible/modules/cloud/rackspace/rax.py6
-rw-r--r--lib/ansible/modules/cloud/rackspace/rax_keypair.py2
-rw-r--r--lib/ansible/modules/cloud/softlayer/sl_vm.py6
-rw-r--r--lib/ansible/modules/cloud/univention/udm_group.py4
-rw-r--r--lib/ansible/modules/cloud/univention/udm_user.py6
-rw-r--r--lib/ansible/modules/cloud/vmware/vcenter_license.py2
-rw-r--r--lib/ansible/modules/cloud/vmware/vmware_deploy_ovf.py2
-rw-r--r--lib/ansible/modules/cloud/vmware/vmware_resource_pool.py2
-rw-r--r--lib/ansible/modules/clustering/consul.py2
-rw-r--r--lib/ansible/modules/clustering/k8s/_kubernetes.py2
-rw-r--r--lib/ansible/modules/database/misc/riak.py2
-rw-r--r--lib/ansible/modules/database/mssql/mssql_db.py2
-rw-r--r--lib/ansible/modules/database/mysql/mysql_replication.py8
-rw-r--r--lib/ansible/modules/database/mysql/mysql_user.py2
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_lang.py2
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_user.py2
-rw-r--r--lib/ansible/modules/files/stat.py2
-rw-r--r--lib/ansible/modules/files/unarchive.py10
-rw-r--r--lib/ansible/modules/monitoring/datadog_event.py2
-rw-r--r--lib/ansible/modules/monitoring/datadog_monitor.py2
-rw-r--r--lib/ansible/modules/monitoring/logicmonitor.py2
-rw-r--r--lib/ansible/modules/monitoring/pagerduty.py2
-rw-r--r--lib/ansible/modules/monitoring/pingdom.py2
-rw-r--r--lib/ansible/modules/monitoring/sensu_silence.py6
-rw-r--r--lib/ansible/modules/net_tools/basics/uri.py2
-rw-r--r--lib/ansible/modules/net_tools/netbox/netbox_device.py2
-rw-r--r--lib/ansible/modules/net_tools/nmcli.py2
-rw-r--r--lib/ansible/modules/net_tools/snmp_facts.py2
-rw-r--r--lib/ansible/modules/network/a10/a10_server.py2
-rw-r--r--lib/ansible/modules/network/a10/a10_server_axapi3.py2
-rw-r--r--lib/ansible/modules/network/a10/a10_service_group.py2
-rw-r--r--lib/ansible/modules/network/a10/a10_virtual_server.py2
-rw-r--r--lib/ansible/modules/network/aci/aci_rest.py4
-rw-r--r--lib/ansible/modules/network/aos/_aos_asn_pool.py8
-rw-r--r--lib/ansible/modules/network/aos/_aos_blueprint.py4
-rw-r--r--lib/ansible/modules/network/aos/_aos_blueprint_param.py6
-rw-r--r--lib/ansible/modules/network/aos/_aos_blueprint_virtnet.py6
-rw-r--r--lib/ansible/modules/network/aos/_aos_device.py2
-rw-r--r--lib/ansible/modules/network/aos/_aos_external_router.py8
-rw-r--r--lib/ansible/modules/network/aos/_aos_ip_pool.py10
-rw-r--r--lib/ansible/modules/network/aos/_aos_logical_device.py4
-rw-r--r--lib/ansible/modules/network/aos/_aos_logical_device_map.py6
-rw-r--r--lib/ansible/modules/network/aos/_aos_rack_type.py4
-rw-r--r--lib/ansible/modules/network/aos/_aos_template.py6
-rw-r--r--lib/ansible/modules/network/avi/avi_useraccount.py2
-rw-r--r--lib/ansible/modules/network/cloudengine/ce_file_copy.py2
-rw-r--r--lib/ansible/modules/network/cnos/cnos_backup.py2
-rw-r--r--lib/ansible/modules/network/cnos/cnos_bgp.py2
-rw-r--r--lib/ansible/modules/network/cnos/cnos_conditional_command.py2
-rw-r--r--lib/ansible/modules/network/cnos/cnos_conditional_template.py2
-rw-r--r--lib/ansible/modules/network/cnos/cnos_factory.py2
-rw-r--r--lib/ansible/modules/network/cnos/cnos_image.py2
-rw-r--r--lib/ansible/modules/network/cnos/cnos_interface.py2
-rw-r--r--lib/ansible/modules/network/cnos/cnos_reload.py2
-rw-r--r--lib/ansible/modules/network/cnos/cnos_rollback.py2
-rw-r--r--lib/ansible/modules/network/cnos/cnos_save.py2
-rw-r--r--lib/ansible/modules/network/cnos/cnos_showrun.py2
-rw-r--r--lib/ansible/modules/network/cnos/cnos_template.py2
-rw-r--r--lib/ansible/modules/network/cnos/cnos_vlag.py2
-rw-r--r--lib/ansible/modules/network/dellos10/dellos10_facts.py4
-rw-r--r--lib/ansible/modules/network/fortimanager/fmgr_device.py4
-rw-r--r--lib/ansible/modules/network/fortimanager/fmgr_device_config.py4
-rw-r--r--lib/ansible/modules/network/fortimanager/fmgr_device_group.py4
-rw-r--r--lib/ansible/modules/network/fortimanager/fmgr_fwobj_address.py10
-rw-r--r--lib/ansible/modules/network/fortimanager/fmgr_fwobj_vip.py8
-rw-r--r--lib/ansible/modules/network/fortimanager/fmgr_fwpol_ipv4.py10
-rw-r--r--lib/ansible/modules/network/fortimanager/fmgr_ha.py6
-rw-r--r--lib/ansible/modules/network/fortimanager/fmgr_query.py2
-rw-r--r--lib/ansible/modules/network/fortimanager/fmgr_secprof_ssl_ssh.py8
-rw-r--r--lib/ansible/modules/network/fortimanager/fmgr_secprof_web.py8
-rw-r--r--lib/ansible/modules/network/fortios/fortios_address.py4
-rw-r--r--lib/ansible/modules/network/fortios/fortios_config.py8
-rw-r--r--lib/ansible/modules/network/junos/junos_command.py2
-rw-r--r--lib/ansible/modules/network/netconf/netconf_get.py2
-rw-r--r--lib/ansible/modules/network/netconf/netconf_rpc.py4
-rw-r--r--lib/ansible/modules/network/nxos/nxos_file_copy.py2
-rw-r--r--lib/ansible/modules/network/nxos/nxos_snapshot.py2
-rw-r--r--lib/ansible/modules/network/ordnance/ordnance_facts.py2
-rw-r--r--lib/ansible/modules/network/panos/panos_check.py2
-rw-r--r--lib/ansible/modules/notification/bearychat.py2
-rw-r--r--lib/ansible/modules/notification/mail.py2
-rw-r--r--lib/ansible/modules/notification/nexmo.py2
-rw-r--r--lib/ansible/modules/notification/pushover.py2
-rw-r--r--lib/ansible/modules/notification/syslogger.py2
-rw-r--r--lib/ansible/modules/packaging/os/apt.py8
-rw-r--r--lib/ansible/modules/packaging/os/sorcery.py4
-rw-r--r--lib/ansible/modules/packaging/os/zypper.py2
-rw-r--r--lib/ansible/modules/remote_management/foreman/_foreman.py2
-rw-r--r--lib/ansible/modules/remote_management/foreman/_katello.py2
-rw-r--r--lib/ansible/modules/remote_management/hpilo/hpilo_facts.py6
-rw-r--r--lib/ansible/modules/remote_management/imc/imc_rest.py2
-rw-r--r--lib/ansible/modules/remote_management/ucs/ucs_managed_objects.py2
-rw-r--r--lib/ansible/modules/source_control/bzr.py2
-rw-r--r--lib/ansible/modules/source_control/git.py8
-rw-r--r--lib/ansible/modules/source_control/gitlab_group.py2
-rw-r--r--lib/ansible/modules/source_control/gitlab_project.py2
-rw-r--r--lib/ansible/modules/source_control/gitlab_user.py2
-rw-r--r--lib/ansible/modules/storage/emc/emc_vnx_sg_member.py2
-rw-r--r--lib/ansible/modules/storage/infinidat/infini_export.py2
-rw-r--r--lib/ansible/modules/storage/infinidat/infini_export_client.py2
-rw-r--r--lib/ansible/modules/storage/infinidat/infini_fs.py6
-rw-r--r--lib/ansible/modules/storage/infinidat/infini_host.py2
-rw-r--r--lib/ansible/modules/storage/infinidat/infini_pool.py6
-rw-r--r--lib/ansible/modules/storage/infinidat/infini_vol.py6
-rw-r--r--lib/ansible/modules/storage/netapp/na_elementsw_backup.py2
-rw-r--r--lib/ansible/modules/storage/netapp/na_elementsw_cluster_pair.py2
-rw-r--r--lib/ansible/modules/storage/netapp/na_elementsw_ldap.py2
-rw-r--r--lib/ansible/modules/storage/netapp/na_elementsw_network_interfaces.py2
-rw-r--r--lib/ansible/modules/storage/netapp/na_elementsw_snapshot_schedule.py2
-rw-r--r--lib/ansible/modules/storage/netapp/na_elementsw_vlan.py2
-rw-r--r--lib/ansible/modules/storage/netapp/na_elementsw_volume.py2
-rw-r--r--lib/ansible/modules/storage/netapp/na_elementsw_volume_pair.py2
-rw-r--r--lib/ansible/modules/storage/netapp/na_ontap_volume_clone.py2
-rw-r--r--lib/ansible/modules/storage/netapp/netapp_e_amg_role.py4
-rw-r--r--lib/ansible/modules/storage/netapp/netapp_e_amg_sync.py2
-rw-r--r--lib/ansible/modules/storage/netapp/netapp_e_auditlog.py2
-rw-r--r--lib/ansible/modules/storage/netapp/netapp_e_auth.py4
-rw-r--r--lib/ansible/modules/storage/netapp/netapp_e_facts.py2
-rw-r--r--lib/ansible/modules/storage/netapp/netapp_e_flashcache.py2
-rw-r--r--lib/ansible/modules/storage/netapp/netapp_e_hostgroup.py2
-rw-r--r--lib/ansible/modules/storage/netapp/netapp_e_snapshot_group.py2
-rw-r--r--lib/ansible/modules/storage/netapp/netapp_e_snapshot_images.py2
-rw-r--r--lib/ansible/modules/storage/netapp/netapp_e_snapshot_volume.py2
-rw-r--r--lib/ansible/modules/storage/netapp/netapp_e_storage_system.py2
-rw-r--r--lib/ansible/modules/storage/purestorage/purefa_dns.py4
-rw-r--r--lib/ansible/modules/storage/purestorage/purefa_ds.py8
-rw-r--r--lib/ansible/modules/storage/purestorage/purefa_hg.py24
-rw-r--r--lib/ansible/modules/storage/purestorage/purefa_host.py22
-rw-r--r--lib/ansible/modules/storage/purestorage/purefa_ntp.py4
-rw-r--r--lib/ansible/modules/storage/purestorage/purefa_pg.py34
-rw-r--r--lib/ansible/modules/storage/purestorage/purefa_pgsnap.py16
-rw-r--r--lib/ansible/modules/storage/purestorage/purefa_ra.py6
-rw-r--r--lib/ansible/modules/storage/purestorage/purefa_snap.py12
-rw-r--r--lib/ansible/modules/storage/purestorage/purefa_volume.py24
-rw-r--r--lib/ansible/modules/storage/purestorage/purefb_bucket.py10
-rw-r--r--lib/ansible/modules/storage/purestorage/purefb_dsrole.py6
-rw-r--r--lib/ansible/modules/storage/purestorage/purefb_fs.py12
-rw-r--r--lib/ansible/modules/storage/purestorage/purefb_network.py8
-rw-r--r--lib/ansible/modules/storage/purestorage/purefb_s3acc.py4
-rw-r--r--lib/ansible/modules/storage/purestorage/purefb_s3user.py8
-rw-r--r--lib/ansible/modules/storage/purestorage/purefb_snap.py14
-rw-r--r--lib/ansible/modules/storage/purestorage/purefb_subnet.py14
-rw-r--r--lib/ansible/modules/system/capabilities.py2
-rw-r--r--lib/ansible/modules/system/cron.py4
-rw-r--r--lib/ansible/modules/system/cronvar.py4
-rw-r--r--lib/ansible/modules/system/group.py2
-rw-r--r--lib/ansible/modules/system/mount.py2
-rw-r--r--lib/ansible/modules/system/pam_limits.py4
-rw-r--r--lib/ansible/modules/system/seboolean.py2
-rw-r--r--lib/ansible/modules/system/service.py6
-rw-r--r--lib/ansible/modules/system/timezone.py8
-rw-r--r--lib/ansible/modules/utilities/logic/async_wrapper.py2
-rw-r--r--lib/ansible/modules/utilities/logic/wait_for.py6
-rw-r--r--lib/ansible/parsing/plugin_docs.py2
-rw-r--r--lib/ansible/plugins/action/add_host.py2
-rw-r--r--lib/ansible/plugins/action/bigip.py2
-rw-r--r--lib/ansible/plugins/action/bigip_imish_config.py2
-rw-r--r--lib/ansible/plugins/action/bigiq.py2
-rw-r--r--lib/ansible/plugins/action/service.py2
-rw-r--r--lib/ansible/plugins/connection/chroot.py4
-rw-r--r--lib/ansible/plugins/connection/jail.py4
-rw-r--r--lib/ansible/plugins/connection/libvirt_lxc.py4
-rw-r--r--lib/ansible/plugins/connection/zone.py4
-rw-r--r--lib/ansible/plugins/filter/ipaddr.py54
-rw-r--r--lib/ansible/plugins/filter/network.py8
-rw-r--r--lib/ansible/plugins/inventory/virtualbox.py4
-rw-r--r--lib/ansible/plugins/lookup/_redis_kv.py2
-rw-r--r--lib/ansible/plugins/lookup/dig.py6
-rw-r--r--lib/ansible/plugins/lookup/passwordstore.py2
-rw-r--r--lib/ansible/plugins/strategy/free.py2
-rw-r--r--lib/ansible/plugins/strategy/linear.py2
-rw-r--r--lib/ansible/template/__init__.py4
-rw-r--r--lib/ansible/utils/display.py2
-rw-r--r--lib/ansible/utils/encrypt.py4
-rw-r--r--lib/ansible/utils/vars.py2
-rw-r--r--test/legacy/consul_running.py2
-rw-r--r--test/runner/lib/thread.py5
-rw-r--r--test/units/module_utils/ec2/test_aws.py2
-rw-r--r--test/units/modules/net_tools/nios/test_nios_module.py2
-rw-r--r--test/units/modules/network/aireos/aireos_module.py2
-rw-r--r--test/units/modules/network/aruba/aruba_module.py2
-rw-r--r--test/units/modules/network/cnos/cnos_module.py2
-rw-r--r--test/units/modules/network/dellos10/dellos10_module.py2
-rw-r--r--test/units/modules/network/dellos6/dellos6_module.py2
-rw-r--r--test/units/modules/network/dellos9/dellos9_module.py2
-rw-r--r--test/units/modules/network/edgeos/edgeos_module.py2
-rw-r--r--test/units/modules/network/edgeswitch/edgeswitch_module.py2
-rw-r--r--test/units/modules/network/enos/enos_module.py2
-rw-r--r--test/units/modules/network/eos/eos_module.py2
-rw-r--r--test/units/modules/network/exos/exos_module.py2
-rw-r--r--test/units/modules/network/ingate/ingate_module.py2
-rw-r--r--test/units/modules/network/ios/ios_module.py2
-rw-r--r--test/units/modules/network/iosxr/iosxr_module.py2
-rw-r--r--test/units/modules/network/ironware/ironware_module.py2
-rw-r--r--test/units/modules/network/junos/junos_module.py4
-rw-r--r--test/units/modules/network/netvisor/nvos_module.py2
-rw-r--r--test/units/modules/network/nos/nos_module.py2
-rw-r--r--test/units/modules/network/nxos/nxos_module.py2
-rw-r--r--test/units/modules/network/onyx/onyx_module.py2
-rw-r--r--test/units/modules/network/opx/opx_module.py2
-rw-r--r--test/units/modules/network/ovs/ovs_module.py2
-rw-r--r--test/units/modules/network/routeros/routeros_module.py2
-rw-r--r--test/units/modules/network/slxos/slxos_module.py2
-rw-r--r--test/units/modules/network/voss/voss_module.py2
-rw-r--r--test/units/modules/network/vyos/vyos_module.py2
-rw-r--r--test/units/modules/packaging/os/test_apt.py2
-rw-r--r--test/units/parsing/utils/test_addresses.py4
-rw-r--r--test/units/plugins/lookup/test_conjur_variable.py6
-rw-r--r--test/units/plugins/lookup/test_onepassword.py2
320 files changed, 659 insertions, 656 deletions
diff --git a/bin/ansible-connection b/bin/ansible-connection
index 59e15602bb..ce03429703 100755
--- a/bin/ansible-connection
+++ b/bin/ansible-connection
@@ -185,7 +185,7 @@ class ConnectionProcess(object):
self.sock.close()
if self.connection:
self.connection.close()
- except:
+ except Exception:
pass
finally:
if os.path.exists(self.socket_path):
diff --git a/contrib/inventory/abiquo.py b/contrib/inventory/abiquo.py
index 621ef96620..90d52d3c6c 100755
--- a/contrib/inventory/abiquo.py
+++ b/contrib/inventory/abiquo.py
@@ -62,7 +62,7 @@ def api_get(link, config):
result = open_url(url, headers=headers, url_username=config.get('auth', 'apiuser').replace('\n', ''),
url_password=config.get('auth', 'apipass').replace('\n', ''))
return json.loads(result.read())
- except:
+ except Exception:
return None
@@ -99,7 +99,7 @@ def cache_available(config):
try:
existing = os.stat('/'.join([dpath, 'inventory']))
- except:
+ except Exception:
# cache doesn't exist or isn't accessible
return False
diff --git a/contrib/inventory/apstra_aos.py b/contrib/inventory/apstra_aos.py
index c793f29aad..7b9af7db5c 100755
--- a/contrib/inventory/apstra_aos.py
+++ b/contrib/inventory/apstra_aos.py
@@ -463,38 +463,38 @@ class AosInventory(object):
# Try to reach all parameters from File, if not available try from ENV
try:
self.aos_server = config.get('aos', 'aos_server')
- except:
+ except Exception:
if 'AOS_SERVER' in os.environ.keys():
self.aos_server = os.environ['AOS_SERVER']
try:
self.aos_server_port = config.get('aos', 'port')
- except:
+ except Exception:
if 'AOS_PORT' in os.environ.keys():
self.aos_server_port = os.environ['AOS_PORT']
try:
self.aos_username = config.get('aos', 'username')
- except:
+ except Exception:
if 'AOS_USERNAME' in os.environ.keys():
self.aos_username = os.environ['AOS_USERNAME']
try:
self.aos_password = config.get('aos', 'password')
- except:
+ except Exception:
if 'AOS_PASSWORD' in os.environ.keys():
self.aos_password = os.environ['AOS_PASSWORD']
try:
self.aos_blueprint = config.get('aos', 'blueprint')
- except:
+ except Exception:
if 'AOS_BLUEPRINT' in os.environ.keys():
self.aos_blueprint = os.environ['AOS_BLUEPRINT']
try:
if config.get('aos', 'blueprint_interface') in ['false', 'no']:
self.aos_blueprint_int = False
- except:
+ except Exception:
pass
def parse_cli_args(self):
diff --git a/contrib/inventory/azure_rm.py b/contrib/inventory/azure_rm.py
index 7da0ed7f98..ba758b7e39 100755
--- a/contrib/inventory/azure_rm.py
+++ b/contrib/inventory/azure_rm.py
@@ -397,7 +397,7 @@ class AzureRM(object):
for key in AZURE_CREDENTIAL_ENV_MAPPING:
try:
credentials[key] = config.get(profile, key, raw=True)
- except:
+ except Exception:
pass
if credentials.get('client_id') is not None or credentials.get('ad_user') is not None:
@@ -921,7 +921,7 @@ class AzureInventory(object):
try:
config = cp.ConfigParser()
config.read(path)
- except:
+ except Exception:
pass
if config is not None:
@@ -929,7 +929,7 @@ class AzureInventory(object):
for key in AZURE_CONFIG_SETTINGS:
try:
settings[key] = config.get('azure', key, raw=True)
- except:
+ except Exception:
pass
return settings
diff --git a/contrib/inventory/brook.py b/contrib/inventory/brook.py
index dc983761c0..b8c4bd7341 100755
--- a/contrib/inventory/brook.py
+++ b/contrib/inventory/brook.py
@@ -88,7 +88,7 @@ import json
try:
import libbrook
-except:
+except Exception:
sys.exit('Brook.io inventory script requires libbrook. See https://github.com/doalitic/libbrook')
diff --git a/contrib/inventory/collins.py b/contrib/inventory/collins.py
index 8c7b36c9bc..b768f6b3f9 100755
--- a/contrib/inventory/collins.py
+++ b/contrib/inventory/collins.py
@@ -208,7 +208,7 @@ class CollinsInventory(object):
break
cur_page += 1
num_retries = 0
- except:
+ except Exception:
self.log.error("Error while communicating with Collins, retrying:\n%s", traceback.format_exc())
num_retries += 1
return assets
@@ -277,7 +277,7 @@ class CollinsInventory(object):
# Locates all server assets from Collins.
try:
server_assets = self.find_assets()
- except:
+ except Exception:
self.log.error("Error while locating assets from Collins:\n%s", traceback.format_exc())
return False
@@ -288,7 +288,7 @@ class CollinsInventory(object):
ip_index = self._asset_get_attribute(asset, 'ANSIBLE_IP_INDEX')
try:
ip_index = int(ip_index)
- except:
+ except Exception:
self.log.error(
"ANSIBLE_IP_INDEX attribute on asset %s not an integer: %s", asset,
ip_index)
@@ -350,7 +350,7 @@ class CollinsInventory(object):
try:
self.write_to_cache(self.cache, self.cache_path_cache)
self.write_to_cache(self.inventory, self.cache_path_inventory)
- except:
+ except Exception:
self.log.error("Error while writing to cache:\n%s", traceback.format_exc())
return False
return True
@@ -388,7 +388,7 @@ class CollinsInventory(object):
json_inventory = cache.read()
self.inventory = json.loads(json_inventory)
return True
- except:
+ except Exception:
self.log.error("Error while loading inventory:\n%s",
traceback.format_exc())
self.inventory = {}
@@ -402,7 +402,7 @@ class CollinsInventory(object):
json_cache = cache.read()
self.cache = json.loads(json_cache)
return True
- except:
+ except Exception:
self.log.error("Error while loading host cache:\n%s",
traceback.format_exc())
self.cache = {}
diff --git a/contrib/inventory/consul_io.py b/contrib/inventory/consul_io.py
index b4bf022bdb..113f3c99a8 100755
--- a/contrib/inventory/consul_io.py
+++ b/contrib/inventory/consul_io.py
@@ -335,7 +335,7 @@ class ConsulInventory(object):
metadata = json.loads(metadata['Value'])
for k, v in metadata.items():
self.add_metadata(node_data, k, v)
- except:
+ except Exception:
pass
def load_groups_from_kv(self, node_data):
diff --git a/contrib/inventory/docker.py b/contrib/inventory/docker.py
index 93359ea0e0..ba221ff434 100755
--- a/contrib/inventory/docker.py
+++ b/contrib/inventory/docker.py
@@ -364,7 +364,7 @@ from collections import defaultdict
for path in [os.getcwd(), '', os.path.dirname(os.path.abspath(__file__))]:
try:
del sys.path[sys.path.index(path)]
- except:
+ except Exception:
pass
HAS_DOCKER_PY = True
diff --git a/contrib/inventory/gce.py b/contrib/inventory/gce.py
index d0285ecf17..59a3ccf246 100755
--- a/contrib/inventory/gce.py
+++ b/contrib/inventory/gce.py
@@ -107,7 +107,7 @@ try:
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
_ = Provider.GCE
-except:
+except Exception:
sys.exit("GCE inventory script requires libcloud >= 0.13")
@@ -289,7 +289,7 @@ class GceInventory(object):
args = list(secrets.GCE_PARAMS)
kwargs = secrets.GCE_KEYWORD_PARAMS
secrets_found = True
- except:
+ except Exception:
pass
if not secrets_found and secrets_path:
@@ -303,7 +303,7 @@ class GceInventory(object):
args = list(getattr(secrets, 'GCE_PARAMS', []))
kwargs = getattr(secrets, 'GCE_KEYWORD_PARAMS', {})
secrets_found = True
- except:
+ except Exception:
pass
if not secrets_found:
diff --git a/contrib/inventory/linode.py b/contrib/inventory/linode.py
index 5af8d25923..427796be3c 100755
--- a/contrib/inventory/linode.py
+++ b/contrib/inventory/linode.py
@@ -88,7 +88,7 @@ try:
from chube import api as chube_api
from chube.datacenter import Datacenter
from chube.linode_obj import Linode
-except:
+except Exception:
try:
# remove local paths and other stuff that may
# cause an import conflict, as chube is sensitive
diff --git a/contrib/inventory/lxd.py b/contrib/inventory/lxd.py
index 6ee8e13669..78a545a791 100755
--- a/contrib/inventory/lxd.py
+++ b/contrib/inventory/lxd.py
@@ -29,7 +29,7 @@ import sys
import json
try:
import configparser
-except:
+except Exception:
from six.moves import configparser
# Set up defaults
diff --git a/contrib/inventory/nsot.py b/contrib/inventory/nsot.py
index d7fca297ba..cf1c1e1903 100755
--- a/contrib/inventory/nsot.py
+++ b/contrib/inventory/nsot.py
@@ -254,7 +254,7 @@ class NSoTInventory(object):
obj[group]['vars'] = hostvars
try:
assert isinstance(query, string_types)
- except:
+ except Exception:
sys.exit('ERR: Group queries must be a single string\n'
' Group: %s\n'
' Query: %s\n' % (group, query)
diff --git a/contrib/inventory/rackhd.py b/contrib/inventory/rackhd.py
index 536a38a83b..e7a5cca5f5 100755
--- a/contrib/inventory/rackhd.py
+++ b/contrib/inventory/rackhd.py
@@ -69,7 +69,7 @@ def parse_args():
try:
# check if rackhd url(ie:10.1.1.45:8080) is specified in the environment
RACKHD_URL = 'http://' + str(os.environ['RACKHD_URL'])
-except:
+except Exception:
# use default values
pass
@@ -81,7 +81,7 @@ if (parse_args().host):
try:
nodeids += parse_args().host.split(',')
RackhdInventory(nodeids)
- except:
+ except Exception:
pass
if (parse_args().list):
try:
@@ -92,5 +92,5 @@ if (parse_args().list):
if entry['type'] == 'compute':
nodeids.append(entry['id'])
RackhdInventory(nodeids)
- except:
+ except Exception:
pass
diff --git a/contrib/inventory/rax.py b/contrib/inventory/rax.py
index 96a32c1fbb..dca3c80bf4 100755
--- a/contrib/inventory/rax.py
+++ b/contrib/inventory/rax.py
@@ -242,7 +242,7 @@ def _list_into_cache(regions):
# pylint: disable=unexpected-keyword-arg
ip_versions = map(int, get_config(p, 'rax', 'access_ip_version',
'RAX_ACCESS_IP_VERSION', 4, islist=True))
- except:
+ except Exception:
ip_versions = [4]
else:
ip_versions = [v for v in ip_versions if v in [4, 6]]
diff --git a/contrib/inventory/rudder.py b/contrib/inventory/rudder.py
index 54bb616840..e361f22de6 100755
--- a/contrib/inventory/rudder.py
+++ b/contrib/inventory/rudder.py
@@ -258,7 +258,7 @@ class RudderInventory(object):
try:
response, content = self.conn.request(target.geturl(), method, body, headers)
- except:
+ except Exception:
self.fail_with_error('Error connecting to Rudder server')
try:
diff --git a/contrib/inventory/stacki.py b/contrib/inventory/stacki.py
index 7af106ec9b..98f35c4fb5 100755
--- a/contrib/inventory/stacki.py
+++ b/contrib/inventory/stacki.py
@@ -53,7 +53,7 @@ import json
try:
import requests
-except:
+except Exception:
sys.exit('requests package is required for this inventory script')
diff --git a/contrib/inventory/vbox.py b/contrib/inventory/vbox.py
index 47fe2f6923..7a0ed702ae 100755
--- a/contrib/inventory/vbox.py
+++ b/contrib/inventory/vbox.py
@@ -40,7 +40,7 @@ def get_hosts(host=None):
else:
returned = {'all': set(), '_metadata': {}}
p = Popen([VBOX, 'list', '-l', 'vms'], stdout=PIPE)
- except:
+ except Exception:
sys.exit(1)
hostvars = {}
@@ -50,7 +50,7 @@ def get_hosts(host=None):
try:
k, v = line.split(':', 1)
- except:
+ except Exception:
continue
if k == '':
@@ -67,7 +67,7 @@ def get_hosts(host=None):
if 'Value' in ipinfo:
a, ip = ipinfo.split(':', 1)
hostvars[curname]['ansible_ssh_host'] = ip.strip()
- except:
+ except Exception:
pass
continue
diff --git a/contrib/inventory/zabbix.py b/contrib/inventory/zabbix.py
index 943a53bd03..8de20ea582 100755
--- a/contrib/inventory/zabbix.py
+++ b/contrib/inventory/zabbix.py
@@ -45,7 +45,7 @@ except ImportError:
try:
from zabbix_api import ZabbixAPI
-except:
+except Exception:
print("Error: Zabbix API library must be installed: pip install zabbix-api.",
file=sys.stderr)
sys.exit(1)
diff --git a/contrib/vault/azure_vault.py b/contrib/vault/azure_vault.py
index e4b0b847c0..0be05c5a98 100755
--- a/contrib/vault/azure_vault.py
+++ b/contrib/vault/azure_vault.py
@@ -305,7 +305,7 @@ class AzureRM(object):
for key in AZURE_CREDENTIAL_ENV_MAPPING:
try:
credentials[key] = config.get(profile, key, raw=True)
- except:
+ except Exception:
pass
if credentials.get('client_id') is not None or credentials.get('ad_user') is not None:
@@ -571,7 +571,7 @@ class AzureKeyVaultSecret:
try:
config = cp.ConfigParser()
config.read(path)
- except:
+ except Exception:
pass
if config is not None:
@@ -579,7 +579,7 @@ class AzureKeyVaultSecret:
for key in AZURE_VAULT_SETTINGS:
try:
settings[key] = config.get('azure_keyvault', key, raw=True)
- except:
+ except Exception:
pass
return settings
diff --git a/docs/bin/generate_man.py b/docs/bin/generate_man.py
index 938f3435dc..9085c6adc1 100755
--- a/docs/bin/generate_man.py
+++ b/docs/bin/generate_man.py
@@ -107,7 +107,7 @@ def opts_docs(cli_class_name, cli_module_name):
# parse the common options
try:
cli.parse()
- except:
+ except Exception:
pass
# base/common cli info
@@ -154,7 +154,7 @@ def opts_docs(cli_class_name, cli_module_name):
try:
cli.parse()
- except:
+ except Exception:
pass
# FIXME/TODO: needed?
diff --git a/hacking/test-module b/hacking/test-module
index cb4398334c..5e20317037 100755
--- a/hacking/test-module
+++ b/hacking/test-module
@@ -221,7 +221,7 @@ def runtest(modfile, argspath, modname, module_style, interpreters):
print(out)
print(err)
results = json.loads(out)
- except:
+ except Exception:
print("*" * 35)
print("INVALID OUTPUT FORMAT")
print(out)
diff --git a/hacking/tests/gen_distribution_version_testcase.py b/hacking/tests/gen_distribution_version_testcase.py
index fdd0a058bc..6bc52c4e41 100755
--- a/hacking/tests/gen_distribution_version_testcase.py
+++ b/hacking/tests/gen_distribution_version_testcase.py
@@ -62,7 +62,7 @@ ansible_facts = {}
for fact in facts:
try:
ansible_facts[fact] = parsed['ansible_facts']['ansible_' + fact]
- except:
+ except Exception:
ansible_facts[fact] = "N/A"
nicename = ansible_facts['distribution'] + ' ' + ansible_facts['distribution_version']
diff --git a/lib/ansible/cli/config.py b/lib/ansible/cli/config.py
index 7d4af9f94a..413766e72b 100644
--- a/lib/ansible/cli/config.py
+++ b/lib/ansible/cli/config.py
@@ -78,7 +78,7 @@ class ConfigCLI(CLI):
raise AnsibleOptionsError("%s is not a valid file" % (self.config_file))
os.environ['ANSIBLE_CONFIG'] = to_native(self.config_file)
- except:
+ except Exception:
if self.action in ['view']:
raise
elif self.action in ['edit', 'update']:
diff --git a/lib/ansible/executor/process/worker.py b/lib/ansible/executor/process/worker.py
index a1296d2931..32ea239a96 100644
--- a/lib/ansible/executor/process/worker.py
+++ b/lib/ansible/executor/process/worker.py
@@ -30,7 +30,7 @@ HAS_PYCRYPTO_ATFORK = False
try:
from Crypto.Random import atfork
HAS_PYCRYPTO_ATFORK = True
-except:
+except Exception:
# We only need to call atfork if pycrypto is used because it will need to
# reinitialize its RNG. Since old paramiko could be using pycrypto, we
# need to take charge of calling it.
@@ -153,7 +153,7 @@ class WorkerProcess(multiprocessing.Process):
task_fields=self._task.dump_attrs(),
)
self._final_q.put(task_result, block=False)
- except:
+ except Exception:
display.debug(u"WORKER EXCEPTION: %s" % to_text(e))
display.debug(u"WORKER TRACEBACK: %s" % to_text(traceback.format_exc()))
diff --git a/lib/ansible/galaxy/api.py b/lib/ansible/galaxy/api.py
index e11f3926ab..ead7f26b15 100644
--- a/lib/ansible/galaxy/api.py
+++ b/lib/ansible/galaxy/api.py
@@ -183,7 +183,7 @@ class GalaxyAPI(object):
role_name = parts[-1]
if notify:
display.display("- downloading role '%s', owned by %s" % (role_name, user_name))
- except:
+ except Exception:
raise AnsibleError("Invalid role name (%s). Specify role as format: username.rolename" % role_name)
url = '%s/roles/?owner__username=%s&name=%s' % (self.baseurl, user_name, role_name)
@@ -210,7 +210,7 @@ class GalaxyAPI(object):
results += data['results']
done = (data.get('next_link', None) is None)
return results
- except:
+ except Exception:
return None
@g_connect
diff --git a/lib/ansible/galaxy/login.py b/lib/ansible/galaxy/login.py
index e418a5ca60..d8fc97cda3 100644
--- a/lib/ansible/galaxy/login.py
+++ b/lib/ansible/galaxy/login.py
@@ -60,12 +60,12 @@ class GalaxyLogin(object):
try:
self.github_username = input("Github Username: ")
- except:
+ except Exception:
pass
try:
self.github_password = getpass.getpass("Password for %s: " % self.github_username)
- except:
+ except Exception:
pass
if not self.github_username or not self.github_password:
diff --git a/lib/ansible/galaxy/role.py b/lib/ansible/galaxy/role.py
index e727f112b0..cf5cdb9d2e 100644
--- a/lib/ansible/galaxy/role.py
+++ b/lib/ansible/galaxy/role.py
@@ -100,7 +100,7 @@ class GalaxyRole(object):
try:
f = open(meta_path, 'r')
self._metadata = yaml.safe_load(f)
- except:
+ except Exception:
display.vvvvv("Unable to load metadata for %s" % self.name)
return False
finally:
@@ -120,7 +120,7 @@ class GalaxyRole(object):
try:
f = open(info_path, 'r')
self._install_info = yaml.safe_load(f)
- except:
+ except Exception:
display.vvvvv("Unable to load Galaxy install info for %s" % self.name)
return False
finally:
@@ -144,7 +144,7 @@ class GalaxyRole(object):
with open(info_path, 'w+') as f:
try:
self._install_info = yaml.safe_dump(info, f)
- except:
+ except Exception:
return False
return True
@@ -159,7 +159,7 @@ class GalaxyRole(object):
try:
rmtree(self.path)
return True
- except:
+ except Exception:
pass
return False
@@ -285,7 +285,7 @@ class GalaxyRole(object):
else:
try:
self._metadata = yaml.safe_load(role_tar_file.extractfile(meta_file))
- except:
+ except Exception:
raise AnsibleError("this role does not appear to have a valid meta/main.yml file.")
# we strip off any higher-level directories for all of the files contained within
diff --git a/lib/ansible/module_utils/api.py b/lib/ansible/module_utils/api.py
index 1376540668..781518591f 100644
--- a/lib/ansible/module_utils/api.py
+++ b/lib/ansible/module_utils/api.py
@@ -116,7 +116,7 @@ def retry(retries=None, retry_pause=1):
raise Exception("Retry limit exceeded: %d" % retries)
try:
ret = f(*args, **kwargs)
- except:
+ except Exception:
pass
if ret:
break
diff --git a/lib/ansible/module_utils/azure_rm_common.py b/lib/ansible/module_utils/azure_rm_common.py
index 46bbde54f3..85ce317aac 100644
--- a/lib/ansible/module_utils/azure_rm_common.py
+++ b/lib/ansible/module_utils/azure_rm_common.py
@@ -1069,7 +1069,7 @@ class AzureRMAuth(object):
for key in AZURE_CREDENTIAL_ENV_MAPPING:
try:
credentials[key] = config.get(profile, key, raw=True)
- except:
+ except Exception:
pass
if credentials.get('subscription_id'):
diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py
index 01c90d54f6..c11dca8795 100644
--- a/lib/ansible/module_utils/basic.py
+++ b/lib/ansible/module_utils/basic.py
@@ -553,7 +553,7 @@ def human_to_bytes(number, default_unit=None, isbits=False):
raise ValueError("human_to_bytes() can't interpret following string: %s" % str(number))
try:
num = float(m.group(1))
- except:
+ except Exception:
raise ValueError("human_to_bytes() can't interpret following number: %s (original input string: %s)" % (m.group(1), number))
unit = m.group(2)
@@ -566,7 +566,7 @@ def human_to_bytes(number, default_unit=None, isbits=False):
range_key = unit[0].upper()
try:
limit = SIZE_RANGES[range_key]
- except:
+ except Exception:
raise ValueError("human_to_bytes() failed to convert %s (unit = %s). The suffix must be one of %s" % (number, unit, ", ".join(SIZE_RANGES.keys())))
# default value
@@ -1028,7 +1028,7 @@ class AnsibleModule(object):
f = open('/proc/mounts', 'r')
mount_data = f.readlines()
f.close()
- except:
+ except Exception:
return (False, None)
path_mount_point = self.find_mount_point(path)
for line in mount_data:
@@ -1310,7 +1310,7 @@ class AnsibleModule(object):
output['attr_flags'] = res[1].replace('-', '').strip()
output['version'] = res[0].strip()
output['attributes'] = format_attributes(output['attr_flags'])
- except:
+ except Exception:
pass
return output
@@ -1820,7 +1820,7 @@ class AnsibleModule(object):
if value.startswith("{"):
try:
return json.loads(value)
- except:
+ except Exception:
(result, exc) = self.safe_eval(value, dict(), include_exceptions=True)
if exc is not None:
raise TypeError('unable to evaluate string as dictionary')
@@ -2163,7 +2163,7 @@ class AnsibleModule(object):
if not os.access(cwd, os.F_OK | os.R_OK):
raise Exception()
return cwd
- except:
+ except Exception:
# we don't have access to the cwd, probably because of sudo.
# Try and move to a neutral location to prevent errors
for cwd in [self.tmpdir, os.path.expandvars('$HOME'), tempfile.gettempdir()]:
@@ -2171,7 +2171,7 @@ class AnsibleModule(object):
if os.access(cwd, os.F_OK | os.R_OK):
os.chdir(cwd)
return cwd
- except:
+ except Exception:
pass
# we won't error here, as it may *not* be a problem,
# and we don't want to break modules unnecessarily
diff --git a/lib/ansible/module_utils/common/sys_info.py b/lib/ansible/module_utils/common/sys_info.py
index 022bf51bfe..8b62de4f97 100644
--- a/lib/ansible/module_utils/common/sys_info.py
+++ b/lib/ansible/module_utils/common/sys_info.py
@@ -28,7 +28,7 @@ def get_distribution():
distribution = 'Amazon'
else:
distribution = 'OtherLinux'
- except:
+ except Exception:
# FIXME: MethodMissing, I assume?
distribution = platform.dist()[0].capitalize()
return distribution
diff --git a/lib/ansible/module_utils/ec2.py b/lib/ansible/module_utils/ec2.py
index b586f377d4..e328930779 100644
--- a/lib/ansible/module_utils/ec2.py
+++ b/lib/ansible/module_utils/ec2.py
@@ -49,7 +49,7 @@ try:
import boto3
import botocore
HAS_BOTO3 = True
-except:
+except Exception:
HAS_BOTO3 = False
try:
diff --git a/lib/ansible/module_utils/infinibox.py b/lib/ansible/module_utils/infinibox.py
index 0b271211c1..57ee89ec2c 100644
--- a/lib/ansible/module_utils/infinibox.py
+++ b/lib/ansible/module_utils/infinibox.py
@@ -50,7 +50,7 @@ def api_wrapper(func):
module.fail_json(msg=e.message)
except core.exceptions.SystemNotFoundException as e:
module.fail_json(msg=e.message)
- except:
+ except Exception:
raise
return __wrapper
diff --git a/lib/ansible/module_utils/known_hosts.py b/lib/ansible/module_utils/known_hosts.py
index 5e04a6b216..42f067f225 100644
--- a/lib/ansible/module_utils/known_hosts.py
+++ b/lib/ansible/module_utils/known_hosts.py
@@ -135,7 +135,7 @@ def not_in_host_file(self, host):
hash.update(host)
if hash.digest() == kn_host.decode('base64'):
return False
- except:
+ except Exception:
# invalid hashed host key, skip it
continue
else:
@@ -164,7 +164,7 @@ def add_host_key(module, fqdn, port=22, key_type="rsa", create_dir=False):
if create_dir:
try:
os.makedirs(user_ssh_dir, int('700', 8))
- except:
+ except Exception:
module.fail_json(msg="failed to create host key directory: %s" % user_ssh_dir)
else:
module.fail_json(msg="%s does not exist" % user_ssh_dir)
diff --git a/lib/ansible/module_utils/netapp.py b/lib/ansible/module_utils/netapp.py
index 3fead51efe..92b8ddb8b4 100644
--- a/lib/ansible/module_utils/netapp.py
+++ b/lib/ansible/module_utils/netapp.py
@@ -81,7 +81,7 @@ try:
from solidfire.models import Schedule, ScheduleInfo
HAS_SF_SDK = True
-except:
+except Exception:
HAS_SF_SDK = False
@@ -124,7 +124,7 @@ def create_sf_connection(module, port=None):
try:
return_val = ElementFactory.create(hostname, username, password, port=port)
return return_val
- except:
+ except Exception:
raise Exception("Unable to create SF connection")
else:
module.fail_json(msg="the python SolidFire SDK module is required")
@@ -237,7 +237,7 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
data = json.loads(raw_data)
else:
raw_data = None
- except:
+ except Exception:
if ignore_errors:
pass
else:
diff --git a/lib/ansible/module_utils/netapp_elementsw_module.py b/lib/ansible/module_utils/netapp_elementsw_module.py
index b4fea3c88d..c9baa0aeb9 100644
--- a/lib/ansible/module_utils/netapp_elementsw_module.py
+++ b/lib/ansible/module_utils/netapp_elementsw_module.py
@@ -6,7 +6,7 @@ try:
import solidfire.common
HAS_SF_SDK = True
-except:
+except Exception:
HAS_SF_SDK = False
diff --git a/lib/ansible/module_utils/network/a10/a10.py b/lib/ansible/module_utils/network/a10/a10.py
index 1a1b9f9d81..bf713702e4 100644
--- a/lib/ansible/module_utils/network/a10/a10.py
+++ b/lib/ansible/module_utils/network/a10/a10.py
@@ -78,7 +78,7 @@ def axapi_call(module, url, post=None):
data = {"response": {"status": "OK"}}
else:
data = {"response": {"status": "fail", "err": {"msg": raw_data}}}
- except:
+ except Exception:
module.fail_json(msg="could not read the result from the host")
finally:
rsp.close()
@@ -126,7 +126,7 @@ def axapi_call_v3(module, url, method=None, body=None, signature=None):
data = {"response": {"status": "OK"}}
else:
data = {"response": {"status": "fail", "err": {"msg": raw_data}}}
- except:
+ except Exception:
module.fail_json(msg="could not read the result from the host")
finally:
rsp.close()
diff --git a/lib/ansible/module_utils/network/aci/aci.py b/lib/ansible/module_utils/network/aci/aci.py
index 4e8d9df3ad..4c82ccf281 100644
--- a/lib/ansible/module_utils/network/aci/aci.py
+++ b/lib/ansible/module_utils/network/aci/aci.py
@@ -148,7 +148,7 @@ class ACIModule(object):
return true
elif bool_value is False:
return false
- except:
+ except Exception:
# This provides backward compatibility to Ansible v2.4, deprecate in Ansible v2.8
if value == true:
self.module.deprecate("Boolean value '%s' is no longer valid, please use 'yes' as a boolean value." % value, '2.9')
@@ -164,7 +164,7 @@ class ACIModule(object):
''' Return an ACI-compatible ISO8601 formatted time: 2123-12-12T00:00:00.000+00:00 '''
try:
return dt.isoformat(timespec='milliseconds')
- except:
+ except Exception:
tz = dt.strftime('%z')
return '%s.%03d%s:%s' % (dt.strftime('%Y-%m-%dT%H:%M:%S'), dt.microsecond / 1000, tz[:3], tz[3:])
@@ -231,7 +231,7 @@ class ACIModule(object):
try:
sig_key = load_privatekey(FILETYPE_PEM, open(self.params['private_key'], 'r').read())
- except:
+ except Exception:
self.module.fail_json(msg='Cannot load private key %s' % self.params['private_key'])
# NOTE: ACI documentation incorrectly adds a space between method and path
diff --git a/lib/ansible/module_utils/network/aci/msc.py b/lib/ansible/module_utils/network/aci/msc.py
index c7b0a61363..6c8ede9586 100644
--- a/lib/ansible/module_utils/network/aci/msc.py
+++ b/lib/ansible/module_utils/network/aci/msc.py
@@ -183,7 +183,7 @@ class MSCModule(object):
elif self.status >= 400:
try:
payload = json.loads(resp.read())
- except:
+ except Exception:
payload = json.loads(info['body'])
if 'code' in payload:
self.fail_json(msg='MSC Error {code}: {message}'.format(**payload), data=data, info=info, payload=payload)
diff --git a/lib/ansible/module_utils/network/aos/aos.py b/lib/ansible/module_utils/network/aos/aos.py
index 89074e8acf..092bbf5b4a 100644
--- a/lib/ansible/module_utils/network/aos/aos.py
+++ b/lib/ansible/module_utils/network/aos/aos.py
@@ -147,7 +147,7 @@ def content_to_dict(module, content):
if not content_dict:
raise Exception()
- except:
+ except Exception:
module.fail_json(msg="Unable to convert 'content' to a dict, please check if valid")
# replace the string with the dict
@@ -163,7 +163,7 @@ def do_load_resource(module, collection, name):
try:
item = find_collection_item(collection, name, '')
- except:
+ except Exception:
module.fail_json(msg="An error occurred while running 'find_collection_item'")
if item.exists:
diff --git a/lib/ansible/module_utils/network/cnos/cnos.py b/lib/ansible/module_utils/network/cnos/cnos.py
index ea104c8f94..f3ca8cbef3 100644
--- a/lib/ansible/module_utils/network/cnos/cnos.py
+++ b/lib/ansible/module_utils/network/cnos/cnos.py
@@ -38,7 +38,7 @@ try:
from ansible.module_utils.network.cnos import cnos_errorcodes
from ansible.module_utils.network.cnos import cnos_devicerules
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from distutils.cmd import Command
from ansible.module_utils._text import to_text
@@ -1372,7 +1372,7 @@ def enterEnableModeForDevice(enablePassword, timeout, obj):
gotit = buff.find("#")
if(gotit != -1):
return retVal
- except:
+ except Exception:
retVal = retVal + "\n Error-101"
flag = True
if(retVal == ""):
@@ -1396,7 +1396,7 @@ def waitForDeviceResponse(command, prompt, timeout, obj):
gotit = buff.find(prompt)
if(gotit != -1):
flag = True
- except:
+ except Exception:
# debugOutput(prompt)
if prompt == "(yes/no)?":
retVal = retVal
diff --git a/lib/ansible/module_utils/network/common/utils.py b/lib/ansible/module_utils/network/common/utils.py
index 20bb5c4bae..927c2f5fdb 100644
--- a/lib/ansible/module_utils/network/common/utils.py
+++ b/lib/ansible/module_utils/network/common/utils.py
@@ -461,7 +461,7 @@ class Template:
if value:
try:
return ast.literal_eval(value)
- except:
+ except Exception:
return str(value)
else:
return None
diff --git a/lib/ansible/module_utils/network/fortios/fortios.py b/lib/ansible/module_utils/network/fortios/fortios.py
index 1d69cbebb4..bf3385aa31 100644
--- a/lib/ansible/module_utils/network/fortios/fortios.py
+++ b/lib/ansible/module_utils/network/fortios/fortios.py
@@ -79,7 +79,7 @@ def backup(module, running_config):
if not os.path.exists(backup_path):
try:
os.mkdir(backup_path)
- except:
+ except Exception:
module.fail_json(msg="Can't create directory {0} Permission denied ?".format(backup_path))
tstamp = time.strftime("%Y-%m-%d@%H:%M:%S", time.localtime(time.time()))
if 0 < len(backup_filename):
@@ -88,7 +88,7 @@ def backup(module, running_config):
filename = '%s/%s_config.%s' % (backup_path, module.params['host'], tstamp)
try:
open(filename, 'w').write(running_config)
- except:
+ except Exception:
module.fail_json(msg="Can't create backup file {0} Permission denied ?".format(filename))
diff --git a/lib/ansible/module_utils/network/meraki/meraki.py b/lib/ansible/module_utils/network/meraki/meraki.py
index 4519f87a3f..f73b636239 100644
--- a/lib/ansible/module_utils/network/meraki/meraki.py
+++ b/lib/ansible/module_utils/network/meraki/meraki.py
@@ -292,7 +292,7 @@ class MerakiModule(object):
body=json.loads(to_native(info['body'])))
try:
return json.loads(to_native(resp.read()))
- except:
+ except Exception:
pass
def exit_json(self, **kwargs):
diff --git a/lib/ansible/module_utils/rax.py b/lib/ansible/module_utils/rax.py
index ea32de316e..254b522107 100644
--- a/lib/ansible/module_utils/rax.py
+++ b/lib/ansible/module_utils/rax.py
@@ -217,7 +217,7 @@ def rax_find_loadbalancer(module, rax_module, loadbalancer):
clb = rax_module.cloud_loadbalancers
try:
found = clb.get(loadbalancer)
- except:
+ except Exception:
found = []
for lb in clb.list():
if loadbalancer == lb.name:
diff --git a/lib/ansible/module_utils/redfish_utils.py b/lib/ansible/module_utils/redfish_utils.py
index 72fc0ab18a..d5be250e16 100644
--- a/lib/ansible/module_utils/redfish_utils.py
+++ b/lib/ansible/module_utils/redfish_utils.py
@@ -35,7 +35,7 @@ class RedfishUtils(object):
except URLError as e:
return {'ret': False, 'msg': "URL Error: %s" % e.reason}
# Almost all errors should be caught above, but just in case
- except:
+ except Exception:
return {'ret': False, 'msg': "Unknown error"}
return {'ret': True, 'data': data}
@@ -53,7 +53,7 @@ class RedfishUtils(object):
except URLError as e:
return {'ret': False, 'msg': "URL Error: %s" % e.reason}
# Almost all errors should be caught above, but just in case
- except:
+ except Exception:
return {'ret': False, 'msg': "Unknown error"}
return {'ret': True, 'resp': resp}
@@ -71,7 +71,7 @@ class RedfishUtils(object):
except URLError as e:
return {'ret': False, 'msg': "URL Error: %s" % e.reason}
# Almost all errors should be caught above, but just in case
- except:
+ except Exception:
return {'ret': False, 'msg': "Unknown error"}
return {'ret': True, 'resp': resp}
@@ -89,7 +89,7 @@ class RedfishUtils(object):
except URLError as e:
return {'ret': False, 'msg': "URL Error: %s" % e.reason}
# Almost all errors should be caught above, but just in case
- except:
+ except Exception:
return {'ret': False, 'msg': "Unknown error"}
return {'ret': True, 'resp': resp}
diff --git a/lib/ansible/module_utils/remote_management/ucs.py b/lib/ansible/module_utils/remote_management/ucs.py
index e58fe2daf6..1a8a960911 100644
--- a/lib/ansible/module_utils/remote_management/ucs.py
+++ b/lib/ansible/module_utils/remote_management/ucs.py
@@ -31,7 +31,7 @@
try:
import ucsmsdk
HAS_UCSMSDK = True
-except:
+except Exception:
HAS_UCSMSDK = False
ucs_argument_spec = dict(
diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py
index 775220d2ea..c22862ab6a 100644
--- a/lib/ansible/module_utils/urls.py
+++ b/lib/ansible/module_utils/urls.py
@@ -71,13 +71,13 @@ urllib_request.HTTPRedirectHandler.http_error_308 = urllib_request.HTTPRedirectH
try:
from ansible.module_utils.six.moves.urllib.parse import urlparse, urlunparse
HAS_URLPARSE = True
-except:
+except Exception:
HAS_URLPARSE = False
try:
import ssl
HAS_SSL = True
-except:
+except Exception:
HAS_SSL = False
try:
@@ -436,7 +436,7 @@ def generic_urlparse(parts):
generic_parts['password'] = password
generic_parts['hostname'] = hostname
generic_parts['port'] = port
- except:
+ except Exception:
generic_parts['username'] = None
generic_parts['password'] = None
generic_parts['hostname'] = parts[1]
@@ -673,7 +673,7 @@ class SSLValidationHandler(urllib_request.BaseHandler):
(http_version, resp_code, msg) = re.match(br'(HTTP/\d\.\d) (\d\d\d) (.*)', response).groups()
if int(resp_code) not in valid_codes:
raise Exception
- except:
+ except Exception:
raise ProxyError('Connection to proxy failed')
def detect_no_proxy(self, url):
@@ -784,7 +784,7 @@ class SSLValidationHandler(urllib_request.BaseHandler):
# cleanup the temp file created, don't worry
# if it fails for some reason
os.remove(tmp_ca_cert_path)
- except:
+ except Exception:
pass
try:
@@ -792,7 +792,7 @@ class SSLValidationHandler(urllib_request.BaseHandler):
# if it fails for some reason
if to_add_ca_cert_path:
os.remove(to_add_ca_cert_path)
- except:
+ except Exception:
pass
return req
@@ -1305,7 +1305,7 @@ def fetch_url(module, url, data=None, headers=None, method=None,
try:
# Lowercase keys, to conform to py2 behavior, so that py3 and py2 are predictable
info.update(dict((k.lower(), v) for k, v in e.info().items()))
- except:
+ except Exception:
pass
info.update({'msg': to_native(e), 'body': body, 'status': e.code})
diff --git a/lib/ansible/modules/cloud/amazon/aws_direct_connect_connection.py b/lib/ansible/modules/cloud/amazon/aws_direct_connect_connection.py
index 40aede0d04..45e9ab2bef 100644
--- a/lib/ansible/modules/cloud/amazon/aws_direct_connect_connection.py
+++ b/lib/ansible/modules/cloud/amazon/aws_direct_connect_connection.py
@@ -153,7 +153,7 @@ from ansible.module_utils.aws.direct_connect import (DirectConnectError, delete_
try:
from botocore.exceptions import BotoCoreError, ClientError
-except:
+except Exception:
pass
# handled by imported AnsibleAWSModule
diff --git a/lib/ansible/modules/cloud/amazon/aws_direct_connect_link_aggregation_group.py b/lib/ansible/modules/cloud/amazon/aws_direct_connect_link_aggregation_group.py
index bee2b931f7..6b3bbdb76d 100644
--- a/lib/ansible/modules/cloud/amazon/aws_direct_connect_link_aggregation_group.py
+++ b/lib/ansible/modules/cloud/amazon/aws_direct_connect_link_aggregation_group.py
@@ -162,7 +162,7 @@ import time
try:
import botocore
-except:
+except Exception:
pass
# handled by imported HAS_BOTO3
diff --git a/lib/ansible/modules/cloud/amazon/aws_kms.py b/lib/ansible/modules/cloud/amazon/aws_kms.py
index ca1d9a2ee9..ec8205d2d3 100644
--- a/lib/ansible/modules/cloud/amazon/aws_kms.py
+++ b/lib/ansible/modules/cloud/amazon/aws_kms.py
@@ -201,7 +201,7 @@ def do_grant(kms, keyarn, role_arn, granttypes, mode='grant', dry_run=True, clea
kms.put_key_policy(KeyId=keyarn, PolicyName='default', Policy=policy_json_string)
# returns nothing, so we have to just assume it didn't throw
ret['changed'] = True
- except:
+ except Exception:
raise
ret['changes_needed'] = changes_needed
diff --git a/lib/ansible/modules/cloud/amazon/aws_s3_cors.py b/lib/ansible/modules/cloud/amazon/aws_s3_cors.py
index ea45f81157..0a4832d4dc 100644
--- a/lib/ansible/modules/cloud/amazon/aws_s3_cors.py
+++ b/lib/ansible/modules/cloud/amazon/aws_s3_cors.py
@@ -91,7 +91,7 @@ rules:
try:
from botocore.exceptions import ClientError, BotoCoreError
-except:
+except Exception:
# handled by HAS_BOTO3 check in main
pass
diff --git a/lib/ansible/modules/cloud/amazon/aws_ssm_parameter_store.py b/lib/ansible/modules/cloud/amazon/aws_ssm_parameter_store.py
index 1b4ad2e8cf..7a3256984f 100644
--- a/lib/ansible/modules/cloud/amazon/aws_ssm_parameter_store.py
+++ b/lib/ansible/modules/cloud/amazon/aws_ssm_parameter_store.py
@@ -166,7 +166,7 @@ def create_update_parameter(client, module):
try:
existing_parameter = client.get_parameter(Name=args['Name'], WithDecryption=True)
- except:
+ except Exception:
pass
if existing_parameter:
diff --git a/lib/ansible/modules/cloud/amazon/cloudformation.py b/lib/ansible/modules/cloud/amazon/cloudformation.py
index a8044479f1..c314cd923a 100644
--- a/lib/ansible/modules/cloud/amazon/cloudformation.py
+++ b/lib/ansible/modules/cloud/amazon/cloudformation.py
@@ -477,7 +477,7 @@ def stack_operation(cfn, stack_name, operation, events_limit, op_token=None):
try:
stack = get_stack_facts(cfn, stack_name)
existed.append('yes')
- except:
+ except Exception:
# If the stack previously existed, and now can't be found then it's
# been deleted successfully.
if 'yes' in existed or operation == 'DELETE': # stacks may delete fast, look in a few ways.
diff --git a/lib/ansible/modules/cloud/amazon/ec2.py b/lib/ansible/modules/cloud/amazon/ec2.py
index 3bd7813999..1de6ccea4f 100644
--- a/lib/ansible/modules/cloud/amazon/ec2.py
+++ b/lib/ansible/modules/cloud/amazon/ec2.py
@@ -608,7 +608,7 @@ def get_reservations(module, ec2, vpc, tags=None, state=None, zone=None):
if isinstance(tags, str):
try:
tags = literal_eval(tags)
- except:
+ except Exception:
pass
# if not a string type, convert and make sure it's a text string
diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg.py b/lib/ansible/modules/cloud/amazon/ec2_asg.py
index 45433ba6a6..9475da263b 100644
--- a/lib/ansible/modules/cloud/amazon/ec2_asg.py
+++ b/lib/ansible/modules/cloud/amazon/ec2_asg.py
@@ -1156,7 +1156,7 @@ def create_autoscaling_group(connection):
else:
try:
ag['LaunchConfigurationName'] = as_group['LaunchConfigurationName']
- except:
+ except Exception:
launch_template = as_group['LaunchTemplate']
# Prefer LaunchTemplateId over Name as it's more specific. Only one can be used for update_asg.
ag['LaunchTemplate'] = {"LaunchTemplateId": launch_template['LaunchTemplateId'], "Version": launch_template['Version']}
diff --git a/lib/ansible/modules/cloud/amazon/ec2_elb_lb.py b/lib/ansible/modules/cloud/amazon/ec2_elb_lb.py
index dd1664514f..fab79b28ae 100644
--- a/lib/ansible/modules/cloud/amazon/ec2_elb_lb.py
+++ b/lib/ansible/modules/cloud/amazon/ec2_elb_lb.py
@@ -516,7 +516,7 @@ class ElbManager(object):
def get_info(self):
try:
check_elb = self.elb_conn.get_all_load_balancers(self.name)[0]
- except:
+ except Exception:
check_elb = None
if not check_elb:
@@ -528,11 +528,11 @@ class ElbManager(object):
else:
try:
lb_cookie_policy = check_elb.policies.lb_cookie_stickiness_policies[0].__dict__['policy_name']
- except:
+ except Exception:
lb_cookie_policy = None
try:
app_cookie_policy = check_elb.policies.app_cookie_stickiness_policies[0].__dict__['policy_name']
- except:
+ except Exception:
app_cookie_policy = None
info = {
diff --git a/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py b/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py
index 758f8e1aab..5093ccc3d5 100644
--- a/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py
+++ b/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py
@@ -506,7 +506,7 @@ class Ec2Metadata(object):
self._data['%s' % (new_uri)] = content
for (key, value) in dict.items():
self._data['%s:%s' % (new_uri, key.lower())] = value
- except:
+ except Exception:
self._data['%s' % (new_uri)] = content # not a stringifed JSON string
def fix_invalid_varnames(self, data):
diff --git a/lib/ansible/modules/cloud/amazon/ec2_tag.py b/lib/ansible/modules/cloud/amazon/ec2_tag.py
index c33fc52ba9..3a2144b00d 100644
--- a/lib/ansible/modules/cloud/amazon/ec2_tag.py
+++ b/lib/ansible/modules/cloud/amazon/ec2_tag.py
@@ -124,7 +124,7 @@ from ansible.module_utils.ec2 import boto3_tag_list_to_ansible_dict, ansible_dic
try:
from botocore.exceptions import BotoCoreError, ClientError
-except:
+except Exception:
pass # Handled by AnsibleAWSModule
diff --git a/lib/ansible/modules/cloud/amazon/ecs_ecr.py b/lib/ansible/modules/cloud/amazon/ecs_ecr.py
index ca03309f61..a5247d18ac 100644
--- a/lib/ansible/modules/cloud/amazon/ecs_ecr.py
+++ b/lib/ansible/modules/cloud/amazon/ecs_ecr.py
@@ -306,7 +306,7 @@ def run(ecr, params, verbosity):
ecr.set_repository_policy(
registry_id, name, policy_text, force_set_policy)
result['changed'] = True
- except:
+ except Exception:
# Some failure w/ the policy. It's helpful to know what the
# policy is.
result['policy'] = policy_text
diff --git a/lib/ansible/modules/cloud/amazon/elb_classic_lb.py b/lib/ansible/modules/cloud/amazon/elb_classic_lb.py
index a09a184993..fe952509c7 100644
--- a/lib/ansible/modules/cloud/amazon/elb_classic_lb.py
+++ b/lib/ansible/modules/cloud/amazon/elb_classic_lb.py
@@ -512,7 +512,7 @@ class ElbManager(object):
def get_info(self):
try:
check_elb = self.elb_conn.get_all_load_balancers(self.name)[0]
- except:
+ except Exception:
check_elb = None
if not check_elb:
@@ -524,11 +524,11 @@ class ElbManager(object):
else:
try:
lb_cookie_policy = check_elb.policies.lb_cookie_stickiness_policies[0].__dict__['policy_name']
- except:
+ except Exception:
lb_cookie_policy = None
try:
app_cookie_policy = check_elb.policies.app_cookie_stickiness_policies[0].__dict__['policy_name']
- except:
+ except Exception:
app_cookie_policy = None
info = {
diff --git a/lib/ansible/modules/cloud/amazon/lambda_policy.py b/lib/ansible/modules/cloud/amazon/lambda_policy.py
index 2b647c2be0..82823ad149 100644
--- a/lib/ansible/modules/cloud/amazon/lambda_policy.py
+++ b/lib/ansible/modules/cloud/amazon/lambda_policy.py
@@ -134,7 +134,7 @@ from ansible.module_utils.ec2 import get_aws_connection_info, boto3_conn
try:
from botocore.exceptions import ClientError
-except:
+except Exception:
pass # will be protected by AnsibleAWSModule
diff --git a/lib/ansible/modules/cloud/amazon/sqs_queue.py b/lib/ansible/modules/cloud/amazon/sqs_queue.py
index 2add883c0d..f9d62195d4 100644
--- a/lib/ansible/modules/cloud/amazon/sqs_queue.py
+++ b/lib/ansible/modules/cloud/amazon/sqs_queue.py
@@ -224,7 +224,7 @@ def set_queue_attribute(queue, attribute, value, check_mode=False):
try:
existing_value = queue.get_attributes(attributes=attribute)[attribute]
- except:
+ except Exception:
existing_value = ''
# convert dict attributes to JSON strings (sort keys for comparing)
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_aks_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_aks_facts.py
index c1a793aa69..6c64269584 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_aks_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_aks_facts.py
@@ -68,7 +68,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
from azure.common import AzureHttpError
-except:
+except Exception:
# handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_appserviceplan_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_appserviceplan_facts.py
index 21e16c1f40..c91f410dad 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_appserviceplan_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_appserviceplan_facts.py
@@ -121,7 +121,7 @@ appserviceplans:
try:
from msrestazure.azure_exceptions import CloudError
from azure.common import AzureMissingResourceHttpError, AzureHttpError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_availabilityset_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_availabilityset_facts.py
index e97320845c..31a5dc48dc 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_availabilityset_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_availabilityset_facts.py
@@ -74,7 +74,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
-except:
+except Exception:
# handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_cdnprofile_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_cdnprofile_facts.py
index f14e5295c8..755615def2 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_cdnprofile_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_cdnprofile_facts.py
@@ -120,7 +120,7 @@ try:
from azure.mgmt.cdn.models import ErrorResponseException
from azure.common import AzureHttpError
from azure.mgmt.cdn import CdnManagementClient
-except:
+except Exception:
# handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_deployment.py b/lib/ansible/modules/cloud/azure/azure_rm_deployment.py
index af8964cd88..a078c52b0b 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_deployment.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_deployment.py
@@ -590,7 +590,7 @@ class AzureRMDeploymentManager(AzureRMModuleBase):
)
for op in self._get_failed_nested_operations(operations)
]
- except:
+ except Exception:
# If we fail here, the original error gets lost and user receives wrong error message/stacktrace
pass
self.log(dict(failed_deployment_operations=results), pretty_print=True)
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_dnsrecordset_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_dnsrecordset_facts.py
index cc9858ad6a..3127b3b375 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_dnsrecordset_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_dnsrecordset_facts.py
@@ -98,7 +98,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
from azure.common import AzureMissingResourceHttpError, AzureHttpError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_dnszone_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_dnszone_facts.py
index ba0feba192..aa034c7d87 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_dnszone_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_dnszone_facts.py
@@ -80,7 +80,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
from azure.common import AzureMissingResourceHttpError, AzureHttpError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_functionapp_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_functionapp_facts.py
index 8550001b0a..2153c9f19b 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_functionapp_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_functionapp_facts.py
@@ -100,7 +100,7 @@ azure_functionapps:
try:
from msrestazure.azure_exceptions import CloudError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_image_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_image_facts.py
index 053fee54e8..637fa571c6 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_image_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_image_facts.py
@@ -167,7 +167,7 @@ images:
try:
from msrestazure.azure_exceptions import CloudError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_loadbalancer_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_loadbalancer_facts.py
index a0b9fbd399..0ea3a882e3 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_loadbalancer_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_loadbalancer_facts.py
@@ -86,7 +86,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
from azure.common import AzureHttpError
-except:
+except Exception:
# handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py
index 1be258c987..b5582a917c 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py
@@ -79,7 +79,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
-except:
+except Exception:
# handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface_facts.py
index c97892af47..e183095481 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface_facts.py
@@ -108,7 +108,7 @@ azure_networkinterfaces:
try:
from msrestazure.azure_exceptions import CloudError
from azure.common import AzureMissingResourceHttpError, AzureHttpError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
@@ -165,7 +165,7 @@ class AzureRMNetworkInterfaceFacts(AzureRMModuleBase):
item = None
try:
item = self.network_client.network_interfaces.get(self.resource_group, self.name)
- except:
+ except Exception:
pass
if item and self.has_tags(item.tags, self.tags):
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_publicipaddress_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_publicipaddress_facts.py
index 568b939c08..c28f7a9a79 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_publicipaddress_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_publicipaddress_facts.py
@@ -77,7 +77,7 @@ azure_publicipaddresses:
try:
from msrestazure.azure_exceptions import CloudError
from azure.common import AzureMissingResourceHttpError, AzureHttpError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_resource.py b/lib/ansible/modules/cloud/azure/azure_rm_resource.py
index 2fd4d33fab..e9c3ea2f66 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_resource.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_resource.py
@@ -258,7 +258,7 @@ class AzureRMResource(AzureRMModuleBase):
try:
response = json.loads(original.text)
needs_update = (dict_merge(response, self.body) != response)
- except:
+ except Exception:
pass
if needs_update:
@@ -266,7 +266,7 @@ class AzureRMResource(AzureRMModuleBase):
if self.state == 'present':
try:
response = json.loads(response.text)
- except:
+ except Exception:
response = response.text
else:
response = None
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_resource_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_resource_facts.py
index 12625cdab0..ddad963f77 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_resource_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_resource_facts.py
@@ -198,7 +198,7 @@ class AzureRMResourceFacts(AzureRMModuleBase):
self.results['response'] = response
else:
self.results['response'] = [response]
- except:
+ except Exception:
self.results['response'] = []
return self.results
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_resourcegroup_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_resourcegroup_facts.py
index dd14b0104b..fe5af9f921 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_resourcegroup_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_resourcegroup_facts.py
@@ -77,7 +77,7 @@ azure_resourcegroups:
try:
from msrestazure.azure_exceptions import CloudError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_routetable_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_routetable_facts.py
index 7ef3c1d842..18fcb8836f 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_routetable_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_routetable_facts.py
@@ -98,7 +98,7 @@ routes:
try:
from msrestazure.azure_exceptions import CloudError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_securitygroup_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_securitygroup_facts.py
index 8aadbe6e98..12c5be4499 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_securitygroup_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_securitygroup_facts.py
@@ -190,7 +190,7 @@ azure_securitygroups:
try:
from msrestazure.azure_exceptions import CloudError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_storageaccount_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_storageaccount_facts.py
index e96a0f1021..99838f85fd 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_storageaccount_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_storageaccount_facts.py
@@ -93,7 +93,7 @@ azure_storageaccounts:
try:
from msrestazure.azure_exceptions import CloudError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_trafficmanagerendpoint_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_trafficmanagerendpoint_facts.py
index b2d706fff7..0c2be1bc9d 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_trafficmanagerendpoint_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_trafficmanagerendpoint_facts.py
@@ -141,7 +141,7 @@ from ansible.module_utils.common.dict_transformations import (
try:
from msrestazure.azure_exceptions import CloudError
from azure.common import AzureHttpError
-except:
+except Exception:
# handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_trafficmanagerprofile_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_trafficmanagerprofile_facts.py
index 530455636b..2173c94873 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_trafficmanagerprofile_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_trafficmanagerprofile_facts.py
@@ -210,7 +210,7 @@ from ansible.module_utils.common.dict_transformations import _camel_to_snake
try:
from msrestazure.azure_exceptions import CloudError
from azure.common import AzureHttpError
-except:
+except Exception:
# handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_facts.py
index bb649d5671..4811f111ea 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_facts.py
@@ -190,7 +190,7 @@ vms:
try:
from msrestazure.azure_exceptions import CloudError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_scaleset_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_scaleset_facts.py
index 5b6bce4490..bdd19fa3e4 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_scaleset_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_scaleset_facts.py
@@ -240,7 +240,7 @@ import re
try:
from msrestazure.azure_exceptions import CloudError
-except:
+except Exception:
# handled in azure_rm_common
pass
@@ -308,7 +308,7 @@ class AzureRMVirtualMachineScaleSetFacts(AzureRMModuleBase):
subnet_id = (vmss['properties']['virtualMachineProfile']['networkProfile']['networkInterfaceConfigurations'][0]
['properties']['ipConfigurations'][0]['properties']['subnet']['id'])
subnet_name = re.sub('.*subnets\\/', '', subnet_id)
- except:
+ except Exception:
self.log('Could not extract subnet name')
try:
@@ -316,13 +316,13 @@ class AzureRMVirtualMachineScaleSetFacts(AzureRMModuleBase):
['properties']['ipConfigurations'][0]['properties']['loadBalancerBackendAddressPools'][0]['id'])
load_balancer_name = re.sub('\\/backendAddressPools.*', '', re.sub('.*loadBalancers\\/', '', backend_address_pool_id))
virtual_network_name = re.sub('.*virtualNetworks\\/', '', re.sub('\\/subnets.*', '', subnet_id))
- except:
+ except Exception:
self.log('Could not extract load balancer / virtual network name')
try:
ssh_password_enabled = (not vmss['properties']['virtualMachineProfile']['osProfile'],
['linuxConfiguration']['disablePasswordAuthentication'])
- except:
+ except Exception:
self.log('Could not extract SSH password enabled')
data_disks = vmss['properties']['virtualMachineProfile']['storageProfile'].get('dataDisks', [])
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachineimage_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachineimage_facts.py
index eacb92e2da..fe37b32028 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachineimage_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachineimage_facts.py
@@ -90,7 +90,7 @@ azure_vmimages:
try:
from msrestazure.azure_exceptions import CloudError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork_facts.py
index 9cb3daa3ba..3d4043f6d3 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork_facts.py
@@ -86,7 +86,7 @@ azure_virtualnetworks:
try:
from msrestazure.azure_exceptions import CloudError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_webapp_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_webapp_facts.py
index 9922a36c50..dd23d23f90 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_webapp_facts.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_webapp_facts.py
@@ -150,7 +150,7 @@ try:
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
from azure.common import AzureMissingResourceHttpError, AzureHttpError
-except:
+except Exception:
# This is handled in azure_rm_common
pass
diff --git a/lib/ansible/modules/cloud/cloudstack/cs_facts.py b/lib/ansible/modules/cloud/cloudstack/cs_facts.py
index 9161e1eb9c..3f75e5f700 100644
--- a/lib/ansible/modules/cloud/cloudstack/cs_facts.py
+++ b/lib/ansible/modules/cloud/cloudstack/cs_facts.py
@@ -165,7 +165,7 @@ class CloudStackFacts(object):
try:
# this data come form users, we try what we can to parse it...
return yaml.safe_load(self._fetch(CS_USERDATA_BASE_URL))
- except:
+ except Exception:
return None
def _fetch(self, path):
diff --git a/lib/ansible/modules/cloud/docker/docker_container.py b/lib/ansible/modules/cloud/docker/docker_container.py
index 91996618be..cdf39d02cc 100644
--- a/lib/ansible/modules/cloud/docker/docker_container.py
+++ b/lib/ansible/modules/cloud/docker/docker_container.py
@@ -890,7 +890,7 @@ try:
else:
from docker.utils.types import Ulimit, LogConfig
from docker.errors import APIError, NotFound
-except Exception as dummy:
+except Exception:
# missing docker-py handled in ansible.module_utils.docker
pass
diff --git a/lib/ansible/modules/cloud/docker/docker_network.py b/lib/ansible/modules/cloud/docker/docker_network.py
index d9ddd3316e..50dfc06dba 100644
--- a/lib/ansible/modules/cloud/docker/docker_network.py
+++ b/lib/ansible/modules/cloud/docker/docker_network.py
@@ -263,7 +263,7 @@ try:
from docker.errors import NotFound
if LooseVersion(docker_version) >= LooseVersion('2.0.0'):
from docker.types import IPAMPool, IPAMConfig
-except Exception as dummy:
+except Exception:
# missing docker-py handled in ansible.module_utils.docker_common
pass
diff --git a/lib/ansible/modules/cloud/docker/docker_swarm_service.py b/lib/ansible/modules/cloud/docker/docker_swarm_service.py
index 822182bc17..a780fcf61c 100644
--- a/lib/ansible/modules/cloud/docker/docker_swarm_service.py
+++ b/lib/ansible/modules/cloud/docker/docker_swarm_service.py
@@ -471,7 +471,7 @@ from ansible.module_utils._text import to_text
try:
from distutils.version import LooseVersion
from docker import types
-except Exception as dummy:
+except Exception:
# missing docker-py handled in ansible.module_utils.docker
pass
@@ -846,7 +846,7 @@ class DockerService(DockerBaseClass):
network_id = None
try:
network_id = list(filter(lambda n: n['name'] == network_name, docker_networks))[0]['id']
- except Exception as dummy:
+ except Exception:
pass
if network_id:
networks.append({'Target': network_id})
diff --git a/lib/ansible/modules/cloud/google/gce.py b/lib/ansible/modules/cloud/google/gce.py
index 3e9f19aa12..d4db5a3686 100644
--- a/lib/ansible/modules/cloud/google/gce.py
+++ b/lib/ansible/modules/cloud/google/gce.py
@@ -330,11 +330,11 @@ def get_instance_info(inst):
try:
netname = inst.extra['networkInterfaces'][0]['network'].split('/')[-1]
- except:
+ except Exception:
netname = None
try:
subnetname = inst.extra['networkInterfaces'][0]['subnetwork'].split('/')[-1]
- except:
+ except Exception:
subnetname = None
if 'disks' in inst.extra:
disk_names = [disk_info['source'].split('/')[-1]
diff --git a/lib/ansible/modules/cloud/google/gce_lb.py b/lib/ansible/modules/cloud/google/gce_lb.py
index 633d851ef9..4256e554fc 100644
--- a/lib/ansible/modules/cloud/google/gce_lb.py
+++ b/lib/ansible/modules/cloud/google/gce_lb.py
@@ -239,7 +239,7 @@ def main():
zone, node_name = node.split('/')
nodes.append(gce.ex_get_node(node_name, zone))
output_nodes.append(node)
- except:
+ except Exception:
# skip nodes that are badly formatted or don't exist
pass
try:
diff --git a/lib/ansible/modules/cloud/google/gce_pd.py b/lib/ansible/modules/cloud/google/gce_pd.py
index 9972f3cb78..d26bf5c177 100644
--- a/lib/ansible/modules/cloud/google/gce_pd.py
+++ b/lib/ansible/modules/cloud/google/gce_pd.py
@@ -188,7 +188,7 @@ def main():
is_attached = True
json_output['attached_mode'] = d['mode']
json_output['attached_to_instance'] = inst.name
- except:
+ except Exception:
pass
# find disk if it already exists
@@ -210,7 +210,7 @@ def main():
size_gb = int(round(float(size_gb)))
if size_gb < 1:
raise Exception
- except:
+ except Exception:
module.fail_json(msg="Must supply a size_gb larger than 1 GB",
changed=False)
diff --git a/lib/ansible/modules/cloud/google/gcp_backend_service.py b/lib/ansible/modules/cloud/google/gcp_backend_service.py
index af7cab7e4f..d65157edf9 100644
--- a/lib/ansible/modules/cloud/google/gcp_backend_service.py
+++ b/lib/ansible/modules/cloud/google/gcp_backend_service.py
@@ -203,7 +203,7 @@ def _validate_params(params):
try:
check_params(params, fields)
_validate_backend_params(params['backends'])
- except:
+ except Exception:
raise
return (True, '')
@@ -233,7 +233,7 @@ def _validate_backend_params(backends):
for backend in backends:
try:
check_params(backend, fields)
- except:
+ except Exception:
raise
if 'max_rate' in backend and 'max_rate_per_instance' in backend:
diff --git a/lib/ansible/modules/cloud/google/gcp_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_forwarding_rule.py
index 59de6bda99..63e1472c52 100644
--- a/lib/ansible/modules/cloud/google/gcp_forwarding_rule.py
+++ b/lib/ansible/modules/cloud/google/gcp_forwarding_rule.py
@@ -178,7 +178,7 @@ def get_global_forwarding_rule(client, name, project_id=None):
req = client.globalForwardingRules().get(
project=project_id, forwardingRule=name)
return GCPUtils.execute_api_client_req(req, raise_404=False)
- except:
+ except Exception:
raise
@@ -204,7 +204,7 @@ def create_global_forwarding_rule(client, params, project_id):
name=params['forwarding_rule_name'],
project_id=project_id)
return (True, return_data)
- except:
+ except Exception:
raise
@@ -229,7 +229,7 @@ def delete_global_forwarding_rule(client, name, project_id):
project=project_id, forwardingRule=name)
return_data = GCPUtils.execute_api_client_req(req, client)
return (True, return_data)
- except:
+ except Exception:
raise
@@ -270,7 +270,7 @@ def update_global_forwarding_rule(client, forwarding_rule, params, name, project
return_data = GCPUtils.execute_api_client_req(
req, client=client, raw=False)
return (True, return_data)
- except:
+ except Exception:
raise
diff --git a/lib/ansible/modules/cloud/google/gcp_healthcheck.py b/lib/ansible/modules/cloud/google/gcp_healthcheck.py
index 0165929ae5..a572c5e8be 100644
--- a/lib/ansible/modules/cloud/google/gcp_healthcheck.py
+++ b/lib/ansible/modules/cloud/google/gcp_healthcheck.py
@@ -261,7 +261,7 @@ def get_healthcheck(client, name, project_id=None, resource_type='HTTP'):
args = {'project': project_id, entity_name: name}
req = resource.get(**args)
return GCPUtils.execute_api_client_req(req, raise_404=False)
- except:
+ except Exception:
raise
@@ -289,7 +289,7 @@ def create_healthcheck(client, params, project_id, resource_type='HTTP'):
name=params['healthcheck_name'],
project_id=project_id)
return (True, return_data)
- except:
+ except Exception:
raise
@@ -315,7 +315,7 @@ def delete_healthcheck(client, name, project_id, resource_type='HTTP'):
req = resource.delete(**args)
return_data = GCPUtils.execute_api_client_req(req, client)
return (True, return_data)
- except:
+ except Exception:
raise
@@ -356,7 +356,7 @@ def update_healthcheck(client, healthcheck, params, name, project_id,
return_data = GCPUtils.execute_api_client_req(
req, client=client, raw=False)
return (True, return_data)
- except:
+ except Exception:
raise
diff --git a/lib/ansible/modules/cloud/google/gcp_target_proxy.py b/lib/ansible/modules/cloud/google/gcp_target_proxy.py
index b242cd625e..f8555ecb4b 100644
--- a/lib/ansible/modules/cloud/google/gcp_target_proxy.py
+++ b/lib/ansible/modules/cloud/google/gcp_target_proxy.py
@@ -161,7 +161,7 @@ def create_target_http_proxy(client, params, project_id):
name=params['target_proxy_name'],
project_id=project_id)
return (True, return_data)
- except:
+ except Exception:
raise
@@ -186,7 +186,7 @@ def delete_target_http_proxy(client, name, project_id):
project=project_id, targetHttpProxy=name)
return_data = GCPUtils.execute_api_client_req(req, client)
return (True, return_data)
- except:
+ except Exception:
raise
@@ -227,7 +227,7 @@ def update_target_http_proxy(client, target_proxy, params, name, project_id):
return_data = GCPUtils.execute_api_client_req(
req, client=client, raw=False)
return (True, return_data)
- except:
+ except Exception:
raise
diff --git a/lib/ansible/modules/cloud/google/gcp_url_map.py b/lib/ansible/modules/cloud/google/gcp_url_map.py
index 26d7c80ded..51706ad47b 100644
--- a/lib/ansible/modules/cloud/google/gcp_url_map.py
+++ b/lib/ansible/modules/cloud/google/gcp_url_map.py
@@ -178,7 +178,7 @@ def _validate_params(params):
_validate_path_matcher_params(params['path_matchers'])
if 'host_rules' in params and params['host_rules'] is not None:
_validate_host_rules_params(params['host_rules'])
- except:
+ except Exception:
raise
return (True, '')
@@ -220,7 +220,7 @@ def _validate_path_matcher_params(path_matchers):
if not path.startswith('/'):
raise ValueError("path for %s must start with /" % (
pm['name']))
- except:
+ except Exception:
raise
return (True, '')
@@ -259,7 +259,7 @@ def _validate_host_rules_params(host_rules):
raise ValueError("wildcard be followed by a '.' or '-', %s" % (
host))
- except:
+ except Exception:
raise
return (True, '')
@@ -341,7 +341,7 @@ def get_url_map(client, name, project_id=None):
try:
req = client.urlMaps().get(project=project_id, urlMap=name)
return GCPUtils.execute_api_client_req(req, raise_404=False)
- except:
+ except Exception:
raise
@@ -367,7 +367,7 @@ def create_url_map(client, params, project_id):
name=params['url_map_name'],
project_id=project_id)
return (True, return_data)
- except:
+ except Exception:
raise
@@ -391,7 +391,7 @@ def delete_url_map(client, name, project_id):
req = client.urlMaps().delete(project=project_id, urlMap=name)
return_data = GCPUtils.execute_api_client_req(req, client)
return (True, return_data)
- except:
+ except Exception:
raise
@@ -431,7 +431,7 @@ def update_url_map(client, url_map, params, name, project_id):
urlMap=name, body=gcp_dict)
return_data = GCPUtils.execute_api_client_req(req, client=client, raw=False)
return (True, return_data)
- except:
+ except Exception:
raise
diff --git a/lib/ansible/modules/cloud/misc/ovirt.py b/lib/ansible/modules/cloud/misc/ovirt.py
index 3d62642460..e9372c088a 100644
--- a/lib/ansible/modules/cloud/misc/ovirt.py
+++ b/lib/ansible/modules/cloud/misc/ovirt.py
@@ -228,7 +228,7 @@ def conn(url, user, password):
api = API(url=url, username=user, password=password, insecure=True)
try:
value = api.test()
- except:
+ except Exception:
raise Exception("error connecting to the oVirt API")
return api
@@ -262,16 +262,16 @@ def create_vm(conn, vmtype, vmname, zone, vmdisk_size, vmcpus, vmnic, vmnetwork,
try:
conn.vms.add(vmparams)
- except:
+ except Exception:
raise Exception("Error creating VM with specified parameters")
vm = conn.vms.get(name=vmname)
try:
vm.disks.add(vmdisk)
- except:
+ except Exception:
raise Exception("Error attaching disk")
try:
vm.nics.add(nic_net1)
- except:
+ except Exception:
raise Exception("Error adding nic")
@@ -280,7 +280,7 @@ def create_vm_template(conn, vmname, image, zone):
vmparams = params.VM(name=vmname, cluster=conn.clusters.get(name=zone), template=conn.templates.get(name=image), disks=params.Disks(clone=True))
try:
conn.vms.add(vmparams)
- except:
+ except Exception:
raise Exception('error adding template %s' % image)
diff --git a/lib/ansible/modules/cloud/misc/rhevm.py b/lib/ansible/modules/cloud/misc/rhevm.py
index 08d37135d1..6d7366da0f 100644
--- a/lib/ansible/modules/cloud/misc/rhevm.py
+++ b/lib/ansible/modules/cloud/misc/rhevm.py
@@ -339,7 +339,7 @@ class RHEVConn(object):
api = API(url=url, username=user, password=password, insecure=str(insecure_api))
api.test()
self.conn = api
- except:
+ except Exception:
raise Exception("Failed to connect to RHEV-M.")
def __del__(self):
diff --git a/lib/ansible/modules/cloud/misc/virt.py b/lib/ansible/modules/cloud/misc/virt.py
index ff6225688d..8848ae1338 100644
--- a/lib/ansible/modules/cloud/misc/virt.py
+++ b/lib/ansible/modules/cloud/misc/virt.py
@@ -354,7 +354,7 @@ class Virt(object):
results.append(x.name())
else:
results.append(x.name())
- except:
+ except Exception:
pass
return results
diff --git a/lib/ansible/modules/cloud/misc/virt_net.py b/lib/ansible/modules/cloud/misc/virt_net.py
index 1353f5d2a9..d7454c93c4 100644
--- a/lib/ansible/modules/cloud/misc/virt_net.py
+++ b/lib/ansible/modules/cloud/misc/virt_net.py
@@ -229,7 +229,7 @@ class LibvirtConnection(object):
else:
try:
state = self.find_entry(entryid).isActive()
- except:
+ except Exception:
return self.module.exit_json(changed=True)
if not state:
return self.module.exit_json(changed=True)
@@ -302,7 +302,7 @@ class LibvirtConnection(object):
try:
state = self.find_entry(entryid).isActive()
return ENTRY_STATE_ACTIVE_MAP.get(state, "unknown")
- except:
+ except Exception:
return ENTRY_STATE_ACTIVE_MAP.get("inactive", "unknown")
def get_uuid(self, entryid):
@@ -315,7 +315,7 @@ class LibvirtConnection(object):
xml = etree.fromstring(self.find_entry(entryid).XMLDesc(0))
try:
result = xml.xpath('/network/forward')[0].get('mode')
- except:
+ except Exception:
raise ValueError('Forward mode not specified')
return result
@@ -323,7 +323,7 @@ class LibvirtConnection(object):
xml = etree.fromstring(self.find_entry(entryid).XMLDesc(0))
try:
result = xml.xpath('/network/domain')[0].get('name')
- except:
+ except Exception:
raise ValueError('Domain not specified')
return result
@@ -331,7 +331,7 @@ class LibvirtConnection(object):
xml = etree.fromstring(self.find_entry(entryid).XMLDesc(0))
try:
result = xml.xpath('/network/mac')[0].get('address')
- except:
+ except Exception:
raise ValueError('MAC address not specified')
return result
@@ -345,7 +345,7 @@ class LibvirtConnection(object):
else:
try:
return self.find_entry(entryid).autostart()
- except:
+ except Exception:
return self.module.exit_json(changed=True)
def set_autostart(self, entryid, val):
@@ -354,7 +354,7 @@ class LibvirtConnection(object):
else:
try:
state = self.find_entry(entryid).autostart()
- except:
+ except Exception:
return self.module.exit_json(changed=True)
if bool(state) != val:
return self.module.exit_json(changed=True)
@@ -376,7 +376,7 @@ class LibvirtConnection(object):
else:
try:
self.find_entry(entryid)
- except:
+ except Exception:
return self.module.exit_json(changed=True)
diff --git a/lib/ansible/modules/cloud/misc/virt_pool.py b/lib/ansible/modules/cloud/misc/virt_pool.py
index 76762a7a4f..148a5a6fe5 100644
--- a/lib/ansible/modules/cloud/misc/virt_pool.py
+++ b/lib/ansible/modules/cloud/misc/virt_pool.py
@@ -262,7 +262,7 @@ class LibvirtConnection(object):
else:
try:
state = self.find_entry(entryid).isActive()
- except:
+ except Exception:
return self.module.exit_json(changed=True)
if not state:
return self.module.exit_json(changed=True)
@@ -293,7 +293,7 @@ class LibvirtConnection(object):
try:
state = self.find_entry(entryid).isActive()
return ENTRY_STATE_ACTIVE_MAP.get(state, "unknown")
- except:
+ except Exception:
return ENTRY_STATE_ACTIVE_MAP.get("inactive", "unknown")
def get_uuid(self, entryid):
@@ -319,14 +319,14 @@ class LibvirtConnection(object):
result.append(device.get('path'))
try:
return result
- except:
+ except Exception:
raise ValueError('No devices specified')
def get_format(self, entryid):
xml = etree.fromstring(self.find_entry(entryid).XMLDesc(0))
try:
result = xml.xpath('/pool/source/format')[0].get('type')
- except:
+ except Exception:
raise ValueError('Format not specified')
return result
@@ -334,7 +334,7 @@ class LibvirtConnection(object):
xml = etree.fromstring(self.find_entry(entryid).XMLDesc(0))
try:
result = xml.xpath('/pool/source/host')[0].get('name')
- except:
+ except Exception:
raise ValueError('Host not specified')
return result
@@ -342,7 +342,7 @@ class LibvirtConnection(object):
xml = etree.fromstring(self.find_entry(entryid).XMLDesc(0))
try:
result = xml.xpath('/pool/source/dir')[0].get('path')
- except:
+ except Exception:
raise ValueError('Source path not specified')
return result
@@ -360,7 +360,7 @@ class LibvirtConnection(object):
else:
try:
state = self.find_entry(entryid)
- except:
+ except Exception:
return self.module.exit_json(changed=True)
if not state:
return self.module.exit_json(changed=True)
@@ -371,7 +371,7 @@ class LibvirtConnection(object):
else:
try:
state = self.find_entry(entryid)
- except:
+ except Exception:
return self.module.exit_json(changed=True)
if state:
return self.module.exit_json(changed=True)
@@ -386,7 +386,7 @@ class LibvirtConnection(object):
else:
try:
return self.find_entry(entryid).autostart()
- except:
+ except Exception:
return self.module.exit_json(changed=True)
def set_autostart(self, entryid, val):
@@ -395,7 +395,7 @@ class LibvirtConnection(object):
else:
try:
state = self.find_entry(entryid).autostart()
- except:
+ except Exception:
return self.module.exit_json(changed=True)
if bool(state) != val:
return self.module.exit_json(changed=True)
@@ -413,7 +413,7 @@ class LibvirtConnection(object):
else:
try:
self.find_entry(entryid)
- except:
+ except Exception:
return self.module.exit_json(changed=True)
diff --git a/lib/ansible/modules/cloud/openstack/os_keystone_domain_facts.py b/lib/ansible/modules/cloud/openstack/os_keystone_domain_facts.py
index deb287e070..2c3a464436 100644
--- a/lib/ansible/modules/cloud/openstack/os_keystone_domain_facts.py
+++ b/lib/ansible/modules/cloud/openstack/os_keystone_domain_facts.py
@@ -111,7 +111,7 @@ def main():
# Let's suppose user is passing domain ID
try:
domains = opcloud.get_domain(name)
- except:
+ except Exception:
domains = opcloud.search_domains(filters={'name': name})
else:
diff --git a/lib/ansible/modules/cloud/openstack/os_project.py b/lib/ansible/modules/cloud/openstack/os_project.py
index a68becb0a6..9f197591f5 100644
--- a/lib/ansible/modules/cloud/openstack/os_project.py
+++ b/lib/ansible/modules/cloud/openstack/os_project.py
@@ -160,13 +160,13 @@ def main():
# We assume admin is passing domain id
dom = cloud.get_domain(domain)['id']
domain = dom
- except:
+ except Exception:
# If we fail, maybe admin is passing a domain name.
# Note that domains have unique names, just like id.
try:
dom = cloud.search_domains(filters={'name': domain})[0]['id']
domain = dom
- except:
+ except Exception:
# Ok, let's hope the user is non-admin and passing a sane id
pass
diff --git a/lib/ansible/modules/cloud/openstack/os_project_facts.py b/lib/ansible/modules/cloud/openstack/os_project_facts.py
index 8b6b05d796..df476526e0 100644
--- a/lib/ansible/modules/cloud/openstack/os_project_facts.py
+++ b/lib/ansible/modules/cloud/openstack/os_project_facts.py
@@ -127,7 +127,7 @@ def main():
# We assume admin is passing domain id
dom = opcloud.get_domain(domain)['id']
domain = dom
- except:
+ except Exception:
# If we fail, maybe admin is passing a domain name.
# Note that domains have unique names, just like id.
dom = opcloud.search_domains(filters={'name': domain})
diff --git a/lib/ansible/modules/cloud/openstack/os_user.py b/lib/ansible/modules/cloud/openstack/os_user.py
index 2ddc8db181..7e2ca3e132 100644
--- a/lib/ansible/modules/cloud/openstack/os_user.py
+++ b/lib/ansible/modules/cloud/openstack/os_user.py
@@ -160,12 +160,12 @@ def _get_domain_id(cloud, domain):
try:
# We assume admin is passing domain id
domain_id = cloud.get_domain(domain)['id']
- except:
+ except Exception:
# If we fail, maybe admin is passing a domain name.
# Note that domains have unique names, just like id.
try:
domain_id = cloud.search_domains(filters={'name': domain})[0]['id']
- except:
+ except Exception:
# Ok, let's hope the user is non-admin and passing a sane id
domain_id = domain
diff --git a/lib/ansible/modules/cloud/openstack/os_user_facts.py b/lib/ansible/modules/cloud/openstack/os_user_facts.py
index 422544a172..f8f0079030 100644
--- a/lib/ansible/modules/cloud/openstack/os_user_facts.py
+++ b/lib/ansible/modules/cloud/openstack/os_user_facts.py
@@ -135,7 +135,7 @@ def main():
# We assume admin is passing domain id
dom = opcloud.get_domain(domain)['id']
domain = dom
- except:
+ except Exception:
# If we fail, maybe admin is passing a domain name.
# Note that domains have unique names, just like id.
dom = opcloud.search_domains(filters={'name': domain})
diff --git a/lib/ansible/modules/cloud/rackspace/rax.py b/lib/ansible/modules/cloud/rackspace/rax.py
index 106fce3b44..c27a10ab8c 100644
--- a/lib/ansible/modules/cloud/rackspace/rax.py
+++ b/lib/ansible/modules/cloud/rackspace/rax.py
@@ -332,7 +332,7 @@ def create(module, names=None, flavor=None, image=None, meta=None, key_name=None
for server in servers:
try:
server.get()
- except:
+ except Exception:
server.status = 'ERROR'
if not filter(lambda s: s.status not in FINAL_STATUSES,
@@ -346,7 +346,7 @@ def create(module, names=None, flavor=None, image=None, meta=None, key_name=None
for server in servers:
try:
server.get()
- except:
+ except Exception:
server.status = 'ERROR'
instance = rax_to_dict(server, 'server')
if server.status == 'ACTIVE' or not wait:
@@ -418,7 +418,7 @@ def delete(module, instance_ids=None, wait=True, wait_timeout=300, kept=None):
instance_id = server.id
try:
server.get()
- except:
+ except Exception:
instances[instance_id]['status'] = 'DELETED'
instances[instance_id]['rax_status'] = 'DELETED'
diff --git a/lib/ansible/modules/cloud/rackspace/rax_keypair.py b/lib/ansible/modules/cloud/rackspace/rax_keypair.py
index 455caf922d..a9d8ec56f4 100644
--- a/lib/ansible/modules/cloud/rackspace/rax_keypair.py
+++ b/lib/ansible/modules/cloud/rackspace/rax_keypair.py
@@ -128,7 +128,7 @@ def rax_keypair(module, name, public_key, state):
elif state == 'absent':
try:
keypair = cs.keypairs.find(name=name)
- except:
+ except Exception:
pass
if keypair:
diff --git a/lib/ansible/modules/cloud/softlayer/sl_vm.py b/lib/ansible/modules/cloud/softlayer/sl_vm.py
index 2a7b1440ff..b46704c9e9 100644
--- a/lib/ansible/modules/cloud/softlayer/sl_vm.py
+++ b/lib/ansible/modules/cloud/softlayer/sl_vm.py
@@ -294,7 +294,7 @@ def wait_for_instance(module, id):
completed = vsManager.wait_for_ready(id, 10, 2)
if completed:
instance = vsManager.get_instance(id)
- except:
+ except Exception:
completed = False
return completed, instance
@@ -310,12 +310,12 @@ def cancel_instance(module):
for instance in instances:
try:
vsManager.cancel_instance(instance['id'])
- except:
+ except Exception:
canceled = False
elif module.params.get('instance_id') and module.params.get('instance_id') != 0:
try:
vsManager.cancel_instance(instance['id'])
- except:
+ except Exception:
canceled = False
else:
return False, None
diff --git a/lib/ansible/modules/cloud/univention/udm_group.py b/lib/ansible/modules/cloud/univention/udm_group.py
index 7e6564591e..f2d691f09b 100644
--- a/lib/ansible/modules/cloud/univention/udm_group.py
+++ b/lib/ansible/modules/cloud/univention/udm_group.py
@@ -143,7 +143,7 @@ def main():
grp.create()
else:
grp.modify()
- except:
+ except Exception:
module.fail_json(
msg="Creating/editing group {} in {} failed".format(name, container)
)
@@ -154,7 +154,7 @@ def main():
if not module.check_mode:
grp.remove()
changed = True
- except:
+ except Exception:
module.fail_json(
msg="Removing group {} failed".format(name)
)
diff --git a/lib/ansible/modules/cloud/univention/udm_user.py b/lib/ansible/modules/cloud/univention/udm_user.py
index bc22a7495d..a546f818d9 100644
--- a/lib/ansible/modules/cloud/univention/udm_user.py
+++ b/lib/ansible/modules/cloud/univention/udm_user.py
@@ -476,7 +476,7 @@ def main():
obj.create()
elif changed:
obj.modify()
- except:
+ except Exception:
module.fail_json(
msg="Creating/editing user {} in {} failed".format(
username,
@@ -497,7 +497,7 @@ def main():
if not module.check_mode:
grp.modify()
changed = True
- except:
+ except Exception:
module.fail_json(
msg="Adding groups to user {} failed".format(username)
)
@@ -508,7 +508,7 @@ def main():
if not module.check_mode:
obj.remove()
changed = True
- except:
+ except Exception:
module.fail_json(
msg="Removing user {} failed".format(username)
)
diff --git a/lib/ansible/modules/cloud/vmware/vcenter_license.py b/lib/ansible/modules/cloud/vmware/vcenter_license.py
index 71d4b586a8..573269bc2b 100644
--- a/lib/ansible/modules/cloud/vmware/vcenter_license.py
+++ b/lib/ansible/modules/cloud/vmware/vcenter_license.py
@@ -156,7 +156,7 @@ def main():
try:
lam = lm.licenseAssignmentManager
lam.UpdateAssignedLicense(entity=content.about.instanceUuid, licenseKey=license)
- except:
+ except Exception:
module.warn('Could not assign "%s" (%s) to vCenter.' % (license, key.name))
result['licenses'] = list_keys(lm.licenses)
diff --git a/lib/ansible/modules/cloud/vmware/vmware_deploy_ovf.py b/lib/ansible/modules/cloud/vmware/vmware_deploy_ovf.py
index 6b673a711f..769241df5f 100644
--- a/lib/ansible/modules/cloud/vmware/vmware_deploy_ovf.py
+++ b/lib/ansible/modules/cloud/vmware/vmware_deploy_ovf.py
@@ -181,7 +181,7 @@ class TarFileProgressReader(tarfile.ExFileObject):
def __exit__(self, exc_type, exc_value, traceback):
try:
self.close()
- except:
+ except Exception:
pass
def read(self, size=10240):
diff --git a/lib/ansible/modules/cloud/vmware/vmware_resource_pool.py b/lib/ansible/modules/cloud/vmware/vmware_resource_pool.py
index 95da91893c..c6fc6f1af9 100644
--- a/lib/ansible/modules/cloud/vmware/vmware_resource_pool.py
+++ b/lib/ansible/modules/cloud/vmware/vmware_resource_pool.py
@@ -229,7 +229,7 @@ class VMwareResourcePool(object):
task = self.resource_pool_obj.Destroy()
success, result = wait_for_task(task)
- except:
+ except Exception:
self.module.fail_json(msg="Failed to remove resource pool '%s' '%s'" % (
self.resource_pool, resource_pool))
self.module.exit_json(changed=changed, result=str(result))
diff --git a/lib/ansible/modules/clustering/consul.py b/lib/ansible/modules/clustering/consul.py
index 134abde606..1afe20dc0f 100644
--- a/lib/ansible/modules/clustering/consul.py
+++ b/lib/ansible/modules/clustering/consul.py
@@ -514,7 +514,7 @@ class ConsulCheck(object):
if attr is None:
attr = key
data[key] = getattr(self, attr)
- except:
+ except Exception:
pass
diff --git a/lib/ansible/modules/clustering/k8s/_kubernetes.py b/lib/ansible/modules/clustering/k8s/_kubernetes.py
index d635f6341a..2d9c4c0af2 100644
--- a/lib/ansible/modules/clustering/k8s/_kubernetes.py
+++ b/lib/ansible/modules/clustering/k8s/_kubernetes.py
@@ -376,7 +376,7 @@ def main():
f.close()
if not data:
module.fail_json(msg="No valid data could be found.")
- except:
+ except Exception:
module.fail_json(msg="The file '%s' was not found or contained invalid YAML/JSON data" % file_reference)
# set the transport type and build the target endpoint url
diff --git a/lib/ansible/modules/database/misc/riak.py b/lib/ansible/modules/database/misc/riak.py
index 90c98506b2..46b048b834 100644
--- a/lib/ansible/modules/database/misc/riak.py
+++ b/lib/ansible/modules/database/misc/riak.py
@@ -131,7 +131,7 @@ def main():
# here we attempt to load those stats,
try:
stats = json.loads(stats_raw)
- except:
+ except Exception:
module.fail_json(msg='Could not parse Riak stats.')
node_name = stats['nodename']
diff --git a/lib/ansible/modules/database/mssql/mssql_db.py b/lib/ansible/modules/database/mssql/mssql_db.py
index 65f5167f51..f9d0994064 100644
--- a/lib/ansible/modules/database/mssql/mssql_db.py
+++ b/lib/ansible/modules/database/mssql/mssql_db.py
@@ -111,7 +111,7 @@ def db_create(conn, cursor, db):
def db_delete(conn, cursor, db):
try:
cursor.execute("ALTER DATABASE [%s] SET single_user WITH ROLLBACK IMMEDIATE" % db)
- except:
+ except Exception:
pass
cursor.execute("DROP DATABASE [%s]" % db)
return not db_exists(conn, cursor, db)
diff --git a/lib/ansible/modules/database/mysql/mysql_replication.py b/lib/ansible/modules/database/mysql/mysql_replication.py
index 4f08f11fcd..ab3e16efb6 100644
--- a/lib/ansible/modules/database/mysql/mysql_replication.py
+++ b/lib/ansible/modules/database/mysql/mysql_replication.py
@@ -139,7 +139,7 @@ def stop_slave(cursor):
try:
cursor.execute("STOP SLAVE")
stopped = True
- except:
+ except Exception:
stopped = False
return stopped
@@ -148,7 +148,7 @@ def reset_slave(cursor):
try:
cursor.execute("RESET SLAVE")
reset = True
- except:
+ except Exception:
reset = False
return reset
@@ -157,7 +157,7 @@ def reset_slave_all(cursor):
try:
cursor.execute("RESET SLAVE ALL")
reset = True
- except:
+ except Exception:
reset = False
return reset
@@ -166,7 +166,7 @@ def start_slave(cursor):
try:
cursor.execute("START SLAVE")
started = True
- except:
+ except Exception:
started = False
return started
diff --git a/lib/ansible/modules/database/mysql/mysql_user.py b/lib/ansible/modules/database/mysql/mysql_user.py
index fead25428f..d7057ffac2 100644
--- a/lib/ansible/modules/database/mysql/mysql_user.py
+++ b/lib/ansible/modules/database/mysql/mysql_user.py
@@ -588,7 +588,7 @@ def main():
try:
cursor = mysql_connect(module, 'root', '', config_file, ssl_cert, ssl_key, ssl_ca, db,
connect_timeout=connect_timeout)
- except:
+ except Exception:
pass
if not cursor:
diff --git a/lib/ansible/modules/database/postgresql/postgresql_lang.py b/lib/ansible/modules/database/postgresql/postgresql_lang.py
index f43737c395..c47c6fd2ca 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_lang.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_lang.py
@@ -181,7 +181,7 @@ def lang_drop(cursor, lang, cascade):
cursor.execute("DROP LANGUAGE \"%s\" CASCADE" % lang)
else:
cursor.execute("DROP LANGUAGE \"%s\"" % lang)
- except:
+ except Exception:
cursor.execute("ROLLBACK TO SAVEPOINT ansible_pgsql_lang_drop")
cursor.execute("RELEASE SAVEPOINT ansible_pgsql_lang_drop")
return False
diff --git a/lib/ansible/modules/database/postgresql/postgresql_user.py b/lib/ansible/modules/database/postgresql/postgresql_user.py
index a4892f05d5..2414137f11 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_user.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_user.py
@@ -466,7 +466,7 @@ def user_delete(cursor, user):
cursor.execute("SAVEPOINT ansible_pgsql_user_delete")
try:
cursor.execute("DROP USER %s" % pg_quote_identifier(user, 'role'))
- except:
+ except Exception:
cursor.execute("ROLLBACK TO SAVEPOINT ansible_pgsql_user_delete")
cursor.execute("RELEASE SAVEPOINT ansible_pgsql_user_delete")
return False
diff --git a/lib/ansible/modules/files/stat.py b/lib/ansible/modules/files/stat.py
index b78b8cdf82..357691dfd1 100644
--- a/lib/ansible/modules/files/stat.py
+++ b/lib/ansible/modules/files/stat.py
@@ -532,7 +532,7 @@ def main():
mimetype, charset = out.split(':')[1].split(';')
output['mimetype'] = mimetype.strip()
output['charset'] = charset.split('=')[1].strip()
- except:
+ except Exception:
pass
# try to get attr data
diff --git a/lib/ansible/modules/files/unarchive.py b/lib/ansible/modules/files/unarchive.py
index 7ef333b512..2060323cfc 100644
--- a/lib/ansible/modules/files/unarchive.py
+++ b/lib/ansible/modules/files/unarchive.py
@@ -241,7 +241,7 @@ class ZipArchive(object):
try:
for item in archive.infolist():
self._infodict[item.filename] = int(item.CRC)
- except:
+ except Exception:
archive.close()
raise UnarchiveError('Unable to list files in the archive')
@@ -273,7 +273,7 @@ class ZipArchive(object):
break
if not exclude_flag:
self._files_in_archive.append(to_native(member))
- except:
+ except Exception:
archive.close()
raise UnarchiveError('Unable to list files in the archive')
@@ -328,7 +328,7 @@ class ZipArchive(object):
else:
try:
fut_owner = run_owner
- except:
+ except Exception:
pass
fut_uid = run_uid
@@ -347,7 +347,7 @@ class ZipArchive(object):
else:
try:
fut_group = run_group
- except:
+ except Exception:
pass
fut_gid = run_gid
@@ -427,7 +427,7 @@ class ZipArchive(object):
dest = os.path.join(self.dest, path)
try:
st = os.lstat(dest)
- except:
+ except Exception:
change = True
self.includes.append(path)
err += 'Path %s is missing\n' % path
diff --git a/lib/ansible/modules/monitoring/datadog_event.py b/lib/ansible/modules/monitoring/datadog_event.py
index 9c38c3e80e..0f42b567d1 100644
--- a/lib/ansible/modules/monitoring/datadog_event.py
+++ b/lib/ansible/modules/monitoring/datadog_event.py
@@ -96,7 +96,7 @@ import traceback
try:
from datadog import initialize, api
HAS_DATADOG = True
-except:
+except Exception:
HAS_DATADOG = False
from ansible.module_utils.basic import AnsibleModule
diff --git a/lib/ansible/modules/monitoring/datadog_monitor.py b/lib/ansible/modules/monitoring/datadog_monitor.py
index 92350bc127..9937269ba7 100644
--- a/lib/ansible/modules/monitoring/datadog_monitor.py
+++ b/lib/ansible/modules/monitoring/datadog_monitor.py
@@ -144,7 +144,7 @@ import traceback
try:
from datadog import initialize, api
HAS_DATADOG = True
-except:
+except Exception:
HAS_DATADOG = False
from ansible.module_utils.basic import AnsibleModule
diff --git a/lib/ansible/modules/monitoring/logicmonitor.py b/lib/ansible/modules/monitoring/logicmonitor.py
index eccb5fea1e..6f5da3db3d 100644
--- a/lib/ansible/modules/monitoring/logicmonitor.py
+++ b/lib/ansible/modules/monitoring/logicmonitor.py
@@ -867,7 +867,7 @@ class Collector(LogicMonitor):
"arch": arch}))
with open(installfilepath, "w") as write_file:
write_file.write(installer)
- except:
+ except Exception:
self.fail(msg="Unable to open installer file for writing")
else:
self.module.debug("Collector installer already exists")
diff --git a/lib/ansible/modules/monitoring/pagerduty.py b/lib/ansible/modules/monitoring/pagerduty.py
index 81f3e7216c..7926d40574 100644
--- a/lib/ansible/modules/monitoring/pagerduty.py
+++ b/lib/ansible/modules/monitoring/pagerduty.py
@@ -222,7 +222,7 @@ class PagerDutyRequest(object):
def _read_response(self, response):
try:
return json.loads(response.read())
- except:
+ except Exception:
return ""
diff --git a/lib/ansible/modules/monitoring/pingdom.py b/lib/ansible/modules/monitoring/pingdom.py
index 8e8252fd49..9d8ef6eb8d 100644
--- a/lib/ansible/modules/monitoring/pingdom.py
+++ b/lib/ansible/modules/monitoring/pingdom.py
@@ -71,7 +71,7 @@ EXAMPLES = '''
try:
import pingdom
HAS_PINGDOM = True
-except:
+except Exception:
HAS_PINGDOM = False
from ansible.module_utils.basic import AnsibleModule
diff --git a/lib/ansible/modules/monitoring/sensu_silence.py b/lib/ansible/modules/monitoring/sensu_silence.py
index 05f77a17c0..3e5a84244c 100644
--- a/lib/ansible/modules/monitoring/sensu_silence.py
+++ b/lib/ansible/modules/monitoring/sensu_silence.py
@@ -130,7 +130,7 @@ def query(module, url, check, subscription):
try:
json_out = json.loads(response.read())
- except:
+ except Exception:
json_out = ""
return False, json_out, False
@@ -182,7 +182,7 @@ def clear(module, url, check, subscription):
try:
json_out = json.loads(response.read())
- except:
+ except Exception:
json_out = ""
return False, json_out, True
@@ -247,7 +247,7 @@ def create(
try:
json_out = json.loads(response.read())
- except:
+ except Exception:
json_out = ""
return False, json_out, True
diff --git a/lib/ansible/modules/net_tools/basics/uri.py b/lib/ansible/modules/net_tools/basics/uri.py
index f74da990a6..f290af8892 100644
--- a/lib/ansible/modules/net_tools/basics/uri.py
+++ b/lib/ansible/modules/net_tools/basics/uri.py
@@ -588,7 +588,7 @@ def main():
try:
js = json.loads(u_content)
uresp['json'] = js
- except:
+ except Exception:
if PY2:
sys.exc_clear() # Avoid false positive traceback in fail_json() on Python 2
else:
diff --git a/lib/ansible/modules/net_tools/netbox/netbox_device.py b/lib/ansible/modules/net_tools/netbox/netbox_device.py
index 0581564cc6..769e8999b8 100644
--- a/lib/ansible/modules/net_tools/netbox/netbox_device.py
+++ b/lib/ansible/modules/net_tools/netbox/netbox_device.py
@@ -173,7 +173,7 @@ import json
try:
import pynetbox
HAS_PYNETBOX = True
-except:
+except ImportError:
HAS_PYNETBOX = False
diff --git a/lib/ansible/modules/net_tools/nmcli.py b/lib/ansible/modules/net_tools/nmcli.py
index c91b3c9be8..a599233520 100644
--- a/lib/ansible/modules/net_tools/nmcli.py
+++ b/lib/ansible/modules/net_tools/nmcli.py
@@ -632,7 +632,7 @@ class Nmcli(object):
for setting in secrets:
for key in secrets[setting]:
config[setting_name][key] = secrets[setting][key]
- except:
+ except Exception:
pass
def dict_to_string(self, d):
diff --git a/lib/ansible/modules/net_tools/snmp_facts.py b/lib/ansible/modules/net_tools/snmp_facts.py
index f5ccef8632..4267a5cb7f 100644
--- a/lib/ansible/modules/net_tools/snmp_facts.py
+++ b/lib/ansible/modules/net_tools/snmp_facts.py
@@ -169,7 +169,7 @@ from collections import defaultdict
try:
from pysnmp.entity.rfc3413.oneliner import cmdgen
has_pysnmp = True
-except:
+except Exception:
has_pysnmp = False
from ansible.module_utils.basic import AnsibleModule
diff --git a/lib/ansible/modules/network/a10/a10_server.py b/lib/ansible/modules/network/a10/a10_server.py
index 6abbf1d05b..8173fd6aa8 100644
--- a/lib/ansible/modules/network/a10/a10_server.py
+++ b/lib/ansible/modules/network/a10/a10_server.py
@@ -117,7 +117,7 @@ def validate_ports(module, ports):
if 'port_num' in item:
try:
item['port_num'] = int(item['port_num'])
- except:
+ except Exception:
module.fail_json(msg="port_num entries in the port definitions must be integers")
else:
module.fail_json(msg="port definitions must define the port_num field")
diff --git a/lib/ansible/modules/network/a10/a10_server_axapi3.py b/lib/ansible/modules/network/a10/a10_server_axapi3.py
index a0ab55aa85..5b82f179c4 100644
--- a/lib/ansible/modules/network/a10/a10_server_axapi3.py
+++ b/lib/ansible/modules/network/a10/a10_server_axapi3.py
@@ -108,7 +108,7 @@ def validate_ports(module, ports):
if 'port-number' in item:
try:
item['port-number'] = int(item['port-number'])
- except:
+ except Exception:
module.fail_json(msg="port-number entries in the port definitions must be integers")
else:
module.fail_json(msg="port definitions must define the port-number field")
diff --git a/lib/ansible/modules/network/a10/a10_service_group.py b/lib/ansible/modules/network/a10/a10_service_group.py
index 0bce0345c1..168423bffe 100644
--- a/lib/ansible/modules/network/a10/a10_service_group.py
+++ b/lib/ansible/modules/network/a10/a10_service_group.py
@@ -137,7 +137,7 @@ def validate_servers(module, servers):
if 'port' in item:
try:
item['port'] = int(item['port'])
- except:
+ except Exception:
module.fail_json(msg="server port definitions must be integers")
else:
module.fail_json(msg="server definitions must define the port field")
diff --git a/lib/ansible/modules/network/a10/a10_virtual_server.py b/lib/ansible/modules/network/a10/a10_virtual_server.py
index 02c17ab4a7..d7b2c009cf 100644
--- a/lib/ansible/modules/network/a10/a10_virtual_server.py
+++ b/lib/ansible/modules/network/a10/a10_virtual_server.py
@@ -119,7 +119,7 @@ def validate_ports(module, ports):
if 'port' in item:
try:
item['port'] = int(item['port'])
- except:
+ except Exception:
module.fail_json(msg="port definitions must be integers")
else:
module.fail_json(msg="port definitions must define the port field")
diff --git a/lib/ansible/modules/network/aci/aci_rest.py b/lib/ansible/modules/network/aci/aci_rest.py
index ab9359dfa2..9a5d0c06cb 100644
--- a/lib/ansible/modules/network/aci/aci_rest.py
+++ b/lib/ansible/modules/network/aci/aci_rest.py
@@ -242,7 +242,7 @@ import os
try:
from ansible.module_utils.six.moves.urllib.parse import parse_qsl, urlencode, urlparse, urlunparse
HAS_URLPARSE = True
-except:
+except Exception:
HAS_URLPARSE = False
# Optional, only used for XML payload
@@ -263,7 +263,7 @@ except ImportError:
try:
import yaml
HAS_YAML = True
-except:
+except Exception:
HAS_YAML = False
from ansible.module_utils.basic import AnsibleModule
diff --git a/lib/ansible/modules/network/aos/_aos_asn_pool.py b/lib/ansible/modules/network/aos/_aos_asn_pool.py
index 49ec51daa7..c81fac21e7 100644
--- a/lib/ansible/modules/network/aos/_aos_asn_pool.py
+++ b/lib/ansible/modules/network/aos/_aos_asn_pool.py
@@ -209,7 +209,7 @@ def asn_pool_absent(module, aos, my_pool):
if not module.check_mode:
try:
my_pool.delete()
- except:
+ except Exception:
module.fail_json(msg="An error occurred, while trying to delete the ASN Pool")
module.exit_json(changed=True,
@@ -240,7 +240,7 @@ def asn_pool_present(module, aos, my_pool):
try:
my_new_pool = create_new_asn_pool(my_pool, margs['name'], margs['ranges'])
my_pool = my_new_pool
- except:
+ except Exception:
module.fail_json(msg="An error occurred while trying to create a new ASN Pool ")
module.exit_json(changed=True,
@@ -271,7 +271,7 @@ def asn_pool(module):
try:
aos = get_aos_session(module, margs['session'])
- except:
+ except Exception:
module.fail_json(msg="Unable to login to the AOS server")
item_name = False
@@ -304,7 +304,7 @@ def asn_pool(module):
my_pool = find_collection_item(aos.AsnPools,
item_name=item_name,
item_id=item_id)
- except:
+ except Exception:
module.fail_json(msg="Unable to find the IP Pool based on name or ID, something went wrong")
# ----------------------------------------------------
diff --git a/lib/ansible/modules/network/aos/_aos_blueprint.py b/lib/ansible/modules/network/aos/_aos_blueprint.py
index 6b593bcc0c..25bd868757 100644
--- a/lib/ansible/modules/network/aos/_aos_blueprint.py
+++ b/lib/ansible/modules/network/aos/_aos_blueprint.py
@@ -234,7 +234,7 @@ def aos_blueprint(module):
try:
aos = get_aos_session(module, margs['session'])
- except:
+ except Exception:
module.fail_json(msg="Unable to login to the AOS server")
item_name = False
@@ -253,7 +253,7 @@ def aos_blueprint(module):
my_blueprint = find_collection_item(aos.Blueprints,
item_name=item_name,
item_id=item_id)
- except:
+ except Exception:
module.fail_json(msg="Unable to find the Blueprint based on name or ID, something went wrong")
# ----------------------------------------------------
diff --git a/lib/ansible/modules/network/aos/_aos_blueprint_param.py b/lib/ansible/modules/network/aos/_aos_blueprint_param.py
index 4ad6c6eb52..e1962d1692 100644
--- a/lib/ansible/modules/network/aos/_aos_blueprint_param.py
+++ b/lib/ansible/modules/network/aos/_aos_blueprint_param.py
@@ -207,7 +207,7 @@ def get_collection_from_param_map(module, aos):
try:
param_map = yaml.safe_load(param_map_json)
- except:
+ except Exception:
module.fail_json(msg="Unable to parse param_map information")
else:
@@ -292,7 +292,7 @@ def blueprint_param(module):
# --------------------------------------------------------------------
try:
aos = get_aos_session(module, margs['session'])
- except:
+ except Exception:
module.fail_json(msg="Unable to login to the AOS server")
# --------------------------------------------------------------------
@@ -302,7 +302,7 @@ def blueprint_param(module):
blueprint = find_collection_item(aos.Blueprints,
item_name=margs['blueprint'],
item_id=margs['blueprint'])
- except:
+ except Exception:
module.fail_json(msg="Unable to find the Blueprint based on name or ID, something went wrong")
if blueprint.exists is False:
diff --git a/lib/ansible/modules/network/aos/_aos_blueprint_virtnet.py b/lib/ansible/modules/network/aos/_aos_blueprint_virtnet.py
index a699241093..8814b26f46 100644
--- a/lib/ansible/modules/network/aos/_aos_blueprint_virtnet.py
+++ b/lib/ansible/modules/network/aos/_aos_blueprint_virtnet.py
@@ -143,7 +143,7 @@ def blueprint_virtnet(module):
# --------------------------------------------------------------------
try:
aos = get_aos_session(module, margs['session'])
- except:
+ except Exception:
module.fail_json(msg="Unable to login to the AOS server")
# --------------------------------------------------------------------
@@ -153,7 +153,7 @@ def blueprint_virtnet(module):
blueprint = find_collection_item(aos.Blueprints,
item_name=margs['blueprint'],
item_id=margs['blueprint'])
- except:
+ except Exception:
module.fail_json(msg="Unable to find the Blueprint based on name or ID, something went wrong")
if blueprint.exists is False:
@@ -181,7 +181,7 @@ def blueprint_virtnet(module):
# --------------------------------------------------------------------
try:
virtnet = blueprint.VirtualNetworks[item_name]
- except:
+ except Exception:
module.fail_json(msg="Something went wrong while trying to find Virtual Network %s in blueprint %s"
% (item_name, blueprint.name))
diff --git a/lib/ansible/modules/network/aos/_aos_device.py b/lib/ansible/modules/network/aos/_aos_device.py
index 6413456e75..f726c1f060 100644
--- a/lib/ansible/modules/network/aos/_aos_device.py
+++ b/lib/ansible/modules/network/aos/_aos_device.py
@@ -150,7 +150,7 @@ def aos_device(module):
try:
aos = get_aos_session(module, margs['session'])
- except:
+ except Exception:
module.fail_json(msg="Unable to login to the AOS server")
item_name = False
diff --git a/lib/ansible/modules/network/aos/_aos_external_router.py b/lib/ansible/modules/network/aos/_aos_external_router.py
index 5aa8c1827e..32a7539a1d 100644
--- a/lib/ansible/modules/network/aos/_aos_external_router.py
+++ b/lib/ansible/modules/network/aos/_aos_external_router.py
@@ -188,7 +188,7 @@ def ext_router_absent(module, aos, my_ext_router):
# Add Sleep before delete to workaround a bug in AOS
time.sleep(2)
my_ext_router.delete()
- except:
+ except Exception:
module.fail_json(msg="An error occurred, while trying to delete the External Router")
module.exit_json(changed=True,
@@ -219,7 +219,7 @@ def ext_router_present(module, aos, my_ext_router):
margs['loopback'],
margs['asn'])
my_ext_router = my_new_ext_router
- except:
+ except Exception:
module.fail_json(msg="An error occurred while trying to create a new External Router")
module.exit_json(changed=True,
@@ -271,7 +271,7 @@ def ext_router(module):
try:
aos = get_aos_session(module, margs['session'])
- except:
+ except Exception:
module.fail_json(msg="Unable to login to the AOS server")
item_name = False
@@ -299,7 +299,7 @@ def ext_router(module):
my_ext_router = find_collection_item(aos.ExternalRouters,
item_name=item_name,
item_id=item_id)
- except:
+ except Exception:
module.fail_json(msg="Unable to find the IP Pool based on name or ID, something went wrong")
# ----------------------------------------------------
diff --git a/lib/ansible/modules/network/aos/_aos_ip_pool.py b/lib/ansible/modules/network/aos/_aos_ip_pool.py
index 52104d5a19..d2f504f63d 100644
--- a/lib/ansible/modules/network/aos/_aos_ip_pool.py
+++ b/lib/ansible/modules/network/aos/_aos_ip_pool.py
@@ -218,7 +218,7 @@ def ip_pool_absent(module, aos, my_pool):
if not module.check_mode:
try:
my_pool.delete()
- except:
+ except Exception:
module.fail_json(msg="An error occurred, while trying to delete the IP Pool")
module.exit_json(changed=True,
@@ -240,7 +240,7 @@ def ip_pool_present(module, aos, my_pool):
else:
module.fail_json(msg="Unable to find display_name in 'content', Mandatory")
- except:
+ except Exception:
module.fail_json(msg="Unable to load resource from content, something went wrong")
# if ip_pool doesn't exist already, create a new one
@@ -254,7 +254,7 @@ def ip_pool_present(module, aos, my_pool):
try:
my_new_pool = create_new_ip_pool(my_pool, margs['name'], margs['subnets'])
my_pool = my_new_pool
- except:
+ except Exception:
module.fail_json(msg="An error occurred while trying to create a new IP Pool ")
module.exit_json(changed=True,
@@ -283,7 +283,7 @@ def ip_pool(module):
try:
aos = get_aos_session(module, margs['session'])
- except:
+ except Exception:
module.fail_json(msg="Unable to login to the AOS server")
item_name = False
@@ -311,7 +311,7 @@ def ip_pool(module):
my_pool = find_collection_item(aos.IpPools,
item_name=item_name,
item_id=item_id)
- except:
+ except Exception:
module.fail_json(msg="Unable to find the IP Pool based on name or ID, something went wrong")
# ----------------------------------------------------
diff --git a/lib/ansible/modules/network/aos/_aos_logical_device.py b/lib/ansible/modules/network/aos/_aos_logical_device.py
index 4634ca5380..fb16cc9382 100644
--- a/lib/ansible/modules/network/aos/_aos_logical_device.py
+++ b/lib/ansible/modules/network/aos/_aos_logical_device.py
@@ -158,7 +158,7 @@ def logical_device_absent(module, aos, my_logical_dev):
# Need to way 1sec before a delete to workaround a current limitation in AOS
time.sleep(1)
my_logical_dev.delete()
- except:
+ except Exception:
module.fail_json(msg="An error occurred, while trying to delete the Logical Device")
module.exit_json(changed=True,
@@ -198,7 +198,7 @@ def logical_device(module):
try:
aos = get_aos_session(module, margs['session'])
- except:
+ except Exception:
module.fail_json(msg="Unable to login to the AOS server")
item_name = False
diff --git a/lib/ansible/modules/network/aos/_aos_logical_device_map.py b/lib/ansible/modules/network/aos/_aos_logical_device_map.py
index 500d46de55..bd0b0a2ae8 100644
--- a/lib/ansible/modules/network/aos/_aos_logical_device_map.py
+++ b/lib/ansible/modules/network/aos/_aos_logical_device_map.py
@@ -175,7 +175,7 @@ def logical_device_map_absent(module, aos, my_log_dev_map):
# limitation in AOS
time.sleep(1)
my_log_dev_map.delete()
- except:
+ except Exception:
module.fail_json(msg="An error occurred, while trying to delete the Logical Device Map")
module.exit_json(changed=True,
@@ -217,7 +217,7 @@ def logical_device_map(module):
try:
aos = get_aos_session(module, margs['session'])
- except:
+ except Exception:
module.fail_json(msg="Unable to login to the AOS server")
item_name = False
@@ -245,7 +245,7 @@ def logical_device_map(module):
my_log_dev_map = find_collection_item(aos.LogicalDeviceMaps,
item_name=item_name,
item_id=item_id)
- except:
+ except Exception:
module.fail_json(msg="Unable to find the Logical Device Map based on name or ID, something went wrong")
# ----------------------------------------------------
diff --git a/lib/ansible/modules/network/aos/_aos_rack_type.py b/lib/ansible/modules/network/aos/_aos_rack_type.py
index bacf9d948b..c94a422df2 100644
--- a/lib/ansible/modules/network/aos/_aos_rack_type.py
+++ b/lib/ansible/modules/network/aos/_aos_rack_type.py
@@ -155,7 +155,7 @@ def rack_type_absent(module, aos, my_rack_type):
if not module.check_mode:
try:
my_rack_type.delete()
- except:
+ except Exception:
module.fail_json(msg="An error occurred, while trying to delete the Rack Type")
module.exit_json(changed=True,
@@ -195,7 +195,7 @@ def rack_type(module):
try:
aos = get_aos_session(module, margs['session'])
- except:
+ except Exception:
module.fail_json(msg="Unable to login to the AOS server")
item_name = False
diff --git a/lib/ansible/modules/network/aos/_aos_template.py b/lib/ansible/modules/network/aos/_aos_template.py
index 56b941d1f4..dc5fc6ceb1 100644
--- a/lib/ansible/modules/network/aos/_aos_template.py
+++ b/lib/ansible/modules/network/aos/_aos_template.py
@@ -167,7 +167,7 @@ def template_absent(module, aos, my_template):
# need to way 1sec before delete to workaround a current limitation in AOS
time.sleep(1)
my_template.delete()
- except:
+ except Exception:
module.fail_json(msg="An error occurred, while trying to delete the Template")
module.exit_json(changed=True,
@@ -209,7 +209,7 @@ def aos_template(module):
try:
aos = get_aos_session(module, margs['session'])
- except:
+ except Exception:
module.fail_json(msg="Unable to login to the AOS server")
item_name = False
@@ -237,7 +237,7 @@ def aos_template(module):
my_template = find_collection_item(aos.DesignTemplates,
item_name=item_name,
item_id=item_id)
- except:
+ except Exception:
module.fail_json(msg="Unable to find the IP Pool based on name or ID, something went wrong")
# ----------------------------------------------------
diff --git a/lib/ansible/modules/network/avi/avi_useraccount.py b/lib/ansible/modules/network/avi/avi_useraccount.py
index e97963d35d..08ed87c75d 100644
--- a/lib/ansible/modules/network/avi/avi_useraccount.py
+++ b/lib/ansible/modules/network/avi/avi_useraccount.py
@@ -115,7 +115,7 @@ def main():
token=api_creds.token, port=api_creds.port)
password_changed = True
return ansible_return(module, None, False, req=data)
- except:
+ except Exception:
pass
if not password_changed:
diff --git a/lib/ansible/modules/network/cloudengine/ce_file_copy.py b/lib/ansible/modules/network/cloudengine/ce_file_copy.py
index 451cd1a0d4..199c9b4d8a 100644
--- a/lib/ansible/modules/network/cloudengine/ce_file_copy.py
+++ b/lib/ansible/modules/network/cloudengine/ce_file_copy.py
@@ -285,7 +285,7 @@ class FileCopy(object):
scp = SCPClient(ssh.get_transport())
try:
scp.put(self.local_file, full_remote_path)
- except:
+ except Exception:
time.sleep(10)
file_exists, temp_size = self.remote_file_exists(
dest, self.file_system)
diff --git a/lib/ansible/modules/network/cnos/cnos_backup.py b/lib/ansible/modules/network/cnos/cnos_backup.py
index a303cac9c0..6c28dcf1d0 100644
--- a/lib/ansible/modules/network/cnos/cnos_backup.py
+++ b/lib/ansible/modules/network/cnos/cnos_backup.py
@@ -165,7 +165,7 @@ import os
try:
from ansible.module_utils.network.cnos import cnos
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from ansible.module_utils.basic import AnsibleModule
from collections import defaultdict
diff --git a/lib/ansible/modules/network/cnos/cnos_bgp.py b/lib/ansible/modules/network/cnos/cnos_bgp.py
index 6a100f7785..5c18453e3d 100644
--- a/lib/ansible/modules/network/cnos/cnos_bgp.py
+++ b/lib/ansible/modules/network/cnos/cnos_bgp.py
@@ -323,7 +323,7 @@ import re
try:
from ansible.module_utils.network.cnos import cnos
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from ansible.module_utils.basic import AnsibleModule
from collections import defaultdict
diff --git a/lib/ansible/modules/network/cnos/cnos_conditional_command.py b/lib/ansible/modules/network/cnos/cnos_conditional_command.py
index 52233260a4..3412ddd510 100644
--- a/lib/ansible/modules/network/cnos/cnos_conditional_command.py
+++ b/lib/ansible/modules/network/cnos/cnos_conditional_command.py
@@ -109,7 +109,7 @@ import os
try:
from ansible.module_utils.network.cnos import cnos
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from ansible.module_utils.basic import AnsibleModule
from collections import defaultdict
diff --git a/lib/ansible/modules/network/cnos/cnos_conditional_template.py b/lib/ansible/modules/network/cnos/cnos_conditional_template.py
index 6407fecbb3..c6645706f8 100644
--- a/lib/ansible/modules/network/cnos/cnos_conditional_template.py
+++ b/lib/ansible/modules/network/cnos/cnos_conditional_template.py
@@ -123,7 +123,7 @@ import os
try:
from ansible.module_utils.network.cnos import cnos
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from ansible.module_utils.basic import AnsibleModule
from collections import defaultdict
diff --git a/lib/ansible/modules/network/cnos/cnos_factory.py b/lib/ansible/modules/network/cnos/cnos_factory.py
index dd1cda3737..b22a47b841 100644
--- a/lib/ansible/modules/network/cnos/cnos_factory.py
+++ b/lib/ansible/modules/network/cnos/cnos_factory.py
@@ -75,7 +75,7 @@ import re
try:
from ansible.module_utils.network.cnos import cnos
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from ansible.module_utils.basic import AnsibleModule
from collections import defaultdict
diff --git a/lib/ansible/modules/network/cnos/cnos_image.py b/lib/ansible/modules/network/cnos/cnos_image.py
index fb17b15024..30f1caeda6 100644
--- a/lib/ansible/modules/network/cnos/cnos_image.py
+++ b/lib/ansible/modules/network/cnos/cnos_image.py
@@ -130,7 +130,7 @@ import os
try:
from ansible.module_utils.network.cnos import cnos
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from ansible.module_utils.basic import AnsibleModule
from collections import defaultdict
diff --git a/lib/ansible/modules/network/cnos/cnos_interface.py b/lib/ansible/modules/network/cnos/cnos_interface.py
index c84b400a4d..cee0831535 100644
--- a/lib/ansible/modules/network/cnos/cnos_interface.py
+++ b/lib/ansible/modules/network/cnos/cnos_interface.py
@@ -385,7 +385,7 @@ import re
try:
from ansible.module_utils.network.cnos import cnos
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from ansible.module_utils.basic import AnsibleModule
from collections import defaultdict
diff --git a/lib/ansible/modules/network/cnos/cnos_reload.py b/lib/ansible/modules/network/cnos/cnos_reload.py
index 7f0975906d..cbce25a04a 100644
--- a/lib/ansible/modules/network/cnos/cnos_reload.py
+++ b/lib/ansible/modules/network/cnos/cnos_reload.py
@@ -72,7 +72,7 @@ import re
try:
from ansible.module_utils.network.cnos import cnos
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from ansible.module_utils.basic import AnsibleModule
from collections import defaultdict
diff --git a/lib/ansible/modules/network/cnos/cnos_rollback.py b/lib/ansible/modules/network/cnos/cnos_rollback.py
index 2191ff1624..f0a45615e7 100644
--- a/lib/ansible/modules/network/cnos/cnos_rollback.py
+++ b/lib/ansible/modules/network/cnos/cnos_rollback.py
@@ -166,7 +166,7 @@ import os
try:
from ansible.module_utils.network.cnos import cnos
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from ansible.module_utils.basic import AnsibleModule
from collections import defaultdict
diff --git a/lib/ansible/modules/network/cnos/cnos_save.py b/lib/ansible/modules/network/cnos/cnos_save.py
index 3a29be9d54..299921ed24 100644
--- a/lib/ansible/modules/network/cnos/cnos_save.py
+++ b/lib/ansible/modules/network/cnos/cnos_save.py
@@ -75,7 +75,7 @@ import re
try:
from ansible.module_utils.network.cnos import cnos
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from ansible.module_utils.basic import AnsibleModule
from collections import defaultdict
diff --git a/lib/ansible/modules/network/cnos/cnos_showrun.py b/lib/ansible/modules/network/cnos/cnos_showrun.py
index 35546d555d..ac7e099dec 100644
--- a/lib/ansible/modules/network/cnos/cnos_showrun.py
+++ b/lib/ansible/modules/network/cnos/cnos_showrun.py
@@ -75,7 +75,7 @@ import re
try:
from ansible.module_utils.network.cnos import cnos
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from ansible.module_utils.basic import AnsibleModule
from collections import defaultdict
diff --git a/lib/ansible/modules/network/cnos/cnos_template.py b/lib/ansible/modules/network/cnos/cnos_template.py
index 854bc5a3db..c632f53ea2 100644
--- a/lib/ansible/modules/network/cnos/cnos_template.py
+++ b/lib/ansible/modules/network/cnos/cnos_template.py
@@ -95,7 +95,7 @@ import os
try:
from ansible.module_utils.network.cnos import cnos
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from ansible.module_utils.basic import AnsibleModule
from collections import defaultdict
diff --git a/lib/ansible/modules/network/cnos/cnos_vlag.py b/lib/ansible/modules/network/cnos/cnos_vlag.py
index b8b4729606..e039586b4c 100644
--- a/lib/ansible/modules/network/cnos/cnos_vlag.py
+++ b/lib/ansible/modules/network/cnos/cnos_vlag.py
@@ -223,7 +223,7 @@ import re
try:
from ansible.module_utils.network.cnos import cnos
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
from ansible.module_utils.basic import AnsibleModule
diff --git a/lib/ansible/modules/network/dellos10/dellos10_facts.py b/lib/ansible/modules/network/dellos10/dellos10_facts.py
index 90dd1b5c10..52a7c1cdd6 100644
--- a/lib/ansible/modules/network/dellos10/dellos10_facts.py
+++ b/lib/ansible/modules/network/dellos10/dellos10_facts.py
@@ -351,14 +351,14 @@ class Interfaces(FactsBase):
try:
intf = self.intf_facts[name]
intf['mediatype'] = mediatype
- except:
+ except Exception:
# fanout
for subport in range(1, 5):
name = "ethernet" + sname + ":" + str(subport)
try:
intf = self.intf_facts[name]
intf['mediatype'] = mediatype
- except:
+ except Exception:
# valid case to handle 2x50G
pass
diff --git a/lib/ansible/modules/network/fortimanager/fmgr_device.py b/lib/ansible/modules/network/fortimanager/fmgr_device.py
index 9a9f926ade..99e0704088 100644
--- a/lib/ansible/modules/network/fortimanager/fmgr_device.py
+++ b/lib/ansible/modules/network/fortimanager/fmgr_device.py
@@ -195,7 +195,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg != "NULL" and len(results) == 0:
try:
fmg.logout()
- except:
+ except Exception:
pass
module.fail_json(msg=msg)
@@ -204,7 +204,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg == "NULL":
try:
msg = results[1]['status']['message']
- except:
+ except Exception:
msg = "No status message returned from pyFMG. Possible that this was a GET with a tuple result."
if results[0] not in good_codes:
diff --git a/lib/ansible/modules/network/fortimanager/fmgr_device_config.py b/lib/ansible/modules/network/fortimanager/fmgr_device_config.py
index 0b7dc32101..cc34e958ce 100644
--- a/lib/ansible/modules/network/fortimanager/fmgr_device_config.py
+++ b/lib/ansible/modules/network/fortimanager/fmgr_device_config.py
@@ -192,7 +192,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg != "NULL" and len(results) == 0:
try:
fmg.logout()
- except:
+ except Exception:
pass
module.fail_json(msg=msg)
@@ -201,7 +201,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg == "NULL":
try:
msg = results[1]['status']['message']
- except:
+ except Exception:
msg = "No status message returned from pyFMG. Possible that this was a GET with a tuple result."
if results[0] not in good_codes:
diff --git a/lib/ansible/modules/network/fortimanager/fmgr_device_group.py b/lib/ansible/modules/network/fortimanager/fmgr_device_group.py
index f1e656d916..3756c3e185 100644
--- a/lib/ansible/modules/network/fortimanager/fmgr_device_group.py
+++ b/lib/ansible/modules/network/fortimanager/fmgr_device_group.py
@@ -277,7 +277,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg != "NULL" and len(results) == 0:
try:
fmg.logout()
- except:
+ except Exception:
pass
module.fail_json(msg=msg)
@@ -286,7 +286,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg == "NULL":
try:
msg = results[1]['status']['message']
- except:
+ except Exception:
msg = "No status message returned from pyFMG. Possible that this was a GET with a tuple result."
if results[0] not in good_codes:
diff --git a/lib/ansible/modules/network/fortimanager/fmgr_fwobj_address.py b/lib/ansible/modules/network/fortimanager/fmgr_fwobj_address.py
index 787c556a90..76403712ad 100644
--- a/lib/ansible/modules/network/fortimanager/fmgr_fwobj_address.py
+++ b/lib/ansible/modules/network/fortimanager/fmgr_fwobj_address.py
@@ -476,7 +476,7 @@ def fmgr_fwobj_ipv4(fmg, paramgram):
try:
for member in group_members.split(","):
members.append(member)
- except:
+ except Exception:
pass
datagram["member"] = members
@@ -579,7 +579,7 @@ def fmgr_fwobj_ipv6(fmg, paramgram):
try:
for member in group_members.split(","):
members.append(member)
- except:
+ except Exception:
pass
datagram["member"] = members
@@ -703,7 +703,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg != "NULL" and len(results) == 0:
try:
fmg.logout()
- except:
+ except Exception:
pass
module.fail_json(msg=msg)
@@ -712,7 +712,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg == "NULL":
try:
msg = results[1]['status']['message']
- except:
+ except Exception:
msg = "No status message returned from pyFMG. Possible that this was a GET with a tuple result."
if results[0] not in good_codes:
@@ -791,7 +791,7 @@ def main():
response = fmg.login()
if response[1]['status']['code'] != 0:
module.fail_json(msg="Connection to FortiManager Failed")
- except:
+ except Exception:
module.fail_json(msg="Connection to FortiManager Failed")
else:
# START SESSION LOGIC
diff --git a/lib/ansible/modules/network/fortimanager/fmgr_fwobj_vip.py b/lib/ansible/modules/network/fortimanager/fmgr_fwobj_vip.py
index 65ab2d5c25..8ad130d26e 100644
--- a/lib/ansible/modules/network/fortimanager/fmgr_fwobj_vip.py
+++ b/lib/ansible/modules/network/fortimanager/fmgr_fwobj_vip.py
@@ -1849,7 +1849,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg != "NULL" and len(results) == 0:
try:
fmg.logout()
- except:
+ except Exception:
pass
module.fail_json(msg=msg)
@@ -1858,7 +1858,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg == "NULL":
try:
msg = results[1]['status']['message']
- except:
+ except Exception:
msg = "No status message returned from pyFMG. Possible that this was a GET with a tuple result."
if results[0] not in good_codes:
@@ -2552,13 +2552,13 @@ def main():
override_data = list()
try:
override_data = module.params[list_variable]
- except:
+ except Exception:
pass
try:
if override_data:
del paramgram[list_variable]
paramgram[list_variable] = override_data
- except:
+ except Exception:
pass
# CHECK IF THE HOST/USERNAME/PW EXISTS, AND IF IT DOES, LOGIN.
diff --git a/lib/ansible/modules/network/fortimanager/fmgr_fwpol_ipv4.py b/lib/ansible/modules/network/fortimanager/fmgr_fwpol_ipv4.py
index cdee82865a..1904887559 100644
--- a/lib/ansible/modules/network/fortimanager/fmgr_fwpol_ipv4.py
+++ b/lib/ansible/modules/network/fortimanager/fmgr_fwpol_ipv4.py
@@ -1057,7 +1057,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg != "NULL" and len(results) == 0:
try:
fmg.logout()
- except:
+ except Exception:
pass
module.fail_json(msg=msg)
@@ -1066,7 +1066,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg == "NULL":
try:
msg = results[1]['status']['message']
- except:
+ except Exception:
msg = "No status message returned from pyFMG. Possible that this was a GET with a tuple result."
if results[0] not in good_codes:
@@ -1443,13 +1443,13 @@ def main():
override_data = list()
try:
override_data = module.params[list_variable]
- except:
+ except Exception:
pass
try:
if override_data:
del paramgram[list_variable]
paramgram[list_variable] = override_data
- except:
+ except Exception:
pass
# CHECK IF THE HOST/USERNAME/PW EXISTS, AND IF IT DOES, LOGIN.
@@ -1479,7 +1479,7 @@ def main():
if response[1][0]["policyid"]:
policy_id = response[1][0]["policyid"]
paramgram["policyid"] = policy_id
- except:
+ except Exception:
fmgr_logout(fmg, module, results=response, msg="Couldn't get Policy ID from name, delete failed")
results = fmgr_firewall_policy_addsetdelete(fmg, paramgram)
diff --git a/lib/ansible/modules/network/fortimanager/fmgr_ha.py b/lib/ansible/modules/network/fortimanager/fmgr_ha.py
index 2ea708c932..44bd0ef802 100644
--- a/lib/ansible/modules/network/fortimanager/fmgr_ha.py
+++ b/lib/ansible/modules/network/fortimanager/fmgr_ha.py
@@ -230,7 +230,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg != "NULL" and len(results) == 0:
try:
fmg.logout()
- except:
+ except Exception:
pass
module.fail_json(msg=msg)
@@ -239,7 +239,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg == "NULL":
try:
msg = results[1]['status']['message']
- except:
+ except Exception:
msg = "No status message returned from pyFMG. Possible that this was a GET with a tuple result."
if results[0] not in good_codes:
@@ -374,7 +374,7 @@ def main():
if sn_compare == paramgram["fmgr_ha_peer_sn"]:
paramgram["peer_id"] = peer_loopcount
paramgram["next_peer_id"] = paramgram["peer_id"]
- except:
+ except Exception:
pass
# ADVANCE THE LOOP AND REPEAT UNTIL DONE
peer_loopcount += 1
diff --git a/lib/ansible/modules/network/fortimanager/fmgr_query.py b/lib/ansible/modules/network/fortimanager/fmgr_query.py
index 6562665379..939e22a6a2 100644
--- a/lib/ansible/modules/network/fortimanager/fmgr_query.py
+++ b/lib/ansible/modules/network/fortimanager/fmgr_query.py
@@ -282,7 +282,7 @@ def fmgr_get_cluster_nodes(fmg, paramgram):
try:
returned_nodes = response[1][0]["ha_slave"]
num_of_nodes = len(returned_nodes)
- except:
+ except Exception:
error_msg = {"cluster_status": "MISSING"}
return error_msg
diff --git a/lib/ansible/modules/network/fortimanager/fmgr_secprof_ssl_ssh.py b/lib/ansible/modules/network/fortimanager/fmgr_secprof_ssl_ssh.py
index 92d32d8298..cbdc481d46 100644
--- a/lib/ansible/modules/network/fortimanager/fmgr_secprof_ssl_ssh.py
+++ b/lib/ansible/modules/network/fortimanager/fmgr_secprof_ssl_ssh.py
@@ -770,7 +770,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg != "NULL" and len(results) == 0:
try:
fmg.logout()
- except:
+ except Exception:
pass
module.fail_json(msg=msg)
@@ -779,7 +779,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg == "NULL":
try:
msg = results[1]['status']['message']
- except:
+ except Exception:
msg = "No status message returned from pyFMG. Possible that this was a GET with a tuple result."
if results[0] not in good_codes:
@@ -1056,13 +1056,13 @@ def main():
override_data = list()
try:
override_data = module.params[list_variable]
- except:
+ except Exception:
pass
try:
if override_data:
del paramgram[list_variable]
paramgram[list_variable] = override_data
- except:
+ except Exception:
pass
# CHECK IF THE HOST/USERNAME/PW EXISTS, AND IF IT DOES, LOGIN.
diff --git a/lib/ansible/modules/network/fortimanager/fmgr_secprof_web.py b/lib/ansible/modules/network/fortimanager/fmgr_secprof_web.py
index 1cb261ffec..8fb282b429 100644
--- a/lib/ansible/modules/network/fortimanager/fmgr_secprof_web.py
+++ b/lib/ansible/modules/network/fortimanager/fmgr_secprof_web.py
@@ -855,7 +855,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg != "NULL" and len(results) == 0:
try:
fmg.logout()
- except:
+ except Exception:
pass
module.fail_json(msg=msg)
@@ -864,7 +864,7 @@ def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_
if msg == "NULL":
try:
msg = results[1]['status']['message']
- except:
+ except Exception:
msg = "No status message returned from pyFMG. Possible that this was a GET with a tuple result."
if results[0] not in good_codes:
@@ -1194,13 +1194,13 @@ def main():
override_data = list()
try:
override_data = module.params[list_variable]
- except:
+ except Exception:
pass
try:
if override_data:
del paramgram[list_variable]
paramgram[list_variable] = override_data
- except:
+ except Exception:
pass
# CHECK IF THE HOST/USERNAME/PW EXISTS, AND IF IT DOES, LOGIN.
diff --git a/lib/ansible/modules/network/fortios/fortios_address.py b/lib/ansible/modules/network/fortios/fortios_address.py
index dc9cc5965a..fd5fcbb129 100644
--- a/lib/ansible/modules/network/fortios/fortios_address.py
+++ b/lib/ansible/modules/network/fortios/fortios_address.py
@@ -116,7 +116,7 @@ from ansible.module_utils.basic import AnsibleModule
try:
from netaddr import IPNetwork
HAS_NETADDR = True
-except:
+except Exception:
HAS_NETADDR = False
@@ -169,7 +169,7 @@ def get_formated_ipaddr(input_ip):
else:
ip = IPNetwork(input_ip)
return "%s %s" % (str(ip.ip), str(ip.netmask))
- except:
+ except Exception:
return False
return False
diff --git a/lib/ansible/modules/network/fortios/fortios_config.py b/lib/ansible/modules/network/fortios/fortios_config.py
index 367046740c..400cab4e1d 100644
--- a/lib/ansible/modules/network/fortios/fortios_config.py
+++ b/lib/ansible/modules/network/fortios/fortios_config.py
@@ -82,7 +82,7 @@ try:
from pyFG.fortios import logger
from pyFG.exceptions import CommandExecutionException, FailedCommit, ForcedCommit
HAS_PYFG = True
-except:
+except Exception:
HAS_PYFG = False
@@ -124,7 +124,7 @@ def main():
# connect
try:
f.open()
- except:
+ except Exception:
module.fail_json(msg='Error connecting device')
# get config
@@ -132,7 +132,7 @@ def main():
f.load_config(path=module.params['filter'])
result['running_config'] = f.running_config.to_text()
- except:
+ except Exception:
module.fail_json(msg='Error reading running config')
# backup config
@@ -145,7 +145,7 @@ def main():
try:
conf_str = module.params['src']
f.load_config(in_candidate=True, config_text=conf_str)
- except:
+ except Exception:
module.fail_json(msg="Can't open configuration file, or configuration invalid")
# get updates lines
diff --git a/lib/ansible/modules/network/junos/junos_command.py b/lib/ansible/modules/network/junos/junos_command.py
index 4cb426b255..b01287d6ae 100644
--- a/lib/ansible/modules/network/junos/junos_command.py
+++ b/lib/ansible/modules/network/junos/junos_command.py
@@ -400,7 +400,7 @@ def main():
json_resp = jxmlease.parse(resp)
transformed.append(json_resp)
output.append(json_resp)
- except:
+ except Exception:
raise ValueError(resp)
else:
transformed.append(resp)
diff --git a/lib/ansible/modules/network/netconf/netconf_get.py b/lib/ansible/modules/network/netconf/netconf_get.py
index 823bd87aef..c1fcb20273 100644
--- a/lib/ansible/modules/network/netconf/netconf_get.py
+++ b/lib/ansible/modules/network/netconf/netconf_get.py
@@ -242,7 +242,7 @@ def main():
elif display == 'json':
try:
output = jxmlease.parse(xml_resp)
- except:
+ except Exception:
raise ValueError(xml_resp)
elif display == 'pretty':
output = tostring(response, pretty_print=True)
diff --git a/lib/ansible/modules/network/netconf/netconf_rpc.py b/lib/ansible/modules/network/netconf/netconf_rpc.py
index bfeae9482f..c5399d1c0e 100644
--- a/lib/ansible/modules/network/netconf/netconf_rpc.py
+++ b/lib/ansible/modules/network/netconf/netconf_rpc.py
@@ -182,7 +182,7 @@ def get_xml_request(module, request, xmlns, content):
try:
# trying if content contains dict
content = ast.literal_eval(content)
- except:
+ except Exception:
module.fail_json(msg='unsupported content value `%s`' % content)
if isinstance(content, dict):
@@ -246,7 +246,7 @@ def main():
elif display == 'json':
try:
output = jxmlease.parse(xml_resp)
- except:
+ except Exception:
raise ValueError(xml_resp)
elif display == 'pretty':
output = tostring(response, pretty_print=True)
diff --git a/lib/ansible/modules/network/nxos/nxos_file_copy.py b/lib/ansible/modules/network/nxos/nxos_file_copy.py
index 678aa65389..2c1491e9fd 100644
--- a/lib/ansible/modules/network/nxos/nxos_file_copy.py
+++ b/lib/ansible/modules/network/nxos/nxos_file_copy.py
@@ -268,7 +268,7 @@ def transfer_file_to_device(module, dest):
scp = SCPClient(ssh.get_transport())
try:
scp.put(module.params['local_file'], full_remote_path)
- except:
+ except Exception:
time.sleep(10)
temp_size = verify_remote_file_exists(
module, dest, file_system=module.params['file_system'])
diff --git a/lib/ansible/modules/network/nxos/nxos_snapshot.py b/lib/ansible/modules/network/nxos/nxos_snapshot.py
index ad21459c24..3393087777 100644
--- a/lib/ansible/modules/network/nxos/nxos_snapshot.py
+++ b/lib/ansible/modules/network/nxos/nxos_snapshot.py
@@ -298,7 +298,7 @@ def write_on_file(content, filename, module):
report = open(filepath, 'w')
report.write(content)
report.close()
- except:
+ except Exception:
module.fail_json(msg="Error while writing on file.")
return filepath
diff --git a/lib/ansible/modules/network/ordnance/ordnance_facts.py b/lib/ansible/modules/network/ordnance/ordnance_facts.py
index 4d620cbdad..6c2ab681c7 100644
--- a/lib/ansible/modules/network/ordnance/ordnance_facts.py
+++ b/lib/ansible/modules/network/ordnance/ordnance_facts.py
@@ -112,7 +112,7 @@ class FactsBase(object):
def run(self, cmd):
try:
return self.module.cli(cmd)[0]
- except:
+ except Exception:
self.failed_commands.append(cmd)
diff --git a/lib/ansible/modules/network/panos/panos_check.py b/lib/ansible/modules/network/panos/panos_check.py
index 00dba29b45..09a3228650 100644
--- a/lib/ansible/modules/network/panos/panos_check.py
+++ b/lib/ansible/modules/network/panos/panos_check.py
@@ -123,7 +123,7 @@ def main():
while True:
try:
xapi.op(cmd="show jobs all", cmd_xml=True)
- except:
+ except Exception:
pass
else:
jobs = xapi.element_root.findall('.//job')
diff --git a/lib/ansible/modules/notification/bearychat.py b/lib/ansible/modules/notification/bearychat.py
index eb03f204a3..cf57154405 100644
--- a/lib/ansible/modules/notification/bearychat.py
+++ b/lib/ansible/modules/notification/bearychat.py
@@ -93,7 +93,7 @@ msg:
try:
from ansible.module_utils.six.moves.urllib.parse import urlparse, urlunparse
HAS_URLPARSE = True
-except:
+except Exception:
HAS_URLPARSE = False
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import fetch_url
diff --git a/lib/ansible/modules/notification/mail.py b/lib/ansible/modules/notification/mail.py
index af5be66ea4..56094b8db3 100644
--- a/lib/ansible/modules/notification/mail.py
+++ b/lib/ansible/modules/notification/mail.py
@@ -275,7 +275,7 @@ def main():
if secure == 'always':
module.fail_json(rc=1, msg='Unable to start an encrypted session to %s:%s: %s' %
(host, port, to_native(e)), exception=traceback.format_exc())
- except:
+ except Exception:
pass
if not secure_state:
diff --git a/lib/ansible/modules/notification/nexmo.py b/lib/ansible/modules/notification/nexmo.py
index c2397f65ba..fe776673b2 100644
--- a/lib/ansible/modules/notification/nexmo.py
+++ b/lib/ansible/modules/notification/nexmo.py
@@ -95,7 +95,7 @@ def send_msg(module):
try:
responses[number] = json.load(response)
- except:
+ except Exception:
failed.append(number)
responses[number] = dict(failed=True)
else:
diff --git a/lib/ansible/modules/notification/pushover.py b/lib/ansible/modules/notification/pushover.py
index 33c775e1d0..d1d2d18b71 100644
--- a/lib/ansible/modules/notification/pushover.py
+++ b/lib/ansible/modules/notification/pushover.py
@@ -100,7 +100,7 @@ def main():
msg_object = Pushover(module, module.params['user_key'], module.params['app_token'])
try:
response = msg_object.run(module.params['pri'], module.params['msg'])
- except:
+ except Exception:
module.fail_json(msg='Unable to send msg via pushover')
module.exit_json(msg='message sent successfully: %s' % response, changed=False)
diff --git a/lib/ansible/modules/notification/syslogger.py b/lib/ansible/modules/notification/syslogger.py
index 1ec1c3493a..6f944cf885 100644
--- a/lib/ansible/modules/notification/syslogger.py
+++ b/lib/ansible/modules/notification/syslogger.py
@@ -159,7 +159,7 @@ def run_module():
syslog.closelog()
result['changed'] = True
- except:
+ except Exception:
module.fail_json(error='Failed to write to syslog', **result)
module.exit_json(**result)
diff --git a/lib/ansible/modules/packaging/os/apt.py b/lib/ansible/modules/packaging/os/apt.py
index 42332077c6..ee76ec5331 100644
--- a/lib/ansible/modules/packaging/os/apt.py
+++ b/lib/ansible/modules/packaging/os/apt.py
@@ -357,7 +357,7 @@ class PolicyRcD(object):
if self.backup_dir:
try:
shutil.move('/usr/sbin/policy-rc.d', self.backup_dir)
- except:
+ except Exception:
self.m.fail_json(msg="Fail to move /usr/sbin/policy-rc.d to %s" % self.backup_dir)
# we write /usr/sbin/policy-rc.d so it always exit with code policy_rc_d
@@ -366,7 +366,7 @@ class PolicyRcD(object):
policy_rc_d.write('#!/bin/sh\nexit %d\n' % self.m.params['policy_rc_d'])
os.chmod('/usr/sbin/policy-rc.d', 0o0755)
- except:
+ except Exception:
self.m.fail_json(msg="Failed to create or chmod /usr/sbin/policy-rc.d")
def __exit__(self, type, value, traceback):
@@ -385,7 +385,7 @@ class PolicyRcD(object):
shutil.move(os.path.join(self.backup_dir, 'policy-rc.d'),
'/usr/sbin/policy-rc.d')
os.rmdir(self.tmpdir_name)
- except:
+ except Exception:
self.m.fail_json(msg="Fail to move back %s to /usr/sbin/policy-rc.d"
% os.path.join(self.backup_dir, 'policy-rc.d'))
else:
@@ -393,7 +393,7 @@ class PolicyRcD(object):
# we just remove the file
try:
os.remove('/usr/sbin/policy-rc.d')
- except:
+ except Exception:
self.m.fail_json(msg="Fail to remove /usr/sbin/policy-rc.d (after package manipulation)")
diff --git a/lib/ansible/modules/packaging/os/sorcery.py b/lib/ansible/modules/packaging/os/sorcery.py
index bb9968fb91..3f869c7659 100644
--- a/lib/ansible/modules/packaging/os/sorcery.py
+++ b/lib/ansible/modules/packaging/os/sorcery.py
@@ -198,7 +198,7 @@ def codex_fresh(codex, module):
try:
mtime = os.stat(lastupdate_path).st_mtime
- except:
+ except Exception:
return False
lastupdate_ts = datetime.datetime.fromtimestamp(mtime)
@@ -472,7 +472,7 @@ def manage_spells(module):
try:
queue_size = os.stat(sorcery_queue).st_size
- except:
+ except Exception:
module.fail_json(msg="failed to read the update queue")
if queue_size != 0:
diff --git a/lib/ansible/modules/packaging/os/zypper.py b/lib/ansible/modules/packaging/os/zypper.py
index 5c084a5723..368d5ec2d3 100644
--- a/lib/ansible/modules/packaging/os/zypper.py
+++ b/lib/ansible/modules/packaging/os/zypper.py
@@ -240,7 +240,7 @@ def split_name_version(name):
if version is None:
version = ''
return prefix, name, version
- except:
+ except Exception:
return prefix, name, ''
diff --git a/lib/ansible/modules/remote_management/foreman/_foreman.py b/lib/ansible/modules/remote_management/foreman/_foreman.py
index 8231b2334e..874d101724 100644
--- a/lib/ansible/modules/remote_management/foreman/_foreman.py
+++ b/lib/ansible/modules/remote_management/foreman/_foreman.py
@@ -76,7 +76,7 @@ try:
from nailgun import entities
from nailgun.config import ServerConfig
HAS_NAILGUN_PACKAGE = True
-except:
+except Exception:
HAS_NAILGUN_PACKAGE = False
from ansible.module_utils.basic import AnsibleModule
diff --git a/lib/ansible/modules/remote_management/foreman/_katello.py b/lib/ansible/modules/remote_management/foreman/_katello.py
index bb668c4e35..aec9264bbc 100644
--- a/lib/ansible/modules/remote_management/foreman/_katello.py
+++ b/lib/ansible/modules/remote_management/foreman/_katello.py
@@ -232,7 +232,7 @@ try:
from nailgun import entities, entity_fields, entity_mixins
from nailgun.config import ServerConfig
HAS_NAILGUN_PACKAGE = True
-except:
+except Exception:
HAS_NAILGUN_PACKAGE = False
from ansible.module_utils.basic import AnsibleModule
diff --git a/lib/ansible/modules/remote_management/hpilo/hpilo_facts.py b/lib/ansible/modules/remote_management/hpilo/hpilo_facts.py
index 1369575b87..d1fe6e4f28 100644
--- a/lib/ansible/modules/remote_management/hpilo/hpilo_facts.py
+++ b/lib/ansible/modules/remote_management/hpilo/hpilo_facts.py
@@ -138,7 +138,7 @@ warnings.simplefilter('ignore')
def parse_flat_interface(entry, non_numeric='hw_eth_ilo'):
try:
factname = 'hw_eth' + str(int(entry['Port']) - 1)
- except:
+ except Exception:
factname = non_numeric
facts = {
@@ -193,7 +193,7 @@ def main():
if name.startswith('Port'):
try:
factname = 'hw_eth' + str(int(value) - 1)
- except:
+ except Exception:
factname = 'hw_eth_ilo'
elif name.startswith('MAC'):
facts[factname] = {
@@ -208,7 +208,7 @@ def main():
if name.startswith('Port'):
try:
factname = 'hw_iscsi' + str(int(value) - 1)
- except:
+ except Exception:
factname = 'hw_iscsi_ilo'
elif name.startswith('MAC'):
facts[factname] = {
diff --git a/lib/ansible/modules/remote_management/imc/imc_rest.py b/lib/ansible/modules/remote_management/imc/imc_rest.py
index e0cb231f46..3cd7ea5103 100644
--- a/lib/ansible/modules/remote_management/imc/imc_rest.py
+++ b/lib/ansible/modules/remote_management/imc/imc_rest.py
@@ -376,7 +376,7 @@ def main():
# Store cookie for future requests
try:
cookie = result['aaaLogin']['attributes']['outCookie']
- except:
+ except Exception:
module.fail_json(msg='Could not find cookie in output', **result)
# If we would not log out properly, we run out of sessions quickly
diff --git a/lib/ansible/modules/remote_management/ucs/ucs_managed_objects.py b/lib/ansible/modules/remote_management/ucs/ucs_managed_objects.py
index a05e48475f..fead566c82 100644
--- a/lib/ansible/modules/remote_management/ucs/ucs_managed_objects.py
+++ b/lib/ansible/modules/remote_management/ucs/ucs_managed_objects.py
@@ -164,7 +164,7 @@ RETURN = r'''
try:
from importlib import import_module
HAS_IMPORT_MODULE = True
-except:
+except Exception:
HAS_IMPORT_MODULE = False
from copy import deepcopy
diff --git a/lib/ansible/modules/source_control/bzr.py b/lib/ansible/modules/source_control/bzr.py
index 3bb5d814e3..88d8c9cb71 100644
--- a/lib/ansible/modules/source_control/bzr.py
+++ b/lib/ansible/modules/source_control/bzr.py
@@ -89,7 +89,7 @@ class Bzr(object):
dest_dirname = os.path.dirname(self.dest)
try:
os.makedirs(dest_dirname)
- except:
+ except Exception:
pass
if self.version.lower() != 'head':
args_list = ["branch", "-r", self.version, self.parent, self.dest]
diff --git a/lib/ansible/modules/source_control/git.py b/lib/ansible/modules/source_control/git.py
index f2b62b96d8..dca4ba8247 100644
--- a/lib/ansible/modules/source_control/git.py
+++ b/lib/ansible/modules/source_control/git.py
@@ -300,7 +300,7 @@ def head_splitter(headfile, remote, module=None, fail_on_error=False):
f = open(headfile, 'r')
rawdata = f.readline()
f.close()
- except:
+ except Exception:
if fail_on_error and module:
module.fail_json(msg="Unable to read %s" % headfile)
if rawdata:
@@ -310,7 +310,7 @@ def head_splitter(headfile, remote, module=None, fail_on_error=False):
newref = refparts[-1]
nrefparts = newref.split('/', 2)
res = nrefparts[-1].rstrip('\n')
- except:
+ except Exception:
if fail_on_error and module:
module.fail_json(msg="Unable to split head from '%s'" % rawdata)
return res
@@ -448,7 +448,7 @@ def clone(git_path, module, repo, dest, remote, depth, version, bare,
dest_dirname = os.path.dirname(dest)
try:
os.makedirs(dest_dirname)
- except:
+ except Exception:
pass
cmd = [git_path, 'clone']
@@ -1065,7 +1065,7 @@ def main():
module.fail_json(msg="umask must be defined as a quoted octal integer")
try:
umask = int(umask, 8)
- except:
+ except Exception:
module.fail_json(msg="umask must be an octal integer",
details=str(sys.exc_info()[1]))
os.umask(umask)
diff --git a/lib/ansible/modules/source_control/gitlab_group.py b/lib/ansible/modules/source_control/gitlab_group.py
index 697ed5367a..17f8606812 100644
--- a/lib/ansible/modules/source_control/gitlab_group.py
+++ b/lib/ansible/modules/source_control/gitlab_group.py
@@ -90,7 +90,7 @@ RETURN = '''# '''
try:
import gitlab
HAS_GITLAB_PACKAGE = True
-except:
+except Exception:
HAS_GITLAB_PACKAGE = False
from ansible.module_utils.basic import AnsibleModule
diff --git a/lib/ansible/modules/source_control/gitlab_project.py b/lib/ansible/modules/source_control/gitlab_project.py
index 0cb91ae466..bff74eb2ae 100644
--- a/lib/ansible/modules/source_control/gitlab_project.py
+++ b/lib/ansible/modules/source_control/gitlab_project.py
@@ -143,7 +143,7 @@ RETURN = '''# '''
try:
import gitlab
HAS_GITLAB_PACKAGE = True
-except:
+except Exception:
HAS_GITLAB_PACKAGE = False
from ansible.module_utils.basic import AnsibleModule
diff --git a/lib/ansible/modules/source_control/gitlab_user.py b/lib/ansible/modules/source_control/gitlab_user.py
index d83d80c649..9430daec7a 100644
--- a/lib/ansible/modules/source_control/gitlab_user.py
+++ b/lib/ansible/modules/source_control/gitlab_user.py
@@ -124,7 +124,7 @@ RETURN = '''# '''
try:
import gitlab
HAS_GITLAB_PACKAGE = True
-except:
+except Exception:
HAS_GITLAB_PACKAGE = False
from ansible.module_utils.basic import AnsibleModule
diff --git a/lib/ansible/modules/storage/emc/emc_vnx_sg_member.py b/lib/ansible/modules/storage/emc/emc_vnx_sg_member.py
index 540a7dac24..a0a748f9c5 100644
--- a/lib/ansible/modules/storage/emc/emc_vnx_sg_member.py
+++ b/lib/ansible/modules/storage/emc/emc_vnx_sg_member.py
@@ -88,7 +88,7 @@ try:
from storops.exception import VNXCredentialError, VNXStorageGroupError, \
VNXAluAlreadyAttachedError, VNXAttachAluError, VNXDetachAluNotFoundError
HAS_LIB = True
-except:
+except Exception:
HAS_LIB = False
diff --git a/lib/ansible/modules/storage/infinidat/infini_export.py b/lib/ansible/modules/storage/infinidat/infini_export.py
index 7edb89a865..5ad35f6ae3 100644
--- a/lib/ansible/modules/storage/infinidat/infini_export.py
+++ b/lib/ansible/modules/storage/infinidat/infini_export.py
@@ -102,7 +102,7 @@ def get_filesystem(module, system):
"""Return Filesystem or None"""
try:
return system.filesystems.get(name=module.params['filesystem'])
- except:
+ except Exception:
return None
diff --git a/lib/ansible/modules/storage/infinidat/infini_export_client.py b/lib/ansible/modules/storage/infinidat/infini_export_client.py
index d1e3d6a5a0..68292427b8 100644
--- a/lib/ansible/modules/storage/infinidat/infini_export_client.py
+++ b/lib/ansible/modules/storage/infinidat/infini_export_client.py
@@ -104,7 +104,7 @@ def get_export(module, system):
try:
export = system.exports.get(export_path=module.params['export'])
- except:
+ except Exception:
module.fail_json(msg="Export with export path {} not found".format(module.params['export']))
return export
diff --git a/lib/ansible/modules/storage/infinidat/infini_fs.py b/lib/ansible/modules/storage/infinidat/infini_fs.py
index aeddc2dca0..421421cd52 100644
--- a/lib/ansible/modules/storage/infinidat/infini_fs.py
+++ b/lib/ansible/modules/storage/infinidat/infini_fs.py
@@ -76,7 +76,7 @@ def get_pool(module, system):
"""Return Pool or None"""
try:
return system.pools.get(name=module.params['pool'])
- except:
+ except Exception:
return None
@@ -85,7 +85,7 @@ def get_filesystem(module, system):
"""Return Filesystem or None"""
try:
return system.filesystems.get(name=module.params['name'])
- except:
+ except Exception:
return None
@@ -143,7 +143,7 @@ def main():
if module.params['size']:
try:
Capacity(module.params['size'])
- except:
+ except Exception:
module.fail_json(msg='size (Physical Capacity) should be defined in MB, GB, TB or PB units')
state = module.params['state']
diff --git a/lib/ansible/modules/storage/infinidat/infini_host.py b/lib/ansible/modules/storage/infinidat/infini_host.py
index 516f2303f9..6ab09839bf 100644
--- a/lib/ansible/modules/storage/infinidat/infini_host.py
+++ b/lib/ansible/modules/storage/infinidat/infini_host.py
@@ -143,7 +143,7 @@ def main():
if module.params['volume']:
try:
system.volumes.get(name=module.params['volume'])
- except:
+ except Exception:
module.fail_json(msg='Volume {} not found'.format(module.params['volume']))
if host and state == 'present':
diff --git a/lib/ansible/modules/storage/infinidat/infini_pool.py b/lib/ansible/modules/storage/infinidat/infini_pool.py
index 0c7ecabe05..2fdbfa34d9 100644
--- a/lib/ansible/modules/storage/infinidat/infini_pool.py
+++ b/lib/ansible/modules/storage/infinidat/infini_pool.py
@@ -95,7 +95,7 @@ def get_pool(module, system):
"""Return Pool on None"""
try:
return system.pools.get(name=module.params['name'])
- except:
+ except Exception:
return None
@@ -185,13 +185,13 @@ def main():
if module.params['size']:
try:
Capacity(module.params['size'])
- except:
+ except Exception:
module.fail_json(msg='size (Physical Capacity) should be defined in MB, GB, TB or PB units')
if module.params['vsize']:
try:
Capacity(module.params['vsize'])
- except:
+ except Exception:
module.fail_json(msg='vsize (Virtual Capacity) should be defined in MB, GB, TB or PB units')
state = module.params['state']
diff --git a/lib/ansible/modules/storage/infinidat/infini_vol.py b/lib/ansible/modules/storage/infinidat/infini_vol.py
index c83a7a6767..b4ef41e3aa 100644
--- a/lib/ansible/modules/storage/infinidat/infini_vol.py
+++ b/lib/ansible/modules/storage/infinidat/infini_vol.py
@@ -76,7 +76,7 @@ def get_pool(module, system):
"""Return Pool or None"""
try:
return system.pools.get(name=module.params['pool'])
- except:
+ except Exception:
return None
@@ -85,7 +85,7 @@ def get_volume(module, system):
"""Return Volume or None"""
try:
return system.volumes.get(name=module.params['name'])
- except:
+ except Exception:
return None
@@ -141,7 +141,7 @@ def main():
if module.params['size']:
try:
Capacity(module.params['size'])
- except:
+ except Exception:
module.fail_json(msg='size (Physical Capacity) should be defined in MB, GB, TB or PB units')
state = module.params['state']
diff --git a/lib/ansible/modules/storage/netapp/na_elementsw_backup.py b/lib/ansible/modules/storage/netapp/na_elementsw_backup.py
index ae5ac4e48e..9f3647f895 100644
--- a/lib/ansible/modules/storage/netapp/na_elementsw_backup.py
+++ b/lib/ansible/modules/storage/netapp/na_elementsw_backup.py
@@ -125,7 +125,7 @@ import time
HAS_SF_SDK = netapp_utils.has_sf_sdk()
try:
import solidfire.common
-except:
+except Exception:
HAS_SF_SDK = False
diff --git a/lib/ansible/modules/storage/netapp/na_elementsw_cluster_pair.py b/lib/ansible/modules/storage/netapp/na_elementsw_cluster_pair.py
index 4f5d8a9540..998f20abe2 100644
--- a/lib/ansible/modules/storage/netapp/na_elementsw_cluster_pair.py
+++ b/lib/ansible/modules/storage/netapp/na_elementsw_cluster_pair.py
@@ -82,7 +82,7 @@ from ansible.module_utils.netapp_module import NetAppModule
HAS_SF_SDK = netapp_utils.has_sf_sdk()
try:
import solidfire.common
-except:
+except Exception:
HAS_SF_SDK = False
diff --git a/lib/ansible/modules/storage/netapp/na_elementsw_ldap.py b/lib/ansible/modules/storage/netapp/na_elementsw_ldap.py
index d895feee61..a5dbb7a00a 100644
--- a/lib/ansible/modules/storage/netapp/na_elementsw_ldap.py
+++ b/lib/ansible/modules/storage/netapp/na_elementsw_ldap.py
@@ -108,7 +108,7 @@ import ansible.module_utils.netapp as netapp_utils
HAS_SF_SDK = netapp_utils.has_sf_sdk()
try:
import solidfire.common
-except:
+except Exception:
HAS_SF_SDK = False
diff --git a/lib/ansible/modules/storage/netapp/na_elementsw_network_interfaces.py b/lib/ansible/modules/storage/netapp/na_elementsw_network_interfaces.py
index 5feaa35b88..87b47c6273 100644
--- a/lib/ansible/modules/storage/netapp/na_elementsw_network_interfaces.py
+++ b/lib/ansible/modules/storage/netapp/na_elementsw_network_interfaces.py
@@ -165,7 +165,7 @@ HAS_SF_SDK = netapp_utils.has_sf_sdk()
try:
from solidfire.models import Network, NetworkConfig
HAS_SF_SDK = True
-except:
+except Exception:
HAS_SF_SDK = False
diff --git a/lib/ansible/modules/storage/netapp/na_elementsw_snapshot_schedule.py b/lib/ansible/modules/storage/netapp/na_elementsw_snapshot_schedule.py
index d76a6e5d0b..e22b7b143a 100644
--- a/lib/ansible/modules/storage/netapp/na_elementsw_snapshot_schedule.py
+++ b/lib/ansible/modules/storage/netapp/na_elementsw_snapshot_schedule.py
@@ -187,7 +187,7 @@ HAS_SF_SDK = netapp_utils.has_sf_sdk()
try:
from solidfire.custom.models import DaysOfWeekFrequency, Weekday, DaysOfMonthFrequency
from solidfire.common import ApiServerError
-except:
+except Exception:
HAS_SF_SDK = False
diff --git a/lib/ansible/modules/storage/netapp/na_elementsw_vlan.py b/lib/ansible/modules/storage/netapp/na_elementsw_vlan.py
index 6eff5178fd..f6959692fd 100644
--- a/lib/ansible/modules/storage/netapp/na_elementsw_vlan.py
+++ b/lib/ansible/modules/storage/netapp/na_elementsw_vlan.py
@@ -112,7 +112,7 @@ from ansible.module_utils.netapp_elementsw_module import NaElementSWModule
HAS_SF_SDK = netapp_utils.has_sf_sdk()
try:
import solidfire.common
-except:
+except Exception:
HAS_SF_SDK = False
diff --git a/lib/ansible/modules/storage/netapp/na_elementsw_volume.py b/lib/ansible/modules/storage/netapp/na_elementsw_volume.py
index 2854f85a2c..a6f77783a7 100644
--- a/lib/ansible/modules/storage/netapp/na_elementsw_volume.py
+++ b/lib/ansible/modules/storage/netapp/na_elementsw_volume.py
@@ -147,7 +147,7 @@ from ansible.module_utils.netapp_elementsw_module import NaElementSWModule
HAS_SF_SDK = netapp_utils.has_sf_sdk()
try:
import solidfire.common
-except:
+except Exception:
HAS_SF_SDK = False
diff --git a/lib/ansible/modules/storage/netapp/na_elementsw_volume_pair.py b/lib/ansible/modules/storage/netapp/na_elementsw_volume_pair.py
index 0806cc6a93..0cd48d6a77 100644
--- a/lib/ansible/modules/storage/netapp/na_elementsw_volume_pair.py
+++ b/lib/ansible/modules/storage/netapp/na_elementsw_volume_pair.py
@@ -116,7 +116,7 @@ from ansible.module_utils.netapp_module import NetAppModule
HAS_SF_SDK = netapp_utils.has_sf_sdk()
try:
import solidfire.common
-except:
+except Exception:
HAS_SF_SDK = False
diff --git a/lib/ansible/modules/storage/netapp/na_ontap_volume_clone.py b/lib/ansible/modules/storage/netapp/na_ontap_volume_clone.py
index b7d9d44d9d..486501c794 100644
--- a/lib/ansible/modules/storage/netapp/na_ontap_volume_clone.py
+++ b/lib/ansible/modules/storage/netapp/na_ontap_volume_clone.py
@@ -150,7 +150,7 @@ class NetAppOntapVolumeClone(object):
clone_obj.add_new_child("volume", self.volume)
try:
results = self.server.invoke_successfully(clone_obj, True)
- except:
+ except Exception:
return False
attributes = results.get_child_by_name('attributes')
info = attributes.get_child_by_name('volume-clone-info')
diff --git a/lib/ansible/modules/storage/netapp/netapp_e_amg_role.py b/lib/ansible/modules/storage/netapp/netapp_e_amg_role.py
index 9370dbcedf..5860a04fa7 100644
--- a/lib/ansible/modules/storage/netapp/netapp_e_amg_role.py
+++ b/lib/ansible/modules/storage/netapp/netapp_e_amg_role.py
@@ -114,7 +114,7 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
data = json.loads(raw_data)
else:
raw_data = None
- except:
+ except Exception:
if ignore_errors:
pass
else:
@@ -138,7 +138,7 @@ def has_match(module, ssid, api_url, api_pwd, api_usr, body, name):
try:
amg_rc, amgs = request(url, url_username=api_usr, url_password=api_pwd,
headers=HEADERS)
- except:
+ except Exception:
module.fail_json(msg="Failed to find AMGs on storage array. Id [%s]" % (ssid))
for amg in amgs:
diff --git a/lib/ansible/modules/storage/netapp/netapp_e_amg_sync.py b/lib/ansible/modules/storage/netapp/netapp_e_amg_sync.py
index bd58913ced..777282c336 100644
--- a/lib/ansible/modules/storage/netapp/netapp_e_amg_sync.py
+++ b/lib/ansible/modules/storage/netapp/netapp_e_amg_sync.py
@@ -143,7 +143,7 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
data = json.loads(raw_data)
else:
raw_data = None
- except:
+ except Exception:
if ignore_errors:
pass
else:
diff --git a/lib/ansible/modules/storage/netapp/netapp_e_auditlog.py b/lib/ansible/modules/storage/netapp/netapp_e_auditlog.py
index ff21bb0913..90a942e4c4 100644
--- a/lib/ansible/modules/storage/netapp/netapp_e_auditlog.py
+++ b/lib/ansible/modules/storage/netapp/netapp_e_auditlog.py
@@ -110,7 +110,7 @@ from ansible.module_utils._text import to_native
try:
from urlparse import urlparse, urlunparse
-except:
+except Exception:
from urllib.parse import urlparse, urlunparse
diff --git a/lib/ansible/modules/storage/netapp/netapp_e_auth.py b/lib/ansible/modules/storage/netapp/netapp_e_auth.py
index fa1417a794..a41decbf32 100644
--- a/lib/ansible/modules/storage/netapp/netapp_e_auth.py
+++ b/lib/ansible/modules/storage/netapp/netapp_e_auth.py
@@ -120,7 +120,7 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
data = json.loads(raw_data)
else:
raw_data = None
- except:
+ except Exception:
if ignore_errors:
pass
else:
@@ -207,7 +207,7 @@ def set_password(module, ssid, api_url, user, pwd, current_password=None, new_pa
try:
rc, data = request(url, method='POST', data=post_body, headers=HEADERS, url_username=user, url_password=pwd,
validate_certs=module.validate_certs)
- except:
+ except Exception:
# TODO(lorenp): Resolve ignored rc, data
module.fail_json(msg="Wrong or no admin password supplied. Please update your playbook and try again")
diff --git a/lib/ansible/modules/storage/netapp/netapp_e_facts.py b/lib/ansible/modules/storage/netapp/netapp_e_facts.py
index ff5ea2fc13..8ad6aadba7 100644
--- a/lib/ansible/modules/storage/netapp/netapp_e_facts.py
+++ b/lib/ansible/modules/storage/netapp/netapp_e_facts.py
@@ -89,7 +89,7 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
data = json.loads(raw_data)
else:
data = None
- except:
+ except Exception:
if ignore_errors:
pass
else:
diff --git a/lib/ansible/modules/storage/netapp/netapp_e_flashcache.py b/lib/ansible/modules/storage/netapp/netapp_e_flashcache.py
index e8af86ffee..5ec29578f8 100644
--- a/lib/ansible/modules/storage/netapp/netapp_e_flashcache.py
+++ b/lib/ansible/modules/storage/netapp/netapp_e_flashcache.py
@@ -118,7 +118,7 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
data = json.loads(raw_data)
else:
raw_data = None
- except:
+ except Exception:
if ignore_errors:
pass
else:
diff --git a/lib/ansible/modules/storage/netapp/netapp_e_hostgroup.py b/lib/ansible/modules/storage/netapp/netapp_e_hostgroup.py
index 231705b1b6..370417ea43 100644
--- a/lib/ansible/modules/storage/netapp/netapp_e_hostgroup.py
+++ b/lib/ansible/modules/storage/netapp/netapp_e_hostgroup.py
@@ -150,7 +150,7 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
data = json.loads(raw_data)
else:
raw_data = None
- except:
+ except Exception:
if ignore_errors:
pass
else:
diff --git a/lib/ansible/modules/storage/netapp/netapp_e_snapshot_group.py b/lib/ansible/modules/storage/netapp/netapp_e_snapshot_group.py
index 0be1240fed..e1f16aed27 100644
--- a/lib/ansible/modules/storage/netapp/netapp_e_snapshot_group.py
+++ b/lib/ansible/modules/storage/netapp/netapp_e_snapshot_group.py
@@ -159,7 +159,7 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
data = json.loads(raw_data)
else:
raw_data = None
- except:
+ except Exception:
if ignore_errors:
pass
else:
diff --git a/lib/ansible/modules/storage/netapp/netapp_e_snapshot_images.py b/lib/ansible/modules/storage/netapp/netapp_e_snapshot_images.py
index 634e8ca465..c9e35f9dee 100644
--- a/lib/ansible/modules/storage/netapp/netapp_e_snapshot_images.py
+++ b/lib/ansible/modules/storage/netapp/netapp_e_snapshot_images.py
@@ -106,7 +106,7 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
data = json.loads(raw_data)
else:
raw_data = None
- except:
+ except Exception:
if ignore_errors:
pass
else:
diff --git a/lib/ansible/modules/storage/netapp/netapp_e_snapshot_volume.py b/lib/ansible/modules/storage/netapp/netapp_e_snapshot_volume.py
index 768ad99f9a..d4cf471afc 100644
--- a/lib/ansible/modules/storage/netapp/netapp_e_snapshot_volume.py
+++ b/lib/ansible/modules/storage/netapp/netapp_e_snapshot_volume.py
@@ -133,7 +133,7 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
data = json.loads(raw_data)
else:
raw_data = None
- except:
+ except Exception:
if ignore_errors:
pass
else:
diff --git a/lib/ansible/modules/storage/netapp/netapp_e_storage_system.py b/lib/ansible/modules/storage/netapp/netapp_e_storage_system.py
index 5dbec3bdb6..cd1ac979e1 100644
--- a/lib/ansible/modules/storage/netapp/netapp_e_storage_system.py
+++ b/lib/ansible/modules/storage/netapp/netapp_e_storage_system.py
@@ -119,7 +119,7 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
data = json.loads(raw_data)
else:
raw_data = None
- except:
+ except Exception:
if ignore_errors:
pass
else:
diff --git a/lib/ansible/modules/storage/purestorage/purefa_dns.py b/lib/ansible/modules/storage/purestorage/purefa_dns.py
index f74baed47f..71175607d7 100644
--- a/lib/ansible/modules/storage/purestorage/purefa_dns.py
+++ b/lib/ansible/modules/storage/purestorage/purefa_dns.py
@@ -81,7 +81,7 @@ def delete_dns(module, array):
try:
array.set_dns(domain='', nameservers=[])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Delete DNS settigs failed')
module.exit_json(changed=changed)
@@ -95,7 +95,7 @@ def create_dns(module, array):
array.set_dns(domain=module.params['domain'],
nameservers=module.params['nameservers'][0:3])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Set DNS settings failed: Check configuration')
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefa_ds.py b/lib/ansible/modules/storage/purestorage/purefa_ds.py
index 1e326fb28b..37ebaff57e 100644
--- a/lib/ansible/modules/storage/purestorage/purefa_ds.py
+++ b/lib/ansible/modules/storage/purestorage/purefa_ds.py
@@ -158,7 +158,7 @@ def enable_ds(module, array):
try:
array.enable_directory_service()
changed = True
- except:
+ except Exception:
module.fail_json(msg='Enable Directory Service failed: Check Configuration')
module.exit_json(changed=changed)
@@ -170,7 +170,7 @@ def disable_ds(module, array):
try:
array.disable_directory_service()
changed = True
- except:
+ except Exception:
module.fail_json(msg='Disable Directory Service failed')
module.exit_json(changed=changed)
@@ -190,7 +190,7 @@ def delete_ds(module, array):
array_admin_group="",
certificate="")
changed = True
- except:
+ except Exception:
module.fail_json(msg='Delete Directory Service failed')
module.exit_json(changed=changed)
@@ -215,7 +215,7 @@ def create_ds(module, array):
array_admin_group=module.params['aa_group'])
array.set_directory_service(enabled=module.params['enable'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Create Directory Service failed: Check configuration')
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefa_hg.py b/lib/ansible/modules/storage/purestorage/purefa_hg.py
index 983a887765..ce48f31526 100644
--- a/lib/ansible/modules/storage/purestorage/purefa_hg.py
+++ b/lib/ansible/modules/storage/purestorage/purefa_hg.py
@@ -125,7 +125,7 @@ def make_hostgroup(module, array):
try:
array.create_hgroup(module.params['hostgroup'])
- except:
+ except Exception:
changed = False
if module.params['host']:
array.set_hgroup(module.params['hostgroup'], hostlist=module.params['host'])
@@ -146,7 +146,7 @@ def update_hostgroup(module, array):
try:
array.set_hgroup(module.params['hostgroup'], addhostlist=new_hosts)
changed = True
- except:
+ except Exception:
module.fail_josn(msg='Failed to add host(s) to hostgroup')
if module.params['volume']:
if volumes:
@@ -156,14 +156,14 @@ def update_hostgroup(module, array):
try:
array.connect_hgroup(module.params['hostgroup'], cvol)
changed = True
- except:
+ except Exception:
changed = False
else:
for cvol in module.params['volume']:
try:
array.connect_hgroup(module.params['hostgroup'], cvol)
changed = True
- except:
+ except Exception:
changed = False
else:
if module.params['host']:
@@ -172,7 +172,7 @@ def update_hostgroup(module, array):
try:
array.set_hgroup(module.params['hostgroup'], remhostlist=old_hosts)
changed = True
- except:
+ except Exception:
changed = False
if module.params['volume']:
old_volumes = list(set(module.params['volume']).difference(set([vol['name'] for vol in volumes])))
@@ -180,7 +180,7 @@ def update_hostgroup(module, array):
try:
array.disconnect_hgroup(module.params['hostgroup'], cvol)
changed = True
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
@@ -193,18 +193,18 @@ def delete_hostgroup(module, array):
for vol in vols:
try:
array.disconnect_hgroup(module.params['hostgroup'], vol["vol"])
- except:
+ except Exception:
changed = False
host = array.get_hgroup(module.params['hostgroup'])
try:
array.set_hgroup(module.params['hostgroup'], remhostlist=host['hosts'])
try:
array.delete_hgroup(module.params['hostgroup'])
- except:
+ except Exception:
changed = False
- except:
+ except Exception:
changed = False
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
@@ -231,14 +231,14 @@ def main():
try:
for hst in module.params['host']:
array.get_host(hst)
- except:
+ except Exception:
module.fail_json(msg='Host {0} not found'.format(hst))
if module.params['volume']:
try:
for vol in module.params['volume']:
array.get_volume(vol)
- except:
+ except Exception:
module.fail_json(msg='Volume {0} not found'.format(vol))
if hostgroup and state == 'present':
diff --git a/lib/ansible/modules/storage/purestorage/purefa_host.py b/lib/ansible/modules/storage/purestorage/purefa_host.py
index 389780b486..07510a6ecb 100644
--- a/lib/ansible/modules/storage/purestorage/purefa_host.py
+++ b/lib/ansible/modules/storage/purestorage/purefa_host.py
@@ -159,21 +159,21 @@ def _set_host_initiators(module, array):
try:
array.set_host(module.params['host'],
nqnlist=module.params['nqn'])
- except:
+ except Exception:
module.fail_json(msg='Setting of NVMeF NQN failed.')
if module.params['protocol'] in ['iscsi', 'mixed']:
if module.params['iqn']:
try:
array.set_host(module.params['host'],
iqnlist=module.params['iqn'])
- except:
+ except Exception:
module.fail_json(msg='Setting of iSCSI IQN failed.')
if module.params['protocol'] in ['fc', 'mixed']:
if module.params['wwns']:
try:
array.set_host(module.params['host'],
wwnlist=module.params['wwns'])
- except:
+ except Exception:
module.fail_json(msg='Setting of FC WWNs failed.')
@@ -184,21 +184,21 @@ def _update_host_initiators(module, array):
try:
array.set_host(module.params['host'],
nqnlist=module.params['nqn'])
- except:
+ except Exception:
module.fail_json(msg='Change of NVMeF NQN failed.')
if module.params['protocol'] in ['iscsi', 'mixed']:
if module.params['iqn']:
try:
array.set_host(module.params['host'],
iqnlist=module.params['iqn'])
- except:
+ except Exception:
module.fail_json(msg='Change of iSCSI IQN failed.')
if module.params['protocol'] in ['fc', 'mixed']:
if module.params['wwns']:
try:
array.set_host(module.params['host'],
addwwnlist=module.params['wwns'])
- except:
+ except Exception:
module.fail_json(msg='FC WWN additiona failed.')
@@ -211,7 +211,7 @@ def _connect_new_volume(module, array, answer=False):
module.params['volume'],
lun=module.params['lun'])
answer = True
- except:
+ except Exception:
module.fail_json(msg='LUN ID {0} invalid. Check for duplicate LUN IDs.'.format(module.params['lun']))
else:
array.connect_host(module.params['host'], module.params['volume'])
@@ -260,7 +260,7 @@ def make_host(module, array):
try:
array.create_host(module.params['host'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Host {0} creation failed.'.format(module.params['host']))
try:
_set_host_initiators(module, array)
@@ -274,7 +274,7 @@ def make_host(module, array):
lun=module.params['lun'])
else:
array.connect_host(module.params['host'], module.params['volume'])
- except:
+ except Exception:
module.fail_json(msg='Host {0} configuration failed.'.format(module.params['host']))
module.exit_json(changed=changed)
@@ -303,7 +303,7 @@ def delete_host(module, array):
array.disconnect_host(module.params['host'], vol["vol"])
array.delete_host(module.params['host'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Host {0} deletion failed'.format(module.params['host']))
module.exit_json(changed=changed)
@@ -341,7 +341,7 @@ def main():
if module.params['volume']:
try:
array.get_volume(module.params['volume'])
- except:
+ except Exception:
module.fail_json(msg='Volume {} not found'.format(module.params['volume']))
if host is None and state == 'present':
diff --git a/lib/ansible/modules/storage/purestorage/purefa_ntp.py b/lib/ansible/modules/storage/purestorage/purefa_ntp.py
index 906c3bd0e2..48fb33695b 100644
--- a/lib/ansible/modules/storage/purestorage/purefa_ntp.py
+++ b/lib/ansible/modules/storage/purestorage/purefa_ntp.py
@@ -79,7 +79,7 @@ def delete_ntp(module, array):
try:
array.set(ntpserver=[])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Deletion of NTP servers failed')
module.exit_json(changed=changed)
@@ -92,7 +92,7 @@ def create_ntp(module, array):
try:
array.set(ntpserver=module.params['ntp_servers'][0:4])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Update of NTP servers failed')
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefa_pg.py b/lib/ansible/modules/storage/purestorage/purefa_pg.py
index 9a7445adae..b62b989ae6 100644
--- a/lib/ansible/modules/storage/purestorage/purefa_pg.py
+++ b/lib/ansible/modules/storage/purestorage/purefa_pg.py
@@ -174,36 +174,36 @@ def make_pgroup(module, array):
if set(module.params['target'][0:4]).issubset(connected_arrays):
try:
array.create_pgroup(module.params['pgroup'], targetlist=[module.params['target'][0:4]])
- except:
+ except Exception:
module.fail_json(msg='Creation of replicated pgroup {0} failed.'.format(module.params['pgroup']))
else:
module.fail_json(msg='Target arrays {0} not connected to source array.'.format(module.params['target']))
else:
try:
array.create_pgroup(module.params['pgroup'])
- except:
+ except Exception:
module.fail_json(msg='Creation of pgroup {0} failed.'.format(module.params['pgroup']))
try:
if module.params['target']:
array.set_pgroup(module.params['pgroup'], replicate_enabled=module.params['enabled'])
else:
array.set_pgroup(module.params['pgroup'], snap_enabled=module.params['enabled'])
- except:
+ except Exception:
module.fail_json(msg='Enabling pgroup {0} failed.'.format(module.params['pgroup']))
if module.params['volume']:
try:
array.set_pgroup(module.params['pgroup'], vollist=module.params['volume'])
- except:
+ except Exception:
module.fail_json(msg='Adding volumes to pgroup {0} failed.'.format(module.params['pgroup']))
if module.params['host']:
try:
array.set_pgroup(module.params['pgroup'], hostlist=module.params['host'])
- except:
+ except Exception:
module.fail_json(msg='Adding hosts to pgroup {0} failed.'.format(module.params['pgroup']))
if module.params['hostgroup']:
try:
array.set_pgroup(module.params['pgroup'], hgrouplist=module.params['hostgroup'])
- except:
+ except Exception:
module.fail_json(msg='Adding hostgroups to pgroup {0} failed.'.format(module.params['pgroup']))
changed = True
module.exit_json(changed=changed)
@@ -220,20 +220,20 @@ def update_pgroup(module, array):
try:
array.set_pgroup(module.params['pgroup'], targetlist=[module.params['target'][0:4]])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Changing targets for pgroup {0} failed.'.format(module.params['pgroup']))
if module.params['target'] and module.params['enabled'] != get_pgroup_sched(module, array)['replicate_enabled']:
try:
array.set_pgroup(module.params['pgroup'], replicate_enabled=module.params['enabled'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Changing enabled status of pgroup {0} failed.'.format(module.params['pgroup']))
elif not module.params['target'] and module.params['enabled'] != get_pgroup_sched(module, array)['snap_enabled']:
try:
array.set_pgroup(module.params['pgroup'], snap_enabled=module.params['enabled'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Changing enabled status of pgroup {0} failed.'.format(module.params['pgroup']))
if module.params['volume'] and get_pgroup(module, array)['hosts'] is None and get_pgroup(module, array)['hgroups'] is None:
@@ -241,14 +241,14 @@ def update_pgroup(module, array):
try:
array.set_pgroup(module.params['pgroup'], vollist=module.params['volume'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Adding volumes to pgroup {0} failed.'.format(module.params['pgroup']))
else:
if not all(x in get_pgroup(module, array)['volumes'] for x in module.params['volume']):
try:
array.set_pgroup(module.params['pgroup'], vollist=module.params['volume'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Changing volumes in pgroup {0} failed.'.format(module.params['pgroup']))
if module.params['host'] and get_pgroup(module, array)['volumes'] is None and get_pgroup(module, array)['hgroups'] is None:
@@ -256,14 +256,14 @@ def update_pgroup(module, array):
try:
array.set_pgroup(module.params['pgroup'], hostlist=module.params['host'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Adding hosts to pgroup {0} failed.'.format(module.params['pgroup']))
else:
if not all(x in get_pgroup(module, array)['hosts'] for x in module.params['host']):
try:
array.set_pgroup(module.params['pgroup'], hostlist=module.params['host'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Changing hosts in pgroup {0} failed.'.format(module.params['pgroup']))
if module.params['hostgroup'] and get_pgroup(module, array)['hosts'] is None and get_pgroup(module, array)['volumes'] is None:
@@ -271,14 +271,14 @@ def update_pgroup(module, array):
try:
array.set_pgroup(module.params['pgroup'], hgrouplist=module.params['hostgroup'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Adding hostgroups to pgroup {0} failed.'.format(module.params['pgroup']))
else:
if not all(x in get_pgroup(module, array)['hgroups'] for x in module.params['hostgroup']):
try:
array.set_pgroup(module.params['pgroup'], hgrouplist=module.params['hostgroup'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Changing hostgroups in pgroup {0} failed.'.format(module.params['pgroup']))
module.exit_json(changed=changed)
@@ -319,14 +319,14 @@ def main():
try:
for hst in module.params['host']:
array.get_host(hst)
- except:
+ except Exception:
module.fail_json(msg='Host {} not found'.format(hst))
if module.params['hostgroup']:
try:
for hstg in module.params['hostgroup']:
array.get_hgroup(hstg)
- except:
+ except Exception:
module.fail_json(msg='Hostgroup {} not found'.format(hstg))
if pgroup and state == 'present':
diff --git a/lib/ansible/modules/storage/purestorage/purefa_pgsnap.py b/lib/ansible/modules/storage/purestorage/purefa_pgsnap.py
index 62ad8ed42e..22817fda0f 100644
--- a/lib/ansible/modules/storage/purestorage/purefa_pgsnap.py
+++ b/lib/ansible/modules/storage/purestorage/purefa_pgsnap.py
@@ -112,7 +112,7 @@ def get_pgroup(module, array):
"""Return Protection Group or None"""
try:
return array.get_pgroup(module.params['name'])
- except:
+ except Exception:
return None
@@ -123,7 +123,7 @@ def get_pgroupvolume(module, array):
for volume in pgroup['volumes']:
if volume == module.params['restore']:
return volume
- except:
+ except Exception:
return None
@@ -134,7 +134,7 @@ def get_rpgsnapshot(module, array):
for snap in array.list_volumes(snap='true'):
if snap['name'] == snapname:
return snapname
- except:
+ except Exception:
return None
@@ -145,7 +145,7 @@ def get_pgsnapshot(module, array):
for snap in array.get_pgroup(module.params['name'], snap='true'):
if snap['name'] == snapname:
return snapname
- except:
+ except Exception:
return None
@@ -157,7 +157,7 @@ def create_pgsnapshot(module, array):
snap=True,
apply_retention=True)
changed = True
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
@@ -168,7 +168,7 @@ def restore_pgsnapvolume(module, array):
try:
array.copy_volume(volume, module.params['target'], overwrite=module.params['overwrite'])
changed = True
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
@@ -189,9 +189,9 @@ def delete_pgsnapshot(module, array):
try:
array.eradicate_pgroup(snapname)
changed = True
- except:
+ except Exception:
changed = False
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefa_ra.py b/lib/ansible/modules/storage/purestorage/purefa_ra.py
index d13d6b44de..bf5cee5666 100644
--- a/lib/ansible/modules/storage/purestorage/purefa_ra.py
+++ b/lib/ansible/modules/storage/purestorage/purefa_ra.py
@@ -65,14 +65,14 @@ def enable_ra(module, array):
ra_facts['fa_ra'] = {'name': ra_data['name'],
'port': ra_data['port']}
changed = True
- except:
+ except Exception:
module.fail_json(msg='Enabling Remote Assist failed')
else:
try:
ra_data = array.get_remote_assist_status()
ra_facts['fa_ra'] = {'name': ra_data['name'],
'port': ra_data['port']}
- except:
+ except Exception:
module.fail_json(msg='Getting Remote Assist failed')
module.exit_json(changed=changed, ansible_facts=ra_facts)
@@ -84,7 +84,7 @@ def disable_ra(module, array):
try:
array.disable_remote_assist()
changed = True
- except:
+ except Exception:
module.fail_json(msg='Disabling Remote Assist failed')
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefa_snap.py b/lib/ansible/modules/storage/purestorage/purefa_snap.py
index 8accb45903..5737b85e55 100644
--- a/lib/ansible/modules/storage/purestorage/purefa_snap.py
+++ b/lib/ansible/modules/storage/purestorage/purefa_snap.py
@@ -107,7 +107,7 @@ def get_volume(module, array):
"""Return Volume or None"""
try:
return array.get_volume(module.params['name'])
- except:
+ except Exception:
return None
@@ -115,7 +115,7 @@ def get_target(module, array):
"""Return Volume or None"""
try:
return array.get_volume(module.params['target'])
- except:
+ except Exception:
return None
@@ -126,7 +126,7 @@ def get_snapshot(module, array):
for s in array.get_volume(module.params['name'], snap='true'):
if s['name'] == snapname:
return snapname
- except:
+ except Exception:
return None
@@ -136,7 +136,7 @@ def create_snapshot(module, array):
if not module.check_mode:
try:
array.create_snapshot(module.params['name'], suffix=module.params['suffix'])
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
@@ -177,9 +177,9 @@ def delete_snapshot(module, array):
if module.params['eradicate']:
try:
array.eradicate_volume(snapname)
- except:
+ except Exception:
changed = False
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefa_volume.py b/lib/ansible/modules/storage/purestorage/purefa_volume.py
index 545f6bff35..25c91472e1 100644
--- a/lib/ansible/modules/storage/purestorage/purefa_volume.py
+++ b/lib/ansible/modules/storage/purestorage/purefa_volume.py
@@ -135,7 +135,7 @@ def get_volume(module, array):
"""Return Volume or None"""
try:
return array.get_volume(module.params['name'])
- except:
+ except Exception:
return None
@@ -146,7 +146,7 @@ def get_destroyed_volume(module, array):
return True
else:
return False
- except:
+ except Exception:
return False
@@ -154,7 +154,7 @@ def get_target(module, array):
"""Return Volume or None"""
try:
return array.get_volume(module.params['target'])
- except:
+ except Exception:
return None
@@ -167,7 +167,7 @@ def create_volume(module, array):
array.create_volume(module.params['name'], module.params['size'],
bandwidth_limit=module.params['qos'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Volume {0} creation failed.'.format(module.params['name']))
else:
module.fail_json(msg='QoS value {0} out of range.'.format(module.params['qos']))
@@ -175,7 +175,7 @@ def create_volume(module, array):
try:
array.create_volume(module.params['name'], module.params['size'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Volume {0} creation failed.'.format(module.params['name']))
module.exit_json(changed=changed)
@@ -192,7 +192,7 @@ def copy_from_volume(module, array):
array.copy_volume(module.params['name'],
module.params['target'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Copy volume {0} to volume {1} failed.'.format(module.params['name'],
module.params['target']))
elif tgt is not None and module.params['overwrite']:
@@ -201,7 +201,7 @@ def copy_from_volume(module, array):
module.params['target'],
overwrite=module.params['overwrite'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Copy volume {0} to volume {1} failed.'.format(module.params['name'],
module.params['target']))
@@ -221,7 +221,7 @@ def update_volume(module, array):
try:
array.extend_volume(module.params['name'], module.params['size'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Volume {0} resize failed.'.format(module.params['name']))
if module.params['qos']:
if human_to_bytes(module.params['qos']) != vol_qos['bandwidth_limit']:
@@ -230,7 +230,7 @@ def update_volume(module, array):
array.set_volume(module.params['name'],
bandwidth_limit=module.params['qos'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Volume {0} QoS change failed.'.format(module.params['name']))
else:
module.fail_json(msg='QoS value {0} out of range. Check documentation.'.format(module.params['qos']))
@@ -247,10 +247,10 @@ def delete_volume(module, array):
if module.params['eradicate']:
try:
array.eradicate_volume(module.params['name'])
- except:
+ except Exception:
module.fail_json(msg='Eradicate volume {0} failed.'.format(module.params['name']))
changed = True
- except:
+ except Exception:
module.fail_json(msg='Delete volume {0} failed.'.format(module.params['name']))
module.exit_json(changed=changed)
@@ -261,7 +261,7 @@ def eradicate_volume(module, array):
try:
array.eradicate_volume(module.params['name'])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Eradication of volume {0} failed'.format(module.params['name']))
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefb_bucket.py b/lib/ansible/modules/storage/purestorage/purefb_bucket.py
index 6cc5804a41..3b521de0d9 100644
--- a/lib/ansible/modules/storage/purestorage/purefb_bucket.py
+++ b/lib/ansible/modules/storage/purestorage/purefb_bucket.py
@@ -124,7 +124,7 @@ def create_bucket(module, blade):
attr.account = Reference(name=module.params['account'])
blade.buckets.create_buckets(names=[module.params['name']], account=attr)
changed = True
- except:
+ except Exception:
module.fail_json(msg='Object Store Bucket {0}: Creation failed'.format(module.params['name']))
module.exit_json(changed=changed)
@@ -140,9 +140,9 @@ def delete_bucket(module, blade):
try:
blade.buckets.delete_buckets(names=[module.params['name']])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Object Store Bucket {0}: Eradication failed'.format(module.params['name']))
- except:
+ except Exception:
module.fail_json(msg='Object Store Bucket {0}: Deletion failed'.format(module.params['name']))
module.exit_json(changed=changed)
@@ -154,7 +154,7 @@ def recover_bucket(module, blade):
blade.buckets.update_buckets(names=[module.params['name']],
destroyed=Bucket(destroyed=False))
changed = True
- except:
+ except Exception:
module.fail_json(msg='Object Store Bucket {0}: Recovery failed'.format(module.params['name']))
module.exit_json(changed=changed)
@@ -165,7 +165,7 @@ def eradicate_bucket(module, blade):
try:
blade.buckets.delete_buckets(names=[module.params['name']])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Object Store Bucket {0}: Eradication failed'.format(module.params['name']))
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefb_dsrole.py b/lib/ansible/modules/storage/purestorage/purefb_dsrole.py
index 98c59e44b3..209fa42baf 100644
--- a/lib/ansible/modules/storage/purestorage/purefb_dsrole.py
+++ b/lib/ansible/modules/storage/purestorage/purefb_dsrole.py
@@ -100,7 +100,7 @@ def update_role(module, blade):
blade.directory_services.update_directory_services_roles(names=[module.params['role']],
directory_service_role=role)
changed = True
- except:
+ except Exception:
module.fail_json(msg='Update Directory Service Role {0} failed'.format(module.params['role']))
module.exit_json(changed=changed)
@@ -114,7 +114,7 @@ def delete_role(module, blade):
blade.directory_services.update_directory_services_roles(names=[module.params['role']],
directory_service_role=role)
changed = True
- except:
+ except Exception:
module.fail_json(msg='Delete Directory Service Role {0} failed'.format(module.params['role']))
module.exit_json(changed=changed)
@@ -128,7 +128,7 @@ def create_role(module, blade):
blade.directory_services.update_directory_services_roles(names=[module.params['role']],
directory_service_role=role)
changed = True
- except:
+ except Exception:
module.fail_json(msg='Create Directory Service Role {0} failed: Check configuration'.format(module.params['role']))
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefb_fs.py b/lib/ansible/modules/storage/purestorage/purefb_fs.py
index 8addc539bd..c44328f24a 100644
--- a/lib/ansible/modules/storage/purestorage/purefb_fs.py
+++ b/lib/ansible/modules/storage/purestorage/purefb_fs.py
@@ -160,7 +160,7 @@ def get_fs(module, blade):
try:
res = blade.file_systems.list_file_systems(names=fs)
return res.items[0]
- except:
+ except Exception:
return None
@@ -196,7 +196,7 @@ def create_fs(module, blade):
)
blade.file_systems.create_file_systems(fs_obj)
changed = True
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
@@ -257,7 +257,7 @@ def modify_fs(module, blade):
n_attr = FileSystem(**attr)
try:
blade.file_systems.update_file_systems(name=module.params['name'], attributes=n_attr)
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
@@ -277,9 +277,9 @@ def delete_fs(module, blade):
try:
blade.file_systems.delete_file_systems(module.params['name'])
changed = True
- except:
+ except Exception:
changed = False
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
@@ -290,7 +290,7 @@ def eradicate_fs(module, blade):
try:
blade.file_systems.delete_file_systems(module.params['name'])
changed = True
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefb_network.py b/lib/ansible/modules/storage/purestorage/purefb_network.py
index 406a6a9a55..5ffa2ec3ff 100644
--- a/lib/ansible/modules/storage/purestorage/purefb_network.py
+++ b/lib/ansible/modules/storage/purestorage/purefb_network.py
@@ -102,7 +102,7 @@ def get_iface(module, blade):
try:
res = blade.network_interfaces.list_network_interfaces(names=iface)
return res.items[0]
- except:
+ except Exception:
return None
@@ -121,7 +121,7 @@ def create_iface(module, blade):
)
)
changed = True
- except:
+ except Exception:
module.fail_json(msg='Interface creation failed. Check valid subnet exists for IP address {0}'.format(module.params['address']))
changed = False
module.exit_json(changed=changed)
@@ -138,7 +138,7 @@ def modify_iface(module, blade):
blade.network_interfaces.update_network_interfaces(names=iface_new,
network_interface=NetworkInterface(address=module.params['address']))
changed = True
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
@@ -150,7 +150,7 @@ def delete_iface(module, blade):
try:
blade.network_interfaces.delete_network_interfaces(names=iface)
changed = True
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefb_s3acc.py b/lib/ansible/modules/storage/purestorage/purefb_s3acc.py
index 6136e91b7d..112675c7ee 100644
--- a/lib/ansible/modules/storage/purestorage/purefb_s3acc.py
+++ b/lib/ansible/modules/storage/purestorage/purefb_s3acc.py
@@ -81,7 +81,7 @@ def create_s3acc(module, blade):
try:
blade.object_store_accounts.create_object_store_accounts(names=[module.params['name']])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Object Store Account {0}: Creation failed'.format(module.params['name']))
module.exit_json(changed=changed)
@@ -96,7 +96,7 @@ def delete_s3acc(module, blade):
try:
blade.object_store_accounts.delete_object_store_accounts(names=[module.params['name']])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Object Store Account {0}: Deletion failed'.format(module.params['name']))
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefb_s3user.py b/lib/ansible/modules/storage/purestorage/purefb_s3user.py
index ac272c3504..900340bc74 100644
--- a/lib/ansible/modules/storage/purestorage/purefb_s3user.py
+++ b/lib/ansible/modules/storage/purestorage/purefb_s3user.py
@@ -113,7 +113,7 @@ def update_s3user(module, blade):
s3user_facts['fb_s3user'] = {'user': user,
'access_key': result.items[0].secret_access_key,
'access_id': result.items[0].name}
- except:
+ except Exception:
delete_s3user(module, blade)
module.fail_json(msg='Object Store User {0}: Creation failed'.format(user))
changed = True
@@ -134,11 +134,11 @@ def create_s3user(module, blade):
s3user_facts['fb_s3user'] = {'user': user,
'access_key': result.items[0].secret_access_key,
'access_id': result.items[0].name}
- except:
+ except Exception:
delete_s3user(module, blade)
module.fail_json(msg='Object Store User {0}: Creation failed'.format(user))
changed = True
- except:
+ except Exception:
module.fail_json(msg='Object Store User {0}: Creation failed'.format(user))
module.exit_json(changed=changed, ansible_facts=s3user_facts)
@@ -150,7 +150,7 @@ def delete_s3user(module, blade):
try:
blade.object_store_users.delete_object_store_users(names=[user])
changed = True
- except:
+ except Exception:
module.fail_json(msg='Object Store Account {0}: Deletion failed'.format(module.params['name']))
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefb_snap.py b/lib/ansible/modules/storage/purestorage/purefb_snap.py
index 6de8104f05..88e43ea29f 100644
--- a/lib/ansible/modules/storage/purestorage/purefb_snap.py
+++ b/lib/ansible/modules/storage/purestorage/purefb_snap.py
@@ -99,7 +99,7 @@ def get_fs(module, blade):
try:
res = blade.file_systems.list_file_systems(names=fs)
return res.items[0]
- except:
+ except Exception:
return None
@@ -109,7 +109,7 @@ def get_fssnapshot(module, blade):
filt = 'source=\'' + module.params['name'] + '\' and suffix=\'' + module.params['suffix'] + '\''
res = blade.file_system_snapshots.list_file_system_snapshots(filter=filt)
return res.items[0]
- except:
+ except Exception:
return None
@@ -121,7 +121,7 @@ def create_snapshot(module, blade):
try:
blade.file_system_snapshots.create_file_system_snapshots(sources=source, suffix=SnapshotSuffix(module.params['suffix']))
changed = True
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
@@ -134,7 +134,7 @@ def recover_snapshot(module, blade):
try:
blade.file_system_snapshots.update_file_system_snapshots(name=snapname, attributes=new_attr)
changed = True
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
@@ -157,9 +157,9 @@ def delete_snapshot(module, blade):
try:
blade.file_system_snapshots.delete_file_system_snapshots(name=snapname)
changed = True
- except:
+ except Exception:
changed = False
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
@@ -171,7 +171,7 @@ def eradicate_snapshot(module, blade):
try:
blade.file_system_snapshots.delete_file_system_snapshots(name=snapname)
changed = True
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/storage/purestorage/purefb_subnet.py b/lib/ansible/modules/storage/purestorage/purefb_subnet.py
index 2be5173824..2d6093389a 100644
--- a/lib/ansible/modules/storage/purestorage/purefb_subnet.py
+++ b/lib/ansible/modules/storage/purestorage/purefb_subnet.py
@@ -118,7 +118,7 @@ def get_subnet(module, blade):
try:
res = blade.subnets.list_subnets(names=subnet)
return res.items[0]
- except:
+ except Exception:
return None
@@ -136,7 +136,7 @@ def create_subnet(module, blade):
)
)
changed = True
- except:
+ except Exception:
module.fail_json(msg='Failed to create subnet {0}. Confirm supplied parameters'.format(module.params['name']))
module.exit_json(changed=changed)
@@ -153,7 +153,7 @@ def modify_subnet(module, blade):
blade.subnets.update_subnets(names=subnet_new,
subnet=Subnet(prefix=module.params['prefix']))
changed = True
- except:
+ except Exception:
module.fail_json(msg='Failed to change subnet {0} prefix to {1}'.format(module.params['name'],
module.params['prefix']))
if module.params['vlan']:
@@ -162,7 +162,7 @@ def modify_subnet(module, blade):
blade.subnets.update_subnets(names=subnet_new,
subnet=Subnet(vlan=module.params['vlan']))
changed = True
- except:
+ except Exception:
module.fail_json(msg='Failed to change subnet {0} VLAN to {1}'.format(module.params['name'],
module.params['vlan']))
if module.params['gateway']:
@@ -171,7 +171,7 @@ def modify_subnet(module, blade):
blade.subnets.update_subnets(names=subnet_new,
subnet=Subnet(gateway=module.params['gateway']))
changed = True
- except:
+ except Exception:
module.fail_json(msg='Failed to change subnet {0} gateway to {1}'.format(module.params['name'],
module.params['gateway']))
if module.params['mtu']:
@@ -180,7 +180,7 @@ def modify_subnet(module, blade):
blade.subnets.update_subnets(names=subnet_new,
subnet=Subnet(mtu=module.params['mtu']))
changed = True
- except:
+ except Exception:
module.fail_json(msg='Failed to change subnet {0} MTU to {1}'.format(module.params['name'],
module.params['mtu']))
module.exit_json(changed=changed)
@@ -193,7 +193,7 @@ def delete_subnet(module, blade):
try:
blade.subnets.delete_subnets(names=subnet)
changed = True
- except:
+ except Exception:
changed = False
module.exit_json(changed=changed)
diff --git a/lib/ansible/modules/system/capabilities.py b/lib/ansible/modules/system/capabilities.py
index 022a751029..38064229b7 100644
--- a/lib/ansible/modules/system/capabilities.py
+++ b/lib/ansible/modules/system/capabilities.py
@@ -145,7 +145,7 @@ class CapabilitiesModule(object):
while opind == -1:
opind = cap.find(OPS[i])
i += 1
- except:
+ except Exception:
if op_required:
self.module.fail_json(msg="Couldn't find operator (one of: %s)" % str(OPS))
else:
diff --git a/lib/ansible/modules/system/cron.py b/lib/ansible/modules/system/cron.py
index e7d3fc9b3d..7b31f3bc11 100644
--- a/lib/ansible/modules/system/cron.py
+++ b/lib/ansible/modules/system/cron.py
@@ -246,7 +246,7 @@ class CronTab(object):
except IOError:
# cron file does not exist
return
- except:
+ except Exception:
raise CronTabError("Unexpected error:", sys.exc_info()[0])
else:
# using safely quoted shell for now, but this really should be two non-shell calls instead. FIXME
@@ -371,7 +371,7 @@ class CronTab(object):
except OSError:
# cron file does not exist
return False
- except:
+ except Exception:
raise CronTabError("Unexpected error:", sys.exc_info()[0])
def find_job(self, name, job=None):
diff --git a/lib/ansible/modules/system/cronvar.py b/lib/ansible/modules/system/cronvar.py
index 757ae2891c..7d13a212f4 100644
--- a/lib/ansible/modules/system/cronvar.py
+++ b/lib/ansible/modules/system/cronvar.py
@@ -145,7 +145,7 @@ class CronVar(object):
except IOError:
# cron file does not exist
return
- except:
+ except Exception:
raise CronVarError("Unexpected error:", sys.exc_info()[0])
else:
# using safely quoted shell for now, but this really should be two non-shell calls instead. FIXME
@@ -200,7 +200,7 @@ class CronVar(object):
except OSError:
# cron file does not exist
return False
- except:
+ except Exception:
raise CronVarError("Unexpected error:", sys.exc_info()[0])
def parse_for_var(self, line):
diff --git a/lib/ansible/modules/system/group.py b/lib/ansible/modules/system/group.py
index 0b2cdd80b2..a95bc3c3d9 100644
--- a/lib/ansible/modules/system/group.py
+++ b/lib/ansible/modules/system/group.py
@@ -347,7 +347,7 @@ class DarwinGroup(Group):
if highest == 0 or highest == 499:
return False
return (highest + 1)
- except:
+ except Exception:
return False
diff --git a/lib/ansible/modules/system/mount.py b/lib/ansible/modules/system/mount.py
index 99ae6c2afe..8a8ac8587b 100644
--- a/lib/ansible/modules/system/mount.py
+++ b/lib/ansible/modules/system/mount.py
@@ -432,7 +432,7 @@ def remount(module, args):
rc = 1
else:
rc, out, err = module.run_command(cmd)
- except:
+ except Exception:
rc = 1
msg = ''
diff --git a/lib/ansible/modules/system/pam_limits.py b/lib/ansible/modules/system/pam_limits.py
index 1ac460349a..cc215a3b29 100644
--- a/lib/ansible/modules/system/pam_limits.py
+++ b/lib/ansible/modules/system/pam_limits.py
@@ -220,7 +220,7 @@ def main():
newline = newline.split('#', 1)[0]
try:
old_comment = line.split('#', 1)[1]
- except:
+ except Exception:
old_comment = ''
newline = newline.rstrip()
@@ -299,7 +299,7 @@ def main():
try:
nf.close()
- except:
+ except Exception:
pass
res_args = dict(
diff --git a/lib/ansible/modules/system/seboolean.py b/lib/ansible/modules/system/seboolean.py
index fff4238aa3..3af541c2ba 100644
--- a/lib/ansible/modules/system/seboolean.py
+++ b/lib/ansible/modules/system/seboolean.py
@@ -307,7 +307,7 @@ def main():
module.fail_json(msg="Failed to set boolean %s to %s" % (name, state))
try:
selinux.security_commit_booleans()
- except:
+ except Exception:
module.fail_json(msg="Failed to commit pending boolean %s value" % name)
result['changed'] = changed
diff --git a/lib/ansible/modules/system/service.py b/lib/ansible/modules/system/service.py
index 79f97e9a96..7700128cfd 100644
--- a/lib/ansible/modules/system/service.py
+++ b/lib/ansible/modules/system/service.py
@@ -481,7 +481,7 @@ class LinuxService(Service):
res = version_re.search(stdout)
if res:
self.upstart_version = LooseVersion(res.groups()[0])
- except:
+ except Exception:
pass # we'll use the default of 0.0.0
self.svc_cmd = location['initctl']
@@ -720,7 +720,7 @@ class LinuxService(Service):
if self.changed:
try:
write_to_override_file(override_file_name, override_state)
- except:
+ except Exception:
self.module.fail_json(msg='Could not modify override file')
return
@@ -1007,7 +1007,7 @@ class FreeBsdService(Service):
rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.name, 'rcvar', self.arguments))
try:
rcvars = shlex.split(stdout, comments=True)
- except:
+ except Exception:
# TODO: add a warning to the output with the failure
pass
diff --git a/lib/ansible/modules/system/timezone.py b/lib/ansible/modules/system/timezone.py
index d9fc8cfbe7..79babdb0e8 100644
--- a/lib/ansible/modules/system/timezone.py
+++ b/lib/ansible/modules/system/timezone.py
@@ -546,7 +546,7 @@ class NosystemdTimezone(Timezone):
try:
if not filecmp.cmp('/etc/localtime', '/usr/share/zoneinfo/' + planned):
return 'n/a'
- except:
+ except Exception:
return 'n/a'
else:
self.abort('unknown parameter "%s"' % key)
@@ -610,7 +610,7 @@ class SmartOSTimezone(Timezone):
m = re.match('^TZ=(.*)$', line.strip())
if m:
return m.groups()[0]
- except:
+ except Exception:
self.module.fail_json(msg='Failed to read /etc/default/init')
else:
self.module.fail_json(msg='%s is not a supported option on target platform' % key)
@@ -745,7 +745,7 @@ class BSDTimezone(Timezone):
try:
if not os.path.isfile(zonefile):
self.module.fail_json(msg='%s is not a recognized timezone' % value)
- except:
+ except Exception:
self.module.fail_json(msg='Failed to stat %s' % zonefile)
# Now (somewhat) atomically update the symlink by creating a new
@@ -759,7 +759,7 @@ class BSDTimezone(Timezone):
try:
os.symlink(zonefile, new_localtime)
os.rename(new_localtime, '/etc/localtime')
- except:
+ except Exception:
os.remove(new_localtime)
self.module.fail_json(msg='Could not update /etc/localtime')
else:
diff --git a/lib/ansible/modules/utilities/logic/async_wrapper.py b/lib/ansible/modules/utilities/logic/async_wrapper.py
index 47fac5989e..c87989727f 100644
--- a/lib/ansible/modules/utilities/logic/async_wrapper.py
+++ b/lib/ansible/modules/utilities/logic/async_wrapper.py
@@ -234,7 +234,7 @@ if __name__ == '__main__':
if not os.path.exists(jobdir):
try:
os.makedirs(jobdir)
- except:
+ except Exception:
print(json.dumps({
"failed": 1,
"msg": "could not create: %s" % jobdir
diff --git a/lib/ansible/modules/utilities/logic/wait_for.py b/lib/ansible/modules/utilities/logic/wait_for.py
index a269566808..7c19f876b7 100644
--- a/lib/ansible/modules/utilities/logic/wait_for.py
+++ b/lib/ansible/modules/utilities/logic/wait_for.py
@@ -508,7 +508,7 @@ def main():
for _connection_state in module.params['active_connection_states']:
try:
get_connection_state_id(_connection_state)
- except:
+ except Exception:
module.fail_json(msg="unknown active_connection_state (%s) defined" % _connection_state, elapsed=0)
start = datetime.datetime.utcnow()
@@ -534,7 +534,7 @@ def main():
s = _create_connection(host, port, connect_timeout)
s.shutdown(socket.SHUT_RDWR)
s.close()
- except:
+ except Exception:
break
# Conditions not yet met, wait and try again
time.sleep(module.params['sleep'])
@@ -582,7 +582,7 @@ def main():
alt_connect_timeout = math.ceil(_timedelta_total_seconds(end - datetime.datetime.utcnow()))
try:
s = _create_connection(host, port, min(connect_timeout, alt_connect_timeout))
- except:
+ except Exception:
# Failed to connect by connect_timeout. wait and try again
pass
else:
diff --git a/lib/ansible/parsing/plugin_docs.py b/lib/ansible/parsing/plugin_docs.py
index 15b2ba72e9..ac3f90531a 100644
--- a/lib/ansible/parsing/plugin_docs.py
+++ b/lib/ansible/parsing/plugin_docs.py
@@ -74,7 +74,7 @@ def read_docstring(filename, verbose=True, ignore_errors=True):
# Add default metadata
data['metadata'] = {'supported_by': 'community',
'status': ['preview']}
- except:
+ except Exception:
if verbose:
display.error("unable to parse %s" % filename)
if not ignore_errors:
diff --git a/lib/ansible/plugins/action/add_host.py b/lib/ansible/plugins/action/add_host.py
index 5851994fdb..aed8b1437c 100644
--- a/lib/ansible/plugins/action/add_host.py
+++ b/lib/ansible/plugins/action/add_host.py
@@ -55,7 +55,7 @@ class ActionModule(ActionBase):
try:
name, port = parse_address(new_name, allow_ranges=False)
- except:
+ except Exception:
# not a parsable hostname, but might still be usable
name = new_name
port = None
diff --git a/lib/ansible/plugins/action/bigip.py b/lib/ansible/plugins/action/bigip.py
index 9d89b4d3b8..4ccc37865e 100644
--- a/lib/ansible/plugins/action/bigip.py
+++ b/lib/ansible/plugins/action/bigip.py
@@ -32,7 +32,7 @@ from ansible.utils.display import Display
try:
from library.module_utils.network.f5.common import f5_provider_spec
-except:
+except Exception:
from ansible.module_utils.network.f5.common import f5_provider_spec
display = Display()
diff --git a/lib/ansible/plugins/action/bigip_imish_config.py b/lib/ansible/plugins/action/bigip_imish_config.py
index d0a8741f9a..eb02aa2256 100644
--- a/lib/ansible/plugins/action/bigip_imish_config.py
+++ b/lib/ansible/plugins/action/bigip_imish_config.py
@@ -30,7 +30,7 @@ from ansible.module_utils.six.moves.urllib.parse import urlsplit
try:
from library.module_utils.network.f5.common import f5_provider_spec
-except:
+except Exception:
from ansible.module_utils.network.f5.common import f5_provider_spec
from ansible.utils.display import Display
diff --git a/lib/ansible/plugins/action/bigiq.py b/lib/ansible/plugins/action/bigiq.py
index 95ed9252a4..3b3553cf47 100644
--- a/lib/ansible/plugins/action/bigiq.py
+++ b/lib/ansible/plugins/action/bigiq.py
@@ -32,7 +32,7 @@ from ansible.utils.display import Display
try:
from library.module_utils.network.f5.common import f5_provider_spec
-except:
+except Exception:
from ansible.module_utils.network.f5.common import f5_provider_spec
display = Display()
diff --git a/lib/ansible/plugins/action/service.py b/lib/ansible/plugins/action/service.py
index c07113c06b..41b33d4e06 100644
--- a/lib/ansible/plugins/action/service.py
+++ b/lib/ansible/plugins/action/service.py
@@ -47,7 +47,7 @@ class ActionModule(ActionBase):
module = self._templar.template("{{hostvars['%s']['ansible_facts']['service_mgr']}}" % self._task.delegate_to)
else:
module = self._templar.template('{{ansible_facts.service_mgr}}')
- except:
+ except Exception:
pass # could not get it from template!
try:
diff --git a/lib/ansible/plugins/connection/chroot.py b/lib/ansible/plugins/connection/chroot.py
index 78af1c59e8..86168a45d9 100644
--- a/lib/ansible/plugins/connection/chroot.py
+++ b/lib/ansible/plugins/connection/chroot.py
@@ -154,7 +154,7 @@ class Connection(ConnectionBase):
raise AnsibleError("chroot connection requires dd command in the chroot")
try:
stdout, stderr = p.communicate()
- except:
+ except Exception:
traceback.print_exc()
raise AnsibleError("failed to transfer file %s to %s" % (in_path, out_path))
if p.returncode != 0:
@@ -179,7 +179,7 @@ class Connection(ConnectionBase):
while chunk:
out_file.write(chunk)
chunk = p.stdout.read(BUFSIZE)
- except:
+ except Exception:
traceback.print_exc()
raise AnsibleError("failed to transfer file %s to %s" % (in_path, out_path))
stdout, stderr = p.communicate()
diff --git a/lib/ansible/plugins/connection/jail.py b/lib/ansible/plugins/connection/jail.py
index f8fb5d277f..6747d53829 100644
--- a/lib/ansible/plugins/connection/jail.py
+++ b/lib/ansible/plugins/connection/jail.py
@@ -165,7 +165,7 @@ class Connection(ConnectionBase):
raise AnsibleError("jail connection requires dd command in the jail")
try:
stdout, stderr = p.communicate()
- except:
+ except Exception:
traceback.print_exc()
raise AnsibleError("failed to transfer file %s to %s" % (in_path, out_path))
if p.returncode != 0:
@@ -190,7 +190,7 @@ class Connection(ConnectionBase):
while chunk:
out_file.write(chunk)
chunk = p.stdout.read(BUFSIZE)
- except:
+ except Exception:
traceback.print_exc()
raise AnsibleError("failed to transfer file %s to %s" % (in_path, out_path))
stdout, stderr = p.communicate()
diff --git a/lib/ansible/plugins/connection/libvirt_lxc.py b/lib/ansible/plugins/connection/libvirt_lxc.py
index fe37905365..4ef116cbcd 100644
--- a/lib/ansible/plugins/connection/libvirt_lxc.py
+++ b/lib/ansible/plugins/connection/libvirt_lxc.py
@@ -144,7 +144,7 @@ class Connection(ConnectionBase):
raise AnsibleError("chroot connection requires dd command in the chroot")
try:
stdout, stderr = p.communicate()
- except:
+ except Exception:
traceback.print_exc()
raise AnsibleError("failed to transfer file %s to %s" % (in_path, out_path))
if p.returncode != 0:
@@ -169,7 +169,7 @@ class Connection(ConnectionBase):
while chunk:
out_file.write(chunk)
chunk = p.stdout.read(BUFSIZE)
- except:
+ except Exception:
traceback.print_exc()
raise AnsibleError("failed to transfer file %s to %s" % (in_path, out_path))
stdout, stderr = p.communicate()
diff --git a/lib/ansible/plugins/connection/zone.py b/lib/ansible/plugins/connection/zone.py
index ce39427ed8..b8c8cf768c 100644
--- a/lib/ansible/plugins/connection/zone.py
+++ b/lib/ansible/plugins/connection/zone.py
@@ -163,7 +163,7 @@ class Connection(ConnectionBase):
raise AnsibleError("jail connection requires dd command in the jail")
try:
stdout, stderr = p.communicate()
- except:
+ except Exception:
traceback.print_exc()
raise AnsibleError("failed to transfer file %s to %s" % (in_path, out_path))
if p.returncode != 0:
@@ -188,7 +188,7 @@ class Connection(ConnectionBase):
while chunk:
out_file.write(chunk)
chunk = p.stdout.read(BUFSIZE)
- except:
+ except Exception:
traceback.print_exc()
raise AnsibleError("failed to transfer file %s to %s" % (in_path, out_path))
stdout, stderr = p.communicate()
diff --git a/lib/ansible/plugins/filter/ipaddr.py b/lib/ansible/plugins/filter/ipaddr.py
index e6a01375f7..ad5edd62e5 100644
--- a/lib/ansible/plugins/filter/ipaddr.py
+++ b/lib/ansible/plugins/filter/ipaddr.py
@@ -74,7 +74,7 @@ def _6to4_query(v, vtype, value):
try:
return '2002:{:02x}{:02x}:{:02x}{:02x}::1/48'.format(*numbers)
- except:
+ except Exception:
return False
elif v.version == 6:
@@ -128,7 +128,7 @@ def _cidr_lookup_query(v, iplist, value):
try:
if v in iplist:
return value
- except:
+ except Exception:
return False
@@ -192,7 +192,7 @@ def _ipv4_query(v, value):
if v.version == 6:
try:
return str(v.ipv4())
- except:
+ except Exception:
return False
else:
return value
@@ -563,14 +563,14 @@ def ipaddr(value, query='', version=False, alias='ipaddr'):
v.prefixlen = 128
# IPv4 didn't work the first time, so it definitely has to be IPv6
- except:
+ except Exception:
try:
v = netaddr.IPNetwork('::/0')
v.value = int(value)
v.prefixlen = 128
# The value is too big for IPv6. Are you a nanobot?
- except:
+ except Exception:
return False
# We got an IP address, let's mark it as such
@@ -588,11 +588,11 @@ def ipaddr(value, query='', version=False, alias='ipaddr'):
try:
address, prefix = value.split('/')
vtype = 'network'
- except:
+ except Exception:
vtype = 'address'
# value hasn't been recognized, maybe it's a numerical CIDR?
- except:
+ except Exception:
try:
address, prefix = value.split('/')
address.isdigit()
@@ -601,7 +601,7 @@ def ipaddr(value, query='', version=False, alias='ipaddr'):
prefix = int(prefix)
# It's not numerical CIDR, give up
- except:
+ except Exception:
return False
# It is something, so let's try and build a CIDR from the parts
@@ -611,14 +611,14 @@ def ipaddr(value, query='', version=False, alias='ipaddr'):
v.prefixlen = prefix
# It's not a valid IPv4 CIDR
- except:
+ except Exception:
try:
v = netaddr.IPNetwork('::/0')
v.value = address
v.prefixlen = prefix
# It's not a valid IPv6 CIDR. Give up.
- except:
+ except Exception:
return False
# We have a valid CIDR, so let's write it in correct format
@@ -633,7 +633,7 @@ def ipaddr(value, query='', version=False, alias='ipaddr'):
if query and (query not in query_func_map or query == 'cidr_lookup') and ipaddr(query, 'network'):
iplist = netaddr.IPSet([netaddr.IPNetwork(query)])
query = 'cidr_lookup'
- except:
+ except Exception:
pass
# This code checks if value maches the IP version the user wants, ie. if
@@ -659,13 +659,13 @@ def ipaddr(value, query='', version=False, alias='ipaddr'):
elif v.size > 1:
try:
return str(v[query]) + '/' + str(v.prefixlen)
- except:
+ except Exception:
return False
else:
return value
- except:
+ except Exception:
raise errors.AnsibleFilterError(alias + ': unknown filter type: %s' % query)
return False
@@ -706,7 +706,7 @@ def ipwrap(value, query=''):
else:
return value
- except:
+ except Exception:
return value
@@ -750,7 +750,7 @@ def ipsubnet(value, query='', index='x'):
v = ipaddr(value, 'subnet')
value = netaddr.IPNetwork(v)
- except:
+ except Exception:
return False
query_string = str(query)
if not query:
@@ -767,26 +767,26 @@ def ipsubnet(value, query='', index='x'):
if vsize > 1:
try:
return str(list(value.subnet(query))[index])
- except:
+ except Exception:
return False
elif vsize == 1:
try:
return str(value.supernet(query)[index])
- except:
+ except Exception:
return False
- except:
+ except Exception:
if vsize > 1:
try:
return str(len(list(value.subnet(query))))
- except:
+ except Exception:
return False
elif vsize == 1:
try:
return str(value.supernet(query)[0])
- except:
+ except Exception:
return False
elif query_string:
@@ -822,7 +822,7 @@ def nthhost(value, query=''):
v = ipaddr(value, 'subnet')
value = netaddr.IPNetwork(v)
- except:
+ except Exception:
return False
if not query:
@@ -849,7 +849,7 @@ def next_nth_usable(value, offset):
v = ipaddr(value, 'subnet')
v = netaddr.IPNetwork(v)
- except:
+ except Exception:
return False
if type(offset) != int:
@@ -871,7 +871,7 @@ def previous_nth_usable(value, offset):
v = ipaddr(value, 'subnet')
v = netaddr.IPNetwork(v)
- except:
+ except Exception:
return False
if type(offset) != int:
@@ -912,7 +912,7 @@ def _address_normalizer(value):
vtype = ipaddr(value, 'type')
if vtype == 'address' or vtype == "network":
v = ipaddr(value, 'subnet')
- except:
+ except Exception:
return False
return v
@@ -1018,7 +1018,7 @@ def slaac(value, query=''):
return False
value = netaddr.IPNetwork(v)
- except:
+ except Exception:
return False
if not query:
@@ -1028,7 +1028,7 @@ def slaac(value, query=''):
mac = hwaddr(query, alias='slaac')
eui = netaddr.EUI(mac)
- except:
+ except Exception:
return False
return eui.ipv6(value.network)
@@ -1059,7 +1059,7 @@ def hwaddr(value, query='', alias='hwaddr'):
try:
v = netaddr.EUI(value)
- except:
+ except Exception:
if query and query != 'bool':
raise errors.AnsibleFilterError(alias + ': not a hardware address: %s' % value)
diff --git a/lib/ansible/plugins/filter/network.py b/lib/ansible/plugins/filter/network.py
index ffa8e664af..6d54a90004 100644
--- a/lib/ansible/plugins/filter/network.py
+++ b/lib/ansible/plugins/filter/network.py
@@ -102,7 +102,7 @@ def parse_cli(output, tmpl):
try:
variables = spec.get('vars', {})
value = template(value, variables)
- except:
+ except Exception:
pass
if 'start_block' in attrs and 'end_block' in attrs:
@@ -151,7 +151,7 @@ def parse_cli(output, tmpl):
for k, v in iteritems(value):
try:
obj[k] = template(v, {'item': items}, fail_on_undefined=False)
- except:
+ except Exception:
obj[k] = None
objects.append(obj)
@@ -269,7 +269,7 @@ def _extract_param(template, root, attrs, value):
fields = None
try:
fields = element.findall(param_xpath)
- except:
+ except Exception:
display.warning("Failed to evaluate value of '%s' with XPath '%s'.\nUnexpected error: %s." % (param, param_xpath, traceback.format_exc()))
tags = param_xpath.split('/')
@@ -339,7 +339,7 @@ def parse_xml(output, tmpl):
try:
variables = spec.get('vars', {})
value = template(value, variables)
- except:
+ except Exception:
pass
if 'items' in attrs:
diff --git a/lib/ansible/plugins/inventory/virtualbox.py b/lib/ansible/plugins/inventory/virtualbox.py
index 2e807da734..2103119904 100644
--- a/lib/ansible/plugins/inventory/virtualbox.py
+++ b/lib/ansible/plugins/inventory/virtualbox.py
@@ -71,7 +71,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
if 'Value' in ipinfo:
a, ip = ipinfo.split(':', 1)
ret = ip.strip()
- except:
+ except Exception:
pass
return ret
@@ -137,7 +137,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
continue
try:
k, v = line.split(':', 1)
- except:
+ except Exception:
# skip non splitable
continue
diff --git a/lib/ansible/plugins/lookup/_redis_kv.py b/lib/ansible/plugins/lookup/_redis_kv.py
index fae1fb653b..9d6c45711f 100644
--- a/lib/ansible/plugins/lookup/_redis_kv.py
+++ b/lib/ansible/plugins/lookup/_redis_kv.py
@@ -88,6 +88,6 @@ class LookupModule(LookupBase):
if res is None:
res = ""
ret.append(res)
- except:
+ except Exception:
ret.append("") # connection failed or key not found
return ret
diff --git a/lib/ansible/plugins/lookup/dig.py b/lib/ansible/plugins/lookup/dig.py
index 7b735f3a46..76e79dbc56 100644
--- a/lib/ansible/plugins/lookup/dig.py
+++ b/lib/ansible/plugins/lookup/dig.py
@@ -222,7 +222,7 @@ class LookupModule(LookupBase):
try:
socket.inet_aton(ns)
nameservers.append(ns)
- except:
+ except Exception:
try:
nsaddr = dns.resolver.query(ns)[0].address
nameservers.append(nsaddr)
@@ -233,7 +233,7 @@ class LookupModule(LookupBase):
if '=' in t:
try:
opt, arg = t.split('=')
- except:
+ except Exception:
pass
if opt == 'qtype':
@@ -251,7 +251,7 @@ class LookupModule(LookupBase):
if '/' in t:
try:
domain, qtype = t.split('/')
- except:
+ except Exception:
domain = t
else:
domain = t
diff --git a/lib/ansible/plugins/lookup/passwordstore.py b/lib/ansible/plugins/lookup/passwordstore.py
index 334b50f00e..89c389ae48 100644
--- a/lib/ansible/plugins/lookup/passwordstore.py
+++ b/lib/ansible/plugins/lookup/passwordstore.py
@@ -116,7 +116,7 @@ def check_output2(*popenargs, **kwargs):
process = subprocess.Popen(*popenargs, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs)
try:
b_out, b_err = process.communicate(b_inputdata)
- except:
+ except Exception:
process.kill()
process.wait()
raise
diff --git a/lib/ansible/plugins/strategy/free.py b/lib/ansible/plugins/strategy/free.py
index 104e8afa1c..eb2e334e4f 100644
--- a/lib/ansible/plugins/strategy/free.py
+++ b/lib/ansible/plugins/strategy/free.py
@@ -137,7 +137,7 @@ class StrategyModule(StrategyBase):
try:
task.name = to_text(templar.template(task.name, fail_on_undefined=False), nonstring='empty')
display.debug("done templating", host=host_name)
- except:
+ except Exception:
# just ignore any errors during task name templating,
# we don't care if it just shows the raw name
display.debug("templating failed for some reason", host=host_name)
diff --git a/lib/ansible/plugins/strategy/linear.py b/lib/ansible/plugins/strategy/linear.py
index a7ad7ce0d9..88e5f2174e 100644
--- a/lib/ansible/plugins/strategy/linear.py
+++ b/lib/ansible/plugins/strategy/linear.py
@@ -292,7 +292,7 @@ class StrategyModule(StrategyBase):
try:
task.name = to_text(templar.template(task.name, fail_on_undefined=False), nonstring='empty')
display.debug("done templating")
- except:
+ except Exception:
# just ignore any errors during task name templating,
# we don't care if it just shows the raw name
display.debug("templating failed for some reason")
diff --git a/lib/ansible/template/__init__.py b/lib/ansible/template/__init__.py
index 2183b97f4c..d5cb379249 100644
--- a/lib/ansible/template/__init__.py
+++ b/lib/ansible/template/__init__.py
@@ -495,7 +495,7 @@ class Templar:
new = self.do_template(data, fail_on_undefined=True)
except (AnsibleUndefinedVariable, UndefinedError):
return True
- except:
+ except Exception:
return False
return (new != data)
elif isinstance(data, (list, tuple)):
@@ -515,7 +515,7 @@ class Templar:
templatable = True
try:
self.template(data)
- except:
+ except Exception:
templatable = False
return templatable
diff --git a/lib/ansible/utils/display.py b/lib/ansible/utils/display.py
index e62a26b225..77a035bbfa 100644
--- a/lib/ansible/utils/display.py
+++ b/lib/ansible/utils/display.py
@@ -103,7 +103,7 @@ class Display(with_metaclass(Singleton, object)):
self.cows_available = set([to_text(c) for c in out.split()])
if C.ANSIBLE_COW_WHITELIST:
self.cows_available = set(C.ANSIBLE_COW_WHITELIST).intersection(self.cows_available)
- except:
+ except Exception:
# could not execute cowsay for some reason
self.b_cowsay = False
diff --git a/lib/ansible/utils/encrypt.py b/lib/ansible/utils/encrypt.py
index 46029037b8..2c359145b4 100644
--- a/lib/ansible/utils/encrypt.py
+++ b/lib/ansible/utils/encrypt.py
@@ -25,7 +25,7 @@ try:
from passlib.utils.handlers import HasRawSalt
PASSLIB_AVAILABLE = True
-except:
+except Exception:
pass
display = Display()
@@ -126,7 +126,7 @@ class PasslibHash(BaseHash):
try:
self.crypt_algo = getattr(passlib.hash, algorithm)
- except:
+ except Exception:
raise AnsibleError("passlib does not support '%s' algorithm" % algorithm)
def hash(self, secret, salt=None, salt_size=None, rounds=None):
diff --git a/lib/ansible/utils/vars.py b/lib/ansible/utils/vars.py
index b54211c10f..59b64fa367 100644
--- a/lib/ansible/utils/vars.py
+++ b/lib/ansible/utils/vars.py
@@ -69,7 +69,7 @@ def _validate_mutable_mappings(a, b):
for x in [a, b]:
try:
myvars.append(dumps(x))
- except:
+ except Exception:
myvars.append(to_native(x))
raise AnsibleError("failed to combine variables, expected dicts but got a '{0}' and a '{1}': \n{2}\n{3}".format(
a.__class__.__name__, b.__class__.__name__, myvars[0], myvars[1])
diff --git a/test/legacy/consul_running.py b/test/legacy/consul_running.py
index f64aaeecc3..0772cd4046 100644
--- a/test/legacy/consul_running.py
+++ b/test/legacy/consul_running.py
@@ -7,5 +7,5 @@ if __name__ == '__main__':
consul = consul.Consul(host='0.0.0.0', port=8500)
consul.catalog.nodes()
print("True")
- except:
+ except Exception:
pass
diff --git a/test/runner/lib/thread.py b/test/runner/lib/thread.py
index ce4717e008..8a287790a2 100644
--- a/test/runner/lib/thread.py
+++ b/test/runner/lib/thread.py
@@ -30,10 +30,13 @@ class WrappedThread(threading.Thread):
Run action and capture results or exception.
Do not override. Do not call directly. Executed by the start() method.
"""
+ # We truly want to catch anything that the worker thread might do including call sys.exit.
+ # Therefore we catch *everything* (including old-style class exceptions)
# noinspection PyBroadException, PyPep8
try:
self._result.put((self.action(), None))
- except: # pylint: disable=locally-disabled, bare-except
+ # pylint: disable=locally-disabled, bare-except
+ except: # noqa
self._result.put((None, sys.exc_info()))
def wait_for_result(self):
diff --git a/test/units/module_utils/ec2/test_aws.py b/test/units/module_utils/ec2/test_aws.py
index d7e7ffbed0..6e566eee85 100644
--- a/test/units/module_utils/ec2/test_aws.py
+++ b/test/units/module_utils/ec2/test_aws.py
@@ -20,7 +20,7 @@ try:
import boto3
import botocore
HAS_BOTO3 = True
-except:
+except Exception:
HAS_BOTO3 = False
import pytest
diff --git a/test/units/modules/net_tools/nios/test_nios_module.py b/test/units/modules/net_tools/nios/test_nios_module.py
index 3ad9705c6f..dbf5885173 100644
--- a/test/units/modules/net_tools/nios/test_nios_module.py
+++ b/test/units/modules/net_tools/nios/test_nios_module.py
@@ -40,7 +40,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/aireos/aireos_module.py b/test/units/modules/network/aireos/aireos_module.py
index 5fc6c93578..1ac1b5275c 100644
--- a/test/units/modules/network/aireos/aireos_module.py
+++ b/test/units/modules/network/aireos/aireos_module.py
@@ -39,7 +39,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/aruba/aruba_module.py b/test/units/modules/network/aruba/aruba_module.py
index d11d7d4393..9d305b6b41 100644
--- a/test/units/modules/network/aruba/aruba_module.py
+++ b/test/units/modules/network/aruba/aruba_module.py
@@ -40,7 +40,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/cnos/cnos_module.py b/test/units/modules/network/cnos/cnos_module.py
index bc1428fff0..e31cedd7cc 100644
--- a/test/units/modules/network/cnos/cnos_module.py
+++ b/test/units/modules/network/cnos/cnos_module.py
@@ -44,7 +44,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/dellos10/dellos10_module.py b/test/units/modules/network/dellos10/dellos10_module.py
index 4521bb2e38..24698d20a2 100644
--- a/test/units/modules/network/dellos10/dellos10_module.py
+++ b/test/units/modules/network/dellos10/dellos10_module.py
@@ -42,7 +42,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/dellos6/dellos6_module.py b/test/units/modules/network/dellos6/dellos6_module.py
index 7f0b3da4b4..2323a02dd9 100644
--- a/test/units/modules/network/dellos6/dellos6_module.py
+++ b/test/units/modules/network/dellos6/dellos6_module.py
@@ -40,7 +40,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/dellos9/dellos9_module.py b/test/units/modules/network/dellos9/dellos9_module.py
index 4bf092c7ae..2dfa9d7eb6 100644
--- a/test/units/modules/network/dellos9/dellos9_module.py
+++ b/test/units/modules/network/dellos9/dellos9_module.py
@@ -42,7 +42,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/edgeos/edgeos_module.py b/test/units/modules/network/edgeos/edgeos_module.py
index 59c7b3e3fc..dfab2974f4 100644
--- a/test/units/modules/network/edgeos/edgeos_module.py
+++ b/test/units/modules/network/edgeos/edgeos_module.py
@@ -39,7 +39,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/edgeswitch/edgeswitch_module.py b/test/units/modules/network/edgeswitch/edgeswitch_module.py
index 1731bc6817..37c8b8aa28 100644
--- a/test/units/modules/network/edgeswitch/edgeswitch_module.py
+++ b/test/units/modules/network/edgeswitch/edgeswitch_module.py
@@ -39,7 +39,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/enos/enos_module.py b/test/units/modules/network/enos/enos_module.py
index c97cd5cc35..a7af81c3c2 100644
--- a/test/units/modules/network/enos/enos_module.py
+++ b/test/units/modules/network/enos/enos_module.py
@@ -43,7 +43,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/eos/eos_module.py b/test/units/modules/network/eos/eos_module.py
index d9d5d44fa2..3ae2aa5e64 100644
--- a/test/units/modules/network/eos/eos_module.py
+++ b/test/units/modules/network/eos/eos_module.py
@@ -40,7 +40,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/exos/exos_module.py b/test/units/modules/network/exos/exos_module.py
index 067df1e014..da4ece7e6c 100644
--- a/test/units/modules/network/exos/exos_module.py
+++ b/test/units/modules/network/exos/exos_module.py
@@ -39,7 +39,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/ingate/ingate_module.py b/test/units/modules/network/ingate/ingate_module.py
index 6e11cadbdc..acdda8e99e 100644
--- a/test/units/modules/network/ingate/ingate_module.py
+++ b/test/units/modules/network/ingate/ingate_module.py
@@ -41,7 +41,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/ios/ios_module.py b/test/units/modules/network/ios/ios_module.py
index f450c4ad26..7a63d5d82a 100644
--- a/test/units/modules/network/ios/ios_module.py
+++ b/test/units/modules/network/ios/ios_module.py
@@ -40,7 +40,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/iosxr/iosxr_module.py b/test/units/modules/network/iosxr/iosxr_module.py
index a8229ca3df..55f2a23688 100644
--- a/test/units/modules/network/iosxr/iosxr_module.py
+++ b/test/units/modules/network/iosxr/iosxr_module.py
@@ -40,7 +40,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/ironware/ironware_module.py b/test/units/modules/network/ironware/ironware_module.py
index a66a7754b4..918e75b2d3 100644
--- a/test/units/modules/network/ironware/ironware_module.py
+++ b/test/units/modules/network/ironware/ironware_module.py
@@ -41,7 +41,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/junos/junos_module.py b/test/units/modules/network/junos/junos_module.py
index b0701b1fe2..055b40a4d4 100644
--- a/test/units/modules/network/junos/junos_module.py
+++ b/test/units/modules/network/junos/junos_module.py
@@ -44,12 +44,12 @@ def load_fixture(name, content='xml'):
data = f.read()
try:
data = json.load(path)
- except:
+ except Exception:
pass
else:
try:
data = parse(path).getroot()
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/netvisor/nvos_module.py b/test/units/modules/network/netvisor/nvos_module.py
index cef888a255..614d59440a 100644
--- a/test/units/modules/network/netvisor/nvos_module.py
+++ b/test/units/modules/network/netvisor/nvos_module.py
@@ -30,7 +30,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/nos/nos_module.py b/test/units/modules/network/nos/nos_module.py
index bc9e56580f..80a24f01fc 100644
--- a/test/units/modules/network/nos/nos_module.py
+++ b/test/units/modules/network/nos/nos_module.py
@@ -39,7 +39,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/nxos/nxos_module.py b/test/units/modules/network/nxos/nxos_module.py
index 342ec550d0..7a9871be8c 100644
--- a/test/units/modules/network/nxos/nxos_module.py
+++ b/test/units/modules/network/nxos/nxos_module.py
@@ -50,7 +50,7 @@ def load_fixture(module_name, name, device=''):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/onyx/onyx_module.py b/test/units/modules/network/onyx/onyx_module.py
index 2234ae5f0d..cee5e0c683 100644
--- a/test/units/modules/network/onyx/onyx_module.py
+++ b/test/units/modules/network/onyx/onyx_module.py
@@ -39,7 +39,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/opx/opx_module.py b/test/units/modules/network/opx/opx_module.py
index 7b5ed21cb0..3741771f0e 100644
--- a/test/units/modules/network/opx/opx_module.py
+++ b/test/units/modules/network/opx/opx_module.py
@@ -42,7 +42,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/ovs/ovs_module.py b/test/units/modules/network/ovs/ovs_module.py
index fe49809d50..7864d9308f 100644
--- a/test/units/modules/network/ovs/ovs_module.py
+++ b/test/units/modules/network/ovs/ovs_module.py
@@ -40,7 +40,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/routeros/routeros_module.py b/test/units/modules/network/routeros/routeros_module.py
index 3ddd33a135..cf9a3dfe2d 100644
--- a/test/units/modules/network/routeros/routeros_module.py
+++ b/test/units/modules/network/routeros/routeros_module.py
@@ -40,7 +40,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/slxos/slxos_module.py b/test/units/modules/network/slxos/slxos_module.py
index e2d3d4401b..8cd482ed11 100644
--- a/test/units/modules/network/slxos/slxos_module.py
+++ b/test/units/modules/network/slxos/slxos_module.py
@@ -39,7 +39,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/voss/voss_module.py b/test/units/modules/network/voss/voss_module.py
index 93df60f1b6..d5ca438c06 100644
--- a/test/units/modules/network/voss/voss_module.py
+++ b/test/units/modules/network/voss/voss_module.py
@@ -40,7 +40,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/network/vyos/vyos_module.py b/test/units/modules/network/vyos/vyos_module.py
index 264cd5c66e..138c684e88 100644
--- a/test/units/modules/network/vyos/vyos_module.py
+++ b/test/units/modules/network/vyos/vyos_module.py
@@ -40,7 +40,7 @@ def load_fixture(name):
try:
data = json.loads(data)
- except:
+ except Exception:
pass
fixture_data[path] = data
diff --git a/test/units/modules/packaging/os/test_apt.py b/test/units/modules/packaging/os/test_apt.py
index e4ebcfafaa..4c4874f017 100644
--- a/test/units/modules/packaging/os/test_apt.py
+++ b/test/units/modules/packaging/os/test_apt.py
@@ -9,7 +9,7 @@ try:
from ansible.modules.packaging.os.apt import (
expand_pkgspec_from_fnmatches,
)
-except:
+except Exception:
# Need some more module_utils work (porting urls.py) before we can test
# modules. So don't error out in this case.
if sys.version_info[0] >= 3:
diff --git a/test/units/parsing/utils/test_addresses.py b/test/units/parsing/utils/test_addresses.py
index e7b60efa1c..ea86c55423 100644
--- a/test/units/parsing/utils/test_addresses.py
+++ b/test/units/parsing/utils/test_addresses.py
@@ -74,7 +74,7 @@ class TestParseAddress(unittest.TestCase):
try:
(host, port) = parse_address(t)
- except:
+ except Exception:
host = None
port = None
@@ -87,7 +87,7 @@ class TestParseAddress(unittest.TestCase):
try:
(host, port) = parse_address(t, allow_ranges=True)
- except:
+ except Exception:
host = None
port = None
diff --git a/test/units/plugins/lookup/test_conjur_variable.py b/test/units/plugins/lookup/test_conjur_variable.py
index c2fa87c781..98890f82ab 100644
--- a/test/units/plugins/lookup/test_conjur_variable.py
+++ b/test/units/plugins/lookup/test_conjur_variable.py
@@ -68,7 +68,7 @@ class TestLookupModule:
mock_response = MagicMock(spec_set=http_client.HTTPResponse)
try:
mock_response.getcode.return_value = 200
- except:
+ except Exception:
# HTTPResponse is a Python 3 only feature. This uses a generic mock for python 2.6
mock_response = MagicMock()
mock_response.getcode.return_value = 200
@@ -83,7 +83,7 @@ class TestLookupModule:
mock_response = MagicMock(spec_set=http_client.HTTPResponse)
try:
mock_response.getcode.return_value = 200
- except:
+ except Exception:
# HTTPResponse is a Python 3 only feature. This uses a generic mock for python 2.6
mock_response = MagicMock()
mock_response.getcode.return_value = 200
@@ -99,7 +99,7 @@ class TestLookupModule:
mock_response = MagicMock(spec_set=http_client.HTTPResponse)
try:
mock_response.getcode.return_value = code
- except:
+ except Exception:
# HTTPResponse is a Python 3 only feature. This uses a generic mock for python 2.6
mock_response = MagicMock()
mock_response.getcode.return_value = code
diff --git a/test/units/plugins/lookup/test_onepassword.py b/test/units/plugins/lookup/test_onepassword.py
index 0f67c8bc42..5db40fb78f 100644
--- a/test/units/plugins/lookup/test_onepassword.py
+++ b/test/units/plugins/lookup/test_onepassword.py
@@ -218,7 +218,7 @@ class TestOnePass(unittest.TestCase):
op = MockOnePass()
try:
op.assert_logged_in()
- except:
+ except Exception:
self.fail()
def test_onepassword_logged_out(self):