Sha256: ce7ca00eead083acd9fed49a9db4f325c1da72073d7b7f1333dfcc1dd9b61039

Contents?: true

Size: 1.04 KB

Versions: 40

Compression:

Stored size: 1.04 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
  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

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

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
takeltau-0.46.9 lib/takeltau/docker/container/list.rb
takeltau-0.46.8 lib/takeltau/docker/container/list.rb
takeltau-0.46.5 lib/takeltau/docker/container/list.rb
takeltau-0.46.1 lib/takeltau/docker/container/list.rb
takeltau-0.46.0 lib/takeltau/docker/container/list.rb
takeltau-0.45.27 lib/takeltau/docker/container/list.rb
takeltau-0.45.26 lib/takeltau/docker/container/list.rb
takeltau-0.45.24 lib/takeltau/docker/container/list.rb
takeltau-0.45.23 lib/takeltau/docker/container/list.rb
takeltau-0.45.22 lib/takeltau/docker/container/list.rb
takeltau-0.45.21 lib/takeltau/docker/container/list.rb
takeltau-0.45.19 lib/takeltau/docker/container/list.rb
takeltau-0.45.17 lib/takeltau/docker/container/list.rb
takeltau-0.45.16 lib/takeltau/docker/container/list.rb
takeltau-0.45.14 lib/takeltau/docker/container/list.rb
takeltau-0.45.13 lib/takeltau/docker/container/list.rb
takeltau-0.45.12 lib/takeltau/docker/container/list.rb
takeltau-0.45.11 lib/takeltau/docker/container/list.rb
takeltau-0.45.10 lib/takeltau/docker/container/list.rb
takeltau-0.45.9 lib/takeltau/docker/container/list.rb