aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2010-12-16 13:03:08 +0100
committerintrigeri <intrigeri@boum.org>2010-12-16 13:03:08 +0100
commitbbe2c8aee9b00dad4313644611e6a75d40ca8d49 (patch)
tree65f573ad4b145eed2f3e990e77c2d22fcca36552
parent4765a02564ddadeeafcb87fdce7d077ec6972c02 (diff)
downloadpuppet-apt-bbe2c8aee9b00dad4313644611e6a75d40ca8d49.tar.gz
puppet-apt-bbe2c8aee9b00dad4313644611e6a75d40ca8d49.tar.bz2
New class: apt::dist_upgrade::initiator.
This implements the "update initiator" pattern suggested by http://projects.puppetlabs.com/projects/puppet/wiki/Debian_Patterns. This feature is useful when one does not want to setup a fully automated upgrade process but still needs a way to manually trigger full upgrades of any number of systems at scheduled times.
-rw-r--r--README26
-rw-r--r--files/upgrade_initiator1
-rw-r--r--manifests/dist_upgrade/initiator.pp23
3 files changed, 49 insertions, 1 deletions
diff --git a/README b/README
index 8503e73..61ffb1d 100644
--- a/README
+++ b/README
@@ -213,7 +213,31 @@ dist-upgrade's the system.
This exec is set as refreshonly so including this class does not
trigger any action per-se: other resources may notify it, other
classes may inherit from this one and add to its subscription list
-using the plusignment ('+>') operator.
+using the plusignment ('+>') operator. A real-world example can be
+seen in the apt::dist_upgrade::initiator source.
+
+When this class is included the APT indexes are updated on every
+Puppet run due to the author's lack of Puppet wizardry.
+
+apt::dist_upgrade::initiator
+----------------------------
+
+This class automatically dist-upgrade's the system when an initiator
+file's content changes. The initiator file is copied from the first
+available source amongst the following ones, in decreasing priority
+order:
+
+- puppet:///site-apt/${fqdn}/upgrade_initiator
+- puppet:///site-apt/upgrade_initiator
+- puppet:///apt/upgrade_initiator
+
+This is useful when one does not want to setup a fully automated
+upgrade process but still needs a way to manually trigger full
+upgrades of any number of systems at scheduled times.
+
+Beware: a dist-upgrade is triggered the first time Puppet runs after
+this class has been included. This is actually the single reason why
+this class is not enabled by default.
When this class is included the APT indexes are updated on every
Puppet run due to the author's lack of Puppet wizardry.
diff --git a/files/upgrade_initiator b/files/upgrade_initiator
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/files/upgrade_initiator
@@ -0,0 +1 @@
+
diff --git a/manifests/dist_upgrade/initiator.pp b/manifests/dist_upgrade/initiator.pp
new file mode 100644
index 0000000..6d57947
--- /dev/null
+++ b/manifests/dist_upgrade/initiator.pp
@@ -0,0 +1,23 @@
+class apt::dist_upgrade::initiator inherits apt::dist_upgrade {
+
+ $initiator = 'upgrade_initiator'
+ $initiator_abs = "${apt::apt_base_dir}/${initiator}"
+
+ file { 'apt_upgrade_initiator':
+ mode => 0644,
+ owner => root,
+ group => 0,
+ path => "${initiator_abs}",
+ checksum => md5,
+ source => [
+ "puppet:///modules/site-apt/${fqdn}/${initiator}",
+ "puppet:///modules/site-apt/${initiator}",
+ "puppet:///modules/apt/${initiator}",
+ ],
+ }
+
+ Exec['apt_dist-upgrade'] {
+ subscribe +> File['apt_upgrade_initiator'],
+ }
+
+}