Question

I am trying to edit the exclude part of my yum.conf using the augeas tool which again I use in puppet.

The problem is that doing:

# augtool
augtool> set /files/etc/yum.conf/main/exclude[last()+1] 'kernel*'
augtool> save
Saved 1 file(s)
augtool> set /files/etc/yum.conf/main/exclude[last()+1] 'python*'
augtool> save
Saved 1 file(s)
augtool> 

Writes out:

exclude=kernel*
exclude=python*

in the /etc/yum.conf file.

The yum.conf's exclude part only support a space separated list. So how can I trick augeas to use space separation here? Or am I doing something completely wrong?

Overwriting the whole exclude option is not a solution since there could be other entries in it already.

Was it helpful?

Solution

You've hit an issue in Augeas that's been logged as #275: yum.aug doesn't break 'exclude' or 'includepkg' into sequences for yum repositories. The issue is that the lens doesn't split the value up into multiple nodes, instead treating it as one node with spaces.

The only way to do it in Augeas would be to replace the entire line with a single space separated string, which is precisely what you don't want to do:

set /files/etc/yum.conf/main/exclude 'kernel* python*'

I'll mention this on the above ticket so we know there's more demand, as we'll probably just have to take the hit for no backwards compatibility, as in similar cases.

We don't have a patch for it yet, but once we do then you could use the updated yum.aug on your systems. Putting it under /usr/share/augeas/lenses will override the packaged version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top