[BUG] yumpkg option "get_extra_options" leads to CLI parameter error #64476
Labels
Bug
broken, incorrect, or confusing behavior
Regression
The issue is a bug that breaks functionality known to work in previous releases.
RHEL
Related to running salt on or targeting Red Had Enterprise Linux
Milestone
Description
The yumpkg module has the option to pass additional CLI parameters to yum/dnf by stating them as kwargs. This can be enabled by setting kwarg
get_extra_options: True
:https://github.com/saltstack/salt/blob/master/salt/modules/yumpkg.py#L294
https://github.com/saltstack/salt/blob/master/salt/modules/yumpkg.py#L328
I use this in special cases to let yum use a different config file via the CLI option
--config
(see SLS example below).And this was working fine for 3004.2, but in 3005.1 and 3006.1, yum throws an error:
Command line error: argument --version: ignored explicit argument 'None'
It looks like there is an kwarg "version" with value None present, which is given to yum as
--version=None
.I can't tell for sure if kwarg "version" was present in 3004.2 already in my case, but it probably got simply ignored as it was a NoneType and not a string or True: https://github.com/saltstack/salt/blob/master/salt/modules/yumpkg.py#L334
But there was a change that always converts it to a string, and so it is not ignored anymore: 2962b04
A possible fix I can think of is to extend the cases where kwargs are ignored here:
https://github.com/saltstack/salt/blob/master/salt/modules/yumpkg.py#L331
So not only ignore kwarg names starting with "__" but also blacklist "version", as passing
--version
as parameter doesn't make sense anyway.Log with error message
Setup
test-yum.sls:
Steps to Reproduce the behavior
salt-call state.apply test-yum
(with test-yum.sls from above)
Versions Report
salt --versions-report
The text was updated successfully, but these errors were encountered: