bmc-daemon-lib 0.13.5 → 0.14.0
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/bmc-daemon-lib.gemspec +1 -1
- data/lib/bmc-daemon-lib/conf.rb +20 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95584e4825ec5689ee4b524266ea2e2f924cc3bba32fe79d04d37d5e0ad668bf
|
4
|
+
data.tar.gz: 95147b1684cf98add39341fcb794408c936440acecf58088a00f57dc594456d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01dcad1a0954f8de9e5d621447c48d27446ab26891e1561c3c65df79c801b69246c34a3bcab9383d76550ebb30202db7c700b4757c8002e850457f719a4b29b8
|
7
|
+
data.tar.gz: a9243531dbb76d338bb55fd7009be295f630d08eb44361f3448d0fe260dcdba073bf60b0b5d0241ebee479cd69c5afb873a3e2c4425c710fa440ea73b5248bba
|
data/bmc-daemon-lib.gemspec
CHANGED
data/lib/bmc-daemon-lib/conf.rb
CHANGED
@@ -63,6 +63,9 @@ module BmcDaemonLib
|
|
63
63
|
# Read the gemspec
|
64
64
|
gemspec = init_from_gemspec
|
65
65
|
|
66
|
+
# Annnounce loaded context
|
67
|
+
log_conf "initialized [#{@app_name}] version [#{@app_ver}]"
|
68
|
+
|
66
69
|
#return gemspec
|
67
70
|
return @app_root
|
68
71
|
end
|
@@ -72,9 +75,9 @@ module BmcDaemonLib
|
|
72
75
|
end
|
73
76
|
|
74
77
|
def dump_to_logs
|
75
|
-
|
78
|
+
log_conf "configuration dump"
|
76
79
|
dump.lines.each do |line|
|
77
|
-
|
80
|
+
log_conf "| #{line.rstrip}"
|
78
81
|
end
|
79
82
|
end
|
80
83
|
|
@@ -92,20 +95,20 @@ module BmcDaemonLib
|
|
92
95
|
if ::File.exists?(logfile)
|
93
96
|
# File is there, is it writable ?
|
94
97
|
unless ::File.writable?(logfile)
|
95
|
-
|
98
|
+
log_conf "logging [#{pipe}] disabled: file not writable [#{logfile}]"
|
96
99
|
return nil
|
97
100
|
end
|
98
101
|
else
|
99
102
|
# No file here, can we create it ?
|
100
103
|
logdir = ::File.dirname(logfile)
|
101
104
|
unless ::File.writable?(logdir)
|
102
|
-
|
105
|
+
log_conf "logging [#{pipe}] disabled: directory not writable [#{logdir}]"
|
103
106
|
return nil
|
104
107
|
end
|
105
108
|
end
|
106
109
|
|
107
110
|
# OK, return a clean file path
|
108
|
-
|
111
|
+
log_conf "logging [#{pipe}] to [#{logfile}]"
|
109
112
|
return logfile
|
110
113
|
end
|
111
114
|
|
@@ -182,7 +185,7 @@ module BmcDaemonLib
|
|
182
185
|
return unless self.feature?(:newrelic)
|
183
186
|
|
184
187
|
# Ok, let's start
|
185
|
-
|
188
|
+
log_conf "prepare NewRelic"
|
186
189
|
conf = self[:newrelic]
|
187
190
|
|
188
191
|
# Enable GC profiler
|
@@ -208,7 +211,7 @@ module BmcDaemonLib
|
|
208
211
|
end
|
209
212
|
|
210
213
|
# Ok, let's start
|
211
|
-
|
214
|
+
log_conf "prepare Rollbar"
|
212
215
|
conf = self[:rollbar]
|
213
216
|
|
214
217
|
# Configure
|
@@ -239,7 +242,7 @@ module BmcDaemonLib
|
|
239
242
|
|
240
243
|
# Reload config
|
241
244
|
# puts "Conf.reload: loading files: #{files.inspect}"
|
242
|
-
|
245
|
+
log_conf "loading configuration from: #{files.inspect}"
|
243
246
|
load files: files, namespaces: { environment: @app_env }
|
244
247
|
|
245
248
|
# Try to access any key to force parsing of the files
|
@@ -253,12 +256,16 @@ module BmcDaemonLib
|
|
253
256
|
return to_hash
|
254
257
|
end
|
255
258
|
|
259
|
+
def log_conf msg
|
260
|
+
self.log :conf, msg
|
261
|
+
end
|
262
|
+
|
256
263
|
def log origin, message
|
257
264
|
printf(
|
258
265
|
"%s %-14s %s \n",
|
259
266
|
Time.now.strftime("%Y-%m-%d %H:%M:%S"),
|
260
|
-
origin,
|
261
|
-
message
|
267
|
+
origin.to_s,
|
268
|
+
message.to_s
|
262
269
|
)
|
263
270
|
end
|
264
271
|
|
@@ -317,7 +324,7 @@ module BmcDaemonLib
|
|
317
324
|
# Check if Chamber's behaviour may cause problems with hyphens
|
318
325
|
basename = ::File.basename(path)
|
319
326
|
if basename.include?'-'
|
320
|
-
|
327
|
+
log_conf "WARNING: files with dashes may cause unexpected behaviour with Chamber (#{basename})"
|
321
328
|
end
|
322
329
|
|
323
330
|
# Add it
|
@@ -335,7 +342,7 @@ module BmcDaemonLib
|
|
335
342
|
|
336
343
|
# Fallback on default path if not provided,
|
337
344
|
specific ||= default
|
338
|
-
specific ||= "default.log"
|
345
|
+
specific ||= "log/default.log"
|
339
346
|
|
340
347
|
# Build logfile_path
|
341
348
|
::File.expand_path specific.to_s, path.to_s
|
@@ -352,7 +359,7 @@ module BmcDaemonLib
|
|
352
359
|
next unless arg.to_s.empty?
|
353
360
|
|
354
361
|
# Otherise, we just exit
|
355
|
-
|
362
|
+
log_conf "FAILED: object Conf has not been initialized correctly yet"
|
356
363
|
exit 200
|
357
364
|
end
|
358
365
|
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.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno MEDICI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|