Merge pull request #792 from eimlav/stringify
[puppet-modules/puppetlabs-apt.git] / tasks / init.rb
index 5db86ebb0c00b0fca3ca3883e6156129287306cc..b4cb0dc7622744be6334972eeb720ae1d89faf08 100755 (executable)
@@ -4,10 +4,10 @@ require 'open3'
 require 'puppet'
 
 def apt_get(action)
-  cmd_string = "apt-get #{action}"
-  cmd_string << ' -y' if  action == 'upgrade'
-  stdout, stderr, status = Open3.capture3(cmd_string)
-  raise Puppet::Error, stderr if status != 0
+  cmd = ['apt-get', action]
+  cmd << '-y' if action == 'upgrade'
+  stdout, stderr, status = Open3.capture3(*cmd)
+  raise Puppet::Error, stderr if status != 0 # rubocop:disable GetText/DecorateFunctionMessage
   { status: stdout.strip }
 end