Class: Inspec::Resources::Podman

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

Instance Method Summary collapse

Instance Method Details

#containersObject



46
47
48
# File 'lib/inspec/resources/podman.rb', line 46

def containers
  PodmanContainerFilter.new(parse_containers)
end

#imagesObject



50
51
52
# File 'lib/inspec/resources/podman.rb', line 50

def images
  PodmanImageFilter.new(parse_images)
end

#infoObject



76
77
78
79
80
81
82
83
84
# File 'lib/inspec/resources/podman.rb', line 76

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

#networksObject



54
55
56
# File 'lib/inspec/resources/podman.rb', line 54

def networks
  PodmanNetworkFilter.new(parse_networks)
end

#object(id) ⇒ Object

returns information about podman objects



87
88
89
90
91
92
93
94
95
96
# File 'lib/inspec/resources/podman.rb', line 87

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

#podsObject



58
59
60
# File 'lib/inspec/resources/podman.rb', line 58

def pods
  PodmanPodFilter.new(parse_pods)
end

#to_sObject



98
99
100
# File 'lib/inspec/resources/podman.rb', line 98

def to_s
  "Podman"
end

#versionObject



66
67
68
69
70
71
72
73
74
# File 'lib/inspec/resources/podman.rb', line 66

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

#volumesObject



62
63
64
# File 'lib/inspec/resources/podman.rb', line 62

def volumes
  PodmanVolumeFilter.new(parse_volumes)
end