Class: Inspec::Resources::Group
- Inherits:
-
Object
- Object
- Inspec::Resources::Group
- Includes:
- GroupManagementSelector
- Defined in:
- lib/inspec/resources/groups.rb
Overview
Usage: describe group(‘root’) do
it { should exist }
its('gid') { should eq 0 }
end
Instance Method Summary collapse
-
#exists? ⇒ Boolean
verifies if a group exists.
- #gid ⇒ Object
-
#initialize(groupname) ⇒ Group
constructor
A new instance of Group.
- #local ⇒ Object
- #members ⇒ Object
- #members_array ⇒ Object
- #to_s ⇒ Object
Methods included from GroupManagementSelector
Constructor Details
#initialize(groupname) ⇒ Group
Returns a new instance of Group.
103 104 105 106 107 108 109 |
# File 'lib/inspec/resources/groups.rb', line 103 def initialize(groupname) @group = groupname # select group manager @group_provider = select_group_manager(inspec.os) return skip_resource "The `group` resource is not supported on your OS yet." if @group_provider.nil? end |
Instance Method Details
#exists? ⇒ Boolean
verifies if a group exists
112 113 114 |
# File 'lib/inspec/resources/groups.rb', line 112 def exists? !group_info.entries.empty? end |
#gid ⇒ Object
116 117 118 |
# File 'lib/inspec/resources/groups.rb', line 116 def gid flatten_entry(group_info, "gid") end |
#local ⇒ Object
128 129 130 131 |
# File 'lib/inspec/resources/groups.rb', line 128 def local # at this point the implementation only returns local groups true end |
#members ⇒ Object
120 121 122 |
# File 'lib/inspec/resources/groups.rb', line 120 def members flatten_entry(group_info, "members") || empty_value_for_members end |
#members_array ⇒ Object
124 125 126 |
# File 'lib/inspec/resources/groups.rb', line 124 def members_array flatten_entry(group_info, "members_array") || [] end |
#to_s ⇒ Object
133 134 135 |
# File 'lib/inspec/resources/groups.rb', line 133 def to_s "Group #{@group}" end |