Sha256: d85bab7979e9b6c1c2efdfcfd5583f97a26ddb1140795f3ad20c27516bfb3cce

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

# tau ship info lib
module ShipInfoLib
  private

  # Gather takelship information
  def _ship_info_lib_get_takelshipinfo
    log.debug 'Gathering takelship info'
    takelshipinfo = _ship_info_lib_get_info_from_docker
    return false if takelshipinfo.nil?

    takelshipinfo
  end

  # Read takelship info from docker run
  def _ship_info_lib_get_info_from_docker
    log.debug 'Reading takelship info from takelship container'
    command = 'info'
    _parse_yaml _ship_container_lib_docker_nonprivileged(command) || {}
  end

  def _ship_info_lib_get_project(project, takelship)
    return '' if takelship.nil?

    return '' unless takelship.key? 'default_project'

    project = config.active['ship_default_project'] if project == 'default'
    project = takelship['default_project'] if project == 'default'
    project
  end

  def _ship_info_lib_valid_project?(takelship, project)
    valid_project = false
    takelship_projects = takelship['projects']
    return false if takelship_projects.nil? || takelship_projects.empty?

    takelship_projects.each do |takelship_project|
      valid_project = true if project == takelship_project['name']
    end
    valid_project
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
takeltau-0.45.19 lib/takeltau/ship/info/lib.rb
takeltau-0.45.17 lib/takeltau/ship/info/lib.rb
takeltau-0.45.16 lib/takeltau/ship/info/lib.rb