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

[BUG] ext_pillar netbox not working after upgrade to 3007 #66194

Closed
margau opened this issue Mar 10, 2024 · 4 comments · Fixed by #66330
Closed

[BUG] ext_pillar netbox not working after upgrade to 3007 #66194

margau opened this issue Mar 10, 2024 · 4 comments · Fixed by #66330
Labels
Bug broken, incorrect, or confusing behavior

Comments

@margau
Copy link

margau commented Mar 10, 2024

Description
The external pillar netbox stops working after upgrade to 3007.

Setup

  • Hetzner Cloud VM
  • Debian 11 with onedir debian package

Netbox Config:

cat /etc/salt/master.d/netbox.conf 
ext_pillar:
  - netbox:
      api_url: https://netbox.example.com/api/
      api_token: <>
      virtual_machines: true
      interfaces: true
      interface_ips: true
      proxy_return: false

Steps to Reproduce the behavior
Try to do something with the ext_pillar, e.g. saltutil.refresh_pillar.

Logs

Mar 10 13:15:41 salt salt-master[6754]: [ERROR   ] Exception caught loading ext_pillar 'netbox':
Mar 10 13:15:41 salt salt-master[6754]:   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/__init__.py", line 1219, in ext_pillar
Mar 10 13:15:41 salt salt-master[6754]:     ext = self._external_pillar_data(pillar, val, key)
Mar 10 13:15:41 salt salt-master[6754]:   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/__init__.py", line 1139, in _external_pillar_data
Mar 10 13:15:41 salt salt-master[6754]:     ext = self.ext_pillars[key](self.minion_id, pillar, **val)
Mar 10 13:15:41 salt salt-master[6754]:   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__
Mar 10 13:15:41 salt salt-master[6754]:     ret = self.loader.run(run_func, *args, **kwargs)
Mar 10 13:15:41 salt salt-master[6754]:   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1233, in run
Mar 10 13:15:41 salt salt-master[6754]:     return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
Mar 10 13:15:41 salt salt-master[6754]:   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1248, in _run_as
Mar 10 13:15:41 salt salt-master[6754]:     return _func_or_method(*args, **kwargs)
Mar 10 13:15:41 salt salt-master[6754]:   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/netbox.py", line 1118, in ext_pillar
Mar 10 13:15:41 salt salt-master[6754]:     nodes.extend(_get_devices(api_url, minion_id, headers, api_query_result_limit))
Mar 10 13:15:41 salt salt-master[6754]:   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/netbox.py", line 707, in _get_devices
Mar 10 13:15:41 salt salt-master[6754]:     device_ret = salt.utils.http.query(
Mar 10 13:15:41 salt salt-master[6754]:   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/http.py", line 620, in query
Mar 10 13:15:41 salt salt-master[6754]:     HTTPClient(max_body_size=max_body)
Mar 10 13:15:41 salt salt-master[6754]:   File "/opt/saltstack/salt/lib/python3.10/site-packages/tornado/httpclient.py", line 109, in __init__
Mar 10 13:15:41 salt salt-master[6754]:     self._async_client = self._io_loop.run_sync(make_client)
Mar 10 13:15:41 salt salt-master[6754]:   File "/opt/saltstack/salt/lib/python3.10/site-packages/tornado/ioloop.py", line 521, in run_sync
Mar 10 13:15:41 salt salt-master[6754]:     self.start()
Mar 10 13:15:41 salt salt-master[6754]:   File "/opt/saltstack/salt/lib/python3.10/site-packages/tornado/platform/asyncio.py", line 195, in start
Mar 10 13:15:41 salt salt-master[6754]:     self.asyncio_loop.run_forever()
Mar 10 13:15:41 salt salt-master[6754]:   File "/opt/saltstack/salt/lib/python3.10/asyncio/base_events.py", line 592, in run_forever
Mar 10 13:15:41 salt salt-master[6754]:     self._check_running()
Mar 10 13:15:41 salt salt-master[6754]:   File "/opt/saltstack/salt/lib/python3.10/asyncio/base_events.py", line 586, in _check_running
Mar 10 13:15:41 salt salt-master[6754]:     raise RuntimeError(
Mar 10 13:15:42 salt salt-master[6754]: [CRITICAL] Pillar render error: Failed to load ext_pillar netbox: Cannot run the event loop while another loop is running

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
root@salt:~# salt-master --versions-report
Salt Version:
          Salt: 3007.0
 
Python Version:
        Python: 3.10.13 (main, Feb 19 2024, 03:31:20) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.16.0
      cherrypy: 18.8.0
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: 4.0.10
     gitpython: 3.1.32
        Jinja2: 3.1.3
       libgit2: 1.6.4
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.7
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 23.1
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: 1.12.2
  python-gnupg: 0.5.2
        PyYAML: 6.0.1
         PyZMQ: 25.1.2
        relenv: 0.15.1
         smmap: 5.0.0
       timelib: 0.3.0
       Tornado: 6.3.3
           ZMQ: 4.3.4
 
Salt Package Information:
  Package Type: onedir
 
System Versions:
          dist: debian 11.9 bullseye
        locale: utf-8
       machine: x86_64
       release: 5.10.0-28-amd64
        system: Linux
       version: Debian GNU/Linux 11.9 bullseye
@margau margau added Bug broken, incorrect, or confusing behavior needs-triage labels Mar 10, 2024
@margau margau changed the title [BUG] ext_pillar netbox working after upgrade to 3007 [BUG] ext_pillar netbox not working after upgrade to 3007 Mar 10, 2024
@manuelrais
Copy link

Hi
I can confirm the exact same error on 3007 version with netbox pillar extension.

@Peter0x48
Copy link

Hi,

Can also confirm that. For now downgraded to 3006.7

@ITJamie
Copy link
Contributor

ITJamie commented Apr 29, 2024

just got hit by this. downgrading too.

I attempted the fix from #66330 but it just gave a new error:

    Data failed to compile:
----------
    Pillar failed to render with the following messages:
----------
    Failed to load ext_pillar netbox: '_asyncio.Future' object has no attribute 'code'

krombel added a commit to krombel/salt that referenced this issue Apr 29, 2024
@dwoz dwoz removed the needs-triage label Apr 30, 2024
@dwoz dwoz added this to the Chlorine v3007.1 milestone Apr 30, 2024
krombel added a commit to krombel/salt that referenced this issue May 2, 2024
krombel added a commit to krombel/salt that referenced this issue Jun 12, 2024
@krombel
Copy link
Contributor

krombel commented Jun 24, 2024

Fixed by #66330

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants