diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/dist_upgrade.pp | 9 | ||||
-rw-r--r-- | manifests/init.pp | 15 | ||||
-rw-r--r-- | manifests/preferences.pp | 20 | ||||
-rw-r--r-- | manifests/preferences/absent.pp | 1 | ||||
-rw-r--r-- | manifests/preferences_snippet.pp | 12 | ||||
-rw-r--r-- | manifests/upgrade_package.pp | 13 |
6 files changed, 38 insertions, 32 deletions
diff --git a/manifests/dist_upgrade.pp b/manifests/dist_upgrade.pp index 9e26769..ed25b0b 100644 --- a/manifests/dist_upgrade.pp +++ b/manifests/dist_upgrade.pp @@ -1,11 +1,16 @@ class apt::dist_upgrade { - include apt::update + if $apt::disable_update == false { + include apt::update + } exec { 'apt_dist-upgrade': command => "/usr/bin/apt-get -q -y -o 'DPkg::Options::=--force-confold' dist-upgrade", refreshonly => true, - require => Exec['apt_updated'], + require => $apt::disable_update ? { + true => undef, + default => Exec['apt_updated'], + } } } diff --git a/manifests/init.pp b/manifests/init.pp index 3de4d9e..c098ef3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,13 +8,14 @@ class apt( $use_volatile = false, $include_src = false, $use_next_release = false, - $debian_url = 'http://cdn.debian.net/debian/', + $debian_url = 'http://http.debian.net/debian/', $security_url = 'http://security.debian.org/', $backports_url = 'http://backports.debian.org/debian-backports/', $volatile_url = 'http://volatile.debian.org/debian-volatile/', $ubuntu_url = 'http://archive.ubuntu.com/ubuntu', $repos = 'auto', - $custom_preferences = '' + $custom_preferences = '', + $disable_update = false ){ case $::operatingsystem { 'debian': { @@ -44,6 +45,9 @@ class apt( $codename = $::lsbdistcodename $release = $::lsbdistrelease } + 'n/a': { + fail("Unknown lsbdistcodename reported by facter: '$lsbdistcodename', please fix this by setting this variable in your manifest.") + } default: { $release = debian_release($codename) } @@ -60,6 +64,7 @@ class apt( '' => template( "apt/${::operatingsystem}/sources.list.erb"), default => $custom_sources_list }, + mode => 0644, owner => root, group => 0, require => Package['lsb'], notify => Exec['refresh_apt'], owner => root, group => 0, mode => 0644; @@ -106,10 +111,6 @@ class apt( # backports uses the normal archive key now package { "debian-backports-keyring": ensure => absent } - include common::moduledir - $apt_base_dir = "${common::moduledir::module_dir_path}/apt" - modules_dir { apt: } - if $custom_key_dir { file { "${apt_base_dir}/keys.d": source => "$custom_key_dir", @@ -123,7 +124,7 @@ class apt( } if $custom_preferences != false { Exec["custom_keys"] { - before => Concat[apt_config], + before => File['apt_config'], } } } diff --git a/manifests/preferences.pp b/manifests/preferences.pp index e9a74ff..66f36a7 100644 --- a/manifests/preferences.pp +++ b/manifests/preferences.pp @@ -1,20 +1,18 @@ class apt::preferences { - concat::fragment{"apt_preferences_header": - content => $apt::custom_preferences ? { - '' => $::operatingsystem ? { - 'debian' => template("apt/${::operatingsystem}/preferences_${apt::codename}.erb"), - 'ubuntu' => template("apt/${::operatingsystem}/preferences_${apt::codename}.erb"), - }, - default => $custom_preferences + $pref_contents = $custom_preferences ? { + '' => $operatingsystem ? { + 'debian' => template("apt/${::operatingsystem}/preferences_${apt::codename}.erb"), + 'ubuntu' => template("apt/${::operatingsystem}/preferences_${apt::codename}.erb"), }, - order => 00, - target => '/etc/apt/preferences', + default => $custom_preferences } - concat{'/etc/apt/preferences': - alias => apt_config, + file { '/etc/apt/preferences': + ensure => present, + alias => 'apt_config', # only update together + content => $pref_contents, require => File["/etc/apt/sources.list"], owner => root, group => 0, mode => 0644; } diff --git a/manifests/preferences/absent.pp b/manifests/preferences/absent.pp index 0e96119..68ab400 100644 --- a/manifests/preferences/absent.pp +++ b/manifests/preferences/absent.pp @@ -1,6 +1,7 @@ class apt::preferences::absent { file { '/etc/apt/preferences': + alias => 'apt_config', ensure => absent, } } diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp index 6a8e6bc..1aafe57 100644 --- a/manifests/preferences_snippet.pp +++ b/manifests/preferences_snippet.pp @@ -23,11 +23,9 @@ define apt::preferences_snippet( fail("apt::preferences_snippet requires either a 'pin' or 'release' argument, not both") } - include apt::preferences - - concat::fragment{"apt_preference_${name}": + file { "/etc/apt/preferences.d/${name}": ensure => $ensure, - target => '/etc/apt/preferences', + owner => root, group => 0, mode => 0644; } # This should really work in the same manner as sources_list and apt_conf @@ -37,19 +35,19 @@ define apt::preferences_snippet( '': { case $release { '': { - Concat::Fragment["apt_preference_${name}"]{ + File["/etc/apt/preferences.d/${name}"]{ content => template("apt/preferences_snippet.erb") } } default: { - Concat::Fragment["apt_preference_${name}"]{ + File["/etc/apt/preferences.d/${name}"]{ content => template("apt/preferences_snippet_release.erb") } } } } default: { - Concat::Fragment["apt_preference_${name}"]{ + File["/etc/apt/preferences.d/${name}"]{ source => $source } } diff --git a/manifests/upgrade_package.pp b/manifests/upgrade_package.pp index 9202624..2ce6932 100644 --- a/manifests/upgrade_package.pp +++ b/manifests/upgrade_package.pp @@ -1,6 +1,8 @@ define apt::upgrade_package ($version = "") { - include apt::update + if $apt::disable_update == false { + include apt::update + } $version_suffix = $version ? { '' => '', @@ -24,10 +26,11 @@ define apt::upgrade_package ($version = "") { exec { "apt-get -q -y -o 'DPkg::Options::=--force-confold' install ${name}${version_suffix}": onlyif => [ "grep-status -F Status installed -a -P $name -q", "apt-show-versions -u $name | grep -q upgradeable" ], - require => [ - Exec['apt_updated'], - Package['apt-show-versions', 'dctrl-tools'], - ], + require => $apt::disable_update ? { + true => Package['apt-show-versions', 'dctrl-tools'], + default => [ Exec['apt_updated'], + Package['apt-show-versions', 'dctrl-tools'] ], + } } } |