LCVcode / jockey

MIT License
2 stars 3 forks source link

Applications with zero units breaks unit querying #8

Closed LCVcode closed 5 months ago

LCVcode commented 6 months ago

I observed a case where homer-dashboard was deployed as an application with no units. This caused a key error when parsing the "units" list in that application's dictionary. Here is an example:

$ python3 jockey.py unit
<truncated>
Getting units for application: homer-dashboard
Traceback (most recent call last):
  File "jockey.py", line 739, in <module>
    main(args)
  File "jockey.py", line 696, in main
    print(" ".join(action(status, args.filters)))
  File "jockey.py", line 616, in filter_units
    for unit in get_units(status):
  File "jockey.py", line 244, in get_units
    for unit_name, data in status["applications"][app]["units"].items():
KeyError: 'units'

It appears that the "units" list is entirely omitted for applications with zero units. Unclear if this affects both primary and subordinate applications.