Class: Kontena::Cli::Stacks::ServiceGeneratorV2

Inherits:
ServiceGenerator show all
Defined in:
lib/kontena/cli/stacks/service_generator_v2.rb

Instance Attribute Summary

Attributes inherited from ServiceGenerator

#service_config

Instance Method Summary collapse

Methods inherited from ServiceGenerator

#generate, #initialize

Methods included from Kontena::Cli::Services::ServicesHelper

#create_service, #delete_service, #deploy_service, #get_service, #health_status, #health_status_icon, #int_to_filesize, #parse_build_args, #parse_container_name, #parse_deploy_opts, #parse_health_check, #parse_image, #parse_links, #parse_log_opts, #parse_memory, #parse_ports, #parse_relative_time, #parse_secrets, #parse_service_id, #render_service_deploy_instances, #restart_service, #scale_service, #show_service, #show_service_containers, #show_service_instances, #start_service, #stop_service, #update_service, #wait_for_deploy_to_finish

Methods included from Common

#access_token=, #add_master, #any_key_to_continue, #any_key_to_continue_with_timeout, #api_url, #api_url=, #caret, #clear_current_grid, #client, #cloud_auth?, #cloud_client, #config, #confirm, #confirm_command, #current_grid, #current_master_index, #debug?, #display_account_login_info, #display_login_info, display_logo, #display_master_login_info, #error, exit_with_error, #kontena_account, #logger, #pastel, #print, #prompt, #puts, #require_api_url, #require_token, #reset_client, #reset_cloud_client, #running_quiet?, #running_silent?, #running_verbose?, #spin_if, #spinner, #sprint, #sputs, #stdin_input, #use_refresh_token, #vfakespinner, #vputs, #vspinner, #warning

Constructor Details

This class inherits a constructor from Kontena::Cli::Stacks::ServiceGenerator

Instance Method Details

#parse_build_options(options) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/kontena/cli/stacks/service_generator_v2.rb', line 19

def parse_build_options(options)
  unless options['build'].is_a?(Hash)
    options['build'] = { 'context' => options['build']}
  end
  options['build']['args'] = parse_build_args(options['build']['args']) if options['build']['args']
  options['build']
end

#parse_data(options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/kontena/cli/stacks/service_generator_v2.rb', line 7

def parse_data(options)
  data = super(options)
  data['net'] = options['network_mode'] if options['network_mode']
  data['log_driver'] = options.dig('logging', 'driver')
  data['log_opts'] = options.dig('logging', 'options')
  if options['depends_on']
    data['links'] ||= []
    data['links'] = (data['links'] + parse_links(options['depends_on'])).uniq
  end
  data
end