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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 239b8f0424a5cac440f94c96d90c22596b26b8d6
4
- data.tar.gz: e5af414d7d6537423a7f689f535762dee3b28823
3
+ metadata.gz: 39a5211262ffbaf280e09eaa26f6998653cd469e
4
+ data.tar.gz: e023d6fcd04aea8c7551239efb90010dfed58ba4
5
5
  SHA512:
6
- metadata.gz: f3b5dbc5d9868a7addaf034e0eab01c5a7fe6c14445c8927bc9312f230feefae51a1094f3e08f9403bd468ff1d00273989b0ee6d77e4c43a0b295d1e5b8f5161
7
- data.tar.gz: 5e11b9a03c718469a6dd2c0c89287d45028a280b4cf5eaa8f579aa699e37cc0892c5601b327a0e950009152b1d40611eb5c527aa9137ec0dc125af35327cc024
6
+ metadata.gz: 8b1c779c256f6fce44c8db46796816838a34fa8f980030551a5e3f3435088181d8e55f6dabddee9db01a84ce7b530ca718173eb5110f6c4a5c497d45069d507e
7
+ data.tar.gz: 7ea257109d25cfdbed700fdb7dc8f4d7d3f2c0234b1abf554f58b1dd0192ace8ce98c4bae4e5e9b399a27f24f0734ecbb69df8b6055b8755986f9fd0a9c6de35
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bmc-daemon-lib (0.3.8)
4
+ bmc-daemon-lib (0.3.10)
5
5
  chamber (~> 2.9)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  # Project version
4
- spec.version = "0.3.8"
4
+ spec.version = "0.3.10"
5
5
 
6
6
  # Project description
7
7
  spec.name = "bmc-daemon-lib"
@@ -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
- return unless self.feature?(:rollbar)
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
- puts "logging [#{pipe}] failed: access error"
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
- puts "logging [#{pipe}] disabled: file not writable [#{logfile}]"
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
- puts "logging [#{pipe}] disabled: directory not writable [#{logdir}]"
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
- puts "logging [#{pipe}] to [#{logfile}]"
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.8
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-07 00:00:00.000000000 Z
11
+ date: 2016-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler