libvirtinator 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/libvirtinator/users.rb +6 -1
- metadata +1 -1
data/lib/libvirtinator/users.rb
CHANGED
@@ -25,6 +25,7 @@ namespace :users do
|
|
25
25
|
fatal "Please set domain and usergroups like 'cap users:setup_domain domain=example.com usergroups=sysadmins,others'"
|
26
26
|
exit
|
27
27
|
end
|
28
|
+
set :user, -> { ENV['USER'] }
|
28
29
|
set :ip, -> { ENV['domain'] }
|
29
30
|
set :usergroups, -> { Array(ENV['usergroups'].split',') }
|
30
31
|
Rake::Task['users:setup'].invoke
|
@@ -52,7 +53,11 @@ namespace :users do
|
|
52
53
|
end
|
53
54
|
execute "usermod", "-s", "'/bin/bash'", user['name']
|
54
55
|
user['groups'].each do |group|
|
55
|
-
|
56
|
+
if test "grep", "-q", group, "/etc/group"
|
57
|
+
execute "usermod", "-a", "-G", group, user['name']
|
58
|
+
else
|
59
|
+
warn "Not adding user '#{user['name']}' to group '#{group}' because the group doesn't exist"
|
60
|
+
end
|
56
61
|
end
|
57
62
|
execute "mkdir", "-p", "/home/#{user['name']}/.ssh"
|
58
63
|
execute "chown", "#{user['name']}.", "-R", "/home/#{user['name']}"
|