sensu-settings 1.9.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sensu/settings/loader.rb +19 -3
- data/sensu-settings.gemspec +1 -1
- data/spec/loader_spec.rb +3 -1
- data/spec/settings_spec.rb +3 -1
- 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: ca8f0399f312c1be636acd8b5e2821e506293e27
|
4
|
+
data.tar.gz: f555802b381e16ee23947c3e384c370b6c865eca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b797e36e3831943b86bbc9ff9fa38cac622b70a987b35041ed5eb8fe5b8a72db9143037d7e34379872490cd9104f7c8e1899a3b5a7c1aefdaed42d58a872b4d4
|
7
|
+
data.tar.gz: fea30269b1e5d2ee02db99adee8dfcb035fb8bac8ef334d0331137f6e1808a2ded3926dc3f0e91566ecbdc2fc9ea2a9c3d0b1e29ab9bc0c743688d265a4f2a8d
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "sensu/settings/validator"
|
2
2
|
require "multi_json"
|
3
|
+
require "tempfile"
|
3
4
|
|
4
5
|
module Sensu
|
5
6
|
module Settings
|
@@ -135,11 +136,26 @@ module Sensu
|
|
135
136
|
end
|
136
137
|
end
|
137
138
|
|
139
|
+
# Create a temporary file containing the colon delimited list of
|
140
|
+
# loaded configuration files.
|
141
|
+
#
|
142
|
+
# @return [String] tempfile path.
|
143
|
+
def create_loaded_tempfile!
|
144
|
+
file = Tempfile.new("sensu_loaded_files")
|
145
|
+
file.write(@loaded_files.join(":"))
|
146
|
+
file.close
|
147
|
+
file.path
|
148
|
+
end
|
149
|
+
|
138
150
|
# Set Sensu settings related environment variables. This method
|
139
|
-
#
|
140
|
-
#
|
151
|
+
# sets `SENSU_LOADED_TEMPFILE` to a new temporary file path,
|
152
|
+
# a file containing the colon delimited list of loaded
|
153
|
+
# configuration files (using `create_loaded_tempfile!()`. The
|
154
|
+
# environment variable `SENSU_CONFIG_FILES` has been removed,
|
155
|
+
# due to the exec ARG_MAX (E2BIG) error when spawning processes
|
156
|
+
# after loading many configuration files (e.g. > 2000).
|
141
157
|
def set_env!
|
142
|
-
ENV["
|
158
|
+
ENV["SENSU_LOADED_TEMPFILE"] = create_loaded_tempfile!
|
143
159
|
end
|
144
160
|
|
145
161
|
# Validate the loaded settings.
|
data/sensu-settings.gemspec
CHANGED
data/spec/loader_spec.rb
CHANGED
@@ -130,7 +130,9 @@ describe "Sensu::Settings::Loader" do
|
|
130
130
|
@loader.load_directory(@config_dir)
|
131
131
|
expect(@loader.loaded_files.size).to eq(3)
|
132
132
|
@loader.set_env!
|
133
|
-
expect(ENV["
|
133
|
+
expect(ENV["SENSU_LOADED_TEMPFILE"]).to match(/sensu_loaded_files/)
|
134
|
+
loaded_files = IO.read(ENV["SENSU_LOADED_TEMPFILE"])
|
135
|
+
expect(loaded_files.split(":")).to eq(@loader.loaded_files)
|
134
136
|
end
|
135
137
|
|
136
138
|
it "can load settings and determine if certain definitions exist" do
|
data/spec/settings_spec.rb
CHANGED
@@ -38,7 +38,9 @@ describe "Sensu::Settings" do
|
|
38
38
|
expect(settings[:checks][:merger][:command]).to eq("echo -n merger")
|
39
39
|
expect(settings[:checks][:merger][:subscribers]).to eq(["foo", "bar"])
|
40
40
|
expect(settings[:checks][:nested][:command]).to eq("true")
|
41
|
-
expect(ENV["
|
41
|
+
expect(ENV["SENSU_LOADED_TEMPFILE"]).to match(/sensu_loaded_files/)
|
42
|
+
loaded_files = IO.read(ENV["SENSU_LOADED_TEMPFILE"])
|
43
|
+
expect(loaded_files.split(":")).to eq(settings.loaded_files)
|
42
44
|
ENV["RABBITMQ_URL"] = nil
|
43
45
|
end
|
44
46
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Porter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|