config_o_mat 0.2.0 → 0.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35eaeccb6abdf69afb14c8cbe951c4579734f27af4844673b1761db70dfd1bf1
|
4
|
+
data.tar.gz: 392a61b3ee55ba8d9351c2b7d69d39de7d591bbde87f3374fac77fc425e628b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31f9277ada3b1a7fc09efe007a3b530fb3f100c480c09ab0af83a9879ab1fa3ea0b0db3252300fe8dbe9bb9877acf2244727a94554a6384bf52641a5a95c685b
|
7
|
+
data.tar.gz: 4346bae4957800e67e238c0231ddf1b424e1c5afe60a86e2d29e2134f480d56979d320514e24b412557f7f31b239fd7342ffdce459c387ba2b3ce56ce3e3e054
|
@@ -41,13 +41,11 @@ module ConfigOMat
|
|
41
41
|
private
|
42
42
|
|
43
43
|
def do_restart(service, service_def)
|
44
|
-
|
45
|
-
|
46
|
-
file_path = File.join(runtime_directory, unit + '.restart')
|
44
|
+
file_path = File.join(runtime_directory, service_def.restart_unit + '.restart')
|
47
45
|
|
48
46
|
logger&.notice(
|
49
47
|
:service_restart,
|
50
|
-
name: service, systemd_unit:
|
48
|
+
name: service, systemd_unit: service_def.systemd_unit, touched_path: file_path
|
51
49
|
)
|
52
50
|
|
53
51
|
FileUtils.touch(file_path)
|
@@ -27,10 +27,10 @@ module ConfigOMat
|
|
27
27
|
|
28
28
|
def call
|
29
29
|
grouped_restart_modes = service_defs.values.group_by(&:restart_mode)
|
30
|
-
restarts = grouped_restart_modes
|
30
|
+
restarts = grouped_restart_modes.fetch(:restart, []) + grouped_restart_modes.fetch(:restart_all, [])
|
31
31
|
flip_flops = grouped_restart_modes[:flip_flop]
|
32
32
|
|
33
|
-
enable_restarts(restarts) if restarts
|
33
|
+
enable_restarts(restarts) if !restarts.empty?
|
34
34
|
enable_flip_flops(flip_flops) if flip_flops
|
35
35
|
|
36
36
|
systemd_interface.daemon_reload
|
@@ -54,10 +54,9 @@ module ConfigOMat
|
|
54
54
|
def enable_restarts(services)
|
55
55
|
units = []
|
56
56
|
services.each do |service|
|
57
|
-
|
58
|
-
units << unit
|
57
|
+
units << service.restart_unit
|
59
58
|
|
60
|
-
write_dropin(
|
59
|
+
write_dropin(service.systemd_unit, service)
|
61
60
|
end
|
62
61
|
|
63
62
|
systemd_interface.enable_restart_paths(units)
|
@@ -87,23 +87,21 @@ module ConfigOMat
|
|
87
87
|
class Service < ConfigItem
|
88
88
|
RESTART_MODES = %i[restart flip_flop restart_all].freeze
|
89
89
|
|
90
|
-
attr_reader :systemd_unit, :restart_mode, :templates
|
90
|
+
attr_reader :systemd_unit, :restart_mode, :templates, :restart_unit
|
91
91
|
|
92
92
|
def initialize(opts)
|
93
93
|
@systemd_unit = (opts[:systemd_unit] || '')
|
94
94
|
@restart_mode = opts[:restart_mode]&.to_sym
|
95
95
|
@templates = opts[:templates]
|
96
96
|
|
97
|
-
if @restart_mode == :flip_flop && !@systemd_unit.include?('@')
|
97
|
+
if (@restart_mode == :flip_flop || @restart_mode == :restart_all) && !@systemd_unit.include?('@')
|
98
98
|
@systemd_unit = "#{@systemd_unit}@"
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
@systemd_unit = "#{@systemd_unit}@\\x2a"
|
106
|
-
end
|
99
|
+
end
|
100
|
+
|
101
|
+
@restart_unit = @systemd_unit
|
102
|
+
|
103
|
+
if @restart_mode == :restart_all
|
104
|
+
@restart_unit = "#{@restart_unit}\\x2a"
|
107
105
|
end
|
108
106
|
end
|
109
107
|
|
@@ -123,7 +121,7 @@ module ConfigOMat
|
|
123
121
|
error :systemd_unit, 'must not be a naked instantiated unit when restart_mode=restart'
|
124
122
|
end
|
125
123
|
|
126
|
-
if restart_mode == :restart_all && !@systemd_unit.end_with?('
|
124
|
+
if restart_mode == :restart_all && !@systemd_unit.end_with?('@')
|
127
125
|
error :systemd_unit, 'must not be an instantiated unit when restart_mode=restart_all'
|
128
126
|
end
|
129
127
|
end
|
data/lib/config_o_mat/version.rb
CHANGED