saltstack / saltstack/salt

[BUG] ldap.managed state KeyError: 'ldap3.connect'

Open
#66,461 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
After upgrade of salt-minion from 3005.5-1 to 3005.5-2, state ldap.managed fails with KeyError: 'ldap3.connect'

Setup
salt-master 3005.5
salt-minion 3005.5
salt-minion-3005.5-2.el7.x86_64

Steps to Reproduce the behavior
salt <my_minion> state.highstate

      ID: state-dirsrv-tls
Function: ldap.managed
  Result: False
 Comment: An exception occurred in this state: Traceback (most recent call last):
            File "salt/state.py", line 2276, in call
              ret = self.states[cdata["full"]](
            File "salt/loader/lazy.py", line 149, in __call__
              return self.loader.run(run_func, *args, **kwargs)
            File "salt/loader/lazy.py", line 1228, in run
              return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
            File "salt/loader/lazy.py", line 1243, in _run_as
              return _func_or_method(*args, **kwargs)
            File "salt/loader/lazy.py", line 1276, in wrapper
              return f(*args, **kwargs)
            File "/opt/saltstack/salt/run/salt/states/ldap.py", line 249, in managed
              connect = __salt__["ldap3.connect"]
            File "salt/loader/context.py", line 78, in __getitem__
              return self.value()[item]
            File "salt/loader/lazy.py", line 336, in __getitem__
              super().__getitem__(item)  # try to get the item from the dictionary
            File "salt/utils/lazy.py", line 100, in __getitem__
              return self._dict[key]
          KeyError: 'ldap3.connect'
 Started: 17:22:40.210579
Duration: 11.396 ms

Versions Report

salt --versions-report Salt Version: Salt: 3005.5

Dependency Versions:
cffi: 1.14.3
cherrypy: unknown
dateutil: 2.7.5
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10.1
libgit2: Not Installed
M2Crypto: 0.35.2
Mako: Not Installed
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.14
pycrypto: Not Installed
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.6.8 (default, Jan 16 2024, 02:08:59)
python-gnupg: 0.4.6
PyYAML: 5.4.1
PyZMQ: 20.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4

System Versions:
dist: oracle 8.9
locale: UTF-8
machine: x86_64
release: 4.18.0-513.11.0.1.el8_9.x86_64
system: Linux
version: Oracle Linux Server 8.9

state-dirsrv-tls:
  ldap.managed:
    - connect_spec:
        url: ldap://127.0.0.1:389/
        bind:
          method: simple
          dn: cn=Directory Manager
          password: xxxxxxxx
    - entries:
      # TLS settings
      - cn=encryption,cn=config:
        - replace:
            sslVersionMin: TLS1.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with salt/states/ldap.py and the managed entry point shown in the traceback; trace why salt lacks ldap3.connect after the 3005.5-2 upgrade. Reproduce the failure with the supplied state.highstate command and compare the relevant behavior between the reported package versions. Done means ldap.managed no longer raises this KeyError for the supplied configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.