From 29b8d06c424b052ed104b185061c7bc6bf8bfa86 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Wed, 26 May 2021 15:37:37 +0100 Subject: [PATCH] STAR-431: Add option to prevent any file-I/O from cqlsh (apply from correct version of cqlsh.py this time) (#170) (cherry picked from commit 38a49150cd8d2ea7acbe54095a7fd8c9c3f5d5cf) (cherry picked from commit 0b65dd40abea3d2493083cca603dae658bb46eff) (cherry picked from commit 271f1f1c306beaeb777d869dbbe5759b0880e170) --- bin/cqlsh.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/cqlsh.py b/bin/cqlsh.py index a7c5d629c0fc..94fea40cf357 100755 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@ -425,7 +425,7 @@ class Shell(cmd.Cmd): last_hist = None shunted_query_out = None use_paging = True - no_file_io = False + no_file_io = DEFAULT_NO_FILE_IO default_page_size = 100 @@ -446,8 +446,8 @@ def __init__(self, hostname, port, color=False, request_timeout=DEFAULT_REQUEST_TIMEOUT_SECONDS, protocol_version=None, connect_timeout=DEFAULT_CONNECT_TIMEOUT_SECONDS, - is_subshell=False, - no_file_io=False): + no_file_io=DEFAULT_NO_FILE_IO, + is_subshell=False): cmd.Cmd.__init__(self, completekey=completekey) self.hostname = hostname self.port = port @@ -536,8 +536,8 @@ def __init__(self, hostname, port, color=False, self.empty_lines = 0 self.statement_error = False self.single_statement = single_statement - self.is_subshell = is_subshell self.no_file_io = no_file_io + self.is_subshell = is_subshell @property def batch_mode(self): @@ -1677,6 +1677,7 @@ def do_source(self, parsed): max_trace_wait=self.max_trace_wait, ssl=self.ssl, request_timeout=self.session.default_timeout, connect_timeout=self.conn.connect_timeout, + no_file_io=self.no_file_io, is_subshell=True) # duplicate coverage related settings in subshell if self.coverage: @@ -2184,7 +2185,7 @@ def read_options(cmdlineargs, environment): optvalues.connect_timeout = option_with_default(configs.getint, 'connection', 'timeout', DEFAULT_CONNECT_TIMEOUT_SECONDS) optvalues.request_timeout = option_with_default(configs.getint, 'connection', 'request_timeout', DEFAULT_REQUEST_TIMEOUT_SECONDS) optvalues.execute = None - optvalues.no_file_io = option_with_default(configs.getboolean, 'ui', 'no_file_io', False) + optvalues.no_file_io = option_with_default(configs.getboolean, 'ui', 'no_file_io', DEFAULT_NO_FILE_IO) (options, arguments) = parser.parse_args(cmdlineargs, values=optvalues) # Make sure some user values read from the command line are in unicode