provisoiners/docker: only add user to group if not in it [GH-2838]

This commit is contained in:
Mitchell Hashimoto 2014-01-16 10:34:08 -08:00
parent 0f9ec27018
commit a19e442cf2
2 changed files with 9 additions and 1 deletions

View File

@ -68,6 +68,8 @@ BUG FIXES:
retryable to avoid spurious VirtualBox errors. [GH-2831]
- providers/virtualbox: Config validation catches invalid keys. [GH-2843]
- provisioners/chef: When chowning folders, don't follow symlinks.
- provisioners/docker: Only add SSH user to docker group if the user
isn't already in it. [GH-2838]
- provisioners/salt: Options can now set install type and install args.
[GH-2766]
- synced\_folders/nfs: NFS entries are pruned on every `vagrant up`,

View File

@ -4,7 +4,13 @@ module VagrantPlugins
module Linux
module DockerConfigureVagrantUser
def self.docker_configure_vagrant_user(machine)
machine.communicate.sudo("usermod -a -G docker #{machine.config.ssh.username || "vagrant"}")
ssh_info = machine.ssh_info
machine.communicate.tap do |comm|
if !comm.test("id -Gn | grep docker")
comm.sudo("usermod -a -G docker #{ssh_info[:username]}")
end
end
end
end
end