nautobot / nautobot-app-chatops

Extensible ChatOps Framework to enable other chatbots and the Nautobot chat command.
https://docs.nautobot.com/projects/chatops/en/latest/
Other
51 stars 34 forks source link

Missing grpc dependency? #290

Open glennmatthews opened 1 year ago

glennmatthews commented 1 year ago

Environment

Seeing the below recurring traceback from Nautobot:

nautobot-docker-compose-nautobot-1  | Unable to load worker cloudvision, skipping. Exception follows:
nautobot-docker-compose-nautobot-1  | No module named 'grpc'
nautobot-docker-compose-nautobot-1  | Traceback (most recent call last):
nautobot-docker-compose-nautobot-1  |   File "/opt/nautobot/.local/lib/python3.11/site-packages/nautobot_chatops/workers/__init__.py", line 79, in get_commands_registry
nautobot-docker-compose-nautobot-1  |     command_func = worker.load()
nautobot-docker-compose-nautobot-1  |                    ^^^^^^^^^^^^^
nautobot-docker-compose-nautobot-1  |   File "/usr/local/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2518, in load
nautobot-docker-compose-nautobot-1  |     return self.resolve()
nautobot-docker-compose-nautobot-1  |            ^^^^^^^^^^^^^^
nautobot-docker-compose-nautobot-1  |   File "/usr/local/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2524, in resolve
nautobot-docker-compose-nautobot-1  |     module = __import__(self.module_name, fromlist=['__name__'], level=0)
nautobot-docker-compose-nautobot-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nautobot-docker-compose-nautobot-1  |   File "/opt/nautobot/.local/lib/python3.11/site-packages/nautobot_chatops/integrations/aristacv/worker.py", line 7, in <module>
nautobot-docker-compose-nautobot-1  |     from .cvpgrpcutils import get_device_tags
nautobot-docker-compose-nautobot-1  |   File "/opt/nautobot/.local/lib/python3.11/site-packages/nautobot_chatops/integrations/aristacv/cvpgrpcutils.py", line 5, in <module>
nautobot-docker-compose-nautobot-1  |     import grpc
nautobot-docker-compose-nautobot-1  | ModuleNotFoundError: No module named 'grpc'
zackt25 commented 1 year ago

@glennmatthews I ran into this also, @joewesch was able to help me.

I started off by only installing the chatops application 3.0.1 with no extras and hit the error above. We poetry added grpcio and ran into an error with the next import for arista in that file cvpgrpcutils.py.

We then re-installed the app with the "all" integrations settings and it worked.

Only thing is now when I run my /slash command it's saying that /cloudvision is available, but weird that it isn't listing all the other integrations.

Feels like it trying to load cloudvision even though I'm not requesting it to be loaded with the base install no extras.

smk4664 commented 1 year ago

Interesting, It shouldn't be trying to load cloudvision unless it is enabled. I will look into this.

zackt25 commented 1 year ago

This was my pyproject.toml and it worked, but had to add in django-rq.

# Used for local development
nautobot = { version = "2.0.3", optional = true }
python = ">=3.8,<3.12"
nautobot-chatops = {extras = ["aristacv"], version = "^3.0.1"}
django-rq = "^2.8.1"
Markdown = "*"
smk4664 commented 11 months ago

I know it has been a few weeks, but I am curious @glennmatthews and @zackt25 what you have in your nautobot_config.py. It should only try to load integrations that are enabled in your nautobot_config. For Instance:

PLUGINS_CONFIG = {
    "nautobot_chatops": {
        "enable_aristacv": True,
     },
}
smk4664 commented 11 months ago

Nevermind, I see the issue. it was renamed from "cloudvision" to "aristacv", but only partially. Also, there is still a reference to rq, which is why you had to install it. I will get a fix out for this.