mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-07 08:54:01 -07:00
Bulk autopep8 (modules)
As agreed in 2017-12-07 Core meeting bulk fix pep8 issues Generated using: autopep8 1.3.3 (pycodestyle: 2.3.1) autopep8 -r --max-line-length 160 --in-place --ignore E305,E402,E722,E741 lib/ansible/modules Manually fix issues that autopep8 has introduced
This commit is contained in:
parent
d13d7e9404
commit
c57a7f05e1
314 changed files with 3462 additions and 3383 deletions
|
@ -598,14 +598,14 @@ try:
|
|||
from msrestazure.azure_exceptions import CloudError
|
||||
from msrestazure.tools import parse_resource_id
|
||||
from azure.mgmt.compute.models import NetworkInterfaceReference, \
|
||||
VirtualMachine, HardwareProfile, \
|
||||
StorageProfile, OSProfile, OSDisk, DataDisk, \
|
||||
VirtualHardDisk, ManagedDiskParameters, \
|
||||
ImageReference, NetworkProfile, LinuxConfiguration, \
|
||||
SshConfiguration, SshPublicKey, VirtualMachineSizeTypes, \
|
||||
DiskCreateOptionTypes, Plan, SubResource
|
||||
VirtualMachine, HardwareProfile, \
|
||||
StorageProfile, OSProfile, OSDisk, DataDisk, \
|
||||
VirtualHardDisk, ManagedDiskParameters, \
|
||||
ImageReference, NetworkProfile, LinuxConfiguration, \
|
||||
SshConfiguration, SshPublicKey, VirtualMachineSizeTypes, \
|
||||
DiskCreateOptionTypes, Plan, SubResource
|
||||
from azure.mgmt.network.models import PublicIPAddress, NetworkSecurityGroup, NetworkInterface, \
|
||||
NetworkInterfaceIPConfiguration, Subnet
|
||||
NetworkInterfaceIPConfiguration, Subnet
|
||||
from azure.mgmt.storage.models import StorageAccountCreateParameters, Sku
|
||||
from azure.mgmt.storage.models import Kind, SkuTier, SkuName
|
||||
except ImportError:
|
||||
|
@ -659,7 +659,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
|||
open_ports=dict(type='list'),
|
||||
network_interface_names=dict(type='list', aliases=['network_interfaces']),
|
||||
remove_on_absent=dict(type='list', default=['all']),
|
||||
virtual_network_resource_group=dict(type = 'str'),
|
||||
virtual_network_resource_group=dict(type='str'),
|
||||
virtual_network_name=dict(type='str', aliases=['virtual_network']),
|
||||
subnet_name=dict(type='str', aliases=['subnet']),
|
||||
allocated=dict(type='bool', default=True),
|
||||
|
@ -1297,7 +1297,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
|||
nic_names = []
|
||||
pip_names = []
|
||||
|
||||
if self.remove_on_absent.intersection(set(['all','virtual_storage'])):
|
||||
if self.remove_on_absent.intersection(set(['all', 'virtual_storage'])):
|
||||
# store the attached vhd info so we can nuke it after the VM is gone
|
||||
if(vm.storage_profile.os_disk.managed_disk):
|
||||
self.log('Storing managed disk ID for deletion')
|
||||
|
@ -1319,7 +1319,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
|||
self.log("Managed disk IDs to delete: {0}".format(', '.join(managed_disk_ids)))
|
||||
self.results['deleted_managed_disk_ids'] = managed_disk_ids
|
||||
|
||||
if self.remove_on_absent.intersection(set(['all','network_interfaces'])):
|
||||
if self.remove_on_absent.intersection(set(['all', 'network_interfaces'])):
|
||||
# store the attached nic info so we can nuke them after the VM is gone
|
||||
self.log('Storing NIC names for deletion.')
|
||||
for interface in vm.network_profile.network_interfaces:
|
||||
|
@ -1327,7 +1327,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
|||
nic_names.append(id_dict['networkInterfaces'])
|
||||
self.log('NIC names to delete {0}'.format(', '.join(nic_names)))
|
||||
self.results['deleted_network_interfaces'] = nic_names
|
||||
if self.remove_on_absent.intersection(set(['all','public_ips'])):
|
||||
if self.remove_on_absent.intersection(set(['all', 'public_ips'])):
|
||||
# also store each nic's attached public IPs and delete after the NIC is gone
|
||||
for name in nic_names:
|
||||
nic = self.get_network_interface(name)
|
||||
|
@ -1349,18 +1349,18 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
|||
|
||||
# TODO: parallelize nic, vhd, and public ip deletions with begin_deleting
|
||||
# TODO: best-effort to keep deleting other linked resources if we encounter an error
|
||||
if self.remove_on_absent.intersection(set(['all','virtual_storage'])):
|
||||
if self.remove_on_absent.intersection(set(['all', 'virtual_storage'])):
|
||||
self.log('Deleting VHDs')
|
||||
self.delete_vm_storage(vhd_uris)
|
||||
self.log('Deleting managed disks')
|
||||
self.delete_managed_disks(managed_disk_ids)
|
||||
|
||||
if self.remove_on_absent.intersection(set(['all','network_interfaces'])):
|
||||
if self.remove_on_absent.intersection(set(['all', 'network_interfaces'])):
|
||||
self.log('Deleting network interfaces')
|
||||
for name in nic_names:
|
||||
self.delete_nic(name)
|
||||
|
||||
if self.remove_on_absent.intersection(set(['all','public_ips'])):
|
||||
if self.remove_on_absent.intersection(set(['all', 'public_ips'])):
|
||||
self.log('Deleting public IPs')
|
||||
for name in pip_names:
|
||||
self.delete_pip(name)
|
||||
|
@ -1461,6 +1461,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
|||
return ImageReference(id=vm_image.id)
|
||||
|
||||
self.fail("Error could not find image with name {0}".format(name))
|
||||
|
||||
def get_availability_set(self, resource_group, name):
|
||||
try:
|
||||
return self.compute_client.availability_sets.get(resource_group, name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue