poise-monit 1.3.0 → 1.4.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
  SHA1:
3
- metadata.gz: 07ff0116df0ba8f85dd624148cfbf3439b3189d3
4
- data.tar.gz: 34f52b07a049dbcd0b40955cb7b27453c07670a8
3
+ metadata.gz: 5910f2212aae422952d183c3181c7a9f16ba7645
4
+ data.tar.gz: be58c2407526be1cfdc0f618898c18b1333447a9
5
5
  SHA512:
6
- metadata.gz: 761460bd6768bedb0a30a33f048004b1939a6ee02fc2bcccb6466588d69cf09c412dc7b006db94724e80fe918734e7d19b6694e81b74e053a5114835f1979ecf
7
- data.tar.gz: 5b06b17af6e9411ac51004ed178650502a953bc22bdaf739850644db925973207097c645cae495b86f7c4be6c0197b37f558cbcea18ea4ef0209695ffbecbcef
6
+ metadata.gz: a72322971a42e15e31d8c6c5008d1186b4b66bf38a4f7339a0cfaf2a5a069267077d2c228b1308a82a99f2f42adbf680de67e48b1dcbc9bed2a34cb3e09cf633
7
+ data.tar.gz: 7918da029cf7e55e252f69cf166e66998bdefe6939bc8b8a90209990b40b189b33bca84f1decc79abb776fba327713a9851f8fadc76d4b762793834cff126e56
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Poise-Monit Changelog
2
2
 
3
+ ## v1.4.0
4
+
5
+ * Allow tuning the timeout and wait for `monit_service` via node attributes.
6
+
3
7
  ## v1.3.0
4
8
 
5
9
  * More complete `:dummy` provider for weird install conditions.
data/README.md CHANGED
@@ -261,6 +261,13 @@ end
261
261
 
262
262
  To set the `monit` provider as the global default, use [`poise-sevice-monit`](https://github.com/poise/poise-service-monit).
263
263
 
264
+ The service provider has two node attributes that can used for global tuning:
265
+
266
+ * `node['poise-monit']['monit_service_timeout']` – Seconds before timeout when
267
+ registering a new service with Monit. *(default: 20)*
268
+ * `node['poise-monit']['monit_service_wait']` – Seconds to wait between attempts
269
+ when registering a new service with Monit. *(default: 1)*
270
+
264
271
  ## Upgrading From `monit`
265
272
 
266
273
  Upgrading from the older [`monit` cookbook](https://github.com/poise/poise-monit-compat)
@@ -14,6 +14,11 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
+ # Seconds before timeout when registering a new service with Monit.
18
+ default['poise-monit']['monit_service_timeout'] = 20
19
+ # Seconds to wait between attempts when registering a new service with Monit.
20
+ default['poise-monit']['monit_service_wait'] = 1
21
+
17
22
  # Recipe to include when a parent is needed for poise_service.
18
23
  default['poise-monit']['default_recipe'] = 'poise-monit'
19
24
 
@@ -31,11 +31,6 @@ module PoiseMonit
31
31
  # Value from monit action subcommands that mean the service doesn't exist.
32
32
  NO_SERVICE_ERROR = /There is no service/
33
33
 
34
- # Default time to wait for a monit command to succeed.
35
- DEFAULT_TIMEOUT = 20
36
- # Default time to sleep between tries.
37
- DEFAULT_WAIT = 1
38
-
39
34
  # A `monit_service` resource to control Monit-based services.
40
35
  #
41
36
  # @provides monit_service
@@ -175,7 +170,7 @@ module PoiseMonit
175
170
  status_cmd.stdout =~ re && $1
176
171
  end
177
172
 
178
- def monit_shell_out!(monit_cmd, timeout: DEFAULT_TIMEOUT, wait: DEFAULT_WAIT, &block)
173
+ def monit_shell_out!(monit_cmd, timeout: node['poise-monit']['monit_service_timeout'], wait: node['poise-monit']['monit_service_wait'], &block)
179
174
  while true
180
175
  cmd_args = [new_resource.parent.monit_binary]
181
176
  cmd_args << '-v' if (defined?(new_resource.monit_verbose) && new_resource.monit_verbose) || Chef::Log.level == :debug
@@ -16,5 +16,5 @@
16
16
 
17
17
 
18
18
  module PoiseMonit
19
- VERSION = '1.3.0'
19
+ VERSION = '1.4.0'
20
20
  end
@@ -31,8 +31,9 @@ describe PoiseMonit::Resources::MonitService do
31
31
  allow(File).to receive(:exist?).with('/exists').and_return(true)
32
32
  allow(File).to receive(:exist?).with('/not_exists').and_return(false)
33
33
  # Override these so our tests don't take forever.
34
- stub_const('PoiseMonit::Resources::MonitService::DEFAULT_TIMEOUT', 1)
35
- stub_const('PoiseMonit::Resources::MonitService::DEFAULT_WAIT', 0)
34
+ override_attributes['poise-monit'] ||= {}
35
+ override_attributes['poise-monit']['monit_service_timeout'] = 2
36
+ override_attributes['poise-monit']['monit_service_wait'] = 0.01
36
37
  # Status for simple cases.
37
38
  stub_status(status) if status
38
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poise-monit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Kantrowitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-04 00:00:00.000000000 Z
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: halite