-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 20 August 2007, micah wrote:> David Schmitt david wrote on Mon Jun 25 03:32:09 CDT 2007:
> > For the ongoing modularisation of my config I wrote a
> > assert_lsbdistcodename class today, which can be used for failing
> > parts or complete configurations if a certain variable is not set
> > (lsbdistcodename in this case). Please find the file attached.
>
> This is great, however I ran into something strange with this. It appears
> as if lsbdistcodename is set if you have a valid /etc/apt/sources.list:
>
> With a valid sources.list:
> # facter | grep lsbdistcodename
> lsbdistcodename => sid
>
> But if your sources.list file is messed up, or missing:
> # rm /etc/apt/sources.list
> # facter | grep lsbdistcodename
> lsbdistcodename => n/a
>
> The lsb_release.pp only has the case statements for when lsbdistcodename
> is empty:
>
> case $lsbdistcodename {
> '''':
>
> otherwise it uses what it finds in facter by using "default:" as
the
> final case entry. This results in using "n/a" as your
lsbdistcodename
> when your /etc/apt/sources.list is messed up, which is not what should be
> happening.
>
> Maybe adding a case to $lsbdistcodename which tests if it is set to
''n/a''
> and if so alerting with some information on how to get this set correctly
> would be the solution?
>
> Additionally, this creates a chicken/egg problem with the apt module that
> you have which builds a /etc/apt/sources.list from a template based on
> lsbdistcodename. If you don''t already have a sources.list file,
you will
> end up with one that has broken things in it such as:
>
> # basic n/a
> deb http://ftp.at.debian.org/debian n/a main contrib non-free
I have modified assert_lsbdistcodename to recognize "n/a" as a
"illegal" value
and act accordingly, that is: fail. (see commit 6b3c937, I''ll push it
when
I''m online)
To work around the chicken/egg problem you have to set lsbdistcodename via
facter, e.g. by setting $facter_lsbdistcodename in the environment or by
providing a fallback ruby implementation of this fact.
Thanks for the hint! I hope my solution is satisfactory.
Regards, David
- --
The primary freedom of open source is not the freedom from cost, but the free-
dom to shape software to do what you want. This freedom is /never/ exercised
without cost, but is available /at all/ only by accepting the very different
costs associated with open source, costs not in money, but in time and effort.
- -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFG0eE4/Pp1N6Uzh0URAp7AAJ4kkvY99Wtpi/aHddScMHA67RmR1wCdGDL2
Yh8hH4y9dHNManiUcBJw/gs=nr2C
-----END PGP SIGNATURE-----