Michael Pasternak has uploaded a new change for review. Change subject: cli: CTRL + C signal while password prompt appears causes to rhevm-cli to fall #868647 ......................................................................
cli: CTRL + C signal while password prompt appears causes to rhevm-cli to fall #868647 https://bugzilla.redhat.com/show_bug.cgi?id=868647 Change-Id: Ic462b2baefa9d947e31ab0e81f1a10e06dff26b6 Signed-off-by: Michael Pasternak <[email protected]> --- M src/cli/context.py 1 file changed, 18 insertions(+), 11 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/61/9261/1 diff --git a/src/cli/context.py b/src/cli/context.py index 10d5984..9e1716f 100644 --- a/src/cli/context.py +++ b/src/cli/context.py @@ -83,17 +83,24 @@ def __collect_connection_data(self): self.__exclude_app_options() - if self.settings['ovirt-shell:url'] == '' and \ - not self.__is_option_specified_in_cli_args('--url') and \ - not self.__is_option_specified_in_cli_args('-l'): - self.settings['ovirt-shell:url'] = raw_input('URL: ') - if self.settings['ovirt-shell:username'] == '' and \ - not self.__is_option_specified_in_cli_args('--username') and \ - not self.__is_option_specified_in_cli_args('-u'): - self.settings['ovirt-shell:username'] = raw_input('Username: ') - if self.settings['ovirt-shell:password'] == '': - self.settings['ovirt-shell:password'] = getpass.getpass() - sys.stdin.flush() + + try: + if self.settings['ovirt-shell:url'] == '' and \ + not self.__is_option_specified_in_cli_args('--url') and \ + not self.__is_option_specified_in_cli_args('-l'): + self.settings['ovirt-shell:url'] = raw_input('URL: ') + if self.settings['ovirt-shell:username'] == '' and \ + not self.__is_option_specified_in_cli_args('--username') and \ + not self.__is_option_specified_in_cli_args('-u'): + self.settings['ovirt-shell:username'] = raw_input('Username: ') + if self.settings['ovirt-shell:password'] == '': + self.settings['ovirt-shell:password'] = getpass.getpass() + except KeyboardInterrupt: + sys.exit('') + except EOFError: + sys.exit('') + finally: + sys.stdin.flush() def __exclude_app_options(self): for opt in self.option_parser.app_options: -- To view, visit http://gerrit.ovirt.org/9261 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic462b2baefa9d947e31ab0e81f1a10e06dff26b6 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-cli Gerrit-Branch: master Gerrit-Owner: Michael Pasternak <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
