[Puppet Users] apt-get, exec and a simple lesson

Bruce Richardson
2009-03-19T13:35:05Z

Somebody had this problem back in Feb, where "apt-get update" failed
and
I have found the solution.

So I had these two simple classes

class debian::apt::sources {
        if $debian_apt_sources {
                $debian_apt_sources = $debian_apt_sources
        } else {
                $debian_apt_sources = "#No content specified. Fix
me!\n"
                warning( "Warning: no content specified for
debian::apt::sources" )
        }
        file { ''/etc/apt/sources.list'':
                mode => 444,
                owner => root,
                group => root,
                content => $debian_apt_sources,
        }
}

class debian::apt::update {
        exec { ''apt-get update'':
                path        => ''/usr/bin'',
                subscribe   =>
File[''/etc/apt/sources.list''],
                refreshonly => true,
        }
}

Sometimes, apt-get update would fail with a generic "returned 100
instead of 0" error.  Googling found that a few people had encountered
this, with no solution that i could see.  I tracked it down to an error
returned by bzip2, when downloading bzipped packages lists.  Moment of
revelation was when I realised that apt-get is in /usr/bin but bzip2 is
in /bin (on Debian, anyway).  Changing the debian::apt::update class to
have

		path        => ''/bin:/usr/bin''

fixed it.  So apt-get obviously doesn''t use a hardwired path for bzip2
and expects to find it on the PATH.  Silly me.  Google tells me that a
bunch of Ubuntu and Debian-based consumer devices out there have this
problem as well, doubtless because apt-get has been wrapped in some
custom front-end that makes the same mistake I did.

--
Bruce

Explota!: miles de lemmings no pueden estar equivocados.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---