Skip to content

Instantly share code, notes, and snippets.

@Akasurde
Created May 16, 2017 08:21
Show Gist options
  • Save Akasurde/8af6e4419b104c1d984fe3bccb0f1253 to your computer and use it in GitHub Desktop.
Save Akasurde/8af6e4419b104c1d984fe3bccb0f1253 to your computer and use it in GitHub Desktop.
# 2to3 lib/ansible/modules/network/eos/eos_banner.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored lib/ansible/modules/network/eos/eos_banner.py
--- lib/ansible/modules/network/eos/eos_banner.py (original)
+++ lib/ansible/modules/network/eos/eos_banner.py (refactored)
@@ -97,7 +97,7 @@
want, have = updates
state = module.params['state']
- if state == 'absent' and 'text' in have.keys() and have['text']:
+ if state == 'absent' and 'text' in list(have.keys()) and have['text']:
commands.append('no banner %s' % module.params['banner'])
elif state == 'present':
@@ -128,7 +128,7 @@
banner_response_key = 'loginBanner'
else:
banner_response_key = 'motd'
- if isinstance(output[0], dict) and banner_response_key in output[0].keys():
+ if isinstance(output[0], dict) and banner_response_key in list(output[0].keys()):
obj['text'] = output[0][banner_response_key].strip('\n')
obj['state'] = 'present'
return obj
RefactoringTool: Files that need to be modified:
RefactoringTool: lib/ansible/modules/network/eos/eos_banner.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment