]> gitweb.fluxo.info Git - puppet-nodo.git/commitdiff
Support for hydra and DEBIAN_FRONTEND=noninteractive at nodo::subsystem::apt
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 31 May 2018 13:32:22 +0000 (10:32 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 31 May 2018 13:32:22 +0000 (10:32 -0300)
manifests/subsystem/apt.pp

index 04d6626dbfafa9b3730c1fe8686fb5b964764b9b..6c904c61d7bc701af24255af5cb0066f4fa15f06 100644 (file)
@@ -1,9 +1,10 @@
 class nodo::subsystem::apt(
-  $ensure       = present,
-  $auto_upgrade = present,
-  $hour         = 2,
-  $minute       = 0,
-  $mirror       = 'https://deb.debian.org',
+  $ensure          = present,
+  $auto_upgrade    = present,
+  $upgrade_handler = 'apt',
+  $hour            = 2,
+  $minute          = 0,
+  $mirror          = 'https://deb.debian.org',
 ) {
   package { 'apt-transport-https':
     ensure => installed,
@@ -33,9 +34,15 @@ class nodo::subsystem::apt(
   }
 
   # We have /var/log/dpkg.log, so we do not need to rotate /var/log/upgrade.log
-  $log     = ">> /var/log/upgrade.log 2>&1"
-  $apt     = '/usr/bin/apt-get'
-  $command = "${apt} update ${log} && ${apt} dist-upgrade -y ${log} && ${apt} autoremove -y ${log} && ${apt} clean ${log}"
+  $log = ">> /var/log/upgrade.log 2>&1"
+  $apt = '/usr/bin/apt-get'
+
+  if $upgrade_handler == 'apt' {
+    $command = "${apt} update ${log} && ${apt} dist-upgrade -y ${log} && ${apt} autoremove -y ${log} && ${apt} clean ${log}"
+  }
+  elsif $upgrade_method == 'hydra' {
+    $command = "hydractl upgrade clean ${log}"
+  }
 
   exec { 'nodo-apt-auto-update':
     command     => "${apt} update ${log}",
@@ -46,7 +53,7 @@ class nodo::subsystem::apt(
   cron { 'nodo-apt-auto-upgrade':
     ensure      => $auto_upgrade,
     command     => $command,
-    environment => 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
+    environment => [ 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'DEBIAN_FRONTEND=noninteractive' ],
     user        => 'root',
     hour        => $hour,
     minute      => $minute,