Skip to content

Commit

Permalink
STAR-431: Add option to prevent any file-I/O from cqlsh (apply from c…
Browse files Browse the repository at this point in the history
…orrect version of cqlsh.py this time) (apache#170)

(cherry picked from commit 38a4915)
(cherry picked from commit 0b65dd4)
(cherry picked from commit 271f1f1)
  • Loading branch information
mfleming authored and jacek-lewandowski committed Apr 19, 2022
1 parent c14ba2b commit 29b8d06
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bin/cqlsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 29b8d06

Please sign in to comment.