[BUG] Recent regression in `aptpkg`: Traceback: KeyError: 'index'
myii opened this issue · comments
Description
CC: @Ch3LL.
This is the second of two regressions encountered during the Formulas' weekly testing this week (2022-W24
).
Using interactive debugging, I've traced it down to this commit: b42487f (#61760).
There was just the one formula repo where this failed.
https://gitlab.com/myii/postgres-formula/-/jobs/2592354250#L4440:
postgresql-repo:
pkgrepo.managed:
- file: "/etc/apt/sources.list.d/pgdg.list"
- humanname: "PostgreSQL Official Repository"
- name: "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg] http://apt.postgresql.org/pub/repos/apt buster-pgdg main"
...
ID: postgresql-repo
Function: pkgrepo.managed
Name: deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg] http://apt.postgresql.org/pub/repos/apt buster-pgdg main
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/salt/state.py", line 2277, in call
*cdata["args"], **cdata["kwargs"]
File "/usr/local/lib/python3.7/dist-packages/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/salt/loader/lazy.py", line 1201, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/salt/loader/lazy.py", line 1216, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/salt/loader/lazy.py", line 1249, in wrapper
return f(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/salt/states/pkgrepo.py", line 487, in managed
sanitizedkwargs = __salt__["pkg.expand_repo_def"](repo=repo, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/salt/loader/lazy.py", line 1201, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/salt/loader/lazy.py", line 1216, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/salt/modules/aptpkg.py", line 3002, in expand_repo_def
idx = repo_opts[opt]["index"]
KeyError: 'index'
Notice that signed-by
is the only option given:
deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg] http://apt.postgresql.org/pub/repos/apt buster-pgdg main
Setup
Kitchen CI for the postgres-formula
.
Please be as specific as possible and give set-up details.
- on-prem machine
- VM (Virtualbox, KVM, etc. please specify)
- VM running on a cloud service, please be explicit and add details
- container (Kubernetes, Docker, containerd, etc. please specify)
- or a combination, please be explicit
- jails if it is FreeBSD
Steps to Reproduce the behavior
Run Kitchen testing for the formula mentioned above.
Expected behavior
The pkgrepo.managed
state shouldn't fail.
Versions Report
A current master
branch installation of Salt (8253b6c).
Additional context
I have a fix that I will propose here shortly. I've rebuilt our master
images with it and the jobs are passing again: