Class: Inspec::Resources::Lxc
- Inherits:
-
Object
- Object
- Inspec::Resources::Lxc
- Defined in:
- lib/inspec/resources/lxc.rb
Instance Attribute Summary collapse
-
#container_info ⇒ Object
readonly
Returns the value of attribute container_info.
-
#container_name ⇒ Object
readonly
Returns the value of attribute container_name.
Instance Method Summary collapse
- #architecture ⇒ Object
- #created_at ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(container_name) ⇒ Lxc
constructor
Resource initialization.
- #last_used_at ⇒ Object
- #name ⇒ Object
- #pid ⇒ Object
- #resource_id ⇒ Object
- #resources ⇒ Object
- #running? ⇒ Boolean
- #status ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(container_name) ⇒ Lxc
Resource initialization.
26 27 28 29 30 31 32 |
# File 'lib/inspec/resources/lxc.rb', line 26 def initialize(container_name) @container_name = container_name raise Inspec::Exceptions::ResourceSkipped, "The `lxc` resource is not supported on your OS yet." unless inspec.os.linux? @container_info = populate_container_info end |
Instance Attribute Details
#container_info ⇒ Object (readonly)
Returns the value of attribute container_info.
23 24 25 |
# File 'lib/inspec/resources/lxc.rb', line 23 def container_info @container_info end |
#container_name ⇒ Object (readonly)
Returns the value of attribute container_name.
23 24 25 |
# File 'lib/inspec/resources/lxc.rb', line 23 def container_name @container_name end |
Instance Method Details
#architecture ⇒ Object
62 63 64 |
# File 'lib/inspec/resources/lxc.rb', line 62 def architecture @container_info["Architecture"] end |
#created_at ⇒ Object
70 71 72 |
# File 'lib/inspec/resources/lxc.rb', line 70 def created_at @container_info["Created"] end |
#exists? ⇒ Boolean
42 43 44 |
# File 'lib/inspec/resources/lxc.rb', line 42 def exists? !@container_info.empty? end |
#last_used_at ⇒ Object
74 75 76 |
# File 'lib/inspec/resources/lxc.rb', line 74 def last_used_at @container_info["Last Used"] end |
#name ⇒ Object
50 51 52 |
# File 'lib/inspec/resources/lxc.rb', line 50 def name @container_info["Name"] end |
#pid ⇒ Object
66 67 68 |
# File 'lib/inspec/resources/lxc.rb', line 66 def pid @container_info["PID"] end |
#resource_id ⇒ Object
34 35 36 |
# File 'lib/inspec/resources/lxc.rb', line 34 def resource_id @container_name end |
#resources ⇒ Object
78 79 80 |
# File 'lib/inspec/resources/lxc.rb', line 78 def resources @container_info["Resources"] end |
#running? ⇒ Boolean
46 47 48 |
# File 'lib/inspec/resources/lxc.rb', line 46 def running? @container_info.key?("Status") && @container_info["Status"].casecmp("Running") == 0 end |
#status ⇒ Object
54 55 56 |
# File 'lib/inspec/resources/lxc.rb', line 54 def status @container_info["Status"] end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/inspec/resources/lxc.rb', line 38 def to_s "lxc #{resource_id}" end |
#type ⇒ Object
58 59 60 |
# File 'lib/inspec/resources/lxc.rb', line 58 def type @container_info["Type"] end |