Fix ansible provisioner permission bug

This commit is contained in:
Berne Campbell 2018-08-22 20:32:40 +10:00
parent 38d48ba153
commit 0d23724a1f
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.communciate.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.