Merge pull request #10140 from berney/fix-ansible-perm-issue

Fix ansible_local provisioner permission bug
This commit is contained in:
Brian Cain 2018-08-31 11:02:47 -07:00 committed by GitHub
commit f51176a101
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 8 deletions

View File

@ -125,7 +125,8 @@ module VagrantPlugins
inventory_basedir = File.join(config.tmp_path, "inventory")
inventory_path = File.join(inventory_basedir, "vagrant_ansible_local_inventory")
create_and_chown_remote_folder(inventory_basedir)
@machine.communicate.sudo("mkdir -p #{inventory_path}")
@machine.communicate.sudo("chown -R -h #{@machine.ssh_info[:username]} #{config.tmp_path}")
@machine.communicate.sudo("rm -f #{inventory_path}", error_check: false)
Tempfile.open("vagrant-ansible-local-inventory-#{@machine.name}") do |f|
@ -159,13 +160,6 @@ module VagrantPlugins
return machines
end
def create_and_chown_remote_folder(path)
@machine.communicate.tap do |comm|
comm.sudo("mkdir -p #{path}")
comm.sudo("chown -h #{@machine.ssh_info[:username]} #{path}")
end
end
def check_path(path, test_args, option_name)
# Checks for the existence of given file (or directory) on the guest system,
# and error if it doesn't exist.