Skip to content

Commit

Permalink
Fix Python3 Errors in Azure Cloud Module
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rajasaur authored and abadger committed Jun 29, 2017
1 parent 9500aac commit 171d903
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/ansible/modules/cloud/azure/azure_rm_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def exec_module(self, **kwargs):
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':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def __init__(self):

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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def __init__(self):

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()
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/cloud/azure/azure_rm_resourcegroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def __init__(self):

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()
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/cloud/azure/azure_rm_securitygroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def __init__(self):

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
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/cloud/azure/azure_rm_storageaccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def __init__(self):

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)
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/cloud/azure/azure_rm_storageblob.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def __init__(self):

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
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ def __init__(self):

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
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def __init__(self):

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
Expand Down

0 comments on commit 171d903

Please sign in to comment.