takeltau 0.43.19 → 0.43.23

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: 1b433846c95247973be471defc8590126e5271d13069fa300f0abbd1f5c5e580
4
- data.tar.gz: a94d442031c78bddb68f2789732f5f98ddbbbcd7819b59053becc20a218d5ded
3
+ metadata.gz: 179f0b7a1f0a55cb3a19d640fae0e44172943941112cf79ffa3b676e08424bee
4
+ data.tar.gz: d33e64ed86c368e1c60a82e026f24d8214f1aa426eaa88db0764c4e02ab7b517
5
5
  SHA512:
6
- metadata.gz: 8e334b9e260c0cc13ac64dd0dc1caa0aff76bcb8d9d67ce4ca5143bacb6447ee9e17c5ae20718b6532ffb226c66397048a26cd08b0b0462f1a88bb5b49f4a243
7
- data.tar.gz: c7059141332e62277af38fabb1aa411f1e260470cea3bee256d4812e053a26d94e155c37ae5829bc176cc37576cf70a00c40704214bed5163205108509c792fd
6
+ metadata.gz: 7ecfd4990c4bbb84cd1715218d78bef5aac178b487c9abe8cf0c0d802097fd3fa400cd887210878ed392e2f17afad6060c9b2b671124641cb7687cb5a42f067b
7
+ data.tar.gz: 0401d8bd721ae94f4e15abcd861934c8423b1b513f5ad409938df7def79db972a6ad0197bd6ad71a86071f4ea31fc82986910b41d2ca01e721fd778b92841ea8
@@ -64,6 +64,7 @@ cmd_ship_docker_check: 'docker --version'
64
64
  cmd_ship_project_start_docker_run_nonprivileged: '%{ship_docker} run --rm --interactive %{image} %{command}'
65
65
  cmd_ship_project_start_docker_run_privileged: '%{ship_docker} run --privileged --rm --detach --name %{ship_hostname} --hostname %{ship_hostname} %{ship_env} %{ports} --volume ./%{ship_data_dir}:/home/podman/takelship %{image} %{command}'
66
66
  cmd_ship_project_start_docker_stop: '%{ship_docker} stop %{ship_hostname}'
67
+ cmd_ship_project_follow_logs: 'pod --workdir /home/podman/takelship/compose/projects/%{project} podman-compose logs --follow'
67
68
  docker_container_check_matrjoschka: 'true'
68
69
  docker_debug: 'ansible/roles/takel_takelage/files/takelscripts'
69
70
  docker_entrypoint_extra: ''
@@ -38,6 +38,12 @@ module Takeltau
38
38
  Takeltau::ShipContainer.new.list
39
39
  end
40
40
 
41
+ desc 'logs [PROJECT]', 'Alias for tau ship project logs'
42
+ # ship logs: {Takeltau::ShipProject#logs}
43
+ def logs(project = 'default')
44
+ Takeltau::ShipProject.new.logs(project)
45
+ end
46
+
41
47
  desc 'ls', 'Alias for tau ship container list'
42
48
  # ship list: {Takeltau::ShipContainer#list}
43
49
  def ls
@@ -56,6 +62,18 @@ module Takeltau
56
62
  Takeltau::ShipContainer.new.podman args
57
63
  end
58
64
 
65
+ desc 'command [ARGS]', 'Alias for tau ship container command'
66
+ # ship command: {Takeltau::ShipContainer#command}
67
+ def command(*args)
68
+ Takeltau::ShipContainer.new.command args
69
+ end
70
+
71
+ desc 'sudo [ARGS]', 'Alias for tau ship container sudo'
72
+ # ship sudo: {Takeltau::ShipContainer#sudo}
73
+ def sudo(*args)
74
+ Takeltau::ShipContainer.new.sudo args
75
+ end
76
+
59
77
  desc 'start [PROJECT]', 'Alias for tau ship project start'
60
78
  # ship start: {Takeltau::ShipProject#start}
61
79
  def start(project = 'default')
@@ -14,6 +14,8 @@ module Takeltau
14
14
  include ShipContainerList
15
15
  include ShipContainerLogin
16
16
  include ShipContainerPodman
17
+ include ShipContainerCommand
18
+ include ShipContainerSudo
17
19
  include ShipContainerStop
18
20
  include ShipContainerUpdate
19
21
 
@@ -25,19 +27,31 @@ module Takeltau
25
27
  #
26
28
  desc 'clean', 'Stop all takelship containers'
27
29
  long_desc <<-LONGDESC.gsub("\n", "\x5")
28
- Stop all takelship containers
30
+ Stop all takelship containers
29
31
  LONGDESC
30
32
  # Stop all takelship containers.
31
33
  def clean
32
34
  ship_container_clean
33
35
  end
34
36
 
37
+ #
38
+ # ship container command
39
+ #
40
+ desc 'command', 'Run a command in a takelship container'
41
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
42
+ Run a command in a takelship container
43
+ LONGDESC
44
+ # Run a command in a takelship container.
45
+ def command(*args)
46
+ say ship_container_command args
47
+ end
48
+
35
49
  #
36
50
  # ship container list
37
51
  #
38
52
  desc 'list', 'List takelship containers'
39
53
  long_desc <<-LONGDESC.gsub("\n", "\x5")
40
- List takelage containers
54
+ List takelage containers
41
55
  LONGDESC
42
56
  # List takelage containers.
43
57
  def list
@@ -49,7 +63,7 @@ module Takeltau
49
63
  #
50
64
  desc 'login', 'Log in to a takelship'
51
65
  long_desc <<-LONGDESC.gsub("\n", "\x5")
52
- Log in to a takelship
66
+ Log in to a takelship
53
67
  LONGDESC
54
68
  # Log in to a takelship.
55
69
  def login
@@ -61,19 +75,31 @@ module Takeltau
61
75
  #
62
76
  desc 'podman', 'Run podman command'
63
77
  long_desc <<-LONGDESC.gsub("\n", "\x5")
64
- Run podman command
78
+ Run podman command
65
79
  LONGDESC
66
80
  # Run podman command.
67
81
  def podman(*args)
68
82
  say ship_container_podman args
69
83
  end
70
84
 
85
+ #
86
+ # ship container sudo
87
+ #
88
+ desc 'sudo', 'Run a sudo command in a takelship container'
89
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
90
+ Run a sudo command in a takelship container
91
+ LONGDESC
92
+ # Run a sudo command in a takelship container.
93
+ def sudo(*args)
94
+ say ship_container_sudo args
95
+ end
96
+
71
97
  #
72
98
  # ship container stop
73
99
  #
74
100
  desc 'stop', 'Stop takelship container'
75
101
  long_desc <<-LONGDESC.gsub("\n", "\x5")
76
- Stop takelship container
102
+ Stop takelship container
77
103
  LONGDESC
78
104
  # Stop takelship container.
79
105
  def stop
@@ -85,7 +111,7 @@ module Takeltau
85
111
  #
86
112
  desc 'update', 'Update takelship image'
87
113
  long_desc <<-LONGDESC.gsub("\n", "\x5")
88
- Update takelship image
114
+ Update takelship image
89
115
  LONGDESC
90
116
  # Update takelship image.
91
117
  def update
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # tau ship container command
4
+ module ShipContainerCommand
5
+ # Run a command in a takelship
6
+ def ship_container_command(args)
7
+ return false unless ship_container_check_existing
8
+
9
+ _ship_container_lib_docker_exec "pod #{args.join(' ')}"
10
+ end
11
+ end
@@ -40,7 +40,7 @@ module ShipContainerLib
40
40
  # rubocop:enable Metrics/AbcSize
41
41
 
42
42
  # Run a docker command in a takelship container
43
- def _ship_container_lib_docker(command, tty = '--tty')
43
+ def _ship_container_lib_docker_exec(command, tty = '--tty')
44
44
  cmd_docker_run_command = format(
45
45
  config.active['cmd_ship_container_docker'],
46
46
  ship_docker: config.active['cmd_ship_docker'],
@@ -7,6 +7,6 @@ module ShipContainerLogin
7
7
  return false unless ship_container_check_existing
8
8
 
9
9
  command_after_login = config.active['cmd_ship_container_login']
10
- _ship_container_lib_docker command_after_login, '--tty'
10
+ _ship_container_lib_docker_exec command_after_login, '--tty'
11
11
  end
12
12
  end
@@ -6,6 +6,6 @@ module ShipContainerPodman
6
6
  def ship_container_podman(args)
7
7
  return false unless ship_container_check_existing
8
8
 
9
- _ship_container_lib_docker "pod podman #{args.join(' ')}"
9
+ _ship_container_lib_docker_exec "pod podman #{args.join(' ')}"
10
10
  end
11
11
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # tau ship container sudo
4
+ module ShipContainerSudo
5
+ # Run a sudo command in a takelship
6
+ def ship_container_sudo(args)
7
+ return false unless ship_container_check_existing
8
+
9
+ _ship_container_lib_docker_exec args.join(' ')
10
+ end
11
+ end
@@ -33,6 +33,14 @@ module ShipInfoLib
33
33
  _parse_yaml _ship_container_lib_docker_nonprivileged(command) || {}
34
34
  end
35
35
 
36
+ def _ship_info_lib_get_project(project, takelship)
37
+ return '' unless takelship.key? 'default_project'
38
+
39
+ project = config.active['ship_default_project'] if project == 'default'
40
+ project = takelship['default_project'] if project == 'default'
41
+ project
42
+ end
43
+
36
44
  def _ship_info_lib_valid_project?(takelship, project)
37
45
  valid_project = false
38
46
  takelship_projects = takelship['projects']
@@ -13,6 +13,7 @@ module Takeltau
13
13
  include ShipContainerStop
14
14
  include ShipInfoLib
15
15
  include ShipProjectList
16
+ include ShipProjectLogs
16
17
  include ShipProjectStart
17
18
 
18
19
  #
@@ -20,19 +21,31 @@ module Takeltau
20
21
  #
21
22
  desc 'list', 'List projects'
22
23
  long_desc <<-LONGDESC.gsub("\n", "\x5")
23
- List projects
24
+ List projects
24
25
  LONGDESC
25
26
  # List projects.
26
27
  def list
27
28
  ship_project_list
28
29
  end
29
30
 
31
+ #
32
+ # ship container logs
33
+ #
34
+ desc 'logs [PROJECT]', 'Follow logs of project [PROJECT]'
35
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
36
+ Follow logs of project [PROJECT]
37
+ LONGDESC
38
+ # logs projects.
39
+ def logs(project = 'default')
40
+ ship_project_logs project
41
+ end
42
+
30
43
  #
31
44
  # ship container start
32
45
  #
33
46
  desc 'start [PROJECT]', 'Start project [PROJECT] in a takelship container'
34
47
  long_desc <<-LONGDESC.gsub("\n", "\x5")
35
- Start project [PROJECT] in a takelship container
48
+ Start project [PROJECT] in a takelship container
36
49
  LONGDESC
37
50
  # Run command in docker container.
38
51
  def start(project = 'default')
@@ -44,7 +57,7 @@ module Takeltau
44
57
  #
45
58
  desc 'stop', 'Stop a takelship container'
46
59
  long_desc <<-LONGDESC.gsub("\n", "\x5")
47
- Stop a takelship container
60
+ Stop a takelship container
48
61
  LONGDESC
49
62
  # Stop a takelship container.
50
63
  def stop
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # tau ship project logs
4
+ module ShipProjectLogs
5
+ # Start a takelship
6
+ def ship_project_logs(project)
7
+ return unless ship_container_check_existing
8
+
9
+ takelship = _ship_info_lib_get_takelshipinfo
10
+ project = _ship_info_lib_get_project(project, takelship)
11
+
12
+ return false unless _ship_info_lib_valid_project? takelship, project
13
+
14
+ log.debug "Following logs of takelship project \"#{project}\""
15
+ _ship_project_logs_follow_logs project
16
+ end
17
+
18
+ private
19
+
20
+ def _ship_project_logs_follow_logs(project)
21
+ cmd_follow_logs = format(
22
+ config.active['cmd_ship_project_follow_logs'],
23
+ project: project
24
+ )
25
+ _ship_container_lib_docker_exec cmd_follow_logs
26
+ end
27
+ end
@@ -9,11 +9,7 @@ module ShipProjectStart
9
9
  return false if ship_container_check_existing
10
10
 
11
11
  takelship = _ship_info_lib_get_takelshipinfo
12
-
13
- return false unless takelship.key? 'default_project'
14
-
15
- project = config.active['ship_default_project'] if project == 'default'
16
- project = takelship['default_project'] if project == 'default'
12
+ project = _ship_info_lib_get_project(project, takelship)
17
13
 
18
14
  return false unless _ship_info_lib_valid_project? takelship, project
19
15
 
data/lib/takeltau/version CHANGED
@@ -1 +1 @@
1
- 0.43.19
1
+ 0.43.23
data/lib/takeltau.rb CHANGED
@@ -90,13 +90,16 @@ require_relative 'takeltau/ship/container/check/cli'
90
90
  require_relative 'takeltau/ship/info/lib'
91
91
  require_relative 'takeltau/ship/container/list'
92
92
  require_relative 'takeltau/ship/container/clean'
93
+ require_relative 'takeltau/ship/container/command'
93
94
  require_relative 'takeltau/ship/container/login'
94
95
  require_relative 'takeltau/ship/container/podman'
96
+ require_relative 'takeltau/ship/container/sudo'
95
97
  require_relative 'takeltau/ship/container/stop'
96
98
  require_relative 'takeltau/ship/container/update'
97
99
  require_relative 'takeltau/ship/container/cli'
98
100
  require_relative 'takeltau/ship/info/cli'
99
101
  require_relative 'takeltau/ship/project/list'
102
+ require_relative 'takeltau/ship/project/logs'
100
103
  require_relative 'takeltau/ship/project/start'
101
104
  require_relative 'takeltau/ship/project/cli'
102
105
  require_relative 'takeltau/ship/cli'
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.43.19
4
+ version: 0.43.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takelwerk
@@ -290,16 +290,19 @@ files:
290
290
  - lib/takeltau/ship/container/check/existing.rb
291
291
  - lib/takeltau/ship/container/clean.rb
292
292
  - lib/takeltau/ship/container/cli.rb
293
+ - lib/takeltau/ship/container/command.rb
293
294
  - lib/takeltau/ship/container/lib.rb
294
295
  - lib/takeltau/ship/container/list.rb
295
296
  - lib/takeltau/ship/container/login.rb
296
297
  - lib/takeltau/ship/container/podman.rb
297
298
  - lib/takeltau/ship/container/stop.rb
299
+ - lib/takeltau/ship/container/sudo.rb
298
300
  - lib/takeltau/ship/container/update.rb
299
301
  - lib/takeltau/ship/info/cli.rb
300
302
  - lib/takeltau/ship/info/lib.rb
301
303
  - lib/takeltau/ship/project/cli.rb
302
304
  - lib/takeltau/ship/project/list.rb
305
+ - lib/takeltau/ship/project/logs.rb
303
306
  - lib/takeltau/ship/project/start.rb
304
307
  - lib/takeltau/version
305
308
  homepage: https://github.com/takelwerk/takelage-cli