diff options
author | Adam Stokes <adam.stokes@ubuntu.com> | 2014-04-04 15:52:03 -0400 |
---|---|---|
committer | Adam Stokes <adam.stokes@ubuntu.com> | 2014-04-04 15:52:03 -0400 |
commit | 65d8fb5d30682dffffab1daf06662dafb9e303f2 (patch) | |
tree | 9e75d146e263c420436f95f649fe5b1c69228616 | |
parent | 6fe4ba194b6ae3ad6d7a2a95d3cd882ebf7bc1f3 (diff) | |
download | sos-65d8fb5d30682dffffab1daf06662dafb9e303f2.tar.gz |
Use input method from python six
Something our unittests didnt catch which is more functional
than anything. Using raw_input fails on python3 because it was
renamed to input. Six provides an alias that handles both
cases.
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
-rw-r--r-- | sos/plugins/emc.py | 5 | ||||
-rw-r--r-- | sos/policies/__init__.py | 7 | ||||
-rw-r--r-- | sos/sosreport.py | 4 |
3 files changed, 10 insertions, 6 deletions
diff --git a/sos/plugins/emc.py b/sos/plugins/emc.py index d5fb1ed2..cec66214 100644 --- a/sos/plugins/emc.py +++ b/sos/plugins/emc.py @@ -18,6 +18,9 @@ from sos.plugins import Plugin, RedHatPlugin, os +# Just for completeness sake. +from six.moves import input + class Emc(Plugin, RedHatPlugin): """EMC related information (PowerPath, Solutions Enabler CLI and Navisphere CLI) """ @@ -194,7 +197,7 @@ class Emc(Plugin, RedHatPlugin): CLARiiON_IP_address_list = [] CLARiiON_IP_loop = "stay_in" while CLARiiON_IP_loop == "stay_in": - ans = raw_input("CLARiiON SP IP Address or [Enter] to exit: ") + ans = input("CLARiiON SP IP Address or [Enter] to exit: ") ## Check to make sure the CLARiiON SP IP address provided is valid p = Popen("navicli -h %s getsptime" % (ans,), shell=True, stdout=PIPE, stderr=PIPE, close_fds=True) diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py index 3ae3979c..050a096a 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -18,6 +18,7 @@ from sos import _sos as _ import hashlib from textwrap import fill from six import print_ +from six.moves import input def import_policy(name): policy_fqname = "sos.policies.%s" % name @@ -393,9 +394,9 @@ class LinuxPolicy(Policy): if not self.commons['cmdlineopts'].batch and not self.commons['cmdlineopts'].quiet: try: - self.report_name = raw_input(_("Please enter your first initial and last name [%s]: ") % localname) + self.report_name = input(_("Please enter your first initial and last name [%s]: ") % localname) - self.ticket_number = raw_input(_("Please enter the case number that you are generating this report for: ")) + self.ticket_number = input(_("Please enter the case number that you are generating this report for: ")) self._print() except: self._print() @@ -416,7 +417,7 @@ class LinuxPolicy(Policy): if (self.report_name == ""): self.report_name = "default" - + return diff --git a/sos/sosreport.py b/sos/sosreport.py index 8483d109..334415ee 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -53,7 +53,7 @@ from sos.reporting import Report, Section, Command, CopiedFile, CreatedFile, Ale # PYCOMPAT import six -from six.moves import zip +from six.moves import zip, input if six.PY3: from configparser import ConfigParser else: @@ -894,7 +894,7 @@ class SoSReport(object): msg = self.policy.get_msg() msg += _("Press ENTER to continue, or CTRL-C to quit.\n") try: - raw_input(msg) + input(msg) except: self.ui_log.info("") self._exit() |