Sha256: 02b4654ea3dbc8b1973f7c7039647252a00975abb4ab4ab0e4ba178d80cd5daa

Contents?: true

Size: 904 Bytes

Versions: 2

Compression:

Stored size: 904 Bytes

Contents

# frozen_string_literal: true

# tau ship container list
module ShipContainerList
  # List takelship containers.
  def ship_container_list
    log.debug 'List takelship containers'

    return false unless docker_check_daemon 'cmd_ship_docker'

    _ship_container_list_get_inventory.to_yaml
  end

  private

  # Get the current inventory
  def _ship_container_list_get_inventory
    ship_name = config.active['ship_name']
    inventory = _ship_container_list_new_inventory ship_name
    _ship_container_lib_get_containers.each do |container|
      name = _docker_container_lib_get_container_name_by_id container
      dir = _ship_container_lib_get_mounted_dir.strip
      inventory[ship_name]['hosts'] << { name => dir }
    end
    inventory
  end

  # Create a new inventory
  def _ship_container_list_new_inventory(ship_name)
    {
      ship_name => {
        'hosts' => []
      }
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
takeltau-0.43.16 lib/takeltau/ship/container/list.rb
takeltau-0.43.15 lib/takeltau/ship/container/list.rb