saltstack / saltstack/salt

[BUG] git.config_unset KeyError exception

Open
#65,715 0 comments 0 reactions 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

I am trying to use the git.config_unset state.
This state throws the following error:

File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/state.py", line 2423, in call
                  ret = self.states[cdata["full"]](
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
                  ret = self.loader.run(run_func, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
                  return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
                  return _func_or_method(*args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1293, in wrapper
                  return f(*args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/git.py", line 3050, in config_unset
                  unset = [x for x in pre[key_name] if x not in post[key_name]]
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/git.py", line 3050, in <listcomp>
                  unset = [x for x in pre[key_name] if x not in post[key_name]]
              KeyError: 'core.filemode'

The issue is present since years.
See the following issues / PR:

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/git.py at line 3050 and reproduce the git.config_unset state using the traceback and configuration described in the issue. Read the related issues and pull request for prior context. Done means the state handles a missing core.filemode entry without raising KeyError and preserves the intended unset behavior.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.