takeltau 0.34.9
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 +7 -0
- data/LICENSE +674 -0
- data/README.md +235 -0
- data/bin/tau +6 -0
- data/lib/Thorfile +3 -0
- data/lib/takeltau.rb +257 -0
- data/lib/takeltau/bit/check/cli.rb +23 -0
- data/lib/takeltau/bit/check/workspace.rb +37 -0
- data/lib/takeltau/bit/cli.rb +18 -0
- data/lib/takeltau/bit/clipboard/cli.rb +73 -0
- data/lib/takeltau/bit/clipboard/copy.rb +142 -0
- data/lib/takeltau/bit/clipboard/lib.rb +143 -0
- data/lib/takeltau/bit/clipboard/paste.rb +60 -0
- data/lib/takeltau/bit/clipboard/pull.rb +37 -0
- data/lib/takeltau/bit/clipboard/push.rb +37 -0
- data/lib/takeltau/bit/require/cli.rb +57 -0
- data/lib/takeltau/bit/require/export.rb +34 -0
- data/lib/takeltau/bit/require/import.rb +133 -0
- data/lib/takeltau/bit/require/lib.rb +19 -0
- data/lib/takeltau/bit/scope/add.rb +55 -0
- data/lib/takeltau/bit/scope/cli.rb +74 -0
- data/lib/takeltau/bit/scope/list.rb +41 -0
- data/lib/takeltau/bit/scope/new.rb +44 -0
- data/lib/takeltau/bit/scope/ssh.rb +13 -0
- data/lib/takeltau/completion/cli.rb +24 -0
- data/lib/takeltau/default.yml +95 -0
- data/lib/takeltau/docker/check/cli.rb +23 -0
- data/lib/takeltau/docker/check/daemon.rb +27 -0
- data/lib/takeltau/docker/cli.rb +15 -0
- data/lib/takeltau/docker/container/check/cli.rb +57 -0
- data/lib/takeltau/docker/container/check/existing.rb +32 -0
- data/lib/takeltau/docker/container/check/network.rb +32 -0
- data/lib/takeltau/docker/container/check/orphaned.rb +32 -0
- data/lib/takeltau/docker/container/clean.rb +40 -0
- data/lib/takeltau/docker/container/cli.rb +118 -0
- data/lib/takeltau/docker/container/command.rb +38 -0
- data/lib/takeltau/docker/container/daemon.rb +17 -0
- data/lib/takeltau/docker/container/lib.rb +181 -0
- data/lib/takeltau/docker/container/login.rb +58 -0
- data/lib/takeltau/docker/container/prune.rb +31 -0
- data/lib/takeltau/docker/image/cli.rb +39 -0
- data/lib/takeltau/docker/image/tag/check.rb +42 -0
- data/lib/takeltau/docker/image/tag/cli.rb +68 -0
- data/lib/takeltau/docker/image/tag/latest.rb +24 -0
- data/lib/takeltau/docker/image/tag/list.rb +19 -0
- data/lib/takeltau/docker/image/update.rb +27 -0
- data/lib/takeltau/git/check/bit.rb +26 -0
- data/lib/takeltau/git/check/clean.rb +46 -0
- data/lib/takeltau/git/check/cli.rb +49 -0
- data/lib/takeltau/git/check/workspace.rb +34 -0
- data/lib/takeltau/git/cli.rb +9 -0
- data/lib/takeltau/info/cli.rb +12 -0
- data/lib/takeltau/info/project/cli.rb +69 -0
- data/lib/takeltau/info/status/bar.rb +112 -0
- data/lib/takeltau/info/status/cli.rb +107 -0
- data/lib/takeltau/info/status/git.rb +47 -0
- data/lib/takeltau/info/status/gopass.rb +37 -0
- data/lib/takeltau/info/status/gpg.rb +39 -0
- data/lib/takeltau/info/status/lib.rb +46 -0
- data/lib/takeltau/info/status/ssh.rb +46 -0
- data/lib/takeltau/init/cli.rb +12 -0
- data/lib/takeltau/init/lib.rb +86 -0
- data/lib/takeltau/init/packer/cli.rb +82 -0
- data/lib/takeltau/init/packer/docker.rb +64 -0
- data/lib/takeltau/init/packer/templates/ansiblelint.tt +3 -0
- data/lib/takeltau/init/packer/templates/bitrequireyml.tt +13 -0
- data/lib/takeltau/init/packer/templates/groupvarsprojectyml.tt +2 -0
- data/lib/takeltau/init/packer/templates/playbooksiteyml.tt +6 -0
- data/lib/takeltau/init/packer/templates/projectyml.tt +19 -0
- data/lib/takeltau/init/takelage/cli.rb +70 -0
- data/lib/takeltau/init/takelage/rake.rb +61 -0
- data/lib/takeltau/init/takelage/templates/bitrequireyml.tt +5 -0
- data/lib/takeltau/init/takelage/templates/projectyml.tt +3 -0
- data/lib/takeltau/init/templates/Rakefile.tt +3 -0
- data/lib/takeltau/init/templates/gitignore.tt +16 -0
- data/lib/takeltau/lib/config.rb +130 -0
- data/lib/takeltau/lib/logging.rb +49 -0
- data/lib/takeltau/lib/project.rb +72 -0
- data/lib/takeltau/lib/subcmd.rb +18 -0
- data/lib/takeltau/lib/system.rb +194 -0
- data/lib/takeltau/mutagen/check/cli.rb +40 -0
- data/lib/takeltau/mutagen/check/daemon.rb +76 -0
- data/lib/takeltau/mutagen/cli.rb +12 -0
- data/lib/takeltau/mutagen/socket/check.rb +33 -0
- data/lib/takeltau/mutagen/socket/cli.rb +103 -0
- data/lib/takeltau/mutagen/socket/create.rb +47 -0
- data/lib/takeltau/mutagen/socket/list.rb +33 -0
- data/lib/takeltau/mutagen/socket/terminate.rb +32 -0
- data/lib/takeltau/mutagen/socket/tidy.rb +21 -0
- data/lib/takeltau/self/cli.rb +43 -0
- data/lib/takeltau/self/config/cli.rb +82 -0
- data/lib/takeltau/self/list.rb +35 -0
- data/lib/takeltau/version +1 -0
- metadata +319 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Takeltau
|
|
4
|
+
# takeltau mutagen check
|
|
5
|
+
class MutagenCheck < SubCommandBase
|
|
6
|
+
include LoggingModule
|
|
7
|
+
include SystemModule
|
|
8
|
+
include ConfigModule
|
|
9
|
+
include DockerCheckDaemon
|
|
10
|
+
include DockerContainerCheckExisting
|
|
11
|
+
include DockerContainerCheckNetwork
|
|
12
|
+
include DockerContainerCommand
|
|
13
|
+
include DockerContainerLib
|
|
14
|
+
include MutagenCheckDaemon
|
|
15
|
+
|
|
16
|
+
# Initialize mutagen check
|
|
17
|
+
def initialize(args = [], local_options = {}, configuration = {})
|
|
18
|
+
# initialize thor parent class
|
|
19
|
+
super args, local_options, configuration
|
|
20
|
+
|
|
21
|
+
@workdir = Dir.getwd
|
|
22
|
+
|
|
23
|
+
inside = _docker_container_lib_check_matrjoschka
|
|
24
|
+
@hostname = inside ? ENV['HOSTNAME'] : _docker_container_lib_hostname
|
|
25
|
+
@hostlabel = "hostname=#{@hostname}"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
#
|
|
29
|
+
# mutagen check daemon
|
|
30
|
+
#
|
|
31
|
+
desc 'daemon', 'Check if mutagen host conenction is available'
|
|
32
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
|
33
|
+
Check if mutagen host conenction is available
|
|
34
|
+
LONGDESC
|
|
35
|
+
# Check if mutagen host conenction is available.
|
|
36
|
+
def daemon
|
|
37
|
+
exit mutagen_check_daemon
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# takeltau info status mutagen
|
|
4
|
+
module MutagenCheckDaemon
|
|
5
|
+
# Backend method for mutagen check daemon.
|
|
6
|
+
# @return [Boolean] is mutagen available?
|
|
7
|
+
# rubocop:disable Metrics/MethodLength
|
|
8
|
+
# rubocop:disable Metrics/AbcSize
|
|
9
|
+
def mutagen_check_daemon
|
|
10
|
+
return true if @mutagen_daemon_available
|
|
11
|
+
|
|
12
|
+
return false unless command_available_else_warn? config.active['cmd_mutagen']
|
|
13
|
+
|
|
14
|
+
log.debug 'Check mutagen status'
|
|
15
|
+
|
|
16
|
+
# are we outside of a takelage container?
|
|
17
|
+
unless _docker_container_lib_check_matrjoschka
|
|
18
|
+
unless _mutagen_check_daemon_version
|
|
19
|
+
log.error 'The mutagen daemon is not available'
|
|
20
|
+
return false
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
log.debug 'The mutagen daemon is available'
|
|
24
|
+
@mutagen_daemon_available = true
|
|
25
|
+
return true
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
unless _file_exists? config.active['mutagen_socket_path_mutagen']
|
|
29
|
+
log.error 'The mutagen socket is not available'
|
|
30
|
+
return false
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
unless _mutagen_check_daemon_host_connection
|
|
34
|
+
log.error 'A mutagen host connection is not available'
|
|
35
|
+
return false
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
log.debug 'The mutagen daemon is available'
|
|
39
|
+
@mutagen_daemon_available = true
|
|
40
|
+
true
|
|
41
|
+
end
|
|
42
|
+
# rubocop:enable Metrics/AbcSize
|
|
43
|
+
# rubocop:enable Metrics/MethodLength
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
# Check mutagen host connection
|
|
48
|
+
# rubocop:disable Metrics/MethodLength
|
|
49
|
+
def _mutagen_check_daemon_host_connection
|
|
50
|
+
check_host_connection = format(
|
|
51
|
+
config.active['cmd_mutagen_check_daemon_host_connection'],
|
|
52
|
+
hostlabel: @hostlabel
|
|
53
|
+
)
|
|
54
|
+
stdout, _, exitstatus = run_and_capture check_host_connection
|
|
55
|
+
|
|
56
|
+
unless exitstatus.zero?
|
|
57
|
+
log.debug 'There is no mutagen forward connection to the host'
|
|
58
|
+
return false
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
unless stdout.include? 'Status: Forwarding connections'
|
|
62
|
+
log.debug 'The mutagen forward connection to the host ' \
|
|
63
|
+
'is not forwarding connections'
|
|
64
|
+
return false
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
true
|
|
68
|
+
end
|
|
69
|
+
# rubocop:enable Metrics/MethodLength
|
|
70
|
+
|
|
71
|
+
# Check mutagen version
|
|
72
|
+
def _mutagen_check_daemon_version
|
|
73
|
+
version = try config.active['cmd_mutagen_check_daemon_version']
|
|
74
|
+
version.exitstatus.zero?
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Takeltau
|
|
4
|
+
# takeltau git
|
|
5
|
+
class Mutagen < SubCommandBase
|
|
6
|
+
desc 'check [COMMAND]', 'Check mutagen'
|
|
7
|
+
subcommand 'check', MutagenCheck
|
|
8
|
+
|
|
9
|
+
desc 'socket [COMMAND]', 'Manage mutagen socket'
|
|
10
|
+
subcommand 'socket', MutagenSocket
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# takeltau mutagen socket check
|
|
4
|
+
module MutagenSocketCheck
|
|
5
|
+
# Backend method for mutagen socket check.
|
|
6
|
+
# @return [Boolean] Does a mutagen socket exist?
|
|
7
|
+
def mutagen_socket_check(socket)
|
|
8
|
+
log.debug "Check if the mutagen socket \"#{socket}\" exists"
|
|
9
|
+
|
|
10
|
+
return false unless mutagen_check_daemon
|
|
11
|
+
|
|
12
|
+
socket_exists = _mutagen_socket_check_socket(socket)
|
|
13
|
+
|
|
14
|
+
unless socket_exists.exitstatus.zero?
|
|
15
|
+
log.debug "A mutagen socket \"#{socket}\" does not exist"
|
|
16
|
+
return false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
log.debug "The mutagen socket \"#{socket}\" does exist"
|
|
20
|
+
true
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
# Get git branch.
|
|
26
|
+
def _mutagen_socket_check_socket(socketname)
|
|
27
|
+
cmd_check_socket = format(
|
|
28
|
+
config.active['cmd_mutagen_forward_socket_check'],
|
|
29
|
+
socketname: socketname
|
|
30
|
+
)
|
|
31
|
+
try cmd_check_socket
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Takeltau
|
|
4
|
+
# takeltau mutagen socket
|
|
5
|
+
class MutagenSocket < SubCommandBase
|
|
6
|
+
include LoggingModule
|
|
7
|
+
include SystemModule
|
|
8
|
+
include ConfigModule
|
|
9
|
+
include DockerCheckDaemon
|
|
10
|
+
include DockerContainerCheckExisting
|
|
11
|
+
include DockerContainerCheckNetwork
|
|
12
|
+
include DockerContainerCommand
|
|
13
|
+
include DockerContainerLib
|
|
14
|
+
include DockerImageTagLatest
|
|
15
|
+
include DockerImageTagList
|
|
16
|
+
include DockerImageTagCheck
|
|
17
|
+
include MutagenCheckDaemon
|
|
18
|
+
include MutagenSocketCheck
|
|
19
|
+
include MutagenSocketCreate
|
|
20
|
+
include MutagenSocketList
|
|
21
|
+
include MutagenSocketTidy
|
|
22
|
+
include MutagenSocketTerminate
|
|
23
|
+
|
|
24
|
+
# Initialize mutagen socket
|
|
25
|
+
def initialize(args = [], local_options = {}, configuration = {})
|
|
26
|
+
# initialize thor parent class
|
|
27
|
+
super args, local_options, configuration
|
|
28
|
+
|
|
29
|
+
@docker_repo = config.active['docker_repo']
|
|
30
|
+
@username = ENV['USER'] || 'noname'
|
|
31
|
+
@workdir = Dir.getwd
|
|
32
|
+
|
|
33
|
+
inside = _docker_container_lib_check_matrjoschka
|
|
34
|
+
@hostname = inside ? ENV['HOSTNAME'] : _docker_container_lib_hostname
|
|
35
|
+
|
|
36
|
+
@hostlabel = "hostname=#{@hostname}"
|
|
37
|
+
@takellabel = config.active['mutagen_socket_takelage_label']
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
#
|
|
41
|
+
# mutagen socket check
|
|
42
|
+
#
|
|
43
|
+
desc 'check [SOCKET]', 'Check if mutagen [SOCKET] exists'
|
|
44
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
|
45
|
+
Check if mutagen [SOCKET] exists
|
|
46
|
+
LONGDESC
|
|
47
|
+
# Check if mutagen [SOCKET] exists.
|
|
48
|
+
def check(socket)
|
|
49
|
+
exit mutagen_socket_check socket
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
#
|
|
53
|
+
# mutagen socket create
|
|
54
|
+
#
|
|
55
|
+
desc 'create [NAME] [IN] [OUT]', 'Create a mutagen socket [NAME] from [IN] to [OUT] of the container'
|
|
56
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
|
57
|
+
Create a mutagen socket [NAME] from [IN] to [OUT] of the container
|
|
58
|
+
LONGDESC
|
|
59
|
+
# Create a mutagen socket [NAME] from [IN] to [OUT] of the container.
|
|
60
|
+
def create(name, containersock, hostsock)
|
|
61
|
+
exit mutagen_socket_create name, containersock, hostsock
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
#
|
|
65
|
+
# mutagen socket list
|
|
66
|
+
#
|
|
67
|
+
desc 'list', 'List mutagen sockets'
|
|
68
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
|
69
|
+
List mutagen sockets
|
|
70
|
+
LONGDESC
|
|
71
|
+
# List mutagen sockets.
|
|
72
|
+
def list
|
|
73
|
+
socket_list = mutagen_socket_list
|
|
74
|
+
exit false if socket_list == false
|
|
75
|
+
say socket_list
|
|
76
|
+
true
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
#
|
|
80
|
+
# mutagen socket terminate
|
|
81
|
+
#
|
|
82
|
+
desc 'terminate [SOCKET]', 'Terminate a mutagen [SOCKET]'
|
|
83
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
|
84
|
+
Terminate a mutagen [SOCKET]
|
|
85
|
+
LONGDESC
|
|
86
|
+
# Terminate a mutagen [SOCKET].
|
|
87
|
+
def terminate(socket)
|
|
88
|
+
exit mutagen_socket_terminate socket
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
#
|
|
92
|
+
# mutagen socket tidy
|
|
93
|
+
#
|
|
94
|
+
desc 'tidy', 'Remove mutagen daemon files'
|
|
95
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
|
96
|
+
Remove mutagen daemon files
|
|
97
|
+
LONGDESC
|
|
98
|
+
# Remove mutagen daemon files.
|
|
99
|
+
def tidy
|
|
100
|
+
exit mutagen_socket_tidy
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# takeltau mutagen socket create
|
|
4
|
+
module MutagenSocketCreate
|
|
5
|
+
# Backend method for mutagen socket create.
|
|
6
|
+
# rubocop:disable Metrics/MethodLength
|
|
7
|
+
def mutagen_socket_create(name, containersock, hostsock)
|
|
8
|
+
# See DockerContainerLib::_docker_container_lib_hostname
|
|
9
|
+
socketname = "#{@hostname[-11..-1]}-#{name}"
|
|
10
|
+
log.debug "Create the mutagen socket \"#{socketname}\" in the container " \
|
|
11
|
+
"at \"#{containersock}\" pointing to the host at \"#{hostsock}\""
|
|
12
|
+
|
|
13
|
+
return false unless mutagen_check_daemon
|
|
14
|
+
|
|
15
|
+
return false if mutagen_socket_check socketname
|
|
16
|
+
|
|
17
|
+
socket_created = _mutagen_socket_create_socket(socketname, containersock, hostsock)
|
|
18
|
+
|
|
19
|
+
unless socket_created.include? 'Created session'
|
|
20
|
+
log.debug "Unable to create mutagen socket \"#{socketname}\""
|
|
21
|
+
return false
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
log.debug "Created the mutagen socket \"#{socketname}\""
|
|
25
|
+
true
|
|
26
|
+
end
|
|
27
|
+
# rubocop:enable Metrics/MethodLength
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
# Get git branch.
|
|
32
|
+
# rubocop:disable Metrics/MethodLength
|
|
33
|
+
def _mutagen_socket_create_socket(socketname, containersock, hostsock)
|
|
34
|
+
cmd_create_socket = format(
|
|
35
|
+
config.active['cmd_mutagen_forward_socket_create'],
|
|
36
|
+
socketname: socketname,
|
|
37
|
+
containersock: containersock,
|
|
38
|
+
hostsock: hostsock,
|
|
39
|
+
username: @username,
|
|
40
|
+
container: @hostname,
|
|
41
|
+
hostlabel: @hostlabel,
|
|
42
|
+
takellabel: @takellabel
|
|
43
|
+
)
|
|
44
|
+
run cmd_create_socket
|
|
45
|
+
end
|
|
46
|
+
# rubocop:enable Metrics/MethodLength
|
|
47
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# takeltau mutagen socket list
|
|
4
|
+
module MutagenSocketList
|
|
5
|
+
# Backend method for mutagen socket list.
|
|
6
|
+
# @return [String] List of takelage sockets
|
|
7
|
+
def mutagen_socket_list
|
|
8
|
+
log.debug 'List the mutagen takelage sockets'
|
|
9
|
+
|
|
10
|
+
return false unless mutagen_check_daemon
|
|
11
|
+
|
|
12
|
+
sockets = _mutagen_socket_list
|
|
13
|
+
|
|
14
|
+
if sockets.to_s.empty?
|
|
15
|
+
log.debug 'No mutagen takelage sockets found'
|
|
16
|
+
return false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
log.debug "Found mutagen takelage sockets: \n\"\"\"\n#{sockets}\"\"\""
|
|
20
|
+
sockets.to_s
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
# Get git branch.
|
|
26
|
+
def _mutagen_socket_list
|
|
27
|
+
cmd_list_socket = format(
|
|
28
|
+
config.active['cmd_mutagen_forward_socket_list'],
|
|
29
|
+
takellabel: @takellabel
|
|
30
|
+
)
|
|
31
|
+
run cmd_list_socket
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# takeltau mutagen socket terminate
|
|
4
|
+
module MutagenSocketTerminate
|
|
5
|
+
# Backend method for mutagen socket terminate.
|
|
6
|
+
def mutagen_socket_terminate(socket)
|
|
7
|
+
log.debug "Terminate the mutagen socket \"#{socket}\""
|
|
8
|
+
|
|
9
|
+
return false unless mutagen_check_daemon
|
|
10
|
+
|
|
11
|
+
socket_terminated = _mutagen_socket_terminate_socket socket
|
|
12
|
+
|
|
13
|
+
unless socket_terminated.exitstatus.zero?
|
|
14
|
+
log.debug "Unable to terminated mutagen socket \"#{socket}\""
|
|
15
|
+
return false
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
log.debug "Terminated the mutagen socket \"#{socket}\""
|
|
19
|
+
true
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
# Get git branch.
|
|
25
|
+
def _mutagen_socket_terminate_socket(socketname)
|
|
26
|
+
cmd_terminate_socket = format(
|
|
27
|
+
config.active['cmd_mutagen_forward_socket_terminate'],
|
|
28
|
+
socketname: socketname
|
|
29
|
+
)
|
|
30
|
+
try cmd_terminate_socket
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# takeltau mutagen socket tidy
|
|
4
|
+
module MutagenSocketTidy
|
|
5
|
+
# Backend method for mutagen socket tidy.
|
|
6
|
+
def mutagen_socket_tidy
|
|
7
|
+
log.debug "Remove the mutagen daemon files in container \"#{@hostname}\""
|
|
8
|
+
|
|
9
|
+
container_existing = docker_container_check_existing @hostname
|
|
10
|
+
cmd_remove = config.active['cmd_mutagen_forward_socket_remove']
|
|
11
|
+
return false unless container_existing && cmd_remove.empty?
|
|
12
|
+
|
|
13
|
+
unless docker_container_command cmd_remove
|
|
14
|
+
log.error "Unable to remove the mutagen daemon files in container \"#{@hostname}\""
|
|
15
|
+
return false
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
log.debug "Removed the mutagen daemon files in container \"#{@hostname}\""
|
|
19
|
+
true
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Takeltau
|
|
4
|
+
# semantic version number
|
|
5
|
+
VERSION = (File.read "#{File.dirname(__FILE__)}/../version").chomp
|
|
6
|
+
|
|
7
|
+
# takeltau self
|
|
8
|
+
class Self < SubCommandBase
|
|
9
|
+
include LoggingModule
|
|
10
|
+
include SelfList
|
|
11
|
+
|
|
12
|
+
desc 'config [COMMAND]', 'Manage takeltau configuration'
|
|
13
|
+
subcommand 'config', SelfConfig
|
|
14
|
+
|
|
15
|
+
#
|
|
16
|
+
# self list
|
|
17
|
+
#
|
|
18
|
+
desc 'list', 'List all commands'
|
|
19
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
|
20
|
+
List all commands
|
|
21
|
+
LONGDESC
|
|
22
|
+
# List all commands.
|
|
23
|
+
def list
|
|
24
|
+
list = self_list
|
|
25
|
+
exit false if list == false
|
|
26
|
+
say list
|
|
27
|
+
true
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
#
|
|
31
|
+
# self version
|
|
32
|
+
#
|
|
33
|
+
desc 'version', 'Print takeltau semantic version number'
|
|
34
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
|
35
|
+
Print takeltau semantic version number
|
|
36
|
+
LONGDESC
|
|
37
|
+
# Print takeltau semantic version number.
|
|
38
|
+
def version
|
|
39
|
+
say VERSION
|
|
40
|
+
true
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|