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