mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Fixed a minor bug: 'message' variable changed prompt-message whenever exceptions was caught, it manifested in the subsequent iterations.
This commit is contained in:
parent
f46b1f71ea
commit
ce28c455aa
1 changed files with 6 additions and 4 deletions
|
|
@ -197,13 +197,14 @@ def build_repository(project_directory):
|
|||
|
||||
# Handle the expiration time. The expiration date determines when
|
||||
# the top-level roles expire.
|
||||
message = '\nWhen would you like your certificates to expire? (mm/dd/yyyy): '
|
||||
prompt_message = \
|
||||
'\nWhen would you like your certificates to expire? (mm/dd/yyyy): '
|
||||
timeout = None
|
||||
for attempt in range(MAX_INPUT_ATTEMPTS):
|
||||
# Get the difference between the user's entered expiration date and today's
|
||||
# date. Convert and store the difference to total days till expiration.
|
||||
try:
|
||||
input_date = _prompt(message)
|
||||
input_date = _prompt(prompt_message)
|
||||
expiration_date = datetime.datetime.strptime(input_date, '%m/%d/%Y')
|
||||
time_difference = expiration_date - datetime.datetime.now()
|
||||
timeout = time_difference.days
|
||||
|
|
@ -299,11 +300,12 @@ def build_repository(project_directory):
|
|||
# Ensure the user inputs a valid threshold value.
|
||||
role_threshold = None
|
||||
for attempt in range(MAX_INPUT_ATTEMPTS):
|
||||
message = '\nEnter the desired threshold for the role '+repr(role)+': '
|
||||
prompt_message = \
|
||||
'\nEnter the desired threshold for the role '+repr(role)+': '
|
||||
|
||||
# Check for non-integers and values less than one.
|
||||
try:
|
||||
role_threshold = _prompt(message, int)
|
||||
role_threshold = _prompt(prompt_message, int)
|
||||
if not tuf.formats.THRESHOLD_SCHEMA.matches(role_threshold):
|
||||
raise ValueError
|
||||
break
|
||||
|
|
|
|||
Loading…
Reference in a new issue