puppet 2.7.5 → 2.7.6
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 +121 -0
- data/conf/redhat/puppet.spec +16 -7
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application/cert.rb +17 -3
- data/lib/puppet/application/device.rb +1 -0
- data/lib/puppet/application/kick.rb +0 -2
- data/lib/puppet/application/resource.rb +73 -66
- data/lib/puppet/configurer/plugin_handler.rb +6 -2
- data/lib/puppet/defaults.rb +60 -5
- data/lib/puppet/face/ca.rb +11 -2
- data/lib/puppet/face/certificate.rb +33 -4
- data/lib/puppet/file_serving/fileset.rb +1 -1
- data/lib/puppet/file_serving/indirection_hooks.rb +2 -2
- data/lib/puppet/file_serving/metadata.rb +43 -4
- data/lib/puppet/indirector.rb +0 -1
- data/lib/puppet/indirector/request.rb +3 -4
- data/lib/puppet/indirector/resource/active_record.rb +3 -10
- data/lib/puppet/indirector/resource/ral.rb +2 -2
- data/lib/puppet/indirector/rest.rb +1 -1
- data/lib/puppet/network/handler/ca.rb +16 -106
- data/lib/puppet/network/handler/master.rb +0 -3
- data/lib/puppet/network/handler/runner.rb +1 -0
- data/lib/puppet/parser/scope.rb +10 -0
- data/lib/puppet/provider/file/posix.rb +72 -34
- data/lib/puppet/provider/file/windows.rb +100 -0
- data/lib/puppet/provider/group/windows_adsi.rb +2 -2
- data/lib/puppet/provider/user/windows_adsi.rb +19 -4
- data/lib/puppet/resource.rb +16 -0
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/ssl/certificate.rb +2 -2
- data/lib/puppet/ssl/certificate_authority.rb +86 -10
- data/lib/puppet/ssl/certificate_authority/interface.rb +64 -19
- data/lib/puppet/ssl/certificate_factory.rb +112 -91
- data/lib/puppet/ssl/certificate_request.rb +88 -1
- data/lib/puppet/ssl/host.rb +20 -3
- data/lib/puppet/type/file.rb +15 -34
- data/lib/puppet/type/file/group.rb +11 -91
- data/lib/puppet/type/file/mode.rb +11 -41
- data/lib/puppet/type/file/owner.rb +18 -34
- data/lib/puppet/type/file/source.rb +22 -7
- data/lib/puppet/type/group.rb +4 -3
- data/lib/puppet/type/user.rb +4 -1
- data/lib/puppet/util.rb +59 -6
- data/lib/puppet/util/adsi.rb +11 -0
- data/lib/puppet/util/log.rb +4 -0
- data/lib/puppet/util/log/destinations.rb +7 -1
- data/lib/puppet/util/monkey_patches.rb +19 -0
- data/lib/puppet/util/network_device/config.rb +4 -5
- data/lib/puppet/util/settings.rb +5 -0
- data/lib/puppet/util/suidmanager.rb +0 -1
- data/lib/puppet/util/windows.rb +4 -0
- data/lib/puppet/util/windows/error.rb +16 -0
- data/lib/puppet/util/windows/security.rb +593 -0
- data/spec/integration/defaults_spec.rb +27 -0
- data/spec/integration/network/handler_spec.rb +1 -1
- data/spec/integration/type/file_spec.rb +382 -145
- data/spec/integration/util/windows/security_spec.rb +468 -0
- data/spec/shared_behaviours/file_serving.rb +4 -3
- data/spec/unit/application/agent_spec.rb +1 -0
- data/spec/unit/application/device_spec.rb +5 -0
- data/spec/unit/application/resource_spec.rb +62 -101
- data/spec/unit/configurer/downloader_spec.rb +2 -2
- data/spec/unit/configurer/plugin_handler_spec.rb +15 -8
- data/spec/unit/configurer_spec.rb +2 -2
- data/spec/unit/face/ca_spec.rb +34 -0
- data/spec/unit/face/certificate_spec.rb +168 -1
- data/spec/unit/file_serving/fileset_spec.rb +1 -1
- data/spec/unit/file_serving/indirection_hooks_spec.rb +1 -1
- data/spec/unit/file_serving/metadata_spec.rb +151 -107
- data/spec/unit/indirector/certificate_request/ca_spec.rb +0 -3
- data/spec/unit/indirector/direct_file_server_spec.rb +10 -9
- data/spec/unit/indirector/file_metadata/file_spec.rb +6 -4
- data/spec/unit/indirector/request_spec.rb +13 -3
- data/spec/unit/indirector/resource/active_record_spec.rb +4 -10
- data/spec/unit/indirector/resource/ral_spec.rb +6 -4
- data/spec/unit/indirector/rest_spec.rb +5 -6
- data/spec/unit/network/handler/ca_spec.rb +86 -0
- data/spec/unit/parser/collector_spec.rb +7 -7
- data/spec/unit/parser/scope_spec.rb +20 -0
- data/spec/unit/provider/file/posix_spec.rb +226 -0
- data/spec/unit/provider/file/windows_spec.rb +136 -0
- data/spec/unit/provider/group/windows_adsi_spec.rb +7 -2
- data/spec/unit/provider/user/windows_adsi_spec.rb +36 -3
- data/spec/unit/resource/catalog_spec.rb +20 -10
- data/spec/unit/resource_spec.rb +55 -8
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +97 -54
- data/spec/unit/ssl/certificate_authority_spec.rb +133 -23
- data/spec/unit/ssl/certificate_factory_spec.rb +90 -70
- data/spec/unit/ssl/certificate_request_spec.rb +62 -1
- data/spec/unit/ssl/certificate_spec.rb +20 -14
- data/spec/unit/ssl/host_spec.rb +52 -6
- data/spec/unit/type/file/content_spec.rb +4 -4
- data/spec/unit/type/file/group_spec.rb +34 -96
- data/spec/unit/type/file/mode_spec.rb +88 -0
- data/spec/unit/type/file/owner_spec.rb +32 -123
- data/spec/unit/type/file/source_spec.rb +120 -41
- data/spec/unit/type/file_spec.rb +1033 -753
- data/spec/unit/type_spec.rb +19 -1
- data/spec/unit/util/adsi_spec.rb +19 -0
- data/spec/unit/util/log/destinations_spec.rb +75 -0
- data/spec/unit/util/log_spec.rb +15 -0
- data/spec/unit/util/network_device/config_spec.rb +7 -0
- data/spec/unit/util/settings_spec.rb +10 -0
- data/spec/unit/util_spec.rb +126 -13
- data/test/language/functions.rb +0 -1
- data/test/language/snippets.rb +0 -9
- data/test/lib/puppettest/exetest.rb +1 -1
- data/test/lib/puppettest/servertest.rb +0 -1
- data/test/rails/rails.rb +0 -1
- data/test/ral/type/filesources.rb +0 -60
- metadata +13 -33
- data/lib/puppet/network/client.rb +0 -174
- data/lib/puppet/network/client/ca.rb +0 -56
- data/lib/puppet/network/client/file.rb +0 -6
- data/lib/puppet/network/client/proxy.rb +0 -27
- data/lib/puppet/network/client/report.rb +0 -26
- data/lib/puppet/network/client/runner.rb +0 -10
- data/lib/puppet/network/client/status.rb +0 -4
- data/lib/puppet/network/http_server.rb +0 -3
- data/lib/puppet/network/http_server/mongrel.rb +0 -130
- data/lib/puppet/network/http_server/webrick.rb +0 -155
- data/lib/puppet/network/xmlrpc/client.rb +0 -211
- data/lib/puppet/provider/file/win32.rb +0 -72
- data/lib/puppet/sslcertificates.rb +0 -146
- data/lib/puppet/sslcertificates/ca.rb +0 -375
- data/lib/puppet/sslcertificates/certificate.rb +0 -255
- data/lib/puppet/sslcertificates/inventory.rb +0 -38
- data/lib/puppet/sslcertificates/support.rb +0 -146
- data/spec/integration/network/client_spec.rb +0 -18
- data/spec/unit/network/xmlrpc/client_spec.rb +0 -172
- data/spec/unit/sslcertificates/ca_spec.rb +0 -106
- data/test/certmgr/certmgr.rb +0 -308
- data/test/certmgr/inventory.rb +0 -69
- data/test/certmgr/support.rb +0 -105
- data/test/network/client/ca.rb +0 -69
- data/test/network/client/dipper.rb +0 -34
- data/test/network/handler/ca.rb +0 -273
- data/test/network/server/mongrel_test.rb +0 -99
- data/test/network/server/webrick.rb +0 -111
- data/test/network/xmlrpc/client.rb +0 -45
@@ -50,7 +50,7 @@ module PuppetTest::ExeTest
|
|
50
50
|
args += " --confdir #{Puppet[:confdir]}"
|
51
51
|
args += " --rundir #{File.join(Puppet[:vardir], "run")}"
|
52
52
|
args += " --vardir #{Puppet[:vardir]}"
|
53
|
-
args += " --
|
53
|
+
args += " --dns_alt_names #{Puppet[:master_dns_alt_names]}"
|
54
54
|
args += " --masterport #{@@port}"
|
55
55
|
args += " --user #{Puppet::Util::SUIDManager.uid}"
|
56
56
|
args += " --group #{Puppet::Util::SUIDManager.gid}"
|
data/test/rails/rails.rb
CHANGED
@@ -5,7 +5,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest')
|
|
5
5
|
require 'puppet'
|
6
6
|
require 'puppet/rails'
|
7
7
|
require 'puppet/parser/parser'
|
8
|
-
require 'puppet/network/client'
|
9
8
|
require 'puppettest'
|
10
9
|
require 'puppettest/parsertesting'
|
11
10
|
require 'puppettest/resourcetesting'
|
@@ -226,66 +226,6 @@ class TestFileSources < Test::Unit::TestCase
|
|
226
226
|
file
|
227
227
|
end
|
228
228
|
|
229
|
-
def test_unmountedNetworkSources
|
230
|
-
server = nil
|
231
|
-
mounts = {
|
232
|
-
"/" => "root",
|
233
|
-
"/noexistokay" => "noexist"
|
234
|
-
}
|
235
|
-
|
236
|
-
fileserverconf = mkfileserverconf(mounts)
|
237
|
-
|
238
|
-
Puppet[:autosign] = true
|
239
|
-
Puppet[:masterport] = @port
|
240
|
-
Puppet[:certdnsnames] = "localhost"
|
241
|
-
|
242
|
-
serverpid = nil
|
243
|
-
assert_nothing_raised("Could not start on port #{@port}") {
|
244
|
-
|
245
|
-
server = Puppet::Network::HTTPServer::WEBrick.new(
|
246
|
-
|
247
|
-
:Port => @port,
|
248
|
-
|
249
|
-
:Handlers => {
|
250
|
-
:CA => {}, # so that certs autogenerate
|
251
|
-
:FileServer => {
|
252
|
-
:Config => fileserverconf
|
253
|
-
}
|
254
|
-
}
|
255
|
-
)
|
256
|
-
|
257
|
-
}
|
258
|
-
|
259
|
-
serverpid = fork {
|
260
|
-
assert_nothing_raised {
|
261
|
-
#trap(:INT) { server.shutdown; Kernel.exit! }
|
262
|
-
trap(:INT) { server.shutdown }
|
263
|
-
server.start
|
264
|
-
}
|
265
|
-
}
|
266
|
-
@@tmppids << serverpid
|
267
|
-
|
268
|
-
sleep(1)
|
269
|
-
|
270
|
-
name = File.join(tmpdir, "nosourcefile")
|
271
|
-
|
272
|
-
file = Puppet::Type.type(:file).new(
|
273
|
-
|
274
|
-
:source => "puppet://localhost/noexist/file",
|
275
|
-
|
276
|
-
:name => name
|
277
|
-
)
|
278
|
-
|
279
|
-
assert_raise Puppet::Error do
|
280
|
-
file.retrieve
|
281
|
-
end
|
282
|
-
|
283
|
-
comp = mk_catalog(file)
|
284
|
-
comp.apply
|
285
|
-
|
286
|
-
assert(!FileTest.exists?(name), "File with no source exists anyway")
|
287
|
-
end
|
288
|
-
|
289
229
|
def test_sourcepaths
|
290
230
|
files = []
|
291
231
|
3.times {
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 2.7.
|
9
|
+
- 6
|
10
|
+
version: 2.7.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Puppet Labs
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-10-22 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: facter
|
@@ -278,13 +278,6 @@ files:
|
|
278
278
|
- lib/puppet/network/authconfig.rb
|
279
279
|
- lib/puppet/network/authorization.rb
|
280
280
|
- lib/puppet/network/authstore.rb
|
281
|
-
- lib/puppet/network/client/ca.rb
|
282
|
-
- lib/puppet/network/client/file.rb
|
283
|
-
- lib/puppet/network/client/proxy.rb
|
284
|
-
- lib/puppet/network/client/report.rb
|
285
|
-
- lib/puppet/network/client/runner.rb
|
286
|
-
- lib/puppet/network/client/status.rb
|
287
|
-
- lib/puppet/network/client.rb
|
288
281
|
- lib/puppet/network/client_request.rb
|
289
282
|
- lib/puppet/network/format.rb
|
290
283
|
- lib/puppet/network/format_handler.rb
|
@@ -311,15 +304,11 @@ files:
|
|
311
304
|
- lib/puppet/network/http/webrick.rb
|
312
305
|
- lib/puppet/network/http.rb
|
313
306
|
- lib/puppet/network/http_pool.rb
|
314
|
-
- lib/puppet/network/http_server/mongrel.rb
|
315
|
-
- lib/puppet/network/http_server/webrick.rb
|
316
|
-
- lib/puppet/network/http_server.rb
|
317
307
|
- lib/puppet/network/rest_authconfig.rb
|
318
308
|
- lib/puppet/network/rest_authorization.rb
|
319
309
|
- lib/puppet/network/rest_controller.rb
|
320
310
|
- lib/puppet/network/rights.rb
|
321
311
|
- lib/puppet/network/server.rb
|
322
|
-
- lib/puppet/network/xmlrpc/client.rb
|
323
312
|
- lib/puppet/network/xmlrpc/processor.rb
|
324
313
|
- lib/puppet/network/xmlrpc/server.rb
|
325
314
|
- lib/puppet/network/xmlrpc/webrick_servlet.rb
|
@@ -428,7 +417,7 @@ files:
|
|
428
417
|
- lib/puppet/provider/exec/windows.rb
|
429
418
|
- lib/puppet/provider/exec.rb
|
430
419
|
- lib/puppet/provider/file/posix.rb
|
431
|
-
- lib/puppet/provider/file/
|
420
|
+
- lib/puppet/provider/file/windows.rb
|
432
421
|
- lib/puppet/provider/group/aix.rb
|
433
422
|
- lib/puppet/provider/group/directoryservice.rb
|
434
423
|
- lib/puppet/provider/group/groupadd.rb
|
@@ -571,11 +560,6 @@ files:
|
|
571
560
|
- lib/puppet/ssl/inventory.rb
|
572
561
|
- lib/puppet/ssl/key.rb
|
573
562
|
- lib/puppet/ssl.rb
|
574
|
-
- lib/puppet/sslcertificates/ca.rb
|
575
|
-
- lib/puppet/sslcertificates/certificate.rb
|
576
|
-
- lib/puppet/sslcertificates/inventory.rb
|
577
|
-
- lib/puppet/sslcertificates/support.rb
|
578
|
-
- lib/puppet/sslcertificates.rb
|
579
563
|
- lib/puppet/status.rb
|
580
564
|
- lib/puppet/transaction/event.rb
|
581
565
|
- lib/puppet/transaction/event_manager.rb
|
@@ -725,6 +709,9 @@ files:
|
|
725
709
|
- lib/puppet/util/tagging.rb
|
726
710
|
- lib/puppet/util/user_attr.rb
|
727
711
|
- lib/puppet/util/warnings.rb
|
712
|
+
- lib/puppet/util/windows/error.rb
|
713
|
+
- lib/puppet/util/windows/security.rb
|
714
|
+
- lib/puppet/util/windows.rb
|
728
715
|
- lib/puppet/util/zaml.rb
|
729
716
|
- lib/puppet/util.rb
|
730
717
|
- lib/puppet.rb
|
@@ -886,9 +873,6 @@ files:
|
|
886
873
|
- tasks/rake/sign.rake
|
887
874
|
- tasks/rake/testbranch.rake
|
888
875
|
- tasks/rake/yard.rake
|
889
|
-
- test/certmgr/certmgr.rb
|
890
|
-
- test/certmgr/inventory.rb
|
891
|
-
- test/certmgr/support.rb
|
892
876
|
- test/data/failers/badclassnoparam
|
893
877
|
- test/data/failers/badclassparam
|
894
878
|
- test/data/failers/badcompnoparam
|
@@ -1007,18 +991,12 @@ files:
|
|
1007
991
|
- test/network/authconfig.rb
|
1008
992
|
- test/network/authorization.rb
|
1009
993
|
- test/network/authstore.rb
|
1010
|
-
- test/network/client/ca.rb
|
1011
|
-
- test/network/client/dipper.rb
|
1012
994
|
- test/network/client_request.rb
|
1013
|
-
- test/network/handler/ca.rb
|
1014
995
|
- test/network/handler/fileserver.rb
|
1015
996
|
- test/network/handler/master.rb
|
1016
997
|
- test/network/handler/report.rb
|
1017
998
|
- test/network/handler/runner.rb
|
1018
999
|
- test/network/rights.rb
|
1019
|
-
- test/network/server/mongrel_test.rb
|
1020
|
-
- test/network/server/webrick.rb
|
1021
|
-
- test/network/xmlrpc/client.rb
|
1022
1000
|
- test/network/xmlrpc/processor.rb
|
1023
1001
|
- test/network/xmlrpc/server.rb
|
1024
1002
|
- test/network/xmlrpc/webrick_servlet.rb
|
@@ -1167,7 +1145,6 @@ files:
|
|
1167
1145
|
- spec/integration/indirector/file_content/file_server_spec.rb
|
1168
1146
|
- spec/integration/indirector/file_metadata/file_server_spec.rb
|
1169
1147
|
- spec/integration/indirector/node/ldap_spec.rb
|
1170
|
-
- spec/integration/network/client_spec.rb
|
1171
1148
|
- spec/integration/network/formats_spec.rb
|
1172
1149
|
- spec/integration/network/handler_spec.rb
|
1173
1150
|
- spec/integration/network/rest_authconfig_spec.rb
|
@@ -1206,6 +1183,7 @@ files:
|
|
1206
1183
|
- spec/integration/util/file_locking_spec.rb
|
1207
1184
|
- spec/integration/util/rdoc/parser_spec.rb
|
1208
1185
|
- spec/integration/util/settings_spec.rb
|
1186
|
+
- spec/integration/util/windows/security_spec.rb
|
1209
1187
|
- spec/integration/util_spec.rb
|
1210
1188
|
- spec/lib/matchers/json.rb
|
1211
1189
|
- spec/lib/puppet/face/1.0.0/huzzah.rb
|
@@ -1380,6 +1358,7 @@ files:
|
|
1380
1358
|
- spec/unit/network/format_handler_spec.rb
|
1381
1359
|
- spec/unit/network/format_spec.rb
|
1382
1360
|
- spec/unit/network/formats_spec.rb
|
1361
|
+
- spec/unit/network/handler/ca_spec.rb
|
1383
1362
|
- spec/unit/network/handler/fileserver_spec.rb
|
1384
1363
|
- spec/unit/network/http/api/v1_spec.rb
|
1385
1364
|
- spec/unit/network/http/compression_spec.rb
|
@@ -1398,7 +1377,6 @@ files:
|
|
1398
1377
|
- spec/unit/network/rest_authconfig_spec.rb
|
1399
1378
|
- spec/unit/network/rights_spec.rb
|
1400
1379
|
- spec/unit/network/server_spec.rb
|
1401
|
-
- spec/unit/network/xmlrpc/client_spec.rb
|
1402
1380
|
- spec/unit/node/environment_spec.rb
|
1403
1381
|
- spec/unit/node/facts_spec.rb
|
1404
1382
|
- spec/unit/node_spec.rb
|
@@ -1481,6 +1459,8 @@ files:
|
|
1481
1459
|
- spec/unit/provider/exec/posix_spec.rb
|
1482
1460
|
- spec/unit/provider/exec/shell_spec.rb
|
1483
1461
|
- spec/unit/provider/exec/windows_spec.rb
|
1462
|
+
- spec/unit/provider/file/posix_spec.rb
|
1463
|
+
- spec/unit/provider/file/windows_spec.rb
|
1484
1464
|
- spec/unit/provider/group/groupadd_spec.rb
|
1485
1465
|
- spec/unit/provider/group/ldap_spec.rb
|
1486
1466
|
- spec/unit/provider/group/windows_adsi_spec.rb
|
@@ -1570,7 +1550,6 @@ files:
|
|
1570
1550
|
- spec/unit/ssl/host_spec.rb
|
1571
1551
|
- spec/unit/ssl/inventory_spec.rb
|
1572
1552
|
- spec/unit/ssl/key_spec.rb
|
1573
|
-
- spec/unit/sslcertificates/ca_spec.rb
|
1574
1553
|
- spec/unit/status_spec.rb
|
1575
1554
|
- spec/unit/transaction/event_manager_spec.rb
|
1576
1555
|
- spec/unit/transaction/event_spec.rb
|
@@ -1588,6 +1567,7 @@ files:
|
|
1588
1567
|
- spec/unit/type/file/ctime.rb
|
1589
1568
|
- spec/unit/type/file/ensure_spec.rb
|
1590
1569
|
- spec/unit/type/file/group_spec.rb
|
1570
|
+
- spec/unit/type/file/mode_spec.rb
|
1591
1571
|
- spec/unit/type/file/mtime.rb
|
1592
1572
|
- spec/unit/type/file/owner_spec.rb
|
1593
1573
|
- spec/unit/type/file/selinux_spec.rb
|
@@ -1,174 +0,0 @@
|
|
1
|
-
# the available clients
|
2
|
-
|
3
|
-
require 'puppet'
|
4
|
-
require 'puppet/network/xmlrpc/client'
|
5
|
-
require 'puppet/util/subclass_loader'
|
6
|
-
require 'puppet/util/methodhelper'
|
7
|
-
require 'puppet/sslcertificates/support'
|
8
|
-
|
9
|
-
require 'puppet/network/handler'
|
10
|
-
|
11
|
-
require 'net/http'
|
12
|
-
|
13
|
-
# Some versions of ruby don't have this method defined, which basically causes
|
14
|
-
# us to never use ssl. Yay.
|
15
|
-
class Net::HTTP
|
16
|
-
def use_ssl?
|
17
|
-
if defined?(@use_ssl)
|
18
|
-
@use_ssl
|
19
|
-
else
|
20
|
-
false
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# JJM: This is a "backport" of sorts to older ruby versions which
|
25
|
-
# do not have this accessor. See #896 for more information.
|
26
|
-
attr_accessor :enable_post_connection_check unless Net::HTTP.method_defined? "enable_post_connection_check"
|
27
|
-
end
|
28
|
-
|
29
|
-
# The base class for all of the clients. Many clients just directly
|
30
|
-
# call methods, but some of them need to do some extra work or
|
31
|
-
# provide a different interface.
|
32
|
-
class Puppet::Network::Client
|
33
|
-
Client = self
|
34
|
-
include Puppet::Util
|
35
|
-
extend Puppet::Util::SubclassLoader
|
36
|
-
include Puppet::Util::MethodHelper
|
37
|
-
|
38
|
-
# This handles reading in the key and such-like.
|
39
|
-
include Puppet::SSLCertificates::Support
|
40
|
-
|
41
|
-
attr_accessor :schedule, :lastrun, :local, :stopping
|
42
|
-
|
43
|
-
attr_reader :driver
|
44
|
-
|
45
|
-
# Set up subclass loading
|
46
|
-
handle_subclasses :client, "puppet/network/client"
|
47
|
-
|
48
|
-
# Determine what clients look for when being passed an object for local
|
49
|
-
# client/server stuff. E.g., you could call Client::CA.new(:CA => ca).
|
50
|
-
def self.drivername
|
51
|
-
@drivername ||= self.name
|
52
|
-
end
|
53
|
-
|
54
|
-
# Figure out the handler for our client.
|
55
|
-
def self.handler
|
56
|
-
@handler ||= Puppet::Network::Handler.handler(self.name)
|
57
|
-
end
|
58
|
-
|
59
|
-
# The class that handles xmlrpc interaction for us.
|
60
|
-
def self.xmlrpc_client
|
61
|
-
@xmlrpc_client ||= Puppet::Network::XMLRPCClient.handler_class(self.handler)
|
62
|
-
end
|
63
|
-
|
64
|
-
# Create our client.
|
65
|
-
def initialize(hash)
|
66
|
-
# to whom do we connect?
|
67
|
-
@server = nil
|
68
|
-
|
69
|
-
if hash.include?(:Cache)
|
70
|
-
@cache = hash[:Cache]
|
71
|
-
else
|
72
|
-
@cache = true
|
73
|
-
end
|
74
|
-
|
75
|
-
driverparam = self.class.drivername
|
76
|
-
if hash.include?(:Server)
|
77
|
-
args = {:Server => hash[:Server]}
|
78
|
-
@server = hash[:Server]
|
79
|
-
args[:Port] = hash[:Port] || Puppet[:masterport]
|
80
|
-
|
81
|
-
@driver = self.class.xmlrpc_client.new(args)
|
82
|
-
|
83
|
-
self.read_cert
|
84
|
-
|
85
|
-
@local = false
|
86
|
-
elsif hash.include?(driverparam)
|
87
|
-
@driver = hash[driverparam]
|
88
|
-
if @driver == true
|
89
|
-
@driver = self.class.handler.new
|
90
|
-
end
|
91
|
-
@local = true
|
92
|
-
else
|
93
|
-
raise Puppet::Network::ClientError, "#{self.class} must be passed a Server or #{driverparam}"
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# Are we a local client?
|
98
|
-
def local?
|
99
|
-
if @local
|
100
|
-
true
|
101
|
-
else
|
102
|
-
false
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
# Make sure we set the driver up when we read the cert in.
|
107
|
-
def recycle_connection
|
108
|
-
@driver.recycle_connection if @driver.respond_to?(:recycle_connection)
|
109
|
-
end
|
110
|
-
|
111
|
-
# A wrapper method to run and then store the last run time
|
112
|
-
def runnow
|
113
|
-
if self.stopping
|
114
|
-
Puppet.notice "In shutdown progress; skipping run"
|
115
|
-
return
|
116
|
-
end
|
117
|
-
begin
|
118
|
-
self.run
|
119
|
-
self.lastrun = Time.now.to_i
|
120
|
-
rescue => detail
|
121
|
-
puts detail.backtrace if Puppet[:trace]
|
122
|
-
Puppet.err "Could not run #{self.class}: #{detail}"
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
def run
|
127
|
-
raise Puppet::DevError, "Client type #{self.class} did not override run"
|
128
|
-
end
|
129
|
-
|
130
|
-
def scheduled?
|
131
|
-
if sched = self.schedule
|
132
|
-
return sched.match?(self.lastrun)
|
133
|
-
else
|
134
|
-
return true
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
def shutdown
|
139
|
-
if self.stopping
|
140
|
-
Puppet.notice "Already in shutdown"
|
141
|
-
else
|
142
|
-
self.stopping = true
|
143
|
-
Puppet::Util::Storage.store if self.respond_to? :running? and self.running?
|
144
|
-
rmpidfile
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
# Start listening for events. We're pretty much just listening for
|
149
|
-
# timer events here.
|
150
|
-
def start
|
151
|
-
# Create our timer. Puppet will handle observing it and such.
|
152
|
-
|
153
|
-
timer = Puppet.newtimer(
|
154
|
-
|
155
|
-
:interval => Puppet[:runinterval],
|
156
|
-
:tolerance => 1,
|
157
|
-
|
158
|
-
:start? => true
|
159
|
-
) do
|
160
|
-
begin
|
161
|
-
self.runnow if self.scheduled?
|
162
|
-
rescue => detail
|
163
|
-
puts detail.backtrace if Puppet[:trace]
|
164
|
-
Puppet.err "Could not run client; got otherwise uncaught exception: #{detail}"
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
# Run once before we start following the timer
|
169
|
-
self.runnow
|
170
|
-
end
|
171
|
-
|
172
|
-
require 'puppet/network/client/proxy'
|
173
|
-
end
|
174
|
-
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'puppet/network/client'
|
2
|
-
|
3
|
-
# Request a certificate from the remote system.
|
4
|
-
class Puppet::Network::Client::CA < Puppet::Network::Client
|
5
|
-
class InvalidCertificate < Puppet::Error; end
|
6
|
-
|
7
|
-
def initialize(options = {})
|
8
|
-
options = symbolize_options(options)
|
9
|
-
unless options.include?(:Server) or options.include?(:CA)
|
10
|
-
options[:Server] = Puppet[:ca_server]
|
11
|
-
options[:Port] = Puppet[:ca_port]
|
12
|
-
end
|
13
|
-
super(options)
|
14
|
-
end
|
15
|
-
|
16
|
-
# This client is really only able to request certificates for the
|
17
|
-
# current host. It uses the Puppet.settings settings to figure everything out.
|
18
|
-
def request_cert
|
19
|
-
Puppet.settings.use(:main, :ssl)
|
20
|
-
|
21
|
-
if cert = read_cert
|
22
|
-
return cert
|
23
|
-
end
|
24
|
-
|
25
|
-
begin
|
26
|
-
cert, cacert = @driver.getcert(csr.to_pem)
|
27
|
-
rescue => detail
|
28
|
-
puts detail.backtrace if Puppet[:trace]
|
29
|
-
raise Puppet::Error.new("Certificate retrieval failed: #{detail}")
|
30
|
-
end
|
31
|
-
|
32
|
-
if cert.nil? or cert == ""
|
33
|
-
return nil
|
34
|
-
end
|
35
|
-
|
36
|
-
begin
|
37
|
-
@cert = OpenSSL::X509::Certificate.new(cert)
|
38
|
-
@cacert = OpenSSL::X509::Certificate.new(cacert)
|
39
|
-
rescue => detail
|
40
|
-
raise InvalidCertificate.new(
|
41
|
-
"Invalid certificate: #{detail}"
|
42
|
-
)
|
43
|
-
end
|
44
|
-
|
45
|
-
unless @cert.check_private_key(key)
|
46
|
-
raise InvalidCertificate, "Certificate does not match private key. Try 'puppetca --clean #{Puppet[:certname]}' on the server."
|
47
|
-
end
|
48
|
-
|
49
|
-
# Only write the cert out if it passes validating.
|
50
|
-
Puppet.settings.write(:hostcert) do |f| f.print cert end
|
51
|
-
Puppet.settings.write(:localcacert) do |f| f.print cacert end
|
52
|
-
|
53
|
-
@cert
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|