config_o_mat 0.1.0 → 0.2.0

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: 4f7f711f4b074d2c732ce431dfd678df82d8fe579ba8da5f9035937af9f278f4
4
- data.tar.gz: 8540f7ffdaa0e2474b0a00a9ade88c912e9babbd9b41b5ff43c6ece58b8f64e6
3
+ metadata.gz: b780a147a3eed4c14e90e0905d9002a1810916bb10ba7cf8e18468044a291809
4
+ data.tar.gz: 87c03b8c3ff63239e4c24efb30c118b8ac3e6abfba8c38c4193037eb50bd6854
5
5
  SHA512:
6
- metadata.gz: ae17e8208db65c89c8c0ad943d7ec55a1decf711cab1a1692beccf6a593307548a59b231bd1957780de7f44c18a43ac6718ef9db22ce7fb43dd347dee179cf8e
7
- data.tar.gz: f5810b31cc743ceb07622b1db928f4db28f39bd593d94ba3e73004d90d8e9b0e9c274de28cf84502e21098c20812df4ad3ffa0dea067ddd82d0d111dfa94eda9
6
+ metadata.gz: e4f55821c2ff2fdc1bd701d5448d87d7f7a7cd168a04811395d3ffdbfff49ca4b25689567c21905fc597427e3993f3b79ee213b4add27961def2832d7f98b475
7
+ data.tar.gz: e083e171bcea253ad814d53ba6ff713f4460cf60391e367a92a9dec620b7daea3633e976d5b9f4a0ae674023f35acc768f3598ac4c9f57d1b71615d63b03ef43
@@ -29,8 +29,9 @@ module ConfigOMat
29
29
  def call
30
30
  service = services_to_reload.pop
31
31
  service_def = service_defs[service]
32
+ restart_mode = service_def.restart_mode
32
33
 
33
- if service_def.restart_mode == :restart
34
+ if restart_mode == :restart || restart_mode == :restart_all
34
35
  do_restart(service, service_def)
35
36
  else
36
37
  do_flip_flop(service, service_def)
@@ -85,7 +85,7 @@ module ConfigOMat
85
85
  end
86
86
 
87
87
  class Service < ConfigItem
88
- RESTART_MODES = %i[restart flip_flop].freeze
88
+ RESTART_MODES = %i[restart flip_flop restart_all].freeze
89
89
 
90
90
  attr_reader :systemd_unit, :restart_mode, :templates
91
91
 
@@ -96,6 +96,14 @@ module ConfigOMat
96
96
 
97
97
  if @restart_mode == :flip_flop && !@systemd_unit.include?('@')
98
98
  @systemd_unit = "#{@systemd_unit}@"
99
+ elsif @restart_mode == :restart_all
100
+ if @systemd_unit.include?('@')
101
+ if !@systemd_unit.end_with?('\\x2a')
102
+ @systemd_unit = "#{@systemd_unit}\\x2a"
103
+ end
104
+ else
105
+ @systemd_unit = "#{@systemd_unit}@\\x2a"
106
+ end
99
107
  end
100
108
  end
101
109
 
@@ -114,6 +122,10 @@ module ConfigOMat
114
122
  if restart_mode == :restart && @systemd_unit.end_with?('@')
115
123
  error :systemd_unit, 'must not be a naked instantiated unit when restart_mode=restart'
116
124
  end
125
+
126
+ if restart_mode == :restart_all && !@systemd_unit.end_with?('@\\x2a')
127
+ error :systemd_unit, 'must not be an instantiated unit when restart_mode=restart_all'
128
+ end
117
129
  end
118
130
 
119
131
  def hash
@@ -15,5 +15,5 @@
15
15
  # limitations under the License.
16
16
 
17
17
  module ConfigOMat
18
- VERSION = "0.1.0"
18
+ VERSION = "0.2.0"
19
19
  end
@@ -13,9 +13,9 @@
13
13
  # limitations under the License.
14
14
 
15
15
  [Unit]
16
- Description=Restart %i.service
16
+ Description=Restart %I.service
17
17
 
18
18
  [Service]
19
19
  Type=oneshot
20
- ExecStart=/usr/bin/systemctl restart %i.service
20
+ ExecStart=/usr/bin/systemctl restart %I.service
21
21
  RemainAfterExit=no
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_o_mat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Scarborough
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-20 00:00:00.000000000 Z
11
+ date: 2022-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-appconfig
@@ -177,7 +177,6 @@ files:
177
177
  - lib/config_o_mat/shared/systemd_interface.rb
178
178
  - lib/config_o_mat/shared/types.rb
179
179
  - lib/config_o_mat/version.rb
180
- - lib/version.rb
181
180
  - systemd/teak-configurator-restart-service@.path
182
181
  - systemd/teak-configurator-restart-service@.service
183
182
  - systemd/teak-configurator-start-service@.path
data/lib/version.rb DELETED
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright 2021 Teak.io, Inc.
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # https://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- module ConfigOMat
18
- VERSION = "0.1.0"
19
- end