Skip to content

Commit

Permalink
better catch unauthorized errors with forced password prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
proddata committed Jan 30, 2024
1 parent ce39a5c commit 924f224
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Changes for crash
Unreleased
==========

- Better catch unauthorized errors when forcing a password prompt.

2024/01/29 0.31.0
=================

Expand Down
18 changes: 9 additions & 9 deletions crate/crash/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,17 +580,17 @@ def main():
args, password=password)
except (ProgrammingError, LocationParseError) as e:
msg = getattr(e, 'message', str(e))
if '401' in msg and not args.force_passwd_prompt:
if is_tty:
if '401' in msg and not args.force_passwd_prompt and is_tty:
password = getpass()
try:
cmd = _create_shell(crate_hosts, error_trace, output_writer,
is_tty, args, password=password)
except (ProgrammingError, LocationParseError) as ex:
printer.warn(str(ex))
sys.exit(1)
try:
cmd = _create_shell(crate_hosts, error_trace, output_writer,
is_tty, args, password=password)
except (ProgrammingError, LocationParseError) as ex:
printer.warn(str(ex))
sys.exit(1)
else:
raise e
printer.warn(str(e))
sys.exit(1)
except Exception as e:
printer.warn(str(e))
sys.exit(1)
Expand Down

0 comments on commit 924f224

Please sign in to comment.