This file is indexed.

/usr/lib/ruby/vendor_ruby/chef_compat/copied_from_chef/chef/resource/action_class.rb is in ruby-compat-resource 12.10.5-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
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
begin
  require 'chef/resource/action_class'
rescue LoadError; end

require 'chef_compat/copied_from_chef'
class Chef
module ::ChefCompat
module CopiedFromChef
#
# Author:: John Keiser (<jkeiser@chef.io)
# Copyright:: Copyright 2015-2016, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require "chef_compat/copied_from_chef/chef/dsl/recipe"

class Chef < (defined?(::Chef) ? ::Chef : Object)
  class Resource < (defined?(::Chef::Resource) ? ::Chef::Resource : Object)
    module ActionClass
      CopiedFromChef.extend_chef_module(::Chef::Resource::ActionClass, self) if defined?(::Chef::Resource::ActionClass)
      include Chef::DSL::Recipe

      def to_s
        "#{new_resource || "<no resource>"} action #{action ? action.inspect : "<no action>"}"
      end

      #
      # If load_current_value! is defined on the resource, use that.
      #
      def load_current_resource
        if new_resource.respond_to?(:load_current_value!)
          # dup the resource and then reset desired-state properties.
          current_resource = new_resource.dup

          # We clear desired state in the copy, because it is supposed to be actual state.
          # We keep identity properties and non-desired-state, which are assumed to be
          # "control" values like `recurse: true`
          current_resource.class.properties.each do |name, property|
            if property.desired_state? && !property.identity? && !property.name_property?
              property.reset(current_resource)
            end
          end

          # Call the actual load_current_value! method. If it raises
          # CurrentValueDoesNotExist, set current_resource to `nil`.
          begin
            # If the user specifies load_current_value do |desired_resource|, we
            # pass in the desired resource as well as the current one.
            if current_resource.method(:load_current_value!).arity > 0
              current_resource.load_current_value!(new_resource)
            else
              current_resource.load_current_value!
            end
          rescue Chef::Exceptions::CurrentValueDoesNotExist
            current_resource = nil
          end
        end

        @current_resource = current_resource
      end

      def self.included(other)
        other.extend(ClassMethods)
        other.use_inline_resources
        other.include_resource_dsl true
      end

      module ClassMethods
        CopiedFromChef.extend_chef_module(::Chef::Resource::ActionClass::ClassMethods, self) if defined?(::Chef::Resource::ActionClass::ClassMethods)
        #
        # The Chef::Resource class this ActionClass was declared against.
        #
        # @return [Class] The Chef::Resource class this ActionClass was declared against.
        #
        attr_accessor :resource_class

        def to_s
          "#{resource_class} action provider"
        end

        def inspect
          to_s
        end
      end
    end
  end
end
end
end
end