1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

fix lint errors

This commit is contained in:
Zhijun Zhao 2017-12-28 18:54:38 +08:00 committed by Matt Davis
parent 1fecb6f923
commit f0198cc39a
5 changed files with 26 additions and 25 deletions

View file

@ -685,16 +685,16 @@ class AzureRMModuleBase(object):
# add an inbound SSH rule
parameters.security_rules = [
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
else:
# for windows add inbound RDP and WinRM rules
parameters.security_rules = [
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',
source_port_range='*', destination_port_range='5986', priority=101, name='WinRM01'),
source_port_range='*', destination_port_range='5986', priority=101, name='WinRM01'),
]
else:
# Open custom ports
@ -705,7 +705,7 @@ class AzureRMModuleBase(object):
rule_name = "Rule_{0}".format(priority)
parameters.security_rules.append(
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))

View file

@ -236,10 +236,10 @@ class AzureRMImage(AzureRMModuleBase):
snapshot_resource = self.compute_models.SubResource(snapshot) if snapshot else None
managed_disk = self.compute_models.SubResource(disk) if disk else None
return self.compute_models.ImageOSDisk(os_type=self.os_type,
os_state=self.compute_models.OperatingSystemStateTypes.generalized,
snapshot=snapshot_resource,
managed_disk=managed_disk,
blob_uri=blob_uri)
os_state=self.compute_models.OperatingSystemStateTypes.generalized,
snapshot=snapshot_resource,
managed_disk=managed_disk,
blob_uri=blob_uri)
def create_data_disk(self, lun, 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
managed_disk = self.compute_models.SubResource(disk) if disk else None
return self.compute_models.ImageDataDisk(lun,
blob_uri=blob_uri,
snapshot=snapshot_resource,
managed_disk=managed_disk)
blob_uri=blob_uri,
snapshot=snapshot_resource,
managed_disk=managed_disk)
def create_data_disks(self):
return list(filter(None, [self.create_data_disk(lun, source) for lun, source in enumerate(self.data_disk_sources)]))

View file

@ -455,8 +455,8 @@ class AzureRMNetworkInterface(AzureRMModuleBase):
nic.ip_configurations[0].subnet = self.network_models.Subnet(id=subnet.id)
nic.ip_configurations[0].name = 'default'
nic.network_security_group = self.network_models.NetworkSecurityGroup(id=nsg.id,
location=nsg.location,
resource_guid=nsg.resource_guid)
location=nsg.location,
resource_guid=nsg.resource_guid)
if 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'):
nsg = self.get_security_group(results['network_security_group']['name'])
nic.network_security_group = self.network_models.NetworkSecurityGroup(id=nsg.id,
location=nsg.location,
resource_guid=nsg.resource_guid)
location=nsg.location,
resource_guid=nsg.resource_guid)
# See what actually gets sent to the API
request = self.serialize_obj(nic, 'NetworkInterface')

View file

@ -238,8 +238,8 @@ class AzureRMSubnet(AzureRMModuleBase):
)
if nsg:
subnet.network_security_group = self.network_models.NetworkSecurityGroup(id=nsg.id,
location=nsg.location,
resource_guid=nsg.resource_guid)
location=nsg.location,
resource_guid=nsg.resource_guid)
else:
# update subnet
@ -250,8 +250,8 @@ class AzureRMSubnet(AzureRMModuleBase):
if results['network_security_group'].get('id'):
nsg = self.get_security_group(results['network_security_group']['name'])
subnet.network_security_group = self.network_models.NetworkSecurityGroup(id=nsg.id,
location=nsg.location,
resource_guid=nsg.resource_guid)
location=nsg.location,
resource_guid=nsg.resource_guid)
self.results['state'] = self.create_or_update_subnet(subnet)
elif self.state == 'absent':

View file

@ -937,8 +937,9 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
plan = None
if self.plan:
plan = self.network_models.Plan(name=self.plan.get('name'), product=self.plan.get('product'), publisher=self.plan.get('publisher'),
promotion_code=self.plan.get('promotion_code'))
plan = self.network_models.Plan(name=self.plan.get('name'), product=self.plan.get('product'),
publisher=self.plan.get('publisher'),
promotion_code=self.plan.get('promotion_code'))
vm_resource = self.network_models.VirtualMachine(
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].name = 'default'
parameters.network_security_group = self.network_models.NetworkSecurityGroup(id=group.id,
location=group.location,
resource_guid=group.resource_guid)
location=group.location,
resource_guid=group.resource_guid)
parameters.ip_configurations[0].public_ip_address = self.network_models.PublicIPAddress(id=pip.id,
location=pip.location,
resource_guid=pip.resource_guid)
location=pip.location,
resource_guid=pip.resource_guid)
self.log("Creating NIC {0}".format(network_interface_name))
self.log(self.serialize_obj(parameters, 'NetworkInterface'), pretty_print=True)