use uid/gid for chowns.

This commit is contained in:
Oliver Matthews 2013-09-10 20:57:51 +01:00
parent ce3e061cae
commit e5790d3ad1

View file

@ -4,6 +4,8 @@ require "vagrant/util/subprocess"
require "vagrant-lxc/errors" require "vagrant-lxc/errors"
require "vagrant-lxc/driver/cli" require "vagrant-lxc/driver/cli"
require "etc"
module Vagrant module Vagrant
module LXC module LXC
class Driver class Driver
@ -108,8 +110,11 @@ module Vagrant
@sudo_wrapper.run('rm', '-f', 'rootfs.tar.gz') @sudo_wrapper.run('rm', '-f', 'rootfs.tar.gz')
@sudo_wrapper.run('tar', '--numeric-owner', '-czf', target_path, 'rootfs') @sudo_wrapper.run('tar', '--numeric-owner', '-czf', target_path, 'rootfs')
@logger.info "Changing rootfs tarbal owner" @logger.info "Changing rootfs tarball owner"
@sudo_wrapper.run('chown', "#{ENV['USER']}:#{ENV['USER']}", target_path)
user_details=Etc.getpwnam(Etc.getlogin)
@sudo_wrapper.run('chown', "#{user_details.uid}:#{user_details.gid}", target_path)
end end
target_path target_path