Skip to content

Commit

Permalink
fixup! Make --verify-ssl choices explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
mfussenegger committed Jul 5, 2019
1 parent 2a61de3 commit 9e9157d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/crate/crash/command.py
Expand Up @@ -31,7 +31,7 @@
import urllib3
from getpass import getpass
from appdirs import user_data_dir, user_config_dir
from argparse import ArgumentParser
from argparse import ArgumentParser, ArgumentTypeError
from collections import namedtuple
from crate.client import connect
from crate.client.exceptions import ConnectionError, ProgrammingError
Expand Down Expand Up @@ -115,7 +115,8 @@ def boolean(v):
elif str(v).lower() in ("no", "false", "f", "0"):
return False
else:
raise ValueError('not a boolean value')
raise ArgumentTypeError(
f'Input `{v}` cannot be converted to a boolean, expected one of: [yes, true, t, 1, no, false, f, 0]')


def get_parser(output_formats=[], conf=None):
Expand Down Expand Up @@ -162,7 +163,7 @@ def _conf_or_default(key, value):
help='connect to HOSTS.', metavar='HOSTS')
parser.add_argument(
'--verify-ssl',
choices=(True, False),
choices=('true', 'false', 'yes', 'no'),
type=boolean,
default=True,
help='Enable or disable the verification of the server SSL certificate'
Expand Down

0 comments on commit 9e9157d

Please sign in to comment.