bmc-daemon-lib 0.13.3 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bmc-daemon-lib.gemspec +4 -4
- data/lib/bmc-daemon-lib/conf.rb +20 -13
- metadata +15 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb7754d7f066808a76f4aad0b918a260ccecc311d006dafb7bd447e9160c3547
|
4
|
+
data.tar.gz: 6fdd9b6ab92aefb1e5fe5b16ecae9b42b9706f5e4476865bff2cda110f550274
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 344c3230da898a84841ed3f3f272d92e6825735628802f71a342f1fa231093568d4cc56d0feb3040fccd6b08bfb47488c6f3d48943db99dce1cb3c75c1bf544c
|
7
|
+
data.tar.gz: 1f3865f74e3bbf2f6d55d8a87d06dc45cbdff5fc51fda937594b7e1bf253d2ffce11468c0e90a74a8749620d1b0ee5244c4e7e9ee559adc2b4157be5510af0f0
|
data/bmc-daemon-lib.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
# Project version
|
4
|
-
spec.version = "0.
|
4
|
+
spec.version = "0.14.1"
|
5
5
|
|
6
6
|
# Project description
|
7
7
|
spec.name = "bmc-daemon-lib"
|
@@ -17,10 +17,10 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0")
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
|
-
spec.required_ruby_version = ">= 2.
|
20
|
+
spec.required_ruby_version = ">= 2.7.0"
|
21
21
|
|
22
22
|
# Development dependencies
|
23
|
-
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "bundler", "~> 2"
|
24
24
|
spec.add_development_dependency "rake"
|
25
25
|
spec.add_development_dependency "rspec"
|
26
26
|
spec.add_development_dependency "rubocop"
|
@@ -31,5 +31,5 @@ Gem::Specification.new do |spec|
|
|
31
31
|
|
32
32
|
# spec.add_runtime_dependency "hashie" , "~> 3.4.6" # upgrading to 3.5.4 breaks things !
|
33
33
|
spec.add_runtime_dependency "hashie" , "~> 3" # upgrading to 3.5.4 breaks things !
|
34
|
-
spec.add_runtime_dependency "chamber"
|
34
|
+
spec.add_runtime_dependency "chamber", "~> 2"
|
35
35
|
end
|
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,29 +1,29 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno MEDICI
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: chamber
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '2'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '2'
|
97
97
|
description: 'Shared utilities to build a daemon: logger, configuration, helpers'
|
98
98
|
email: opensource@bmconseil.com
|
99
99
|
executables: []
|
@@ -118,7 +118,7 @@ homepage: http://github.com/bmedici/bmc-daemon-lib
|
|
118
118
|
licenses:
|
119
119
|
- MIT
|
120
120
|
metadata: {}
|
121
|
-
post_install_message:
|
121
|
+
post_install_message:
|
122
122
|
rdoc_options: []
|
123
123
|
require_paths:
|
124
124
|
- lib
|
@@ -126,16 +126,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
126
|
requirements:
|
127
127
|
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: 2.
|
129
|
+
version: 2.7.0
|
130
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
132
|
- - ">="
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
|
-
|
137
|
-
|
138
|
-
signing_key:
|
136
|
+
rubygems_version: 3.1.2
|
137
|
+
signing_key:
|
139
138
|
specification_version: 4
|
140
139
|
summary: 'Shared utilities to build a daemon: logger, configuration, helpers'
|
141
140
|
test_files: []
|