nautobot-docker-compose icon indicating copy to clipboard operation
nautobot-docker-compose copied to clipboard

Celery worker need access to nautobot_config.py (volume mapping)

Open bsmeding opened this issue 1 year ago • 0 comments

Currently the celery worker doesn't have any volumes mapped in the docker_compose.yml file(s)

Result: When executing a job from Plugin it failed because plugin config is not found. This container also needs the same mapping as nautobot and nautobot-worker container

This was needed for golden-config job to execute, that failed first:

 -------------- celery@a2017eec65b4 v5.2.7 (dawn-chorus)
--- ***** -----
-- ******* ---- Linux-4.18.0-372.26.1.el8_6.x86_64-x86_64-with-glibc2.31 2022-10-19 13:44:39
- *** --- * ---
- ** ---------- [config]
- ** ---------- .> app:         nautobot:0x7f9060254580
- ** ---------- .> transport:   redis://:**@nautobot-redis:6379/0
- ** ---------- .> results:     redis://:**@nautobot-redis:6379/0
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
 -------------- [queues]
                .> celery           exchange=celery(direct) key=celery


[2022-10-19 13:46:01,586: ERROR/ForkPoolWorker-1] Task nautobot.extras.jobs.run_job[43b252ff-c653-45a9-a637-c725a850d872] raised unexpected: KeyError('nautobot_golden_config')
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/celery/app/trace.py", line 451, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/celery/app/trace.py", line 734, in __protected_call__
    return self.run(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/nautobot/extras/jobs.py", line 1067, in run_job
    job_class = job_model.job_class
  File "/usr/local/lib/python3.9/site-packages/nautobot/extras/models/jobs.py", line 300, in job_class
    self._job_class = import_object(f"{self.module_name}.{self.job_class_name}")
  File "/usr/local/lib/python3.9/site-packages/nautobot/extras/plugins/utils.py", line 45, in import_object
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/local/lib/python3.9/site-packages/nautobot_golden_config/jobs.py", line 13, in <module>
    from nautobot_golden_config.nornir_plays.config_intended import config_intended
  File "/usr/local/lib/python3.9/site-packages/nautobot_golden_config/nornir_plays/config_intended.py", line 22, in <module>
    from nautobot_golden_config.models import GoldenConfigSetting, GoldenConfig
  File "/usr/local/lib/python3.9/site-packages/nautobot_golden_config/models.py", line 20, in <module>
    from nautobot_golden_config.utilities.utils import get_platform
  File "/usr/local/lib/python3.9/site-packages/nautobot_golden_config/utilities/utils.py", line 5, in <module>
    from nautobot_golden_config.utilities.constant import PLUGIN_CFG
  File "/usr/local/lib/python3.9/site-packages/nautobot_golden_config/utilities/constant.py", line 4, in <module>
    PLUGIN_CFG = settings.PLUGINS_CONFIG["nautobot_golden_config"]
KeyError: 'nautobot_golden_config'

bsmeding avatar Oct 19 '22 14:10 bsmeding