Skip to content

Commit

Permalink
Add interactive option
Browse files Browse the repository at this point in the history
This will keep passwords secret when running from the command line.
  • Loading branch information
SimonKrughoff committed Jun 27, 2019
1 parent cb624d0 commit af75940
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion python/lsst/verify/bin/dispatchverify.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import argparse
import os
import json
import getpass

try:
import git
Expand Down Expand Up @@ -128,6 +129,12 @@ def parse_args():
default=False,
help='Ignore data blobs even if they are available in the verification'
'job.')
parser.add_argument(
'--interactive',
dest='interactive',
action='store_true',
default=False,
help='If set, prompt for password on the command line.')

env_group = parser.add_argument_group('Environment arguments')
env_group.add_argument(
Expand Down Expand Up @@ -394,7 +401,10 @@ def __init__(self, args):
message = '--user or $SQUASH_USER configuration required'
raise RuntimeError(message)

self.api_password = args.api_password or os.getenv('SQUASH_password')
if args.interactive:
self.api_password = getpass.getpass(prompt="Enter your SQuaSH password: ")
else:
self.api_password = args.api_password or os.getenv('SQUASH_password')
if not self.test and self.api_password is None:
message = ('--password or $SQUASH_password configuration '
'required')
Expand Down

0 comments on commit af75940

Please sign in to comment.