libvirtinator 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/libvirtinator/users.rb +6 -1
  2. metadata +1 -1
@@ -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
- execute "usermod", "-a", "-G", group, user['name']
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']}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libvirtinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: