-
Notifications
You must be signed in to change notification settings - Fork 40
Move Opstool to python 3 #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0ac2eb0 to
d642cbe
Compare
src/ops/python_compat.py
Outdated
| @@ -0,0 +1,24 @@ | |||
| # Copyright 2019 Adobe. All rights reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use six (https://six.readthedocs.io/) for compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/ops/cli/inventory.py
Outdated
| def get_host_facts(self, host, indent="\t"): | ||
| vars = host.get_vars() | ||
| vars = {unicode(key): var for key, var in vars.items()} # the yaml dumper doesn't handle mixed keys encoding | ||
| vars = {str(key): var for key, var in vars.items()} # the yaml dumper doesn't handle mixed keys encoding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire line might not be needed at all. We could test that, or at least add a TODO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
499f0a6 to
f18aa1e
Compare
print unicode fixes Signed-off-by: costimuraru <costimuraru@gmail.com> fix inventory sorting Signed-off-by: costimuraru <costimuraru@gmail.com> publish Signed-off-by: costimuraru <costimuraru@gmail.com> Use python3 docker image Signed-off-by: costimuraru <costimuraru@gmail.com> Add patch version test Signed-off-by: costimuraru <costimuraru@gmail.com> Add patch version [RELEASE] - Release version 1.9.3 Fix travia Fix Signed-off-by: costimuraru <costimuraru@gmail.com> Python3 fixes Fix tests for python3 Fix version check Signed-off-by: costimuraru <costimuraru@gmail.com> [RELEASE] - Release version 1.9.4 Upgrade ops-cli Use six for python3 compat check Implement feedback Show docker build command Signed-off-by: costimuraru <costimuraru@gmail.com>
| elif isinstance(value, str): # Python 2 str, check if it can be represented in utf8 | ||
| value.encode('utf-8') | ||
| except UnicodeDecodeError as e: | ||
| print 'Invalid character in argument "{0}", most likely an "en dash", replace it with normal dash -'.format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[not important] Maybe we can add an automatic replacement .replace(u'\u2014', '-', inplace=True) to skip this exception? Check if argument contains en dash and replace with with normal dash. Thus the user doesn't need to retype the command and change it's arguments
Signed-off-by: costimuraru <costimuraru@gmail.com>
Fixes #1