Class: Podman
- Inherits:
-
Object
- Object
- Podman
- Defined in:
- lib/inspec-podman-resources/resources/podman.rb
Instance Method Summary collapse
- #containers ⇒ Object
- #images ⇒ Object
- #info ⇒ Object
- #networks ⇒ Object
-
#object(id) ⇒ Object
returns information about podman objects.
- #pods ⇒ Object
- #to_s ⇒ Object
- #version ⇒ Object
- #volumes ⇒ Object
Instance Method Details
#containers ⇒ Object
45 46 47 |
# File 'lib/inspec-podman-resources/resources/podman.rb', line 45 def containers PodmanContainerFilter.new(parse_containers) end |
#images ⇒ Object
49 50 51 |
# File 'lib/inspec-podman-resources/resources/podman.rb', line 49 def images PodmanImageFilter.new(parse_images) end |
#info ⇒ Object
75 76 77 78 79 80 81 82 83 |
# File 'lib/inspec-podman-resources/resources/podman.rb', line 75 def info return @info if defined?(@info) sub_cmd = "info --format json" output = run_command(sub_cmd) @info = Hashie::Mash.new(JSON.parse(output)) rescue JSON::ParserError => _e Hashie::Mash.new({}) end |
#networks ⇒ Object
53 54 55 |
# File 'lib/inspec-podman-resources/resources/podman.rb', line 53 def networks PodmanNetworkFilter.new(parse_networks) end |
#object(id) ⇒ Object
returns information about podman objects
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/inspec-podman-resources/resources/podman.rb', line 86 def object(id) return @inspect if defined?(@inspect) output = run_command("inspect #{id} --format json") data = JSON.parse(output) data = data[0] if data.is_a?(Array) @inspect = Hashie::Mash.new(data) rescue JSON::ParserError => _e Hashie::Mash.new({}) end |
#pods ⇒ Object
57 58 59 |
# File 'lib/inspec-podman-resources/resources/podman.rb', line 57 def pods PodmanPodFilter.new(parse_pods) end |
#to_s ⇒ Object
97 98 99 |
# File 'lib/inspec-podman-resources/resources/podman.rb', line 97 def to_s "Podman" end |
#version ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/inspec-podman-resources/resources/podman.rb', line 65 def version return @version if defined?(@version) sub_cmd = "version --format json" output = run_command(sub_cmd) @version = Hashie::Mash.new(JSON.parse(output)) rescue JSON::ParserError => _e Hashie::Mash.new({}) end |
#volumes ⇒ Object
61 62 63 |
# File 'lib/inspec-podman-resources/resources/podman.rb', line 61 def volumes PodmanVolumeFilter.new(parse_volumes) end |