projectsyn/commodore

Commodore crash if Lieutenant returns 4xx

laserb opened this issue · 0 comments

Running commodore with an api token that does not have access to the cluster and returns an error 4xx crashes commodore. It expects a reason, but Lieutenant does not provide one.

Log

Traceback (most recent call last):
  File "/usr/local/bin/commodore", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/commodore/cli.py", line 304, in main
    commodore.main(prog_name="commodore", auto_envvar_prefix="COMMODORE")
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/commodore/cli.py", line 176, in compile_catalog
    _compile(config, cluster)
  File "/usr/local/lib/python3.9/site-packages/commodore/compile.py", line 154, in compile
    catalog_repo = _regular_setup(config, cluster_id)
  File "/usr/local/lib/python3.9/site-packages/commodore/compile.py", line 62, in _regular_setup
    cluster = load_cluster_from_api(config, cluster_id)
  File "/usr/local/lib/python3.9/site-packages/commodore/cluster.py", line 99, in load_cluster_from_api
    cluster_response = lieutenant_query(
  File "/usr/local/lib/python3.9/site-packages/commodore/helpers.py", line 111, in lieutenant_query
    extra_msg = f": {resp['reason']}"
KeyError: 'reason'

Expected

  • Commodore should not expect a reason.
  • Or Lieutenant should provide a reason.