Class: Inspec::Resources::WindowsHotfix

Inherits:
Object
  • Object
show all
Defined in:
lib/resources/windows_hotfix.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hotfix_id = nil) ⇒ WindowsHotfix

Returns a new instance of WindowsHotfix.



16
17
18
19
20
21
22
23
24
# File 'lib/resources/windows_hotfix.rb', line 16

def initialize(hotfix_id = nil)
  @id = hotfix_id.upcase
  @content = nil
  os = inspec.os
  return skip_resource 'The `windows_hotfix` resource is not a feature of your OS.' unless os.windows?
  query = "get-hotfix -id #{@id}"
  cmd = inspec.powershell(query)
  @content = cmd.stdout
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



14
15
16
# File 'lib/resources/windows_hotfix.rb', line 14

def content
  @content
end

Instance Method Details

#installed?Boolean

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/resources/windows_hotfix.rb', line 30

def installed?
  return false if @content.nil?
  @content.include?(@id)
end

#to_sObject



26
27
28
# File 'lib/resources/windows_hotfix.rb', line 26

def to_s
  "Windows Hotfix #{@id}"
end