Release prep v9.1.0
[puppet-modules/puppetlabs-apt.git] / tasks / init.rb
index 43053128a25dbd1edad4a4f041424df26c17f338..ee141cdb691dcc8dd5513b50f3cabb8f0dbffdd1 100755 (executable)
@@ -8,12 +8,20 @@ require 'puppet'
 def apt_get(action)
   cmd = ['apt-get', action]
   cmd << '-y' if ['upgrade', 'dist-upgrade', 'autoremove'].include?(action)
+  if ['upgrade', 'dist-upgrade'].include?(action)
+    ENV['DEBIAN_FRONTEND'] = 'noninteractive'
+    cmd << '-o'
+    cmd << 'Dpkg::Options="--force-confdef"'
+    cmd << '-o'
+    cmd << 'Dpkg::Options="--force-confold"'
+  end
   stdout, stderr, status = Open3.capture3(*cmd)
   raise Puppet::Error, stderr if status != 0
+
   { status: stdout.strip }
 end
 
-params = JSON.parse(STDIN.read)
+params = JSON.parse($stdin.read)
 action = params['action']
 
 begin