Class: Inspec::Resources::WindowsHotfix
- Inherits:
-
Object
- Object
- Inspec::Resources::WindowsHotfix
- Defined in:
- lib/inspec/resources/windows_hotfix.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Instance Method Summary collapse
-
#initialize(hotfix_id = nil) ⇒ WindowsHotfix
constructor
A new instance of WindowsHotfix.
- #installed? ⇒ Boolean
- #resource_id ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(hotfix_id = nil) ⇒ WindowsHotfix
Returns a new instance of WindowsHotfix.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/inspec/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
#content ⇒ Object
Returns the value of attribute content.
14 15 16 |
# File 'lib/inspec/resources/windows_hotfix.rb', line 14 def content @content end |
Instance Method Details
#installed? ⇒ Boolean
35 36 37 38 39 |
# File 'lib/inspec/resources/windows_hotfix.rb', line 35 def installed? return false if @content.nil? @content.include?(@id) end |
#resource_id ⇒ Object
27 28 29 |
# File 'lib/inspec/resources/windows_hotfix.rb', line 27 def resource_id @id || "windows_hotfix" end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/inspec/resources/windows_hotfix.rb', line 31 def to_s "Windows Hotfix #{@id}" end |