Use 'except ... as' syntax

This syntax works on Python 2.6 through 3.x.  lib/ansible/module_utils
(and lib/ansible/modules) need to support Python 2.4, so I didn't touch
those.
This commit is contained in:
Marius Gedminas 2015-08-27 09:16:11 +03:00
commit 0c6ce31f76
24 changed files with 51 additions and 51 deletions

View file

@ -382,7 +382,7 @@ class StrategyBase:
data = self._loader.load_from_file(included_file._filename)
if data is None:
return []
except AnsibleError, e:
except AnsibleError as e:
for host in included_file._hosts:
tr = TaskResult(host=host, task=included_file._task, return_data=dict(failed=True, reason=str(e)))
iterator.mark_host_failed(host)
@ -455,7 +455,7 @@ class StrategyBase:
loader=self._loader,
variable_manager=self._variable_manager
)
except AnsibleError, e:
except AnsibleError as e:
return False
if len(included_files) > 0:
@ -475,7 +475,7 @@ class StrategyBase:
# and add the new blocks to the list of handler blocks
handler_block.block.extend(block.block)
#iterator._play.handlers.extend(new_blocks)
except AnsibleError, e:
except AnsibleError as e:
for host in included_file._hosts:
iterator.mark_host_failed(host)
self._tqm._failed_hosts[host.name] = True