provisioners/*: prefix the output
This commit is contained in:
parent
629a80fb44
commit
1c7faae1ee
|
@ -33,14 +33,14 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def create_client_key_folder
|
||||
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.client_key_folder")
|
||||
@machine.ui.info I18n.t("vagrant.provisioners.chef.client_key_folder")
|
||||
path = Pathname.new(@config.client_key_path)
|
||||
|
||||
@machine.communicate.sudo("mkdir -p #{path.dirname}")
|
||||
end
|
||||
|
||||
def upload_validation_key
|
||||
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.upload_validation_key")
|
||||
@machine.ui.info I18n.t("vagrant.provisioners.chef.upload_validation_key")
|
||||
@machine.communicate.upload(validation_key_path, guest_validation_key_path)
|
||||
end
|
||||
|
||||
|
@ -70,16 +70,19 @@ module VagrantPlugins
|
|||
|
||||
@config.attempts.times do |attempt|
|
||||
if attempt == 0
|
||||
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_client")
|
||||
@machine.ui.info I18n.t("vagrant.provisioners.chef.running_client")
|
||||
else
|
||||
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_client_again")
|
||||
@machine.ui.info I18n.t("vagrant.provisioners.chef.running_client_again")
|
||||
end
|
||||
|
||||
exit_status = @machine.communicate.sudo(command, :error_check => false) do |type, data|
|
||||
# Output the data with the proper color based on the stream.
|
||||
color = type == :stdout ? :green : :red
|
||||
@machine.env.ui.info(
|
||||
data, :color => color, :new_line => false, :prefix => false)
|
||||
|
||||
data = data.chomp
|
||||
next if data.empty?
|
||||
|
||||
@machine.ui.info(data, :color => color)
|
||||
end
|
||||
|
||||
# There is no need to run Chef again if it converges
|
||||
|
@ -100,14 +103,14 @@ module VagrantPlugins
|
|||
|
||||
def delete_from_chef_server(deletable)
|
||||
node_name = @config.node_name || @machine.config.vm.hostname
|
||||
@machine.env.ui.info(I18n.t(
|
||||
@machine.ui.info(I18n.t(
|
||||
"vagrant.provisioners.chef.deleting_from_server",
|
||||
deletable: deletable, name: node_name))
|
||||
|
||||
command = ["knife", deletable, "delete", "--yes", node_name]
|
||||
r = Vagrant::Util::Subprocess.execute(*command)
|
||||
if r.exit_code != 0
|
||||
@machine.env.ui.error(I18n.t(
|
||||
@machine.ui.error(I18n.t(
|
||||
"vagrant.chef_client_cleanup_failed",
|
||||
deletable: deletable,
|
||||
stdout: r.stdout,
|
||||
|
|
|
@ -146,16 +146,19 @@ module VagrantPlugins
|
|||
|
||||
@config.attempts.times do |attempt|
|
||||
if attempt == 0
|
||||
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_solo")
|
||||
@machine.ui.info I18n.t("vagrant.provisioners.chef.running_solo")
|
||||
else
|
||||
@machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_solo_again")
|
||||
@machine.ui.info I18n.t("vagrant.provisioners.chef.running_solo_again")
|
||||
end
|
||||
|
||||
exit_status = @machine.communicate.sudo(command, :error_check => false) do |type, data|
|
||||
# Output the data with the proper color based on the stream.
|
||||
color = type == :stdout ? :green : :red
|
||||
@machine.env.ui.info(
|
||||
data, :color => color, :new_line => false, :prefix => false)
|
||||
|
||||
data = data.chomp
|
||||
next if data.empty?
|
||||
|
||||
@machine.ui.info(data, :color => color)
|
||||
end
|
||||
|
||||
# There is no need to run Chef again if it converges
|
||||
|
|
|
@ -162,13 +162,13 @@ module VagrantPlugins
|
|||
end
|
||||
end
|
||||
|
||||
@machine.env.ui.info(I18n.t(
|
||||
@machine.ui.info(I18n.t(
|
||||
"vagrant.provisioners.puppet.running_puppet",
|
||||
:manifest => config.manifest_file))
|
||||
|
||||
@machine.communicate.sudo(command, good_exit: [0,2]) do |type, data|
|
||||
if !data.empty?
|
||||
@machine.env.ui.info(data, :new_line => false, :prefix => false)
|
||||
if !data.chomp.empty?
|
||||
@machine.ui.info(data.chomp)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -89,8 +89,8 @@ module VagrantPlugins
|
|||
|
||||
@machine.ui.info I18n.t("vagrant.provisioners.puppet_server.running_puppetd")
|
||||
@machine.communicate.sudo(command) do |type, data|
|
||||
if !data.empty?
|
||||
@machine.ui.info(data, :new_line => false, :prefix => false)
|
||||
if !data.chomp.empty?
|
||||
@machine.ui.info(data.chomp)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,13 +30,14 @@ module VagrantPlugins
|
|||
# Output the data with the proper color based on the stream.
|
||||
color = type == :stdout ? :green : :red
|
||||
|
||||
options = {
|
||||
new_line: false,
|
||||
prefix: false,
|
||||
}
|
||||
# Clear out the newline since we add one
|
||||
data = data.chomp
|
||||
return if data.empty?
|
||||
|
||||
options = {}
|
||||
options[:color] = color if !config.keep_color
|
||||
|
||||
@machine.env.ui.info(data, options)
|
||||
@machine.ui.info(data.chomp, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue