Merge pull request #140 from cwoac/remove_group_assumption

use uid/gid for chowns.
This commit is contained in:
Fabio Rehm 2013-09-10 13:37:44 -07:00
commit 05c472042d

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