Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file not found .../dist-packages/nomad_tools/entry_githubrunner/default.nomad.hcl #22

Closed
shantanugadgil opened this issue Nov 11, 2024 · 1 comment · Fixed by #23
Closed

Comments

@shantanugadgil
Copy link

OS: Ubuntu 20.04.6 / CentOS 9 Stream
nomad-tools version: 0.5.2 (today's latest)

When I install nomad-tools as root, I get the following error:

As root:

# pip3 install --upgrade nomad-tools

As normal user:

$ nomadtools --help
Traceback (most recent call last):
  File "/usr/local/bin/nomadtools", line 8, in <module>
    sys.exit(entrypoint.main())
  File "/usr/local/lib/python3.8/dist-packages/nomad_tools/entrypoint.py", line 58, in main
    entry.main()
  File "/usr/local/lib/python3.8/dist-packages/nomad_tools/entry.py", line 80, in main
    cli(max_content_width=9999)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1077, in main
    with self.make_context(prog_name, args, **extra) as ctx:
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 943, in make_context
    self.parse_args(ctx, args)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1644, in parse_args
    rest = super().parse_args(ctx, args)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1408, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 2400, in handle_parse_result
    value = self.process_value(ctx, value)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 2362, in process_value
    value = self.callback(ctx, self, value)
  File "/usr/local/lib/python3.8/dist-packages/click/decorators.py", line 550, in callback
    echo(ctx.get_help(), color=ctx.color)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 704, in get_help
    return self.command.get_help(self)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1325, in get_help
    self.format_help(ctx, formatter)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1358, in format_help
    self.format_options(ctx, formatter)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1564, in format_options
    self.format_commands(ctx, formatter)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1617, in format_commands
    cmd = self.get_command(ctx, subcommand)
  File "/usr/local/lib/python3.8/dist-packages/nomad_tools/aliasedlazygroup.py", line 45, in get_command
    return self._lazy_load(matches[0])
  File "/usr/local/lib/python3.8/dist-packages/nomad_tools/aliasedlazygroup.py", line 25, in _lazy_load
    mod = importlib.import_module(modname)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.8/dist-packages/nomad_tools/entry_githubrunner/__init__.py", line 1, in <module>
    from .entry_githubrunner import *
  File "/usr/local/lib/python3.8/dist-packages/nomad_tools/entry_githubrunner/entry_githubrunner.py", line 236, in <module>
    class Config(pydantic.BaseModel, extra=pydantic.Extra.forbid):
  File "/usr/local/lib/python3.8/dist-packages/nomad_tools/entry_githubrunner/entry_githubrunner.py", line 259, in Config
    template: str = get_package_file("entry_githubrunner/default.nomad.hcl")
  File "/usr/local/lib/python3.8/dist-packages/nomad_tools/common_base.py", line 22, in get_package_file
    res = pkgutil.get_data(package, file)
  File "/usr/lib/python3.8/pkgutil.py", line 637, in get_data
    return loader.get_data(resource_name)
  File "<frozen importlib._bootstrap_external>", line 1037, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/dist-packages/nomad_tools/entry_githubrunner/default.nomad.hcl'

creating an empty file makes the error go away:

# touch /usr/local/lib/python3.8/dist-packages/nomad_tools/entry_githubrunner/default.nomad.hcl
$ nomadtools --help
Usage: nomadtools [OPTIONS] COMMAND [ARGS]...

  Collection of useful tools for HashiCorp Nomad.

Options:
  -N, --namespace TEXT    Set NOMAD_NAMESPACE environment variable.  [default: default]
  -h, --help              Show this message and exit.
  --version               Print program version then exit.
  --autocomplete-info     Print shell completion information.
  --autocomplete-install  Install shell completion.

Commands:
  constrainteval      Evaluate the constaint without running a job.
  cp                  Copy files/folders between a nomad allocation and the local filesystem.
  dockers             List all docker images referenced by a Nomad job.
  downloadrelease     Download specific binary from releases.hashicorp Examples: %(prog) -p 1.7.2 nomad ./bin/nomad %(prog) consul ./bin/consul
  githubrunner        Execute Nomad job to run github self-hosted runner for user repositories.
  gitlab-runner       Custom gitlab-runner executor to run gitlab-ci jobs in Nomad.
  go                  Execute one show Nomad job, like docker run.
  info                Get information about current Nomad state
  listattributes      List nodes that have given attributes and show these attributes values.
  listnodeattributes  List attributes of specific nodes or all nodes.
  nodenametoid        Convert node names to id.
  port                Print dynamic ports allocated by Nomad for a specific job or allocation.
  task                Find task inside an allocation given command line arguments and execute an action in it.
  vardir              This is a solution for managing Nomad variables as directories and files.
  watch               Depending on the command, run or stop a Nomad job.

  Written by Kamil Cukrowski 2024. Licensed under GNU GPL version or later.
@Kamilcuk
Copy link
Owner

Hi, sure, thank you, makes sense. I'll fix tests and package-data and release, should be sometime later today.

@Kamilcuk Kamilcuk mentioned this issue Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants