takelage 0.30.1 → 0.30.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/takelage/docker/check/daemon.rb +1 -1
- data/lib/takelage/lib/system.rb +31 -10
- data/lib/takelage/mutagen/check/daemon.rb +1 -1
- data/lib/takelage/version +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3798431602738ebd91bf124034fec693982e0524328416c7424796e6548ecb66
|
4
|
+
data.tar.gz: fe31c05991ca3be5598b3b9baaadd0e3cce9d1decb74b5eccfebbc0cc2bb735b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e6f571cc06aa007f0e5f05fe42a369716f61042b2d237f8e40ba6ec805df7ff704e05841020d4db14bc9013457300b36d9298544ead4c4c245be18ee7436b6d
|
7
|
+
data.tar.gz: 522dc2cf64c9e1051d165a5744a33bc6a7431f9d849ce2ca4ff30f4441dec84bfbd2cfd5afa96ed510ed0842e2d7ca811c0da3b34dc05eeea197d7af2689d8c5
|
@@ -8,7 +8,7 @@ module DockerCheckDaemon
|
|
8
8
|
def docker_check_daemon
|
9
9
|
return true if @docker_daemon_running
|
10
10
|
|
11
|
-
return false unless
|
11
|
+
return false unless command_available_else_error? 'docker'
|
12
12
|
|
13
13
|
log.debug 'Check if the docker daemon is running'
|
14
14
|
|
data/lib/takelage/lib/system.rb
CHANGED
@@ -7,22 +7,26 @@ require 'yaml'
|
|
7
7
|
# Interaction with the operating system
|
8
8
|
# rubocop:disable Metrics/ModuleLength
|
9
9
|
module SystemModule
|
10
|
-
# Check if a command is available
|
10
|
+
# Check if a command is available else log error message
|
11
11
|
# @return [Boolean] is the command available?
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
def command_available_else_error?(command)
|
13
|
+
unless _command_available? command
|
14
|
+
log.error "The command \"#{command}\" is not available"
|
15
|
+
return false
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
+
command_available command
|
19
|
+
end
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
+
# Check if a command is available else log warning message
|
22
|
+
# @return [Boolean] is the command available?
|
23
|
+
def command_available_else_warning?(command)
|
24
|
+
unless _command_available? command
|
25
|
+
log.warning "The command \"#{command}\" is not available"
|
21
26
|
return false
|
22
27
|
end
|
23
28
|
|
24
|
-
|
25
|
-
instance_variable_set("@command_available_#{command}", true)
|
29
|
+
command_available command
|
26
30
|
end
|
27
31
|
|
28
32
|
# Convert hash to yaml.
|
@@ -118,6 +122,23 @@ module SystemModule
|
|
118
122
|
|
119
123
|
private
|
120
124
|
|
125
|
+
# Check if command is available
|
126
|
+
def _command_available?(command)
|
127
|
+
return true if instance_variable_get("@command_available_#{command}")
|
128
|
+
|
129
|
+
log.debug "Check if the command \"#{command}\" is available"
|
130
|
+
status = try "which #{command}"
|
131
|
+
return false unless status.exitstatus.zero?
|
132
|
+
|
133
|
+
true
|
134
|
+
end
|
135
|
+
|
136
|
+
# Command is available
|
137
|
+
def command_available(command)
|
138
|
+
log.debug "The command \"#{command}\" is available"
|
139
|
+
instance_variable_set("@command_available_#{command}", true)
|
140
|
+
end
|
141
|
+
|
121
142
|
# Check if file exists.
|
122
143
|
def _file_exists?(file)
|
123
144
|
unless File.exist? File.expand_path(file)
|
data/lib/takelage/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.30.
|
1
|
+
0.30.5
|