puppet 2.7.8 → 2.7.9
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +6 -0
- data/README_DEVELOPER.md +63 -0
- data/conf/redhat/puppet.spec +4 -1
- data/ext/puppetstoredconfigclean.rb +39 -27
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application/agent.rb +33 -25
- data/lib/puppet/application/apply.rb +15 -1
- data/lib/puppet/application/module.rb +3 -0
- data/lib/puppet/defaults.rb +4 -0
- data/lib/puppet/face/module.rb +12 -0
- data/lib/puppet/face/module/build.rb +31 -0
- data/lib/puppet/face/module/changes.rb +38 -0
- data/lib/puppet/face/module/clean.rb +30 -0
- data/lib/puppet/face/module/generate.rb +40 -0
- data/lib/puppet/face/module/install.rb +83 -0
- data/lib/puppet/face/module/search.rb +66 -0
- data/lib/puppet/indirector/exec.rb +1 -1
- data/lib/puppet/module_tool.rb +97 -0
- data/lib/puppet/module_tool/applications.rb +12 -0
- data/lib/puppet/module_tool/applications/application.rb +83 -0
- data/lib/puppet/module_tool/applications/builder.rb +91 -0
- data/lib/puppet/module_tool/applications/checksummer.rb +47 -0
- data/lib/puppet/module_tool/applications/cleaner.rb +16 -0
- data/lib/puppet/module_tool/applications/generator.rb +141 -0
- data/lib/puppet/module_tool/applications/installer.rb +89 -0
- data/lib/puppet/module_tool/applications/searcher.rb +40 -0
- data/lib/puppet/module_tool/applications/unpacker.rb +70 -0
- data/lib/puppet/module_tool/cache.rb +56 -0
- data/lib/puppet/module_tool/checksums.rb +52 -0
- data/lib/puppet/module_tool/contents_description.rb +82 -0
- data/lib/puppet/module_tool/dependency.rb +24 -0
- data/lib/puppet/module_tool/metadata.rb +141 -0
- data/lib/puppet/module_tool/modulefile.rb +75 -0
- data/lib/puppet/module_tool/repository.rb +79 -0
- data/lib/puppet/module_tool/skeleton.rb +34 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/Modulefile.erb +11 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/README.erb +16 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +41 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/metadata.json +12 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/spec/spec_helper.rb +17 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/tests/init.pp.erb +11 -0
- data/lib/puppet/module_tool/utils.rb +5 -0
- data/lib/puppet/module_tool/utils/interrogation.rb +25 -0
- data/lib/puppet/network/http/api/v1.rb +2 -1
- data/lib/puppet/parser/functions/create_resources.rb +19 -4
- data/lib/puppet/rails.rb +1 -1
- data/lib/puppet/rails/database/schema.rb +1 -1
- data/lib/puppet/ssl/host.rb +16 -8
- data/lib/puppet/transaction.rb +1 -1
- data/lib/puppet/type/file.rb +7 -2
- data/lib/puppet/type/file/ctime.rb +1 -1
- data/lib/puppet/type/file/mtime.rb +1 -1
- data/lib/puppet/type/file/type.rb +1 -1
- data/lib/puppet/util/queue/stomp.rb +19 -6
- data/lib/puppet/util/zaml.rb +39 -5
- data/spec/fixtures/releases/jamtur01-apache/Modulefile +2 -0
- data/spec/fixtures/releases/jamtur01-apache/files/httpd +24 -0
- data/spec/fixtures/releases/jamtur01-apache/files/test.vhost +18 -0
- data/spec/fixtures/releases/jamtur01-apache/lib/puppet/provider/a2mod/debian.rb +21 -0
- data/spec/fixtures/releases/jamtur01-apache/lib/puppet/type/a2mod.rb +12 -0
- data/spec/fixtures/releases/jamtur01-apache/manifests/dev.pp +5 -0
- data/spec/fixtures/releases/jamtur01-apache/manifests/init.pp +34 -0
- data/spec/fixtures/releases/jamtur01-apache/manifests/params.pp +17 -0
- data/spec/fixtures/releases/jamtur01-apache/manifests/php.pp +5 -0
- data/spec/fixtures/releases/jamtur01-apache/manifests/ssl.pp +15 -0
- data/spec/fixtures/releases/jamtur01-apache/manifests/vhost.pp +15 -0
- data/spec/fixtures/releases/jamtur01-apache/metadata.json +1 -0
- data/spec/fixtures/releases/jamtur01-apache/templates/vhost-default.conf.erb +20 -0
- data/spec/fixtures/releases/jamtur01-apache/tests/apache.pp +1 -0
- data/spec/fixtures/releases/jamtur01-apache/tests/dev.pp +1 -0
- data/spec/fixtures/releases/jamtur01-apache/tests/init.pp +1 -0
- data/spec/fixtures/releases/jamtur01-apache/tests/php.pp +1 -0
- data/spec/fixtures/releases/jamtur01-apache/tests/ssl.pp +1 -0
- data/spec/fixtures/releases/jamtur01-apache/tests/vhost.pp +2 -0
- data/spec/integration/module_tool_spec.rb +477 -0
- data/spec/integration/util/windows/security_spec.rb +1 -1
- data/spec/unit/application/agent_spec.rb +26 -0
- data/spec/unit/application/apply_spec.rb +12 -1
- data/spec/unit/face/module/build_spec.rb +30 -0
- data/spec/unit/face/module/changes_spec.rb +30 -0
- data/spec/unit/face/module/clean_spec.rb +30 -0
- data/spec/unit/face/module/generate_spec.rb +30 -0
- data/spec/unit/face/module/install_spec.rb +75 -0
- data/spec/unit/face/module/search_spec.rb +40 -0
- data/spec/unit/face/module_spec.rb +3 -0
- data/spec/unit/file_bucket/dipper_spec.rb +1 -1
- data/spec/unit/module_tool/application_spec.rb +29 -0
- data/spec/unit/module_tool/metadata_spec.rb +11 -0
- data/spec/unit/module_tool/repository_spec.rb +52 -0
- data/spec/unit/module_tool_spec.rb +38 -0
- data/spec/unit/network/http/api/v1_spec.rb +4 -0
- data/spec/unit/parser/functions/create_resources_spec.rb +21 -4
- data/spec/unit/rails_spec.rb +89 -158
- data/spec/unit/ssl/host_spec.rb +10 -33
- data/spec/unit/type/file_spec.rb +30 -0
- data/spec/unit/util/queue/stomp_spec.rb +9 -4
- data/spec/unit/util/zaml_spec.rb +37 -0
- metadata +77 -11
@@ -123,6 +123,10 @@ describe Puppet::Network::HTTP::API::V1 do
|
|
123
123
|
@tester.uri2indirection("GET", "/env/statuses/bar", {})[0].should == 'status'
|
124
124
|
end
|
125
125
|
|
126
|
+
it "should change indirection name to 'probe' if the http method is a GET and the indirection name is probes" do
|
127
|
+
@tester.uri2indirection("GET", "/env/probes/bar", {})[0].should == 'probe'
|
128
|
+
end
|
129
|
+
|
126
130
|
it "should choose 'delete' as the indirection method if the http method is a DELETE and the indirection name is singular" do
|
127
131
|
@tester.uri2indirection("DELETE", "/env/foo/bar", {})[1].should == :destroy
|
128
132
|
end
|
@@ -20,8 +20,9 @@ describe 'function for dynamically creating resources' do
|
|
20
20
|
it "should exist" do
|
21
21
|
Puppet::Parser::Functions.function(:create_resources).should == "function_create_resources"
|
22
22
|
end
|
23
|
-
it 'should require two arguments' do
|
24
|
-
lambda { @scope.function_create_resources(['foo']) }.should raise_error(ArgumentError, 'create_resources(): wrong number of arguments (1; must be 2)')
|
23
|
+
it 'should require two or three arguments' do
|
24
|
+
lambda { @scope.function_create_resources(['foo']) }.should raise_error(ArgumentError, 'create_resources(): wrong number of arguments (1; must be 2 or 3)')
|
25
|
+
lambda { @scope.function_create_resources(['foo', 'bar', 'blah', 'baz']) }.should raise_error(ArgumentError, 'create_resources(): wrong number of arguments (4; must be 2 or 3)')
|
25
26
|
end
|
26
27
|
describe 'when creating native types' do
|
27
28
|
before :each do
|
@@ -58,6 +59,11 @@ describe 'function for dynamically creating resources' do
|
|
58
59
|
foo.should be
|
59
60
|
rg.path_between(test,foo).should be
|
60
61
|
end
|
62
|
+
it 'should account for default values' do
|
63
|
+
@scope.function_create_resources(['file', {'/etc/foo'=>{'ensure'=>'present'}, '/etc/baz'=>{'group'=>'food'}}, {'group' => 'bar'}])
|
64
|
+
@compiler.catalog.resource(:file, "/etc/foo")['group'].should == 'bar'
|
65
|
+
@compiler.catalog.resource(:file, "/etc/baz")['group'].should == 'food'
|
66
|
+
end
|
61
67
|
end
|
62
68
|
describe 'when dynamically creating resource types' do
|
63
69
|
before :each do
|
@@ -103,6 +109,11 @@ notify{test:}
|
|
103
109
|
rg.path_between(test,blah).should be
|
104
110
|
@compiler.catalog.resource(:notify, "blah")['message'].should == 'two'
|
105
111
|
end
|
112
|
+
it 'should account for default values' do
|
113
|
+
@scope.function_create_resources(['foo', {'blah'=>{}}, {'one' => 'two'}])
|
114
|
+
@scope.compiler.compile
|
115
|
+
@compiler.catalog.resource(:notify, "blah")['message'].should == 'two'
|
116
|
+
end
|
106
117
|
end
|
107
118
|
describe 'when creating classes' do
|
108
119
|
before :each do
|
@@ -114,7 +125,7 @@ notify{tester:}
|
|
114
125
|
@scope.resource=Puppet::Parser::Resource.new('class', 't', :scope => @scope)
|
115
126
|
Puppet::Parser::Functions.function(:create_resources)
|
116
127
|
end
|
117
|
-
it 'should be able to create classes'
|
128
|
+
it 'should be able to create classes' do
|
118
129
|
@scope.function_create_resources(['class', {'bar'=>{'one'=>'two'}}])
|
119
130
|
@scope.compiler.compile
|
120
131
|
@compiler.catalog.resource(:notify, "test")['message'].should == 'two'
|
@@ -123,7 +134,7 @@ notify{tester:}
|
|
123
134
|
it 'should fail to create non-existing classes' do
|
124
135
|
lambda { @scope.function_create_resources(['class', {'blah'=>{'one'=>'two'}}]) }.should raise_error(ArgumentError ,'could not find hostclass blah')
|
125
136
|
end
|
126
|
-
it 'should be able to add edges'
|
137
|
+
it 'should be able to add edges' do
|
127
138
|
@scope.function_create_resources(['class', {'bar'=>{'one'=>'two', 'require' => 'Notify[tester]'}}])
|
128
139
|
@scope.compiler.compile
|
129
140
|
rg = @scope.compiler.catalog.to_ral.relationship_graph
|
@@ -133,5 +144,11 @@ notify{tester:}
|
|
133
144
|
tester.should be
|
134
145
|
rg.path_between(tester,test).should be
|
135
146
|
end
|
147
|
+
it 'should account for default values' do
|
148
|
+
@scope.function_create_resources(['class', {'bar'=>{}}, {'one' => 'two'}])
|
149
|
+
@scope.compiler.compile
|
150
|
+
@compiler.catalog.resource(:notify, "test")['message'].should == 'two'
|
151
|
+
@compiler.catalog.resource(:class, "bar").should_not be_nil#['message'].should == 'two'
|
152
|
+
end
|
136
153
|
end
|
137
154
|
end
|
data/spec/unit/rails_spec.rb
CHANGED
@@ -88,169 +88,100 @@ describe Puppet::Rails, "when initializing a sqlite3 connection", :if => Puppet.
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
it "should provide the adapter, log_level, and host, port, username, password, database, socket, connections, and reconnect arguments" do
|
116
|
-
Puppet.settings.stubs(:value).with(:dbadapter).returns("mysql")
|
117
|
-
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
118
|
-
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
|
119
|
-
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
120
|
-
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
121
|
-
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
122
|
-
Puppet.settings.stubs(:value).with(:dbconnections).returns((pool_size = 12).to_s)
|
123
|
-
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
124
|
-
Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
|
125
|
-
|
126
|
-
Puppet::Rails.database_arguments.should == {
|
127
|
-
:adapter => "mysql",
|
128
|
-
:log_level => "testlevel",
|
129
|
-
:host => "testserver",
|
130
|
-
:port => "9999",
|
131
|
-
:username => "testuser",
|
132
|
-
:password => "testpassword",
|
133
|
-
:pool => pool_size,
|
134
|
-
:database => "testname",
|
135
|
-
:socket => "testsocket",
|
136
|
-
:reconnect => true
|
137
|
-
}
|
138
|
-
end
|
139
|
-
|
140
|
-
it "should provide the adapter, log_level, and host, port, username, password, database, socket, and connections arguments" do
|
141
|
-
Puppet.settings.stubs(:value).with(:dbadapter).returns("mysql")
|
142
|
-
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
143
|
-
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
|
144
|
-
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
145
|
-
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
146
|
-
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
147
|
-
Puppet.settings.stubs(:value).with(:dbconnections).returns((pool_size = 23).to_s)
|
148
|
-
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
149
|
-
Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
|
150
|
-
|
151
|
-
Puppet::Rails.database_arguments.should == {
|
152
|
-
:adapter => "mysql",
|
153
|
-
:log_level => "testlevel",
|
154
|
-
:host => "testserver",
|
155
|
-
:port => "9999",
|
156
|
-
:username => "testuser",
|
157
|
-
:password => "testpassword",
|
158
|
-
:pool => pool_size,
|
159
|
-
:database => "testname",
|
160
|
-
:socket => "testsocket",
|
161
|
-
:reconnect => true
|
162
|
-
}
|
163
|
-
end
|
164
|
-
|
165
|
-
it "should not provide the pool if dbconnections is 0, '0', or ''" do
|
166
|
-
Puppet.settings.stubs(:value).with(:dbadapter).returns("mysql")
|
167
|
-
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
168
|
-
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
|
169
|
-
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
170
|
-
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
171
|
-
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
172
|
-
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
173
|
-
Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
|
174
|
-
|
175
|
-
Puppet.settings.stubs(:value).with(:dbconnections).returns(0)
|
176
|
-
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
177
|
-
|
178
|
-
Puppet.settings.stubs(:value).with(:dbconnections).returns('0')
|
179
|
-
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
180
|
-
|
181
|
-
Puppet.settings.stubs(:value).with(:dbconnections).returns('')
|
182
|
-
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
describe Puppet::Rails, "when initializing a postgresql connection", :if => Puppet.features.rails? do
|
187
|
-
it "should provide the adapter, log_level, and host, port, username, password, connections, and database arguments" do
|
188
|
-
Puppet.settings.stubs(:value).with(:dbadapter).returns("postgresql")
|
189
|
-
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
190
|
-
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
|
191
|
-
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
192
|
-
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
193
|
-
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
194
|
-
Puppet.settings.stubs(:value).with(:dbconnections).returns((pool_size = 200).to_s)
|
195
|
-
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
196
|
-
Puppet.settings.stubs(:value).with(:dbsocket).returns("")
|
197
|
-
|
198
|
-
Puppet::Rails.database_arguments.should == {
|
199
|
-
:adapter => "postgresql",
|
200
|
-
:log_level => "testlevel",
|
201
|
-
:host => "testserver",
|
202
|
-
:port => "9999",
|
203
|
-
:username => "testuser",
|
204
|
-
:password => "testpassword",
|
205
|
-
:pool => pool_size,
|
206
|
-
:database => "testname",
|
207
|
-
:reconnect => true
|
208
|
-
}
|
209
|
-
end
|
91
|
+
['mysql','mysql2','postgresql'].each do |dbadapter|
|
92
|
+
describe Puppet::Rails, "when initializing a #{dbadapter} connection", :if => Puppet.features.rails? do
|
93
|
+
it "should provide the adapter, log_level, and host, port, username, password, database, and reconnect arguments" do
|
94
|
+
Puppet.settings.stubs(:value).with(:dbadapter).returns(dbadapter)
|
95
|
+
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
96
|
+
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
|
97
|
+
Puppet.settings.stubs(:value).with(:dbport).returns("")
|
98
|
+
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
99
|
+
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
100
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns((pool_size = 45).to_s)
|
101
|
+
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
102
|
+
Puppet.settings.stubs(:value).with(:dbsocket).returns("")
|
103
|
+
|
104
|
+
Puppet::Rails.database_arguments.should == {
|
105
|
+
:adapter => dbadapter,
|
106
|
+
:log_level => "testlevel",
|
107
|
+
:host => "testserver",
|
108
|
+
:username => "testuser",
|
109
|
+
:password => "testpassword",
|
110
|
+
:pool => pool_size,
|
111
|
+
:database => "testname",
|
112
|
+
:reconnect => true
|
113
|
+
}
|
114
|
+
end
|
210
115
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
116
|
+
it "should provide the adapter, log_level, and host, port, username, password, database, socket, connections, and reconnect arguments" do
|
117
|
+
Puppet.settings.stubs(:value).with(:dbadapter).returns(dbadapter)
|
118
|
+
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
119
|
+
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
|
120
|
+
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
121
|
+
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
122
|
+
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
123
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns((pool_size = 12).to_s)
|
124
|
+
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
125
|
+
Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
|
126
|
+
|
127
|
+
Puppet::Rails.database_arguments.should == {
|
128
|
+
:adapter => dbadapter,
|
129
|
+
:log_level => "testlevel",
|
130
|
+
:host => "testserver",
|
131
|
+
:port => "9999",
|
132
|
+
:username => "testuser",
|
133
|
+
:password => "testpassword",
|
134
|
+
:pool => pool_size,
|
135
|
+
:database => "testname",
|
136
|
+
:socket => "testsocket",
|
137
|
+
:reconnect => true
|
138
|
+
}
|
139
|
+
end
|
221
140
|
|
222
|
-
|
223
|
-
:
|
224
|
-
:
|
225
|
-
:
|
226
|
-
:
|
227
|
-
:
|
228
|
-
:
|
229
|
-
:
|
230
|
-
:
|
231
|
-
:
|
232
|
-
|
233
|
-
|
234
|
-
|
141
|
+
it "should provide the adapter, log_level, and host, port, username, password, database, socket, and connections arguments" do
|
142
|
+
Puppet.settings.stubs(:value).with(:dbadapter).returns(dbadapter)
|
143
|
+
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
144
|
+
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
|
145
|
+
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
146
|
+
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
147
|
+
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
148
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns((pool_size = 23).to_s)
|
149
|
+
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
150
|
+
Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
|
151
|
+
|
152
|
+
Puppet::Rails.database_arguments.should == {
|
153
|
+
:adapter => dbadapter,
|
154
|
+
:log_level => "testlevel",
|
155
|
+
:host => "testserver",
|
156
|
+
:port => "9999",
|
157
|
+
:username => "testuser",
|
158
|
+
:password => "testpassword",
|
159
|
+
:pool => pool_size,
|
160
|
+
:database => "testname",
|
161
|
+
:socket => "testsocket",
|
162
|
+
:reconnect => true
|
163
|
+
}
|
164
|
+
end
|
235
165
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
166
|
+
it "should not provide the pool if dbconnections is 0, '0', or ''" do
|
167
|
+
Puppet.settings.stubs(:value).with(:dbadapter).returns(dbadapter)
|
168
|
+
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
169
|
+
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
|
170
|
+
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
171
|
+
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
172
|
+
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
173
|
+
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
174
|
+
Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
|
245
175
|
|
246
|
-
|
247
|
-
|
176
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns(0)
|
177
|
+
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
248
178
|
|
249
|
-
|
250
|
-
|
179
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns('0')
|
180
|
+
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
251
181
|
|
252
|
-
|
253
|
-
|
182
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns('')
|
183
|
+
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
184
|
+
end
|
254
185
|
end
|
255
186
|
end
|
256
187
|
|
@@ -292,7 +223,7 @@ describe Puppet::Rails, "when initializing an Oracle connection", :if => Puppet.
|
|
292
223
|
end
|
293
224
|
|
294
225
|
it "should not provide the pool if dbconnections is 0, '0', or ''" do
|
295
|
-
Puppet.settings.stubs(:value).with(:dbadapter).returns("
|
226
|
+
Puppet.settings.stubs(:value).with(:dbadapter).returns("oracle_enhanced")
|
296
227
|
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
297
228
|
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
|
298
229
|
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
data/spec/unit/ssl/host_spec.rb
CHANGED
@@ -182,57 +182,48 @@ describe Puppet::SSL::Host do
|
|
182
182
|
it "should cache the localhost instance" do
|
183
183
|
host = stub 'host', :certificate => "eh", :key => 'foo'
|
184
184
|
Puppet::SSL::Host.expects(:new).once.returns host
|
185
|
-
|
186
185
|
Puppet::SSL::Host.localhost.should == Puppet::SSL::Host.localhost
|
187
186
|
end
|
188
187
|
|
189
188
|
it "should be able to verify its certificate matches its key" do
|
190
|
-
Puppet::SSL::Host.new("foo").should respond_to(:
|
189
|
+
Puppet::SSL::Host.new("foo").should respond_to(:validate_certificate_with_key)
|
191
190
|
end
|
192
191
|
|
193
192
|
it "should consider the certificate invalid if it cannot find a key" do
|
194
193
|
host = Puppet::SSL::Host.new("foo")
|
194
|
+
certificate = mock('cert', :fingerprint => 'DEADBEEF')
|
195
|
+
host.expects(:certificate).twice.returns certificate
|
195
196
|
host.expects(:key).returns nil
|
196
|
-
|
197
|
-
host.should_not be_certificate_matches_key
|
197
|
+
lambda { host.validate_certificate_with_key }.should raise_error(Puppet::Error, "No private key with which to validate certificate with fingerprint: DEADBEEF")
|
198
198
|
end
|
199
199
|
|
200
200
|
it "should consider the certificate invalid if it cannot find a certificate" do
|
201
201
|
host = Puppet::SSL::Host.new("foo")
|
202
|
-
host.expects(:key).
|
202
|
+
host.expects(:key).never
|
203
203
|
host.expects(:certificate).returns nil
|
204
|
-
|
205
|
-
host.should_not be_certificate_matches_key
|
204
|
+
lambda { host.validate_certificate_with_key }.should raise_error(Puppet::Error, "No certificate to validate.")
|
206
205
|
end
|
207
206
|
|
208
207
|
it "should consider the certificate invalid if the SSL certificate's key verification fails" do
|
209
208
|
host = Puppet::SSL::Host.new("foo")
|
210
|
-
|
211
209
|
key = mock 'key', :content => "private_key"
|
212
210
|
sslcert = mock 'sslcert'
|
213
|
-
certificate = mock 'cert', :content => sslcert
|
214
|
-
|
211
|
+
certificate = mock 'cert', {:content => sslcert, :fingerprint => 'DEADBEEF'}
|
215
212
|
host.stubs(:key).returns key
|
216
213
|
host.stubs(:certificate).returns certificate
|
217
|
-
|
218
214
|
sslcert.expects(:check_private_key).with("private_key").returns false
|
219
|
-
|
220
|
-
host.should_not be_certificate_matches_key
|
215
|
+
lambda { host.validate_certificate_with_key }.should raise_error(Puppet::Error, /DEADBEEF/)
|
221
216
|
end
|
222
217
|
|
223
218
|
it "should consider the certificate valid if the SSL certificate's key verification succeeds" do
|
224
219
|
host = Puppet::SSL::Host.new("foo")
|
225
|
-
|
226
220
|
key = mock 'key', :content => "private_key"
|
227
221
|
sslcert = mock 'sslcert'
|
228
222
|
certificate = mock 'cert', :content => sslcert
|
229
|
-
|
230
223
|
host.stubs(:key).returns key
|
231
224
|
host.stubs(:certificate).returns certificate
|
232
|
-
|
233
225
|
sslcert.expects(:check_private_key).with("private_key").returns true
|
234
|
-
|
235
|
-
host.should be_certificate_matches_key
|
226
|
+
lambda{ host.validate_certificate_with_key }.should_not raise_error
|
236
227
|
end
|
237
228
|
|
238
229
|
describe "when specifying the CA location" do
|
@@ -511,15 +502,13 @@ describe Puppet::SSL::Host do
|
|
511
502
|
before do
|
512
503
|
@realcert = mock 'certificate'
|
513
504
|
@cert = stub 'cert', :content => @realcert
|
514
|
-
|
515
505
|
@host.stubs(:key).returns mock("key")
|
516
|
-
@host.stubs(:
|
506
|
+
@host.stubs(:validate_certificate_with_key)
|
517
507
|
end
|
518
508
|
|
519
509
|
it "should find the CA certificate if it does not have a certificate" do
|
520
510
|
Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
|
521
511
|
Puppet::SSL::Certificate.indirection.stubs(:find).with("myname").returns @cert
|
522
|
-
|
523
512
|
@host.certificate
|
524
513
|
end
|
525
514
|
|
@@ -541,34 +530,22 @@ describe Puppet::SSL::Host do
|
|
541
530
|
it "should find the key if it does not have one" do
|
542
531
|
Puppet::SSL::Certificate.indirection.stubs(:find)
|
543
532
|
@host.expects(:key).returns mock("key")
|
544
|
-
|
545
533
|
@host.certificate
|
546
534
|
end
|
547
535
|
|
548
536
|
it "should generate the key if one cannot be found" do
|
549
537
|
Puppet::SSL::Certificate.indirection.stubs(:find)
|
550
|
-
|
551
538
|
@host.expects(:key).returns nil
|
552
539
|
@host.expects(:generate_key)
|
553
|
-
|
554
540
|
@host.certificate
|
555
541
|
end
|
556
542
|
|
557
543
|
it "should find the certificate in the Certificate class and return the Puppet certificate instance" do
|
558
544
|
Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
|
559
545
|
Puppet::SSL::Certificate.indirection.expects(:find).with("myname").returns @cert
|
560
|
-
|
561
546
|
@host.certificate.should equal(@cert)
|
562
547
|
end
|
563
548
|
|
564
|
-
it "should fail if the found certificate does not match the private key" do
|
565
|
-
@host.expects(:certificate_matches_key?).returns false
|
566
|
-
|
567
|
-
Puppet::SSL::Certificate.indirection.stubs(:find).returns @cert
|
568
|
-
|
569
|
-
lambda { @host.certificate }.should raise_error(Puppet::Error)
|
570
|
-
end
|
571
|
-
|
572
549
|
it "should return any previously found certificate" do
|
573
550
|
Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
|
574
551
|
Puppet::SSL::Certificate.indirection.expects(:find).with("myname").returns(@cert).once
|