provisioners/ansible: show ansible-playbook only when the verbose option is enabled

Revert 1c884fa4e5 which introduced the
following bug:

Instead of allowing to dump the `ansible-playbook` command details when
VAGRANT_LOG=debug was defined, it was then impossible to disable this
console output when VAGRANT_LOG was undefined (in such case,
``@logger.debug? systematically returns `true`)

In order to keep things simple and focused, it is preferable to drop the
bad idea to mix Ansible verbosity and Vagrant log level.

Fix #5803
This commit is contained in:
Gilles Cornu 2015-07-07 21:19:07 +02:00
parent 28bea401c0
commit 839a2e6fa6
3 changed files with 2 additions and 15 deletions

View File

@ -99,6 +99,7 @@ BUG FIXES:
- provisioners/ansible: fix SSH settings to support more than 5 ssh keys [GH-5017]
- provisioners/ansible: increase ansible connection timeout to 30 seconds [GH-5018]
- provisioners/ansible: disable color if Vagrant is not colored [GH-5531, GH-5532]
- provisioners/ansible: only show ansible-playbook command when `verbose` option is enabled [GH-5803]
- provisioners/docker: use `service` to restart Docker instad of upstart [GH-5245, GH-5577]
- provisioners/docker: Only add docker user to group if exists. [GH-5315]
- provisioners/docker: Use https for repo [GH-5749]

View File

@ -81,7 +81,7 @@ module VagrantPlugins
# ANSIBLE_SSH_ARGS is required for Multiple SSH keys, SSH forwarding and custom SSH settings
env["ANSIBLE_SSH_ARGS"] = ansible_ssh_args unless ansible_ssh_args.empty?
show_ansible_playbook_command(env, command) if (config.verbose || @logger.debug?)
show_ansible_playbook_command(env, command) if config.verbose
# Write stdout and stderr data, since it's the regular Ansible output
command << {

View File

@ -51,7 +51,6 @@ VF
before do
Vagrant::Util::Platform.stub(solaris?: false)
subject.instance_variable_get(:@logger).stub(:debug?).and_return(false)
machine.stub(ssh_info: ssh_info)
machine.env.stub(active_machines: [[iso_env.machine_names[0], :dummy], [iso_env.machine_names[1], :dummy]])
@ -465,19 +464,6 @@ VF
end
end
describe "with VAGRANT_LOG=debug, but without verbose option" do
before do
subject.instance_variable_get(:@logger).stub(:debug?).and_return(true)
config.verbose = false
end
it "shows the ansible-playbook command" do
expect(machine.env.ui).to receive(:detail).with { |full_command|
expect(full_command).to eq("PYTHONUNBUFFERED=1 ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_FORCE_COLOR=true ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook --private-key=/path/to/my/key --user=testuser --connection=ssh --timeout=30 --limit='machine1' --inventory-file=#{generated_inventory_dir} playbook.yml")
}
end
end
describe "with verbose option" do
before do
config.verbose = 'v'