Sha256: d703e8e3941b1448b6cceaae0551bde12ac14ffb3aabdf6da1025d3fc8cb4757

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

# tau docker container list
module DockerContainerList
  # List docker containers.
  def docker_container_list
    log.debug 'List docker containers'

    _docker_container_list_get_inventory.to_yaml
  end

  private

  # Get the current inventory
  # rubocop:disable Metrics/AbcSize
  # rubocop:disable Metrics/MethodLength
  def _docker_container_list_get_inventory
    destination = '/project'
    docker = config.active['cmd_docker']
    inventory = _docker_container_list_new_inventory
    _docker_container_lib_get_containers.each do |container|
      name = _docker_container_lib_get_container_name_by_id container
      dir = (_docker_container_lib_get_mounted_dir name, destination, docker).strip
      if docker_container_check_orphaned container
        inventory['orphaned']['hosts'] << { name => dir }
      else
        inventory['login']['hosts'] << { name => dir }
      end
    end
    inventory
  end
  # rubocop:enable Metrics/MethodLength
  # rubocop:enable Metrics/AbcSize

  # Create a new inventory
  def _docker_container_list_new_inventory
    {
      'login' => {
        'hosts' => []
      },
      'orphaned' => {
        'hosts' => []
      }
    }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
takeltau-0.44.14 lib/takeltau/docker/container/list.rb
takeltau-0.44.12 lib/takeltau/docker/container/list.rb
takeltau-0.44.11 lib/takeltau/docker/container/list.rb
takeltau-0.44.8 lib/takeltau/docker/container/list.rb
takeltau-0.44.2 lib/takeltau/docker/container/list.rb
takeltau-0.43.23 lib/takeltau/docker/container/list.rb
takeltau-0.43.21 lib/takeltau/docker/container/list.rb
takeltau-0.43.19 lib/takeltau/docker/container/list.rb