chef-deployment-monitor 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 878cf5d20b8ce0505205f07f679b8532c0e3fe10
4
- data.tar.gz: 31206a5a68bff4f37ba8b0e564e574e30e419496
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTA1ZTBmMWU1YjgyNDE1MWYwOThjNmRiMDdkYThkYjkzNzdlOTc2Ng==
5
+ data.tar.gz: !binary |-
6
+ NGYxZmQyZGM0MTI5MGJhMmI2YjE3OTk3NzliZWU5ZGZhMmQ3NWE1Yw==
5
7
  SHA512:
6
- metadata.gz: ea7bde4f69f7aa531c021f9ad3b234c852bb83e1740f905b3b71b158e7a91d0e4d06bb3253015b5c11d876815c3c02f1e10e5c4f5e098d7d0214e78470629330
7
- data.tar.gz: c9f178524f05478e4dc38ae7cf92ded5b7e3b2266ff2d3adffe98cbd4e5c68fe6ccff61b56c10af835e7c9226b3b3539b20919e1a62d405d77d8014a66edb430
8
+ metadata.gz: !binary |-
9
+ ZDQ4M2EzNTc0YWNhM2JiZjUyNWQ4MzZkYmJlMjRiZmE2ZTU2NTEwNjkzODc2
10
+ OTJmOThiNDJiNzZiOWNiMzdhNzVkOTkzODc4MzNkZmM2YWI0ZjY0OGIwYjBi
11
+ Y2NjMmYwZTM5ZjZiYzYzODEyY2Y0ODlmYzJkYTA1OGUwZWVhNWY=
12
+ data.tar.gz: !binary |-
13
+ NWRhMDk1MTA2NmNiNDk2MTI2NWZmZmQzNmE4NTM5MWYxY2ExZDM1ZDQxMTdh
14
+ YmUyMzY2MGQyOWViM2Y0OWJhYzBiODBmN2ZkNjdlYjc4YTNjZjAyMzJjMzQx
15
+ NWQ1OTFiYzY2MWNhMDJkNjE5YWExMGVlZWVjZTg0NmQzNzY0NWM=
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency 'file-tail', '>= 1.0.12'
22
22
  s.add_dependency 'daemons', '>= 1.1.9'
23
23
  s.add_dependency 'mixlib-config'
24
+ s.add_dependency 'json'
24
25
 
25
26
  s.add_development_dependency 'rake'
26
27
  s.add_development_dependency 'rubocop'
@@ -24,8 +24,10 @@ class Chef
24
24
  extend Mixlib::Config
25
25
  config_strict_mode true
26
26
 
27
- default :blacklisted?, Proc.new { |data| false }
27
+ default :blacklisted?, Proc.new { |data| false } # rubocop:disable Lint/UnusedBlockArgument:
28
28
  default :marker_file, '/tmp/last_chef_deployment'
29
+ default :history_file, '/tmp/lasts_chef_deployment'
30
+ default :history_file_size, 1000
29
31
  %w(
30
32
  mon_file
31
33
  log_dir
@@ -23,7 +23,7 @@ class Chef
23
23
  class Monitor
24
24
  class Logmon
25
25
  def run
26
- sink = MarkerFileSink.new
26
+ sinks = [MarkerFileSink.new, HistoryFile.new]
27
27
 
28
28
  begin
29
29
  File.open(Monitor::Config[:mon_file]) do |mon|
@@ -38,7 +38,7 @@ class Chef
38
38
  unless filter(data)
39
39
  Monitor::Log.new(data.to_json, 'INFO')
40
40
  data = digest(data)
41
- sink.receive(data)
41
+ sinks.each { |sink| sink.receive(data) }
42
42
  end
43
43
  end
44
44
  end
@@ -18,6 +18,29 @@ class Chef
18
18
  end
19
19
  end
20
20
  end
21
+ class HistoryFileSink < Sink
22
+ require 'json'
23
+
24
+ attr_reader :file
25
+
26
+ def initialize
27
+ @file = Monitor::Config[:history_file]
28
+ @history = if File.exist?(file)
29
+ JSON.parse(File.read(file)) rescue []
30
+ else
31
+ []
32
+ end
33
+ end
34
+
35
+ # will append data to the history file
36
+ # within 5 seconds of last deployment
37
+ # the array is a FIFO
38
+ def receive(data)
39
+ history = [data] + history.take(Monitor::Config[:history_file_size] - 1)
40
+
41
+ File.write(file, history.to_json)
42
+ end
43
+ end
21
44
  end
22
45
  end
23
46
  end
@@ -18,7 +18,7 @@
18
18
  class Chef
19
19
  class Deployment
20
20
  class Monitor
21
- VERSION = '1.0.0'
21
+ VERSION = '1.1.0'
22
22
  MAJOR, MINOR, TINY = VERSION.split('.')
23
23
  end
24
24
  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.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sander Botman
@@ -9,76 +9,90 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-22 00:00:00.000000000 Z
12
+ date: 2016-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: file-tail
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - ! '>='
19
19
  - !ruby/object:Gem::Version
20
20
  version: 1.0.12
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - ! '>='
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.0.12
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: daemons
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - ! '>='
33
33
  - !ruby/object:Gem::Version
34
34
  version: 1.1.9
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - ! '>='
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.1.9
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: mixlib-config
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ">="
46
+ - - ! '>='
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ">="
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: json
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ! '>='
54
68
  - !ruby/object:Gem::Version
55
69
  version: '0'
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: rake
58
72
  requirement: !ruby/object:Gem::Requirement
59
73
  requirements:
60
- - - ">="
74
+ - - ! '>='
61
75
  - !ruby/object:Gem::Version
62
76
  version: '0'
63
77
  type: :development
64
78
  prerelease: false
65
79
  version_requirements: !ruby/object:Gem::Requirement
66
80
  requirements:
67
- - - ">="
81
+ - - ! '>='
68
82
  - !ruby/object:Gem::Version
69
83
  version: '0'
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: rubocop
72
86
  requirement: !ruby/object:Gem::Requirement
73
87
  requirements:
74
- - - ">="
88
+ - - ! '>='
75
89
  - !ruby/object:Gem::Version
76
90
  version: '0'
77
91
  type: :development
78
92
  prerelease: false
79
93
  version_requirements: !ruby/object:Gem::Requirement
80
94
  requirements:
81
- - - ">="
95
+ - - ! '>='
82
96
  - !ruby/object:Gem::Version
83
97
  version: '0'
84
98
  description: Chef Monitoring tool to monitor all changes made
@@ -90,8 +104,8 @@ extensions: []
90
104
  extra_rdoc_files:
91
105
  - LICENSE
92
106
  files:
93
- - ".gitignore"
94
- - ".travis.yml"
107
+ - .gitignore
108
+ - .travis.yml
95
109
  - Gemfile
96
110
  - LICENSE
97
111
  - README.md
@@ -114,17 +128,17 @@ require_paths:
114
128
  - lib
115
129
  required_ruby_version: !ruby/object:Gem::Requirement
116
130
  requirements:
117
- - - ">="
131
+ - - ! '>='
118
132
  - !ruby/object:Gem::Version
119
133
  version: '0'
120
134
  required_rubygems_version: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - ">="
136
+ - - ! '>='
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0'
125
139
  requirements: []
126
140
  rubyforge_project:
127
- rubygems_version: 2.5.1
141
+ rubygems_version: 2.4.5
128
142
  signing_key:
129
143
  specification_version: 4
130
144
  summary: Chef Monitoring tool to monitor all changes made