From f0198cc39aee90f1cd90734bf784ce44d5f4a59c Mon Sep 17 00:00:00 2001 From: Zhijun Zhao Date: Thu, 28 Dec 2017 18:54:38 +0800 Subject: [PATCH] fix lint errors --- lib/ansible/module_utils/azure_rm_common.py | 8 ++++---- lib/ansible/modules/cloud/azure/azure_rm_image.py | 14 +++++++------- .../cloud/azure/azure_rm_networkinterface.py | 8 ++++---- lib/ansible/modules/cloud/azure/azure_rm_subnet.py | 8 ++++---- .../modules/cloud/azure/azure_rm_virtualmachine.py | 13 +++++++------ 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/lib/ansible/module_utils/azure_rm_common.py b/lib/ansible/module_utils/azure_rm_common.py index 616e8849d1..fb97da003d 100644 --- a/lib/ansible/module_utils/azure_rm_common.py +++ b/lib/ansible/module_utils/azure_rm_common.py @@ -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)) diff --git a/lib/ansible/modules/cloud/azure/azure_rm_image.py b/lib/ansible/modules/cloud/azure/azure_rm_image.py index f9bc670408..0512d5d636 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_image.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_image.py @@ -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)])) diff --git a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py index 584914bb5e..a4e0ff83ba 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py @@ -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') diff --git a/lib/ansible/modules/cloud/azure/azure_rm_subnet.py b/lib/ansible/modules/cloud/azure/azure_rm_subnet.py index 2a977f4a4c..6b8a407923 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_subnet.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_subnet.py @@ -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': diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py index d22c78b895..ec55f48ef2 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py @@ -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)