create_user: Try to read password file only when param specified.

The argument parser has default empty values set for the options
`--password` and `--password-file`, and this causes the script to try and
read a password file even when the argument was not provided.
This commit is contained in:
Puneeth Chaganti 2019-06-20 17:27:56 +05:30 committed by Tim Abbott
parent 9576ce589d
commit b530c87d26
1 changed files with 3 additions and 4 deletions

View File

@ -1,4 +1,3 @@
import argparse
import sys
from typing import Any
@ -77,10 +76,10 @@ parameters, or specify no parameters for interactive user creation.""")
full_name = input("Full name: ")
try:
if 'password' in options:
pw = options['password']
if 'password_file' in options:
if options['password_file']:
pw = open(options['password_file'], 'r').read()
elif options['password']:
pw = options['password']
else:
user_initial_password = initial_password(email)
if user_initial_password is None: