Merge pull request #1006 from puppetlabs/release-prep
[puppet-modules/puppetlabs-apt.git] / tasks / init.rb
index d256468b64a739fdaa6446f49b1d5069bc46891d..43053128a25dbd1edad4a4f041424df26c17f338 100755 (executable)
@@ -1,11 +1,13 @@
 #!/opt/puppetlabs/puppet/bin/ruby
+# frozen_string_literal: true
+
 require 'json'
 require 'open3'
 require 'puppet'
 
 def apt_get(action)
   cmd = ['apt-get', action]
-  cmd << ' -y' if action == 'upgrade'
+  cmd << '-y' if ['upgrade', 'dist-upgrade', 'autoremove'].include?(action)
   stdout, stderr, status = Open3.capture3(*cmd)
   raise Puppet::Error, stderr if status != 0
   { status: stdout.strip }