Method: Inspec::Resources::WindowsFeature#info

Defined in:
lib/inspec/resources/windows_feature.rb

#infoObject

returns the package description



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/inspec/resources/windows_feature.rb', line 40

def info
  return @cache unless @cache.nil?

  case @method
  when :powershell
    @cache = info_via_powershell(@feature)
    if @cache[:error]
      # TODO: Allow handling `Inspec::Exception` outside of initialize
      # See: https://github.com/inspec/inspec/issues/3237
      # The below will fail the resource regardless of what is raised
      raise Inspec::Exceptions::ResourceFailed, @cache[:error]
    end
  when :dism
    @cache = info_via_dism(@feature)
  else
    @cache = info_via_powershell(@feature)
    @cache = info_via_dism(@feature) if @cache[:error]
  end

  @cache
end