From fec941081477a517ba870f3f215802957f753b08 Mon Sep 17 00:00:00 2001 From: Dan Carley Date: Tue, 30 Oct 2012 11:10:26 +0000 Subject: [PATCH] Omit empty lines in Puppet provisioner output The sudo() block and/or the Puppet provisioner often returns newline characters as separate strings. This makes the chomp() ineffective and results in extraneous spacing between the output lines. Separate out the call to chomp() so that we only do it once. Then only output info if that line is not an empty string. --- plugins/provisioners/puppet/provisioner/puppet.rb | 3 ++- plugins/provisioners/puppet/provisioner/puppet_server.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/provisioners/puppet/provisioner/puppet.rb b/plugins/provisioners/puppet/provisioner/puppet.rb index c06ea9be9..164241608 100644 --- a/plugins/provisioners/puppet/provisioner/puppet.rb +++ b/plugins/provisioners/puppet/provisioner/puppet.rb @@ -159,7 +159,8 @@ module VagrantPlugins :manifest => @manifest_file) env[:machine].communicate.sudo(command) do |type, data| - env[:ui].info(data.chomp, :prefix => false) + data.chomp! + env[:ui].info(data, :prefix => false) if !data.empty? end end diff --git a/plugins/provisioners/puppet/provisioner/puppet_server.rb b/plugins/provisioners/puppet/provisioner/puppet_server.rb index e88668a6c..3c345b885 100644 --- a/plugins/provisioners/puppet/provisioner/puppet_server.rb +++ b/plugins/provisioners/puppet/provisioner/puppet_server.rb @@ -71,7 +71,8 @@ module VagrantPlugins env[:ui].info I18n.t("vagrant.provisioners.puppet_server.running_puppetd") env[:vm].channel.sudo(command) do |type, data| - env[:ui].info(data.chomp, :prefix => false) + data.chomp! + env[:ui].info(data, :prefix => false) if !data.empty? end end end