This file is indexed.

/usr/lib/ruby/vendor_ruby/chef/resource/chef_group.rb is in ruby-cheffish 4.0.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
require 'cheffish'
require 'cheffish/base_resource'
require 'chef/run_list/run_list_item'
require 'chef/chef_fs/data_handler/group_data_handler'

class Chef
  class Resource
    class ChefGroup < Cheffish::BaseResource
      resource_name :chef_group

      property :name, Cheffish::NAME_REGEX, name_property: true
      property :users, ArrayType
      property :clients, ArrayType
      property :groups, ArrayType
      property :remove_users, ArrayType
      property :remove_clients, ArrayType
      property :remove_groups, ArrayType

      action :create do
        differences = json_differences(current_json, new_json)

        if current_resource_exists?
          if differences.size > 0
            description = [ "update group #{new_resource.name} at #{rest.url}" ] + differences
            converge_by description do
              rest.put("groups/#{new_resource.name}", normalize_for_put(new_json))
            end
          end
        else
          description = [ "create group #{new_resource.name} at #{rest.url}" ] + differences
          converge_by description do
            rest.post("groups", normalize_for_post(new_json))
          end
        end
      end

      action :delete do
        if current_resource_exists?
          converge_by "delete group #{new_resource.name} at #{rest.url}" do
            rest.delete("groups/#{new_resource.name}")
          end
        end
      end

      action_class.class_eval do
        def load_current_resource
          begin
            @current_resource = json_to_resource(rest.get("groups/#{new_resource.name}"))
          rescue Net::HTTPServerException => e
            if e.response.code == "404"
              @current_resource = not_found_resource
            else
              raise
            end
          end
        end

        def augment_new_json(json)
          # Apply modifiers
          json['users']   |= new_resource.users
          json['clients'] |= new_resource.clients
          json['groups']  |= new_resource.groups
          json['users']   -= new_resource.remove_users
          json['clients'] -= new_resource.remove_clients
          json['groups']  -= new_resource.remove_groups
          json
        end

        #
        # Helpers
        #

        def resource_class
          Chef::Resource::ChefGroup
        end

        def data_handler
          Chef::ChefFS::DataHandler::GroupDataHandler.new
        end

        def keys
          {
            'name' => :name,
            'groupname' => :name
          }
        end
      end
    end
  end
end