Michael Pasternak has uploaded a new change for review. Change subject: cli: disable output redirection via config #866853 ......................................................................
cli: disable output redirection via config #866853 paging disabling is done via 'no_paging = True' configuration value. https://bugzilla.redhat.com/show_bug.cgi?id=866853 Change-Id: I633691151acc75441b177dc8c5996552fd4a5628 Signed-off-by: Michael Pasternak <[email protected]> --- M src/cli/context.py M src/cli/executionmode.py M src/cli/settings.py M src/ovirtcli/options.py M src/ovirtcli/settings.py 5 files changed, 18 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/63/9263/1 diff --git a/src/cli/context.py b/src/cli/context.py index 9e1716f..a3c01c3 100644 --- a/src/cli/context.py +++ b/src/cli/context.py @@ -61,6 +61,7 @@ self.option_parser = option_parser self.commands = [] self.status = None + self.mode = ExecutionMode.SHELL self.interactive = sys.stdin.isatty() and sys.stdout.isatty() \ and self.cmdin is sys.stdin self.settings = create(self.Settings, self.name) @@ -68,8 +69,7 @@ self.terminal = create(self.Terminal) self._setup_logging() self._load_settings() - self.setup_commands() - self.mode = ExecutionMode.SHELL + self.setup_commands() def _setup_logging(self): """Configure logging.""" @@ -133,6 +133,8 @@ self.__collect_connection_data() self.settings.add_callback('cli:debug', self._set_debug) self._set_debug('cli:debug', self.settings['cli:debug']) + if self.settings['ovirt-shell:no_paging']: + self.mode = ExecutionMode.NOPAGING def _set_debug(self, key, value): """Enable or disable debugging (callback).""" @@ -295,7 +297,8 @@ def _setup_pipeline(self, pipeline): """INTERNAL: set up the pipeline, if any.""" - if not pipeline or self.mode == ExecutionMode.SCRIPT:# or pipeline == 'less -FSRX': + if not pipeline or self.mode == ExecutionMode.SCRIPT or \ + self.mode == ExecutionMode.NOPAGING: self._pipeline = None return self._pipeline = Popen(pipeline, stdin=PIPE, stderr=PIPE, shell=True) diff --git a/src/cli/executionmode.py b/src/cli/executionmode.py index 0ac576b..6f13e0d 100644 --- a/src/cli/executionmode.py +++ b/src/cli/executionmode.py @@ -16,7 +16,7 @@ class ExecutionMode(): - SHELL, SCRIPT, DEFAULT = range(3) + SHELL, SCRIPT, DEFAULT, NOPAGING = range(4) def __init__(self, Type): self.value = Type @@ -28,6 +28,8 @@ return 'SCRIPT' if self.value == ExecutionMode.DEFAULT: return 'DEFAULT' + if self.value == ExecutionMode.NOPAGING: + return 'NOPAGING' def __eq__(self, y): return self.value == y.value diff --git a/src/cli/settings.py b/src/cli/settings.py index e792ff3..8044444 100644 --- a/src/cli/settings.py +++ b/src/cli/settings.py @@ -115,7 +115,10 @@ if not cp.read(fname): return False, old_format for section in cp.sections(): - for key, value in cp.items(section): + items = cp.items(section) + if len(items) < len(OvirtCliSettings.config_items): + old_format = True + for key, value in items: conf_key = '%s:%s' % (section, key) self[conf_key] = value if conf_key not in OvirtCliSettings.config_items: diff --git a/src/ovirtcli/options.py b/src/ovirtcli/options.py index 0963e65..93e1846 100644 --- a/src/ovirtcli/options.py +++ b/src/ovirtcli/options.py @@ -53,7 +53,7 @@ self.disable_interspersed_args() # list of hidden app. options (long format) - self.app_options = ['--password', '-p'] + self.app_options = ['--password', '-p', '--no-paging', '--no_paging'] def exit(self, status=0, msg=None): self.values._exit = True diff --git a/src/ovirtcli/settings.py b/src/ovirtcli/settings.py index d7cb08a..c225a9b 100644 --- a/src/ovirtcli/settings.py +++ b/src/ovirtcli/settings.py @@ -69,7 +69,8 @@ ('ovirt-shell:commands', str, '%s shell commands:' % PRODUCT), ('ovirt-shell:misc_commands', str, '%s shell commands:' % PRODUCT), ('ovirt-shell:version', str, ''), - ('ovirt-shell:prompt', str, '') + ('ovirt-shell:prompt', str, ''), + ('ovirt-shell:no_paging', boolean, False), ] #config file white list @@ -82,5 +83,6 @@ 'ovirt-shell:ca_file', 'ovirt-shell:insecure', 'ovirt-shell:filter', - 'ovirt-shell:timeout' + 'ovirt-shell:timeout', + 'ovirt-shell:no_paging' ] -- To view, visit http://gerrit.ovirt.org/9263 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I633691151acc75441b177dc8c5996552fd4a5628 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
