Fix Python3 Errors in Azure Cloud Module

When using Python3, the exec_module function errors out with a
unsupported operand type(s) for +: 'dict_keys' and 'list'
error when adding the .keys() to a static list. Use the explicit
list function to make a list of keys and then add to the ['tags'] list.
This commit is contained in:
Raja 2017-06-26 11:43:28 +05:30 committed by Toshio Kuratomi
parent 9500aac5b9
commit 171d903d04
9 changed files with 9 additions and 9 deletions

View file

@ -451,7 +451,7 @@ class AzureRMDeploymentManager(AzureRMModuleBase):
if PREREQ_IMPORT_ERROR:
self.fail(PREREQ_IMPORT_ERROR)
for key in self.module_arg_spec.keys() + ['tags']:
for key in list(self.module_arg_spec.keys()) + ['tags']:
setattr(self, key, kwargs[key])
if self.state == 'present':

View file

@ -336,7 +336,7 @@ class AzureRMNetworkInterface(AzureRMModuleBase):
def exec_module(self, **kwargs):
for key in self.module_arg_spec.keys() + ['tags']:
for key in list(self.module_arg_spec.keys()) + ['tags']:
setattr(self, key, kwargs[key])
results = dict()

View file

@ -182,7 +182,7 @@ class AzureRMPublicIPAddress(AzureRMModuleBase):
def exec_module(self, **kwargs):
for key in self.module_arg_spec.keys() + ['tags']:
for key in list(self.module_arg_spec.keys()) + ['tags']:
setattr(self, key, kwargs[key])
results = dict()

View file

@ -153,7 +153,7 @@ class AzureRMResourceGroup(AzureRMModuleBase):
def exec_module(self, **kwargs):
for key in self.module_arg_spec.keys() + ['tags']:
for key in list(self.module_arg_spec.keys()) + ['tags']:
setattr(self, key, kwargs[key])
results = dict()

View file

@ -548,7 +548,7 @@ class AzureRMSecurityGroup(AzureRMModuleBase):
def exec_module(self, **kwargs):
for key in self.module_arg_spec.keys() + ['tags']:
for key in list(self.module_arg_spec.keys()) + ['tags']:
setattr(self, key, kwargs[key])
changed = False

View file

@ -206,7 +206,7 @@ class AzureRMStorageAccount(AzureRMModuleBase):
def exec_module(self, **kwargs):
for key in self.module_arg_spec.keys() + ['tags']:
for key in list(self.module_arg_spec.keys()) + ['tags']:
setattr(self, key, kwargs[key])
resource_group = self.get_resource_group(self.resource_group)

View file

@ -267,7 +267,7 @@ class AzureRMStorageBlob(AzureRMModuleBase):
def exec_module(self, **kwargs):
for key in self.module_arg_spec.keys() + ['tags']:
for key in list(self.module_arg_spec.keys()) + ['tags']:
setattr(self, key, kwargs[key])
self.results['check_mode'] = self.check_mode

View file

@ -555,7 +555,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
def exec_module(self, **kwargs):
for key in self.module_arg_spec.keys() + ['tags']:
for key in list(self.module_arg_spec.keys()) + ['tags']:
setattr(self, key, kwargs[key])
# make sure options are lower case

View file

@ -221,7 +221,7 @@ class AzureRMVirtualNetwork(AzureRMModuleBase):
def exec_module(self, **kwargs):
for key in self.module_arg_spec.keys() + ['tags']:
for key in list(self.module_arg_spec.keys()) + ['tags']:
setattr(self, key, kwargs[key])
self.results['check_mode'] = self.check_mode