Sha256: c73e47ab508e85f3d18c09176afe2bceff6285360403db0f8c5efaebbad9e31f

Contents?: true

Size: 965 Bytes

Versions: 4

Compression:

Stored size: 965 Bytes

Contents

# frozen_string_literal: true

# takeltau docker container check existing
# tau docker container check existing
module DockerContainerCheckExisting
  # Backend method for docker container check existing.
  # @return [Boolean] is container existing?
  def docker_container_check_existing(container)
    log.debug "Checking if container \"#{container}\" is existing"

    return false unless docker_check_daemon

    stdout_str = run _docker_container_cmd_check_existing container

    if stdout_str.to_s.chomp.empty?
      log.debug "Container \"#{container}\" is not existing"
      return false
    end

    log.debug "Container \"#{container}\" is existing"
    true
  end

  private

  # Format command to check if docker container exists.
  def _docker_container_cmd_check_existing(container)
    format(
      config.active['cmd_docker_container_check_existing_docker_ps'],
      docker: config.active['cmd_docker'],
      container: container
    )
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
takeltau-0.43.16 lib/takeltau/docker/container/check/existing.rb
takeltau-0.43.15 lib/takeltau/docker/container/check/existing.rb
takeltau-0.43.14 lib/takeltau/docker/container/check/existing.rb
takeltau-0.43.10 lib/takeltau/docker/container/check/existing.rb