This file is indexed.

/usr/lib/ruby/vendor_ruby/chef/resource/chef_resolved_cookbooks.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
require 'cheffish/base_resource'
require 'chef_zero'

class Chef
  class Resource
    class ChefResolvedCookbooks < Cheffish::BaseResource
      resource_name :chef_resolved_cookbooks

      def initialize(*args)
        super
        require 'berkshelf'
        berksfile Berkshelf::Berksfile.new('/tmp/Berksfile')
        @cookbooks_from = []
      end

      extend Forwardable

      def_delegators :@berksfile, :cookbook, :extension, :group, :metadata, :source

      def cookbooks_from(path = nil)
        if path
          @cookbooks_from << path
        else
          @cookbooks_from
        end
      end

      property :berksfile

      action :resolve do
        new_resource.cookbooks_from.each do |path|
          ::Dir.entries(path).each do |name|
            if ::File.directory?(::File.join(path, name)) && name != '.' && name != '..'
              new_resource.berksfile.cookbook name, :path => ::File.join(path, name)
            end
          end
        end

        new_resource.berksfile.install

        # Ridley really really wants a key :/
        if new_resource.chef_server[:options][:signing_key_filename]
          new_resource.berksfile.upload(
            :server_url => new_resource.chef_server[:chef_server_url],
            :client_name => new_resource.chef_server[:options][:client_name],
            :client_key => new_resource.chef_server[:options][:signing_key_filename])
        else
          file = Tempfile.new('privatekey')
          begin
            file.write(ChefZero::PRIVATE_KEY)
            file.close

            new_resource.berksfile.upload(
              :server_url => new_resource.chef_server[:chef_server_url],
              :client_name => new_resource.chef_server[:options][:client_name] || 'me',
              :client_key => file.path)

          ensure
            file.close
            file.unlink
          end
        end
      end
    end
  end
end