lietu/gcrc

Crashes on image that has no tag

Closed this issue · 0 comments

gcrc crashes if it encounters an image that has no tags associated with it.

Below is an example showing where and how it crashes.

  File "~/.local/bin/gcrc", line 8, in <module>
    sys.exit(app())
  File "~/.local/pipx/venvs/gcrc/lib/python3.9/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "~/.local/pipx/venvs/gcrc/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "~/.local/pipx/venvs/gcrc/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "~/.local/pipx/venvs/gcrc/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "~/.local/pipx/venvs/gcrc/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "~/.local/pipx/venvs/gcrc/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "~/.local/pipx/venvs/gcrc/lib/python3.9/site-packages/typer/main.py", line 497, in wrapper
    return callback(**use_params)  # type: ignore
  File "~/.local/pipx/venvs/gcrc/lib/python3.9/site-packages/gcrc/main.py", line 147, in cleanup
    tags = gcloud.list_tags(image)
  File "~/.local/pipx/venvs/gcrc/lib/python3.9/site-packages/gcrc/gcloud.py", line 59, in list_tags
    return [ImageTag(**ImageTag.pre_process(row)) for row in json.loads(result.stdout)]
  File "~/.local/pipx/venvs/gcrc/lib/python3.9/site-packages/gcrc/gcloud.py", line 59, in <listcomp>
    return [ImageTag(**ImageTag.pre_process(row)) for row in json.loads(result.stdout)]
  File "~/.local/pipx/venvs/gcrc/lib/python3.9/site-packages/gcrc/gcloud.py", line 25, in pre_process
    "name": data["tags"][0],
IndexError: list index out of range