mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
fix lint errors
This commit is contained in:
parent
1fecb6f923
commit
f0198cc39a
5 changed files with 26 additions and 25 deletions
|
@ -685,16 +685,16 @@ class AzureRMModuleBase(object):
|
||||||
# add an inbound SSH rule
|
# add an inbound SSH rule
|
||||||
parameters.security_rules = [
|
parameters.security_rules = [
|
||||||
self.network_models.SecurityRule('Tcp', '*', '*', 'Allow', 'Inbound', description='Allow SSH Access',
|
self.network_models.SecurityRule('Tcp', '*', '*', 'Allow', 'Inbound', description='Allow SSH Access',
|
||||||
source_port_range='*', destination_port_range='22', priority=100, name='SSH')
|
source_port_range='*', destination_port_range='22', priority=100, name='SSH')
|
||||||
]
|
]
|
||||||
parameters.location = location
|
parameters.location = location
|
||||||
else:
|
else:
|
||||||
# for windows add inbound RDP and WinRM rules
|
# for windows add inbound RDP and WinRM rules
|
||||||
parameters.security_rules = [
|
parameters.security_rules = [
|
||||||
self.network_models.SecurityRule('Tcp', '*', '*', 'Allow', 'Inbound', description='Allow RDP port 3389',
|
self.network_models.SecurityRule('Tcp', '*', '*', 'Allow', 'Inbound', description='Allow RDP port 3389',
|
||||||
source_port_range='*', destination_port_range='3389', priority=100, name='RDP01'),
|
source_port_range='*', destination_port_range='3389', priority=100, name='RDP01'),
|
||||||
self.network_models.SecurityRule('Tcp', '*', '*', 'Allow', 'Inbound', description='Allow WinRM HTTPS port 5986',
|
self.network_models.SecurityRule('Tcp', '*', '*', 'Allow', 'Inbound', description='Allow WinRM HTTPS port 5986',
|
||||||
source_port_range='*', destination_port_range='5986', priority=101, name='WinRM01'),
|
source_port_range='*', destination_port_range='5986', priority=101, name='WinRM01'),
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
# Open custom ports
|
# Open custom ports
|
||||||
|
@ -705,7 +705,7 @@ class AzureRMModuleBase(object):
|
||||||
rule_name = "Rule_{0}".format(priority)
|
rule_name = "Rule_{0}".format(priority)
|
||||||
parameters.security_rules.append(
|
parameters.security_rules.append(
|
||||||
self.network_models.SecurityRule('Tcp', '*', '*', 'Allow', 'Inbound', source_port_range='*',
|
self.network_models.SecurityRule('Tcp', '*', '*', 'Allow', 'Inbound', source_port_range='*',
|
||||||
destination_port_range=str(port), priority=priority, name=rule_name)
|
destination_port_range=str(port), priority=priority, name=rule_name)
|
||||||
)
|
)
|
||||||
|
|
||||||
self.log('Creating default security group {0}'.format(security_group_name))
|
self.log('Creating default security group {0}'.format(security_group_name))
|
||||||
|
|
|
@ -236,10 +236,10 @@ class AzureRMImage(AzureRMModuleBase):
|
||||||
snapshot_resource = self.compute_models.SubResource(snapshot) if snapshot else None
|
snapshot_resource = self.compute_models.SubResource(snapshot) if snapshot else None
|
||||||
managed_disk = self.compute_models.SubResource(disk) if disk else None
|
managed_disk = self.compute_models.SubResource(disk) if disk else None
|
||||||
return self.compute_models.ImageOSDisk(os_type=self.os_type,
|
return self.compute_models.ImageOSDisk(os_type=self.os_type,
|
||||||
os_state=self.compute_models.OperatingSystemStateTypes.generalized,
|
os_state=self.compute_models.OperatingSystemStateTypes.generalized,
|
||||||
snapshot=snapshot_resource,
|
snapshot=snapshot_resource,
|
||||||
managed_disk=managed_disk,
|
managed_disk=managed_disk,
|
||||||
blob_uri=blob_uri)
|
blob_uri=blob_uri)
|
||||||
|
|
||||||
def create_data_disk(self, lun, source):
|
def create_data_disk(self, lun, source):
|
||||||
blob_uri, disk, snapshot = self.resolve_storage_source(source)
|
blob_uri, disk, snapshot = self.resolve_storage_source(source)
|
||||||
|
@ -247,9 +247,9 @@ class AzureRMImage(AzureRMModuleBase):
|
||||||
snapshot_resource = self.compute_models.SubResource(snapshot) if snapshot else None
|
snapshot_resource = self.compute_models.SubResource(snapshot) if snapshot else None
|
||||||
managed_disk = self.compute_models.SubResource(disk) if disk else None
|
managed_disk = self.compute_models.SubResource(disk) if disk else None
|
||||||
return self.compute_models.ImageDataDisk(lun,
|
return self.compute_models.ImageDataDisk(lun,
|
||||||
blob_uri=blob_uri,
|
blob_uri=blob_uri,
|
||||||
snapshot=snapshot_resource,
|
snapshot=snapshot_resource,
|
||||||
managed_disk=managed_disk)
|
managed_disk=managed_disk)
|
||||||
|
|
||||||
def create_data_disks(self):
|
def create_data_disks(self):
|
||||||
return list(filter(None, [self.create_data_disk(lun, source) for lun, source in enumerate(self.data_disk_sources)]))
|
return list(filter(None, [self.create_data_disk(lun, source) for lun, source in enumerate(self.data_disk_sources)]))
|
||||||
|
|
|
@ -455,8 +455,8 @@ class AzureRMNetworkInterface(AzureRMModuleBase):
|
||||||
nic.ip_configurations[0].subnet = self.network_models.Subnet(id=subnet.id)
|
nic.ip_configurations[0].subnet = self.network_models.Subnet(id=subnet.id)
|
||||||
nic.ip_configurations[0].name = 'default'
|
nic.ip_configurations[0].name = 'default'
|
||||||
nic.network_security_group = self.network_models.NetworkSecurityGroup(id=nsg.id,
|
nic.network_security_group = self.network_models.NetworkSecurityGroup(id=nsg.id,
|
||||||
location=nsg.location,
|
location=nsg.location,
|
||||||
resource_guid=nsg.resource_guid)
|
resource_guid=nsg.resource_guid)
|
||||||
if self.private_ip_address:
|
if self.private_ip_address:
|
||||||
nic.ip_configurations[0].private_ip_address = self.private_ip_address
|
nic.ip_configurations[0].private_ip_address = self.private_ip_address
|
||||||
|
|
||||||
|
@ -498,8 +498,8 @@ class AzureRMNetworkInterface(AzureRMModuleBase):
|
||||||
if results['network_security_group'].get('id'):
|
if results['network_security_group'].get('id'):
|
||||||
nsg = self.get_security_group(results['network_security_group']['name'])
|
nsg = self.get_security_group(results['network_security_group']['name'])
|
||||||
nic.network_security_group = self.network_models.NetworkSecurityGroup(id=nsg.id,
|
nic.network_security_group = self.network_models.NetworkSecurityGroup(id=nsg.id,
|
||||||
location=nsg.location,
|
location=nsg.location,
|
||||||
resource_guid=nsg.resource_guid)
|
resource_guid=nsg.resource_guid)
|
||||||
|
|
||||||
# See what actually gets sent to the API
|
# See what actually gets sent to the API
|
||||||
request = self.serialize_obj(nic, 'NetworkInterface')
|
request = self.serialize_obj(nic, 'NetworkInterface')
|
||||||
|
|
|
@ -238,8 +238,8 @@ class AzureRMSubnet(AzureRMModuleBase):
|
||||||
)
|
)
|
||||||
if nsg:
|
if nsg:
|
||||||
subnet.network_security_group = self.network_models.NetworkSecurityGroup(id=nsg.id,
|
subnet.network_security_group = self.network_models.NetworkSecurityGroup(id=nsg.id,
|
||||||
location=nsg.location,
|
location=nsg.location,
|
||||||
resource_guid=nsg.resource_guid)
|
resource_guid=nsg.resource_guid)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# update subnet
|
# update subnet
|
||||||
|
@ -250,8 +250,8 @@ class AzureRMSubnet(AzureRMModuleBase):
|
||||||
if results['network_security_group'].get('id'):
|
if results['network_security_group'].get('id'):
|
||||||
nsg = self.get_security_group(results['network_security_group']['name'])
|
nsg = self.get_security_group(results['network_security_group']['name'])
|
||||||
subnet.network_security_group = self.network_models.NetworkSecurityGroup(id=nsg.id,
|
subnet.network_security_group = self.network_models.NetworkSecurityGroup(id=nsg.id,
|
||||||
location=nsg.location,
|
location=nsg.location,
|
||||||
resource_guid=nsg.resource_guid)
|
resource_guid=nsg.resource_guid)
|
||||||
|
|
||||||
self.results['state'] = self.create_or_update_subnet(subnet)
|
self.results['state'] = self.create_or_update_subnet(subnet)
|
||||||
elif self.state == 'absent':
|
elif self.state == 'absent':
|
||||||
|
|
|
@ -937,8 +937,9 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
||||||
|
|
||||||
plan = None
|
plan = None
|
||||||
if self.plan:
|
if self.plan:
|
||||||
plan = self.network_models.Plan(name=self.plan.get('name'), product=self.plan.get('product'), publisher=self.plan.get('publisher'),
|
plan = self.network_models.Plan(name=self.plan.get('name'), product=self.plan.get('product'),
|
||||||
promotion_code=self.plan.get('promotion_code'))
|
publisher=self.plan.get('publisher'),
|
||||||
|
promotion_code=self.plan.get('promotion_code'))
|
||||||
|
|
||||||
vm_resource = self.network_models.VirtualMachine(
|
vm_resource = self.network_models.VirtualMachine(
|
||||||
self.location,
|
self.location,
|
||||||
|
@ -1645,11 +1646,11 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
||||||
parameters.ip_configurations[0].subnet = self.network_models.Subnet(id=subnet_id)
|
parameters.ip_configurations[0].subnet = self.network_models.Subnet(id=subnet_id)
|
||||||
parameters.ip_configurations[0].name = 'default'
|
parameters.ip_configurations[0].name = 'default'
|
||||||
parameters.network_security_group = self.network_models.NetworkSecurityGroup(id=group.id,
|
parameters.network_security_group = self.network_models.NetworkSecurityGroup(id=group.id,
|
||||||
location=group.location,
|
location=group.location,
|
||||||
resource_guid=group.resource_guid)
|
resource_guid=group.resource_guid)
|
||||||
parameters.ip_configurations[0].public_ip_address = self.network_models.PublicIPAddress(id=pip.id,
|
parameters.ip_configurations[0].public_ip_address = self.network_models.PublicIPAddress(id=pip.id,
|
||||||
location=pip.location,
|
location=pip.location,
|
||||||
resource_guid=pip.resource_guid)
|
resource_guid=pip.resource_guid)
|
||||||
|
|
||||||
self.log("Creating NIC {0}".format(network_interface_name))
|
self.log("Creating NIC {0}".format(network_interface_name))
|
||||||
self.log(self.serialize_obj(parameters, 'NetworkInterface'), pretty_print=True)
|
self.log(self.serialize_obj(parameters, 'NetworkInterface'), pretty_print=True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue