pkgrepo.managed parameter "disabled" broken in RHEL
Problem Description
It looks like the ability to disable YUM repositories is broken in Redhat based distros (possibly due to https://github.com/saltstack/salt/pull/22406 ?). When attempting to disable two repos using the following state file:
disable_repos:
pkgrepo.managed:
- names:
- "base"
- "updates"
- disabled: True
The *.repo files get disabled=True added to them instead of enabled=0. YUM doesn't recognize the "disabled" parameter (reference), so the repositories don't actually get disabled as expected.
Version Information
Salt Version:
Salt: 2015.8.1
Dependency Versions:
Jinja2: 2.8
M2Crypto: 0.21.1
Mako: Not Installed
PyYAML: 3.10
PyZMQ: 14.3.1
Python: 2.7.5 (default, Jun 17 2014, 18:11:42)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 3.2.5
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
libnacl: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: Not Installed
smmap: Not Installed
timelib: Not Installed
System Versions:
dist: centos 7.1.1503 Core
machine: x86_64
release: 3.10.0-229.1.2.el7.x86_64
system: CentOS Linux 7.1.1503 Core
@Dravu, thanks for the report. I remember at the time that the pkgrepo state supported both enabled and disabled, which was confusing, so we removed disabled in favor of enabled, but it seems that this regression remains.
On CentOS 7 with release 2015.8.3 the disabled flag is completely omitted. All created repo files are missing the "enabled=" flag.
Sorry to nag but ... any update or at least an estimate on this?
@m-bastian, not that I know of.
Upon further investiagion i discovered the following: "- disabled: false" will allways be ommited. Means: in the resulting .repo file there is no "enabled=1" entry.
Salt will not overwrite an exisiting .repo file when the disabled switch is changed from true to false or vice versa. If you delete the .repo file on the minion a correct version will be written.
Salt will not overwrite an exisiting .repo file when the disabled switch is changed from true to false or vice versa. If you delete the .repo file on the minion a correct version will be written.
+1 I just ran into this bug with salt-2015.8.7 and 2015.8.8
Here's how I reproduced the issue
Create a repo file
[root@salt-master graphite]# salt "statsmaster" pkg.mod_repo custom_repo_testing baseurl=http://10.44.0.254:8080/yum-repo/redhat/6/testing/$basearch humanname="Sensor Custom Testing Repo - $basearch" name="Sensor Custom Testing Repo - $basearch"
statsmaster:
----------
/etc/yum.repos.d/custom_repo_testing.repo:
----------
custom_repo_testing:
----------
baseurl:
http://10.44.0.254:8080/yum-repo/redhat/6/testing/
humanname:
Sensor Custom Testing Repo -
name:
Sensor Custom Testing Repo -
Set disabled=False - No change
[root@salt-master graphite]# salt "statsmaster" pkg.mod_repo custom_repo_testing baseurl=http://10.44.0.254:8080/yum-repo/redhat/6/testing/$basearch humanname="Sensor Custom Testing Repo - $basearch" name="Sensor Custom Testing Repo - $basearch" disabled=False
statsmaster:
----------
/etc/yum.repos.d/custom_repo_testing.repo:
----------
custom_repo_testing:
----------
baseurl:
http://10.44.0.254:8080/yum-repo/redhat/6/testing/
humanname:
Sensor Custom Testing Repo -
name:
Sensor Custom Testing Repo -
Set disabled=True - enabled=0 is added
[root@salt-master graphite]# salt "statsmaster" pkg.mod_repo custom_repo_testing baseurl=http://10.44.0.254:8080/yum-repo/redhat/6/testing/$basearch humanname="Sensor Custom Testing Repo - $basearch" name="Sensor Custom Testing Repo - $basearch" disabled=True
statsmaster:
----------
/etc/yum.repos.d/custom_repo_testing.repo:
----------
custom_repo_testing:
----------
baseurl:
http://10.44.0.254:8080/yum-repo/redhat/6/testing/
enabled:
0
humanname:
Sensor Custom Testing Repo -
name:
Sensor Custom Testing Repo -
Again set disabled=False, the enabled=0 line stays there
[root@salt-master graphite]# salt "statsmaster" pkg.mod_repo custom_repo_testing baseurl=http://10.44.0.254:8080/yum-repo/redhat/6/testing/$basearch humanname="Sensor Custom Testing Repo - $basearch" name="Sensor Custom Testing Repo - $basearch" disabled=False
statsmaster:
----------
/etc/yum.repos.d/custom_repo_testing.repo:
----------
custom_repo_testing:
----------
baseurl:
http://10.44.0.254:8080/yum-repo/redhat/6/testing/
enabled:
0
humanname:
Sensor Custom Testing Repo -
name:
Sensor Custom Testing Repo -
Looks like this was fixed in https://github.com/saltstack/salt/commit/2eedc260cb288bed4c6e2dfc84e8252ebc9ab5fb which will land in 2016.3.
The fix from #28639, which is present in 2016.3 as @redbaron4 stated, has now been back-ported to the 2015.8 with #32336.