Sha256: 62c2ac785c722a7e0f12188774214ee3a262332bd07b0998f46b0477cdd57a3e

Contents?: true

Size: 649 Bytes

Versions: 10

Compression:

Stored size: 649 Bytes

Contents

require "inspec/resources/command"

module Inspec
  module Utils
    module Podman
      def podman_running?
        inspec.command("podman version").exit_status == 0
      end

      # Generates the template in this format using labels hash: "\"id\": {{json .ID}}, \"name\": {{json .Name}}",
      def generate_go_template(labels)
        (labels.map { |k, v| "\"#{k}\": {{json .#{v}}}" }).join(", ")
      end

      def parse_command_output(output)
        require "json" unless defined?(JSON)
        JSON.parse(output)
      rescue JSON::ParserError => _e
        warn "Could not parse the command output"
        {}
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
inspec-core-6.8.11 lib/inspec/utils/podman.rb
inspec-core-5.22.58 lib/inspec/utils/podman.rb
inspec-core-5.22.55 lib/inspec/utils/podman.rb
inspec-core-6.8.1 lib/inspec/utils/podman.rb
inspec-core-5.22.40 lib/inspec/utils/podman.rb
inspec-core-6.6.0 lib/inspec/utils/podman.rb
inspec-core-5.22.36 lib/inspec/utils/podman.rb
inspec-core-5.22.29 lib/inspec/utils/podman.rb
inspec-core-5.22.3 lib/inspec/utils/podman.rb
inspec-core-5.21.29 lib/inspec/utils/podman.rb