From d007a403330c553d925b1b4888d93962a5f83f99 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Mon, 11 May 2015 10:49:27 -0400 Subject: Replace debian_*() parser functions with facts * Removes dependency on lsb-release and/or Facter >1.7 (values are based on $::lsbdistcodename, when available) * Simplifies maintenance: only lib/facter/util/* require updates as new releases are made Caveats: * apt::codename is removed; to override debian_* facts, set the FACTER_debian_codename environment variable for puppet * If tracking unstable, make sure lsb-release is installed, as other methods can't tell between testing and unstable --- manifests/apticron.pp | 2 +- manifests/init.pp | 16 ---------------- manifests/listchanges.pp | 2 +- manifests/params.pp | 3 +-- manifests/preferences.pp | 4 ++-- manifests/preseeded_package.pp | 2 +- 6 files changed, 6 insertions(+), 23 deletions(-) (limited to 'manifests') diff --git a/manifests/apticron.pp b/manifests/apticron.pp index 54d7b71..9c94f9c 100644 --- a/manifests/apticron.pp +++ b/manifests/apticron.pp @@ -1,6 +1,6 @@ class apt::apticron( $ensure_version = 'installed', - $config = "apt/${::operatingsystem}/apticron_${::lsbdistcodename}.erb", + $config = "apt/${::operatingsystem}/apticron_${::debian_codename}.erb", $email = 'root', $diff_only = '1', $listchanges_profile = 'apticron', diff --git a/manifests/init.pp b/manifests/init.pp index 68856cc..5aaa13a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -4,7 +4,6 @@ # See LICENSE for the full license granted to you. class apt( - $codename = $apt::params::codename, $use_lts = $apt::params::use_lts, $use_volatile = $apt::params::use_volatile, $include_src = $apt::params::include_src, @@ -41,21 +40,6 @@ class apt( require => undef, } - include lsb - - # init $release, $next_release, $next_codename, $release_version - case $codename { - 'n/a': { - fail("Unknown lsbdistcodename reported by facter: '$::lsbdistcodename', please fix this by setting this variable in your manifest.") - } - default: { - $release = debian_release($codename) - } - } - $release_version = debian_release_version($codename) - $next_codename = debian_nextcodename($codename) - $next_release = debian_nextrelease($release) - $sources_content = $custom_sources_list ? { '' => template( "apt/${::operatingsystem}/sources.list.erb"), default => $custom_sources_list diff --git a/manifests/listchanges.pp b/manifests/listchanges.pp index 0c163ae..e64bb1b 100644 --- a/manifests/listchanges.pp +++ b/manifests/listchanges.pp @@ -1,6 +1,6 @@ class apt::listchanges( $ensure_version = 'installed', - $config = "apt/${::operatingsystem}/listchanges_${::lsbdistcodename}.erb", + $config = "apt/${::operatingsystem}/listchanges_${::debian_codename}.erb", $frontend = 'mail', $email = 'root', $confirm = '0', diff --git a/manifests/params.pp b/manifests/params.pp index f977c27..da531db 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,12 +1,11 @@ class apt::params () { - $codename = $::lsbdistcodename $use_lts = false $use_volatile = false $include_src = false $use_next_release = false $debian_url = 'http://httpredir.debian.org/debian/' $security_url = 'http://security.debian.org/' - $backports_url = $::lsbdistcodename ? { + $backports_url = $::debian_codename ? { 'squeeze' => 'http://backports.debian.org/debian-backports/', default => $debian_url } diff --git a/manifests/preferences.pp b/manifests/preferences.pp index 9ed24c1..6982ca0 100644 --- a/manifests/preferences.pp +++ b/manifests/preferences.pp @@ -2,8 +2,8 @@ class apt::preferences { $pref_contents = $apt::custom_preferences ? { '' => $::operatingsystem ? { - 'debian' => template("apt/${::operatingsystem}/preferences_${apt::codename}.erb"), - 'ubuntu' => template("apt/${::operatingsystem}/preferences_${apt::codename}.erb"), + 'debian' => template("apt/${::operatingsystem}/preferences_${::debian_codename}.erb"), + 'ubuntu' => template("apt/${::operatingsystem}/preferences_${::ubuntu_codename}.erb"), }, default => $apt::custom_preferences } diff --git a/manifests/preseeded_package.pp b/manifests/preseeded_package.pp index 9bca8b1..3ef0687 100644 --- a/manifests/preseeded_package.pp +++ b/manifests/preseeded_package.pp @@ -4,7 +4,7 @@ define apt::preseeded_package ( ) { $seedfile = "/var/cache/local/preseeding/${name}.seeds" $real_content = $content ? { - '' => template ( "site_apt/${::lsbdistcodename}/${name}.seeds" ), + '' => template ( "site_apt/${::debian_codename}/${name}.seeds" ), default => $content } -- cgit v1.2.3