On Fri, 4 Dec 2009, Andy Miller wrote:

Thanks Jonathan and Colin,

Both solutions work in the longer term, but not during the initial boot.
Custom %post scripts, (with or without nochroot) happen after the
Spacewalk created %post, and the rhn_check is in that section. So
rhn_check hangs for several minutes trying the remote repos.

I've come up with a dirty hack that seems to work.

Looking at the order that Spacewalk 0.6 puts the various %post sections
into the Kickstart. First we have the %post --nochroot section that
contains both the Spacewalk inserted and the user edited sections (in
that order), then there is the Spacewalk %post section, and finally the
user edited %post section.

I created a %post --nochroot script that contains the following lines
%post
rm -f /etc/yum.repos.d/*.repo >> /root/ks-hack.log

Spacewalk addends these to the %post --nochroot section, creating a
third %post section that gets run before the Spacewalk %post section.
The repos get deleted before the rhn_check runs, and it sails through in
0.041 seconds (it tells me) rather than the >10 minutes it took time out
before.

This is a dirty, nasty hack, and I am sure that something will break it
at some point.

Can anyone think of a more robust solution?

Actually, my solution is slightly different than I'd just implied:

Here's my %pre script that sorts this out, taking advantage of default
spacewalk behaviour later on to make this do something useful:

mkdir -p /tmp/ks-tree-shadow/etc/yum.repos.d/custom

cat << EOF > /tmp/ks-tree-shadow/etc/yum.conf
[main]
cachedir=/var/cache/yum
reposdir=/etc/yum.repos.d/custom/
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=centos-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1

# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h

# Default.
# installonly_limit = 3

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d/custom
EOF

_______________________________________________
Spacewalk-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-list

Reply via email to