Autocompletion without buildbox-casd will stacktrace

Summary

Autocompletion without buildbox-casd will stacktrace

Steps to reproduce

  1. Install BuildStream without buildbox-casd
  2. Source bash completion (source src/buildstream/data/bst)
  3. Type bst artifact delete <tab> <tab> when shelled into a project directory

What is the current bug behavior?

Stacktrace

What is the expected correct behavior?

We should see a list of files and artifact refs.

Relevant logs and/or screenshots

Error instantiating artifact cache: Did not find 'buildbox-casd' in PATH: /home/tlater/Documents/Work/buildstream/.tox/venv/bin:/home/tlater/.local/usr/bin:/home/tlater/.lo
cal/bin:/usr/lib/llvm/8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin
tlater@ren /home/tlater/Documents/Work/buildstream/tests/integration/project $ bst artifact delete Traceback (most recent call last):
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/bin/bst", line 11, in <module>
    sys.exit(cli())
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/buildstream/_frontend/cli.py", line 196, in override_main
    if main_bashcomplete(self, prog_name, partial(override_completions, args)):
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/buildstream/_frontend/complete.py", line 335, in main_bashcomplete
    do_complete(cmd, prog_name, override)
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/buildstream/_frontend/complete.py", line 325, in do_complete
    for item in get_choices(cli, prog_name, args, incomplete, override):
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/buildstream/_frontend/complete.py", line 294, in get_choices
    choices.extend(get_user_autocompletions(all_args, incomplete, ctx.command, cmd_param, override))
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/buildstream/_frontend/complete.py", line 243, in get_user_autocompletions
    incomplete=incomplete)
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/buildstream/_frontend/cli.py", line 185, in override_completions
    return complete_artifact(orig_args, args, incomplete)
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/buildstream/_frontend/cli.py", line 157, in complete_artifact
    complete_list.extend(ref for ref in ctx.artifactcache.list_artifacts() if ref.startswith(incomplete))
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/buildstream/_context.py", line 381, in artifactcache
    self._artifactcache = ArtifactCache(self)
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/buildstream/_artifactcache.py", line 143, in __init__
    super().__init__(context)
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/buildstream/_basecache.py", line 52, in __init__
    self.cas = context.get_cascache()
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/buildstream/_context.py", line 512, in get_cascache
    self._cascache = CASCache(self.cachedir, cache_quota=self.config_cache_quota)
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/buildstream/_cas/cascache.py", line 75, in __init__
    casd_args = [utils.get_host_tool('buildbox-casd')]
  File "/home/tlater/Documents/Work/buildstream/.tox/venv/lib/python3.6/site-packages/buildstream/utils.py", line 480, in get_host_tool
    raise ProgramNotFoundError("Did not find '{}' in PATH: {}".format(name, search_path))
buildstream.utils.ProgramNotFoundError: Did not find 'buildbox-casd' in PATH: /home/tlater/Documents/Work/buildstream/.tox/venv/bin:/home/tlater/.local/usr/bin:/home/tlater
/.local/bin:/usr/lib/llvm/8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin

Possible fixes

Don't check for buildbox-casd when performing auto-completion

Other relevant information

  • BuildStream version affected: /milestone %BuildStream_v1.x