nautobot-app-ssot icon indicating copy to clipboard operation
nautobot-app-ssot copied to clipboard

FileNotFoundError for device-types files when plugin is installed with a non-nautobot user

Open jasonjuenger opened this issue 2 years ago • 0 comments

Environment

  • Python version: 3.7.15
  • Nautobot version: 1.5.4
  • nautobot-ssot-aci version: 1.0.0

Expected Behavior

Absolute paths for directories should be based on the plugin install location, not the expected install user (e.g. nautobot)

Observed Behavior

When the nautobot-ssot-aci plugin is installed with another user, like root, the plugin continues to look for plugin files in the nautobot directory instead of the directory where the module is installed.

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/nautobot_ssot/jobs/base.py", line 332, in run
    self.sync_data()
  File "/usr/local/lib/python3.7/site-packages/nautobot_ssot/jobs/base.py", line 137, in sync_data
    self.load_source_adapter()
  File "/usr/local/lib/python3.7/site-packages/nautobot_ssot_aci/jobs.py", line 70, in load_source_adapter
    self.source_adapter.load()
  File "/usr/local/lib/python3.7/site-packages/nautobot_ssot_aci/diffsync/adapters/aci.py", line 380, in load
    self.load_devices()
  File "/usr/local/lib/python3.7/site-packages/nautobot_ssot_aci/diffsync/adapters/aci.py", line 348, in load_devices
    if f"{self.devices[key]['model']}.yaml" in os.listdir("nautobot_ssot_aci/diffsync/device-types"):
FileNotFoundError: [Errno 2] No such file or directory: 'nautobot_ssot_aci/diffsync/device-types'

Steps to Reproduce

  1. su root
  2. pip install nautobot-ssot-aci
  3. sudo -iu nautobot
  4. nautobot-server start
  5. Go to Nautobot WebUI and start a new SSOT ACI job and it will error out with a FileNotFoundError exception

jasonjuenger avatar Dec 07 '22 22:12 jasonjuenger