aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2013-04-14 13:25:21 +0200
committervarac <varacanero@zeromail.org>2013-04-14 13:25:21 +0200
commitfb19032afc0da5b4d9c6c40ae277173905b4454e (patch)
tree73731eddb479e418bcb64a2d2b218b1bf007dabb
parent1ff5a86f5922df3de9a2bcc4b02f8925a7ef17ec (diff)
parent6bf7a6ab5d6e63f75c94f49aa0f12959e954efa8 (diff)
downloadpuppet-apt-fb19032afc0da5b4d9c6c40ae277173905b4454e.tar.gz
puppet-apt-fb19032afc0da5b4d9c6c40ae277173905b4454e.tar.bz2
Merge branch 'master' of code.leap.se:puppet_apt into nadir_master
-rw-r--r--lib/facter/apt_running.rb7
-rw-r--r--manifests/apt_conf.pp11
-rw-r--r--manifests/init.pp6
-rw-r--r--manifests/unattended_upgrades.pp19
4 files changed, 33 insertions, 10 deletions
diff --git a/lib/facter/apt_running.rb b/lib/facter/apt_running.rb
new file mode 100644
index 0000000..e8f2156
--- /dev/null
+++ b/lib/facter/apt_running.rb
@@ -0,0 +1,7 @@
+Facter.add("apt_running") do
+ setcode do
+ #Facter::Util::Resolution.exec('/usr/bin/dpkg -s mysql-server >/dev/null 2>&1 && echo true || echo false')
+ Facter::Util::Resolution.exec('pgrep apt-get >/dev/null 2>&1 && echo true || echo false')
+ end
+end
+
diff --git a/manifests/apt_conf.pp b/manifests/apt_conf.pp
index d78fb9b..f446c69 100644
--- a/manifests/apt_conf.pp
+++ b/manifests/apt_conf.pp
@@ -1,7 +1,8 @@
define apt::apt_conf(
$ensure = 'present',
$source = '',
- $content = undef )
+ $content = undef,
+ $refresh_apt = true )
{
if $source == '' and $content == undef {
@@ -22,7 +23,6 @@ define apt::apt_conf(
owner => root,
group => 0,
mode => '0644',
- notify => Exec['refresh_apt'],
}
if $source {
@@ -35,4 +35,11 @@ define apt::apt_conf(
content => $content,
}
}
+
+ if $refresh_apt {
+ File["/etc/apt/apt.conf.d/${name}"] {
+ notify => Exec['refresh_apt'],
+ }
+ }
+
}
diff --git a/manifests/init.pp b/manifests/init.pp
index 3f8e1c8..faddf09 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -128,7 +128,11 @@ class apt(
}
if $custom_preferences != false {
Exec['custom_keys'] {
- before => File['apt_config'],
+ before => [ Exec[refresh_apt], File['apt_config'] ]
+ }
+ } else {
+ Exec['custom_keys'] {
+ before => Exec[refresh_apt]
}
}
}
diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp
index c538831..b9d19c3 100644
--- a/manifests/unattended_upgrades.pp
+++ b/manifests/unattended_upgrades.pp
@@ -2,16 +2,21 @@ class apt::unattended_upgrades {
package { 'unattended-upgrades':
ensure => present,
- require => undef,
+ require => Exec[refresh_apt]
}
apt_conf { '50unattended-upgrades':
- source => [
- "puppet:///modules/site_apt/${::lsbdistcodename}/50unattended-upgrades",
- 'puppet:///modules/site_apt/50unattended-upgrades',
- "puppet:///modules/apt/${::lsbdistcodename}/50unattended-upgrades",
- 'puppet:///modules/apt/50unattended-upgrades' ],
- require => Package['unattended-upgrades'],
+ source => [
+ "puppet:///modules/site_apt/${::lsbdistcodename}/50unattended-upgrades",
+ 'puppet:///modules/site_apt/50unattended-upgrades',
+ "puppet:///modules/apt/${::lsbdistcodename}/50unattended-upgrades",
+ 'puppet:///modules/apt/50unattended-upgrades' ],
+ require => Package['unattended-upgrades'],
+ refresh_apt => false
+ }
+
+ Apt_conf['50unattended-upgrades'] {
+ notify => undef
}
if $apt::custom_preferences != false {