OK! This seems to work: setm /files/etc/yum.repos.d/CentOS-Base.repo/*[label() != '#comment'] enabled 0"
But for a set of stanzas like this: [base] name=CentOS-$releasever - Base mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #released updates [updates] blah, blah blah the 'enabled=0' line gets added after the comment, e.g. [base] name=CentOS-$releasever - Base mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #released updates *enabled=0* [updates] blah, blah blah When it would be sooooo much better if the line got added above the comment under the gpgkey line . . . I'm nitpicking here, I know!! Any suggestions? Thanks so much for all of the help up to this point! ;-) On Thu, Apr 16, 2015 at 12:15 PM, Guy Matz <[email protected]> wrote: > No, I was wrong . . that doesn't work with augtool. It seems to, but > won't save . . . > > On Thu, Apr 16, 2015 at 12:00 PM, Guy Matz <[email protected]> wrote: > >> This works with augtool but not in puppet: >> >> augeas { 'disable all other repos in CentOS Base': >> context => '/files/etc/yum.repos.d/CentOS-Base.repo', >> changes => [ >> 'setm /files/etc/yum.repos.d/CentOS-Base.repo/* enabled 0' >> ] >> } >> >> Any thoughts would be appreciated! >> >> On Thu, Apr 16, 2015 at 9:21 AM, Guy Matz <[email protected]> wrote: >> >>> Hi! I'm trying to disable yum repos using augeas and can't quite figure >>> out how to set enabled=0 for all repos in a yum file. I've got this: >>> >>> augeas { 'disable all repos in CentOS Base': >>> context => '/files/etc/yum.repos.d/CentOS-Base.repo', >>> changes => [ >>> 'setm */enabled . 0' >>> ] >>> } >>> >>> Which works if a repo has an enabled line. The problem is that it >>> doesn't *add* an enabled line to a repo that does not. For example, the >>> enabled line here will get set to enabled=0: >>> [centosplus] >>> name=CentOS-$releasever - Plus >>> mirrorlist= >>> http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus >>> #baseurl= >>> http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ >>> gpgcheck=1 >>> enabled=1 >>> gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 >>> >>> but an enabled=0 will not get added to this: >>> [base] >>> name=CentOS-$releasever - Base >>> mirrorlist= >>> http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os >>> #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ >>> gpgcheck=1 >>> gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 >>> >>> >>> Anyone know how/if I can hit these two birds with one stone? >>> >>> Thanks!! >>> >> >> > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CABnTgtV9AH7VHrFjTa1ax8wsKVO5gRj3YyzW%3Dnm-1c8OG%3D7Lng%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
