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

Adding dependency "nautobot[napalm]" breaks Invoke's image URL generation #70

Closed
rlad78 opened this issue May 1, 2024 · 1 comment
Closed

Comments

@rlad78
Copy link
Contributor

rlad78 commented May 1, 2024

I was trying to enable Napalm functionality on our Nautobot instance, using the instructions from Nautobot Documentation -> User Guide -> Administration -> Installation -> Installing Nautobot. In the context of the new poetry + Invoke setup, that just means doing the following:

poetry add nautobot[napalm]@2.1.1

That results in the following being changed in pyproject.toml:

- nautobot = "2.1.1"
+ nautobot = {version = "2.1.1", extras = ["napalm"]}

When running any Invoke command, the following lines get run:

with open("pyproject.toml", "r", encoding="utf8") as pyproject:
parsed_toml = toml.load(pyproject)
NAUTOBOT_VERSION = parsed_toml["tool"]["poetry"]["dependencies"]["nautobot"]

Which evaluates like so:

>>> parsed_toml["tool"]["poetry"]["dependencies"]["nautobot"]
{'version': '2.1.1', 'extras': ['napalm']}

...when, instead, the logic is intended to parse just the version string for the Nautobot dependency.

Later, when trying to synthesize the URL for the required Docker image, the following exception happens:

...

  File "/srv/docker-compose/nautobot-docker-compose-v2.0.0/tasks.py", line 90, in docker_compose
    return context.run(compose_command, env=compose_env, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/pypoetry/virtualenvs/nautobot-docker-compose-ENx6_Wnd-py3.11/lib/python3.11/site-packages/invoke/context.py", line 104, in run
    return self._run(runner, command, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/pypoetry/virtualenvs/nautobot-docker-compose-ENx6_Wnd-py3.11/lib/python3.11/site-packages/invoke/context.py", line 113, in _run
    return runner.run(command, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/pypoetry/virtualenvs/nautobot-docker-compose-ENx6_Wnd-py3.11/lib/python3.11/site-packages/invoke/runners.py", line 395, in run
    return self._run_body(command, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/pypoetry/virtualenvs/nautobot-docker-compose-ENx6_Wnd-py3.11/lib/python3.11/site-packages/invoke/runners.py", line 440, in _run_body
    self.start(command, self.opts["shell"], self.env)
  File "/root/.cache/pypoetry/virtualenvs/nautobot-docker-compose-ENx6_Wnd-py3.11/lib/python3.11/site-packages/invoke/runners.py", line 1337, in start
    self.process = Popen(
                   ^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib64/python3.11/subprocess.py", line 1870, in _execute_child
    env_list.append(k + b'=' + os.fsencode(v))
                               ^^^^^^^^^^^^^^
  File "<frozen os>", line 812, in fsencode
TypeError: expected str, bytes or os.PathLike object, not DynamicInlineTableDict
@jdrew82
Copy link
Contributor

jdrew82 commented Oct 3, 2024

This should be fixed with the merging of #71 .

@jdrew82 jdrew82 closed this as completed Oct 3, 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

No branches or pull requests

2 participants