takeltau 0.44.29 → 0.44.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4af5fc9f1930e7b6b11e1ebf4d2af883e8db4637595392ab80856e214d96659a
4
- data.tar.gz: f65c12c5676d3a4df61fe5fb90280446486af6bdd7ed8d47e5db4f546403f3b4
3
+ metadata.gz: 3627593aec06f80bf5db560ed0f9bb62b06cd61ef093b42b2e7c556e7b167909
4
+ data.tar.gz: 6493471141e19cdb8679618494d5e894e89554bad8d7a184ef10fa2da0f4bb58
5
5
  SHA512:
6
- metadata.gz: 89433fe5f3335b761215eeb7733757befb4bf7549ddd4caf78249f8f436199abd3876a045114eef09e0574380e8354d8f1fbafaaba2165f5de790753d90b4da8
7
- data.tar.gz: 93800b4cf6a686a44777d91d3adf6c611fe29e016b74c30f813bf9347d2e79393a7e20e68ff7a8adc68e0c8a77d4e831c1099be3206b98af13220160f54a9633
6
+ metadata.gz: 85830c8a81f33d082fd4fa0d90d241155a4c2d14f0d8ad4b0aad1f6be3a9f74de7b4c5f61202b5422adb4f1af98cddcc5addd89abea7c40f32a60d71c107a499
7
+ data.tar.gz: a3f4a5a29add541cb6e7c8807ea4046cd63734bff20ee8fd5ffdd67e406a742dd250837e4c3cb730fd3ed57ed6847d9e7b5e6e1cfa82b3eb464c60756f6b3ebf
@@ -92,7 +92,7 @@ ship_data_dir: 'takelship'
92
92
  ship_default_docker_host: '32375'
93
93
  ship_default_project: 'default'
94
94
  ship_docker_host: '32375'
95
- ship_env: '--env TAKELSHIP_UPDATE=true'
95
+ ship_env: ''
96
96
  ship_hostname: '%{ship_name}_%{unique}'
97
97
  ship_name: 'takelship'
98
98
  ship_podman_localhost: '127.0.0.1'
@@ -20,23 +20,19 @@ module ShipContainerLib
20
20
 
21
21
  # Run privileged docker command
22
22
  # rubocop:disable Metrics/AbcSize
23
- # rubocop:disable Metrics/MethodLength
24
- def _ship_container_lib_docker_privileged(ports, command, args = '')
23
+ def _ship_container_lib_docker_privileged(ports, command, args: '', ship_hostname_suffix: nil, publish_ports: true)
24
+ suffix = "_#{ship_hostname_suffix}" unless ship_hostname_suffix.nil?
25
+ ship_hostname = "#{_ship_container_lib_ship_hostname}#{suffix}"
25
26
  args_privileged = config.active['ship_run_args_privileged']
26
- args = "#{args} #{args_privileged}" if config.active['ship_run_args_privileged']
27
+ args = "#{args} #{args_privileged}" if args_privileged
28
+ ship_env = _ship_container_lib_ship_env ports
29
+ ports = _ship_container_lib_publish(ports, publish_ports)
27
30
  ship_data_dir = config.active['ship_data_dir']
28
- ship_env = [config.active['ship_env']]
29
- ports.each do |key, port|
30
- envvar = "TAKELSHIP_#{key}".upcase
31
- envstr = "--env #{envvar}=#{port['localhost']}"
32
- ship_env << envstr
33
- end
34
- ports = _ship_container_lib_publish(ports)
35
31
  cmd_docker_run_command = format(
36
32
  config.active['cmd_ship_project_start_docker_run_privileged'],
37
33
  ship_docker: config.active['cmd_ship_docker'],
38
- ship_hostname: _ship_container_lib_ship_hostname,
39
- ship_env: ship_env.join(' '),
34
+ ship_hostname: ship_hostname,
35
+ ship_env: ship_env,
40
36
  ports: ports,
41
37
  project_root_dir: config.active['project_root_dir'],
42
38
  ship_data_dir: ship_data_dir,
@@ -47,7 +43,6 @@ module ShipContainerLib
47
43
  run_and_capture cmd_docker_run_command
48
44
  end
49
45
 
50
- # rubocop:enable Metrics/MethodLength
51
46
  # rubocop:enable Metrics/AbcSize
52
47
 
53
48
  # Run a docker command in a takelship container
@@ -84,8 +79,24 @@ module ShipContainerLib
84
79
  )
85
80
  end
86
81
 
82
+ # Create ship environment string
83
+ def _ship_container_lib_ship_env(ports)
84
+ ship_env = [config.active['ship_env']]
85
+ ports.each do |key, port|
86
+ envvar = "TAKELSHIP_#{key}".upcase
87
+ envstr = "--env #{envvar}=#{port['localhost']}"
88
+ ship_env << envstr
89
+ end
90
+ update = '--env TAKELSHIP_UPDATE=true'
91
+ update = "--env TAKELSHIP_UPDATE=#{ENV['TAKELSHIP_UPDATE']}" if ENV.key?('TAKELSHIP_UPDATE')
92
+ ship_env << update
93
+ ship_env.join(' ')
94
+ end
95
+
87
96
  # Create publish ports string
88
- def _ship_container_lib_publish(ports)
97
+ def _ship_container_lib_publish(ports, publish_ports)
98
+ return '' unless publish_ports
99
+
89
100
  publish = []
90
101
  ports.each do |port|
91
102
  shipport = port[1]['takelship'].to_s
@@ -27,7 +27,7 @@ module Takeltau
27
27
  It will neither run the [PROJECT] in a takelship nor create service data.
28
28
  LONGDESC
29
29
  def create(project = 'default')
30
- say ship_project_create project
30
+ exit ship_project_create project
31
31
  end
32
32
 
33
33
  #
@@ -87,7 +87,7 @@ module Takeltau
87
87
  It will neither run the [PROJECT] in a takelship nor touch the service data.
88
88
  LONGDESC
89
89
  def update(project = 'default')
90
- say ship_project_create project, 'Updated'
90
+ exit ship_project_create project, 'Updated'
91
91
  end
92
92
  end
93
93
  end
@@ -10,12 +10,16 @@ module ShipProjectCreate
10
10
 
11
11
  log.debug "Dumping takelship project \"#{project}\""
12
12
  ports = _ship_ports_lib_get_ports(takelship, project)
13
- project_root_dir = config.active['project_root_dir']
14
- ship_data_dir = config.active['ship_data_dir']
15
- args = []
16
- args << "--volume #{project_root_dir}/#{ship_data_dir}:/home/podman/takelship"
17
- args << '--env TAKELSHIP_DUMP=true'
18
- _ship_container_lib_docker_privileged ports, project, args.join(' ')
19
- "#{verb} takelship project \"#{project}\"."
13
+
14
+ ship_status = _ship_container_lib_docker_privileged(
15
+ ports,
16
+ project,
17
+ ship_hostname_suffix: 'dump',
18
+ publish_ports: false
19
+ )
20
+ return false unless _ship_container_lib_started? ship_status
21
+
22
+ say "#{verb} takelship project \"#{project}\"."
23
+ true
20
24
  end
21
25
  end
@@ -21,6 +21,7 @@ module ShipProjectStart
21
21
  return false unless _ship_container_lib_started? ship_status
22
22
 
23
23
  _ship_project_start_print_banner project
24
+ say
24
25
  _ship_project_start_print_ports ports
25
26
  true
26
27
  end
@@ -40,6 +41,8 @@ module ShipProjectStart
40
41
  return false unless ship_container_check_existing
41
42
 
42
43
  _ship_project_start_print_banner project
44
+ say 'and is already sailing'
45
+ say
43
46
  _ship_project_start_print_ports ports
44
47
  true
45
48
  end
@@ -69,7 +72,6 @@ module ShipProjectStart
69
72
  say "The takelship #{ship_hostname}"
70
73
  say "departed from #{ship_dir}"
71
74
  say "ships project #{project}"
72
- say
73
75
  end
74
76
 
75
77
  # print ports after starting a takelship
data/lib/takeltau/version CHANGED
@@ -1 +1 @@
1
- 0.44.29
1
+ 0.44.36
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: takeltau
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.44.29
4
+ version: 0.44.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takelwerk