From d084748d4456a05abf73a0c380a0a5494ad5715a Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Tue, 18 Oct 2022 11:07:08 -0500 Subject: [PATCH] Gracefully exit if we can't find a date If the release name passed into the tool doesn't yet have a schedule, which is actually the most common use case, we won't be able to auto-detect a date. In that case let's bail somewhat nicely. Change-Id: I4072e73c15d0299755fcce43f8b35798179719c3 --- openstack_election/cmds/setup_election_config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openstack_election/cmds/setup_election_config.py b/openstack_election/cmds/setup_election_config.py index d05fc3c4..1872f4b6 100755 --- a/openstack_election/cmds/setup_election_config.py +++ b/openstack_election/cmds/setup_election_config.py @@ -140,6 +140,9 @@ def main(): if (args.date is None): schedule = utils.get_schedule_data(names[idx+1]) args.date = select_release_end_date(schedule) + if args.date is None: + print("Error: no end date found in series data") + exit(1) # Given the release history: # Stein, Rocky[0], Queens[1], Pike[2], Ocata[3]