Module: Pot::Verifiers::UsersGroups
- Defined in:
- lib/pot/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
-
#has_group(group) ⇒ Object
Tests that the group exists.
-
#has_user(user, opts = {}) ⇒ Object
Tests that the user exists.
Instance Method Details
#has_group(group) ⇒ Object
Tests that the group exists
28 29 30 |
# File 'lib/pot/verifiers/users_groups.rb', line 28 def has_group(group) @commands << "id -g #{group}" end |
#has_user(user, opts = {}) ⇒ Object
Tests that the user exists
19 20 21 22 23 24 25 |
# File 'lib/pot/verifiers/users_groups.rb', line 19 def has_user(user, opts = {}) if opts[:in_group] @commands << "id -nG #{user} | xargs -n1 echo | grep #{opts[:in_group]}" else @commands << "id #{user}" end end |