Skip to content

Commit

Permalink
prevent error when input version requested does not exist in lookup t…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
georgemccabe committed Nov 15, 2024
1 parent 2424c32 commit f821480
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions metplus/component_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,11 @@ def get_coordinated_version(component, version):
search_version = '.'.join(search_version.split('.')[:2])
# look for component version that begins with search version
for coord_version, versions in VERSION_LOOKUP.items():
if versions.get(component.lower()).startswith(search_version):
return coord_version
try:
if versions.get(component.lower()).startswith(search_version):
return coord_version
except AttributeError:
pass
return None

def main():
Expand Down Expand Up @@ -151,8 +154,8 @@ def main():


if __name__ == "__main__":
version = main()
if not version:
out_version = main()
if not out_version:
sys.exit(1)

print(version)
print(out_version)

0 comments on commit f821480

Please sign in to comment.