Module: Sprinkle::Verifiers::UsersGroups
- Defined in:
- lib/sprinkle/verifiers/users_groups.rb
Overview
Users and groups Verifier
Tests for the existance of users and groups.
Example Usage
verify do
has_user 'ntp'
has_user 'noone', :in_group => 'nobody'
has_group 'nobody'
end
Instance Method Summary (collapse)
-
- (Object) has_group(group)
Tests that the group exists.
-
- (Object) has_user(user, opts = {})
Tests that the user exists.
Instance Method Details
- (Object) has_group(group)
Tests that the group exists
28 29 30 |
# File 'lib/sprinkle/verifiers/users_groups.rb', line 28 def has_group(group) @commands << "id -g #{group}" end |
- (Object) has_user(user, opts = {})
Tests that the user exists
19 20 21 22 23 24 25 |
# File 'lib/sprinkle/verifiers/users_groups.rb', line 19 def has_user(user, opts = {}) if opts[:in_group] @commands << "id -G #{user} | xargs -n1 echo | grep #{opts[:in_group]}" else @commands << "id #{user}" end end |