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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c40db4538a2eb9d126977fc84d1c1a7276517986
4
- data.tar.gz: 5f13e4dac37f2b7abda31f79c6580244c50ff6ab
3
+ metadata.gz: ca8f0399f312c1be636acd8b5e2821e506293e27
4
+ data.tar.gz: f555802b381e16ee23947c3e384c370b6c865eca
5
5
  SHA512:
6
- metadata.gz: 694e9e8e2590d42fc060e938226aa9c2460c79fdec5dedec4d83946a1b19370b6bb22a2da5697bd583070573a1e0d1813d76167ca6b7300966e32569838aed79
7
- data.tar.gz: 456f4622d3e33dc8bdb00f7703655541edda5939d3f5cb1fd69c089232f124d7fd1c350e592722c6a26b0037f88cfa59211984315bd94580a4be4974ceb12d1b
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
- # currently sets SENSU_CONFIG_FILES, a colon delimited list of
140
- # loaded config files.
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["SENSU_CONFIG_FILES"] = @loaded_files.join(":")
158
+ ENV["SENSU_LOADED_TEMPFILE"] = create_loaded_tempfile!
143
159
  end
144
160
 
145
161
  # Validate the loaded settings.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "sensu-settings"
5
- spec.version = "1.9.0"
5
+ spec.version = "2.0.0"
6
6
  spec.authors = ["Sean Porter"]
7
7
  spec.email = ["portertech@gmail.com"]
8
8
  spec.summary = "The Sensu settings library, loader and validator"
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["SENSU_CONFIG_FILES"].split(":")).to eq(@loader.loaded_files)
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
@@ -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["SENSU_CONFIG_FILES"].split(":")).to eq(settings.loaded_files)
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: 1.9.0
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-05-20 00:00:00.000000000 Z
11
+ date: 2015-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json