Sha256: c4a42fddd820d6da2a4c6547749e2ad8c2a84d3d4bd2f923ea173239997b9135

Contents?: true

Size: 1009 Bytes

Versions: 3

Compression:

Stored size: 1009 Bytes

Contents

# frozen_string_literal: true

# tau ship container check existing
module ShipContainerCheckExisting
  # Backend method for ship container check existing.
  # @return [Boolean] is container existing?
  def ship_container_check_existing
    ship_hostname = _ship_container_lib_ship_hostname
    log.debug "Checking if takelship \"#{ship_hostname}\" is existing"

    return false unless docker_check_daemon 'cmd_ship_docker'

    stdout_str = run _ship_container_cmd_check_existing ship_hostname

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

    log.debug "The takelship \"#{ship_hostname}\" is existing"
    true
  end

  private

  # Format command to check if ship container exists.
  def _ship_container_cmd_check_existing(ship_hostname)
    format(
      config.active['cmd_ship_container_check_existing_docker_ps'],
      ship_docker: config.active['cmd_ship_docker'],
      ship_name: ship_hostname
    )
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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