bmc-daemon-lib 0.3.8 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bmc-daemon-lib.gemspec +1 -1
- data/lib/bmc-daemon-lib/conf.rb +20 -2
- data/lib/bmc-daemon-lib/logger_pool.rb +8 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39a5211262ffbaf280e09eaa26f6998653cd469e
|
4
|
+
data.tar.gz: e023d6fcd04aea8c7551239efb90010dfed58ba4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b1c779c256f6fce44c8db46796816838a34fa8f980030551a5e3f3435088181d8e55f6dabddee9db01a84ce7b530ca718173eb5110f6c4a5c497d45069d507e
|
7
|
+
data.tar.gz: 7ea257109d25cfdbed700fdb7dc8f4d7d3f2c0234b1abf554f58b1dd0192ace8ce98c4bae4e5e9b399a27f24f0734ecbb69df8b6055b8755986f9fd0a9c6de35
|
data/Gemfile.lock
CHANGED
data/bmc-daemon-lib.gemspec
CHANGED
data/lib/bmc-daemon-lib/conf.rb
CHANGED
@@ -91,7 +91,6 @@ module BmcDaemonLib
|
|
91
91
|
fail ConfigOtherError, "#{e.message} \n #{e.backtrace.to_yaml}"
|
92
92
|
end
|
93
93
|
|
94
|
-
|
95
94
|
# Reload files
|
96
95
|
def self.reload!
|
97
96
|
ensure_init
|
@@ -133,9 +132,13 @@ module BmcDaemonLib
|
|
133
132
|
case name
|
134
133
|
when :newrelic
|
135
134
|
return false if Gem.datadir('newrelic_rpm').nil?
|
135
|
+
return if self.at(:newrelic, :enabled) == false
|
136
|
+
return if self.at(:newrelic, :disabled) == true
|
136
137
|
return self.at(:newrelic, :license)
|
137
138
|
when :rollbar
|
138
139
|
return false if Gem.datadir('rollbar').nil?
|
140
|
+
return if self.at(:rollbar, :enabled) == false
|
141
|
+
return if self.at(:rollbar, :disabled) == true
|
139
142
|
return self.at(:rollbar, :token)
|
140
143
|
end
|
141
144
|
return false
|
@@ -202,7 +205,13 @@ module BmcDaemonLib
|
|
202
205
|
|
203
206
|
def self.prepare_rollbar
|
204
207
|
# Disable if no config present
|
205
|
-
|
208
|
+
unless self.feature?(:rollbar)
|
209
|
+
Rollbar.configure do |config|
|
210
|
+
config.enabled = false
|
211
|
+
end
|
212
|
+
return
|
213
|
+
end
|
214
|
+
|
206
215
|
section = self[:rollbar]
|
207
216
|
|
208
217
|
# Configure
|
@@ -220,6 +229,15 @@ module BmcDaemonLib
|
|
220
229
|
Rollbar.info("#{@app_name} #{@app_ver} [#{@host}]")
|
221
230
|
end
|
222
231
|
|
232
|
+
def self.log origin, message
|
233
|
+
printf(
|
234
|
+
"%s %-10s %s \n",
|
235
|
+
Time.now.strftime("%Y-%m-%d %H:%M:%S"),
|
236
|
+
origin,
|
237
|
+
message
|
238
|
+
)
|
239
|
+
end
|
240
|
+
|
223
241
|
protected
|
224
242
|
|
225
243
|
def self.load_files
|
@@ -28,7 +28,7 @@ module BmcDaemonLib
|
|
28
28
|
logger
|
29
29
|
|
30
30
|
rescue Errno::EACCES
|
31
|
-
|
31
|
+
log "create [#{pipe}]: access error"
|
32
32
|
end
|
33
33
|
|
34
34
|
protected
|
@@ -45,22 +45,26 @@ module BmcDaemonLib
|
|
45
45
|
if File.exists?(logfile)
|
46
46
|
# File is there, is it writable ?
|
47
47
|
unless File.writable?(logfile)
|
48
|
-
|
48
|
+
log "logging [#{pipe}] to [#{logfile}] disabled: file not writable [#{logfile}]"
|
49
49
|
return nil
|
50
50
|
end
|
51
51
|
else
|
52
52
|
# No file here, can we create it ?
|
53
53
|
logdir = File.dirname(logfile)
|
54
54
|
unless File.writable?(logdir)
|
55
|
-
|
55
|
+
log "logging [#{pipe}] [#{logfile}] disabled: directory not writable [#{logdir}]"
|
56
56
|
return nil
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
# OK, return a clean file path
|
61
|
-
|
61
|
+
log "logging [#{pipe}] to [#{logfile}]"
|
62
62
|
return logfile
|
63
63
|
end
|
64
64
|
|
65
|
+
def log message
|
66
|
+
Conf.log :logger, message
|
67
|
+
end
|
68
|
+
|
65
69
|
end
|
66
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bmc-daemon-lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno MEDICI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|