sensu-plugins-logs 1.1.1 → 1.1.2

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: ae62082cfd31a7aca730053b77c07251aad70314
4
- data.tar.gz: c8f0ce0759a892b40570101af5e0702cace04d75
3
+ metadata.gz: 65e160084e8cadd546a60d41bf28748123ddd4d8
4
+ data.tar.gz: b04f9938db78c391d666a4e54a405f165634c5a8
5
5
  SHA512:
6
- metadata.gz: 339e1ab3150169f934ff312a98e6328e9b47f5babe5f40c5abe8ccf0d4479f67c5f837f87a3ca1c572eb7dbda5ff9213e432ba74a2e31c63b7237f672b0a8fe7
7
- data.tar.gz: e8219a22ab005f16198e9864e8de50a81e50297461fd326258177551a857de944ea15c9ad8ba2c10c94d6a6d38d5f52a340f6fd6ded38f68dc4bda6ec136901c
6
+ metadata.gz: a975a1d9f454ca8c8614e0182c9cf1fba7325ef0b964d2e4f442c874ff518830e22a33b710ee2b0a398645d7090da3eea7dfee3d9ec70de281927686bc763e68
7
+ data.tar.gz: 262801e029c6aa4c90f8e7440e2a957b90f3b756962090eae8efa420cf46a422b3a16bdfdaab1a5eb3da9ee56211e7264bd0cc91b14f271894b7112885d28100
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
6
  ## [Unreleased]
7
+ ## [1.1.2] - 2017-05-25
8
+ ### Fixed
9
+ - Write the state file atomically by using flock where available (@nlopes)
10
+
7
11
  ## [1.1.1] - 2017-05-21
8
12
  ### Changed
9
13
  - `check-log.rb`: Fix 'crit' and 'warn' flags being ignored in search_log (@avifried1)
@@ -44,7 +48,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
44
48
  ### Added
45
49
  - initial release
46
50
 
47
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.1.1...HEAD
51
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.1.2...HEAD
52
+ [1.1.2]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.1.1...1.1.2
48
53
  [1.1.1]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.1.0...1.1.1
49
54
  [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.0.0...1.1.0
50
55
  [0.0.4]:
data/bin/check-log.rb CHANGED
@@ -184,6 +184,7 @@ class CheckLog < Sensu::Plugin::Check::CLI
184
184
  @state_file = File.join(state_dir, File.expand_path(log_file).sub(/^([A-Z]):\//, '\1/'))
185
185
  @bytes_to_skip = begin
186
186
  File.open(@state_file) do |file|
187
+ file.flock(File::LOCK_SH) unless Gem.win_platform?
187
188
  file.readline.to_i
188
189
  end
189
190
  rescue
@@ -225,7 +226,8 @@ class CheckLog < Sensu::Plugin::Check::CLI
225
226
  n_warns = n_matched
226
227
  end
227
228
  FileUtils.mkdir_p(File.dirname(@state_file))
228
- File.open(@state_file, 'w') do |file|
229
+ File.open(@state_file, File::RDWR | File::CREAT, 0644) do |file|
230
+ file.flock(File::LOCK_EX) unless Gem.win_platform?
229
231
  file.write(@bytes_to_skip + bytes_read)
230
232
  end
231
233
  [n_warns, n_crits, accumulative_error]
@@ -2,7 +2,7 @@ module SensuPluginsLogs
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 1
5
- PATCH = 1
5
+ PATCH = 2
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-logs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-21 00:00:00.000000000 Z
11
+ date: 2017-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin