Skip to content

Commit adf65ea

Browse files
Merge pull request #30 from NilashishC/master
Fix exception handling in template Reviewed-by: Nilashish Chakraborty <[email protected]> https://github.com/NilashishC
2 parents 4a13ec0 + b5ff448 commit adf65ea

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

roles/resource_module/templates/module_directory/network_os/network_os_facts.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def main():
100100
try:
101101
ansible_facts, warning = result
102102
warnings.extend(warning)
103-
except TypeError, KeyError:
103+
except (TypeError, KeyError):
104104
ansible_facts = result
105105

106106
module.exit_json(ansible_facts=ansible_facts, warnings=warnings)

roles/resource_module/templates/module_utils/network_os/config/resource/resource.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class {{ resource|capitalize }}(ConfigBase, {{ resource|capitalize }}Args):
4343
result = Facts().get_facts(self._module, self._connection, self.gather_subset, self.gather_network_resources)
4444
try:
4545
facts = result[0]
46-
except TypeError, KeyError:
46+
except (TypeError, KeyError):
4747
facts = result
4848
{{ resource }}_facts = facts['ansible_network_resources'].get('{{ resource }}')
4949
if not {{ resource }}_facts:

0 commit comments

Comments
 (0)