Class: Inspec::Resources::Virtualization
- Inherits:
-
Object
- Object
- Inspec::Resources::Virtualization
- Defined in:
- lib/inspec/resources/virtualization.rb
Instance Method Summary collapse
-
#initialize ⇒ Virtualization
constructor
A new instance of Virtualization.
- #params ⇒ Object
- #physical_system? ⇒ Boolean
- #resource_id ⇒ Object
- #to_s ⇒ Object
- #virtual_system? ⇒ Boolean
Constructor Details
#initialize ⇒ Virtualization
Returns a new instance of Virtualization.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/inspec/resources/virtualization.rb', line 27 def initialize # TODO: no need for hashie here... in fact, no reason for a hash at all @virtualization_data = Hashie::Mash.new if inspec.os.linux? collect_data_linux elsif inspec.os.windows? collect_data_windows end # Allows checking for non-virtualized systems as well @virtualization_data[:physical] = @virtualization_data.empty? end |
Instance Method Details
#params ⇒ Object
57 58 59 60 |
# File 'lib/inspec/resources/virtualization.rb', line 57 def params # TODO: this is broken. cannot return anything but nil collect_data_linux end |
#physical_system? ⇒ Boolean
53 54 55 |
# File 'lib/inspec/resources/virtualization.rb', line 53 def physical_system? @virtualization_data[:physical] end |
#resource_id ⇒ Object
62 63 64 |
# File 'lib/inspec/resources/virtualization.rb', line 62 def resource_id @virtualization_data[:system] || "virtualization" end |
#to_s ⇒ Object
66 67 68 |
# File 'lib/inspec/resources/virtualization.rb', line 66 def to_s "Virtualization Detection" end |
#virtual_system? ⇒ Boolean
49 50 51 |
# File 'lib/inspec/resources/virtualization.rb', line 49 def virtual_system? @virtualization_data[:role] == "guest" end |