bmc-daemon-lib 0.3.3 → 0.3.4
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/Gemfile.lock +2 -2
- data/bmc-daemon-lib.gemspec +1 -1
- data/lib/bmc-daemon-lib/conf.rb +22 -15
- data/lib/bmc-daemon-lib/logger_pool.rb +4 -3
- 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: 07d8df6da72c6e6fdaafac2a1a67b78ecf760859
|
4
|
+
data.tar.gz: 8f64f4c0c20bf983b5e1bb4ba4e0272737a5ec20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 350eec5594f1353e43f7929f03eac494de915c9d29c91e3c4f507f7d736399cc23e7b409651c3be26db0dff826ca3c8c20a37f8f02fcb73685fdc3dbed05fd0f
|
7
|
+
data.tar.gz: a938502ae7175af87becfe05990994a18fa7f1e6f659911d162a550be18628d10deb012b772ccd314a840fd4c8c33c9d65651490175665e3bd3b5766c38aade0
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bmc-daemon-lib (0.3.
|
4
|
+
bmc-daemon-lib (0.3.4)
|
5
5
|
chamber (~> 2.9)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ast (2.3.0)
|
11
|
-
chamber (2.9.
|
11
|
+
chamber (2.9.1)
|
12
12
|
hashie (~> 3.3)
|
13
13
|
thor (~> 0.19.1)
|
14
14
|
diff-lcs (1.2.5)
|
data/bmc-daemon-lib.gemspec
CHANGED
data/lib/bmc-daemon-lib/conf.rb
CHANGED
@@ -81,10 +81,7 @@ module BmcDaemonLib
|
|
81
81
|
Encoding.default_external = "utf-8"
|
82
82
|
|
83
83
|
# Init New Relic
|
84
|
-
|
85
|
-
logs_path = Conf.at :logs, :path
|
86
|
-
newrelic_logfile = File.expand_path logs_newrelic.to_s, logs_path.to_s
|
87
|
-
prepare_newrelic self[:newrelic], newrelic_logfile
|
84
|
+
prepare_newrelic self[:newrelic]
|
88
85
|
|
89
86
|
# Try to access any key to force parsing of the files
|
90
87
|
self[:dummy]
|
@@ -112,6 +109,23 @@ module BmcDaemonLib
|
|
112
109
|
path.reduce(Conf) { |m, key| m && m[key.to_s] }
|
113
110
|
end
|
114
111
|
|
112
|
+
def self.logfile_path pipe
|
113
|
+
# Access configuration
|
114
|
+
path = Conf.at :logs, :path
|
115
|
+
specific = Conf.at :logs, pipe
|
116
|
+
default = Conf.at :logs, :default
|
117
|
+
|
118
|
+
# Ignore if explicitely disabled
|
119
|
+
return nil if specific.nil?
|
120
|
+
|
121
|
+
# Fallback on default path if not provided,
|
122
|
+
specific ||= default
|
123
|
+
specific ||= "default.log"
|
124
|
+
|
125
|
+
# Build logfile_path
|
126
|
+
File.expand_path specific.to_s, path.to_s
|
127
|
+
end
|
128
|
+
|
115
129
|
def self.newrelic_enabled?
|
116
130
|
ensure_init
|
117
131
|
!! (self[:newrelic] && self[:newrelic][:license])
|
@@ -145,7 +159,6 @@ module BmcDaemonLib
|
|
145
159
|
config_etc = self.generate(:config_etc)
|
146
160
|
|
147
161
|
"A default configuration is available (#{config_defaults}) and can be copied to the default location (#{config_etc}): \n sudo cp #{config_defaults} #{config_etc}"
|
148
|
-
|
149
162
|
end
|
150
163
|
end
|
151
164
|
|
@@ -160,7 +173,7 @@ module BmcDaemonLib
|
|
160
173
|
@files << File.expand_path(path) if path && File.readable?(path)
|
161
174
|
end
|
162
175
|
|
163
|
-
def self.prepare_newrelic section
|
176
|
+
def self.prepare_newrelic section
|
164
177
|
# Disable NewRelic if no config present
|
165
178
|
return unless self.newrelic_enabled?
|
166
179
|
|
@@ -168,8 +181,8 @@ module BmcDaemonLib
|
|
168
181
|
GC::Profiler.enable
|
169
182
|
|
170
183
|
# Set logfile, license, monitor mode
|
171
|
-
ENV["NEW_RELIC_LOG"]
|
172
|
-
ENV["NEW_RELIC_LICENSE_KEY"]
|
184
|
+
ENV["NEW_RELIC_LOG"] = logfile_path(:newrelic)
|
185
|
+
ENV["NEW_RELIC_LICENSE_KEY"] = section[:license].to_s
|
173
186
|
ENV["NEW_RELIC_MONITOR_MODE"] = "true"
|
174
187
|
|
175
188
|
# Build NewRelic app_name if not provided as-is
|
@@ -181,7 +194,7 @@ module BmcDaemonLib
|
|
181
194
|
text = stack.join('-')
|
182
195
|
section[:app_name] = "#{text}; #{text}-#{host}"
|
183
196
|
end
|
184
|
-
ENV["NEW_RELIC_APP_NAME"]
|
197
|
+
ENV["NEW_RELIC_APP_NAME"] = section[:app_name].to_s
|
185
198
|
|
186
199
|
# Enable module
|
187
200
|
ENV["NEWRELIC_AGENT_ENABLED"] = "true"
|
@@ -193,12 +206,6 @@ module BmcDaemonLib
|
|
193
206
|
unless @initialized
|
194
207
|
fail ConfigInitiRequired, "ensure_init: Conf.init(app_root) should be invoked beforehand"
|
195
208
|
end
|
196
|
-
|
197
|
-
# # Skip is already done
|
198
|
-
# return if @initialized
|
199
|
-
|
200
|
-
# # Go through init if not already done
|
201
|
-
# self.init
|
202
209
|
end
|
203
210
|
|
204
211
|
end
|
@@ -33,10 +33,11 @@ module BmcDaemonLib
|
|
33
33
|
|
34
34
|
def logfile pipe
|
35
35
|
# Disabled if no valid config
|
36
|
-
return nil unless Conf[:logs].is_a?(Hash) && Conf.at(:logs, pipe)
|
36
|
+
#return nil unless Conf[:logs].is_a?(Hash) && Conf.at(:logs, pipe)
|
37
37
|
|
38
|
-
#
|
39
|
-
logfile =
|
38
|
+
# Build logfile from Conf
|
39
|
+
logfile = Conf.logfile_path pipe
|
40
|
+
return nil if logfile.nil?
|
40
41
|
|
41
42
|
# Check that we'll be able to create logfiles
|
42
43
|
if File.exists?(logfile)
|
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.4
|
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-08-
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|