chef-deployment-monitor 1.1.3 → 1.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 +4 -4
- data/.travis.yml +1 -1
- data/chef-deployment-monitor.gemspec +1 -2
- data/lib/chef_deployment_monitor/config.rb +5 -3
- data/lib/chef_deployment_monitor/logmon.rb +15 -3
- data/lib/chef_deployment_monitor/sinks.rb +10 -4
- metadata +3 -4
- data/lib/chef_deployment_monitor/version.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f31ffdf254faae23202f6f4ec3635e59e909afa
|
4
|
+
data.tar.gz: 04a3e643a46400d82b4d781aca382ef872a2b423
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa8010bc885eecc8752326f0a962b540b34764b979930bf3fd891a492669114998a6f17de356a7dc506d13a423f68f59023d78082aba3e769a42db3eac72d156
|
7
|
+
data.tar.gz: e4662c1e430e15989847c63aa18212dd63126ddd287da59255150012ae413704466024e995c3d9747d22d8b60bda7bca91dd85bd6c7bb9338aeebca733d0f19e
|
data/.travis.yml
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
3
|
-
require 'chef_deployment_monitor/version'
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
5
|
s.name = 'chef-deployment-monitor'
|
7
|
-
s.version =
|
6
|
+
s.version = '1.2.1'
|
8
7
|
s.platform = Gem::Platform::RUBY
|
9
8
|
s.has_rdoc = false
|
10
9
|
s.extra_rdoc_files = ['LICENSE']
|
@@ -24,9 +24,11 @@ class Chef
|
|
24
24
|
extend Mixlib::Config
|
25
25
|
config_strict_mode true
|
26
26
|
|
27
|
-
default :blacklisted?, Proc.new { |data| false } # rubocop:disable Lint/UnusedBlockArgument
|
28
|
-
default :
|
29
|
-
default :
|
27
|
+
default :blacklisted?, Proc.new { |data| false } # rubocop:disable Lint/UnusedBlockArgument, Lint/AmbiguousBlockAssociation
|
28
|
+
default :route, Proc.new { |data| "" } # rubocop:disable Lint/UnusedBlockArgument, Lint/AmbiguousBlockAssociation
|
29
|
+
default :output_file_directory, '/tmp/'
|
30
|
+
default :marker_file_template, '%slast-deployment.json'
|
31
|
+
default :history_file_template, '%slast-deployments.json'
|
30
32
|
default :history_file_size, 1000
|
31
33
|
%w(
|
32
34
|
mon_file
|
@@ -22,9 +22,10 @@ class Chef
|
|
22
22
|
class Deployment
|
23
23
|
class Monitor
|
24
24
|
class Logmon
|
25
|
+
def initialize
|
26
|
+
@sinks = { }
|
27
|
+
end
|
25
28
|
def run
|
26
|
-
sinks = [MarkerFileSink.new, HistoryFileSink.new]
|
27
|
-
|
28
29
|
begin
|
29
30
|
File.open(Monitor::Config[:mon_file]) do |mon|
|
30
31
|
mon.extend(File::Tail)
|
@@ -38,7 +39,7 @@ class Chef
|
|
38
39
|
unless filter(data)
|
39
40
|
Monitor::Log.new(data.to_json, 'INFO')
|
40
41
|
data = digest(data)
|
41
|
-
sinks.each { |sink| sink.receive(data) }
|
42
|
+
sinks(data).each { |sink| sink.receive(data) }
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
@@ -46,6 +47,17 @@ class Chef
|
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
50
|
+
def sinks(data)
|
51
|
+
route = Monitor::Config[:route].call(data)
|
52
|
+
unless @sinks.has_key? route
|
53
|
+
@sinks[route] = [MarkerFileSink.new(::File.join(Monitor::Config[:output_file_directory],
|
54
|
+
Monitor::Config[:marker_file_template] % route)),
|
55
|
+
HistoryFileSink.new(::File.join(Monitor::Config[:output_file_directory],
|
56
|
+
Monitor::Config[:history_file_template] % route))]
|
57
|
+
end
|
58
|
+
@sinks[route]
|
59
|
+
end
|
60
|
+
|
49
61
|
def format(data)
|
50
62
|
# convert to timestamp
|
51
63
|
data_dup = data.dup
|
@@ -9,11 +9,17 @@ class Chef
|
|
9
9
|
end
|
10
10
|
|
11
11
|
class MarkerFileSink < Sink
|
12
|
+
attr_reader :file
|
13
|
+
|
14
|
+
def initialize(outfile)
|
15
|
+
@file = outfile
|
16
|
+
end
|
17
|
+
|
12
18
|
# will modify the marker file
|
13
19
|
# last write data of marker file will be within 5 seconds
|
14
20
|
# of last deployement
|
15
21
|
def receive(data)
|
16
|
-
File.open(
|
22
|
+
File.open(file, 'w+') do |f|
|
17
23
|
f.write(data.to_json)
|
18
24
|
end
|
19
25
|
end
|
@@ -23,10 +29,10 @@ class Chef
|
|
23
29
|
|
24
30
|
attr_reader :file
|
25
31
|
|
26
|
-
def initialize
|
27
|
-
@file =
|
32
|
+
def initialize(outfile)
|
33
|
+
@file = outfile
|
28
34
|
@history = if File.exist?(file)
|
29
|
-
JSON.parse(File.read(file)) rescue []
|
35
|
+
JSON.parse(File.read(file)) rescue [] # rubocop:disable Lint/RescueWithoutErrorClass
|
30
36
|
else
|
31
37
|
[]
|
32
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-deployment-monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sander Botman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: file-tail
|
@@ -116,7 +116,6 @@ files:
|
|
116
116
|
- lib/chef_deployment_monitor/log.rb
|
117
117
|
- lib/chef_deployment_monitor/logmon.rb
|
118
118
|
- lib/chef_deployment_monitor/sinks.rb
|
119
|
-
- lib/chef_deployment_monitor/version.rb
|
120
119
|
- lib/chef_logmon.rb
|
121
120
|
homepage: https://github.com/kamaradclimber/chef-deployment-monitor
|
122
121
|
licenses:
|
@@ -138,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
137
|
version: '0'
|
139
138
|
requirements: []
|
140
139
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.6.
|
140
|
+
rubygems_version: 2.6.13
|
142
141
|
signing_key:
|
143
142
|
specification_version: 4
|
144
143
|
summary: Chef Monitoring tool to monitor all changes made
|
@@ -1,25 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Sander Botman (<sander.botman@gmail.com>)
|
3
|
-
# Copyright:: Copyright (c) 2014 Sander Botman.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
|
18
|
-
class Chef
|
19
|
-
class Deployment
|
20
|
-
class Monitor
|
21
|
-
VERSION = '1.1.3'
|
22
|
-
MAJOR, MINOR, TINY = VERSION.split('.')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|