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.

Files changed (140) hide show
  1. data/CHANGELOG +121 -0
  2. data/conf/redhat/puppet.spec +16 -7
  3. data/lib/puppet.rb +1 -1
  4. data/lib/puppet/application/cert.rb +17 -3
  5. data/lib/puppet/application/device.rb +1 -0
  6. data/lib/puppet/application/kick.rb +0 -2
  7. data/lib/puppet/application/resource.rb +73 -66
  8. data/lib/puppet/configurer/plugin_handler.rb +6 -2
  9. data/lib/puppet/defaults.rb +60 -5
  10. data/lib/puppet/face/ca.rb +11 -2
  11. data/lib/puppet/face/certificate.rb +33 -4
  12. data/lib/puppet/file_serving/fileset.rb +1 -1
  13. data/lib/puppet/file_serving/indirection_hooks.rb +2 -2
  14. data/lib/puppet/file_serving/metadata.rb +43 -4
  15. data/lib/puppet/indirector.rb +0 -1
  16. data/lib/puppet/indirector/request.rb +3 -4
  17. data/lib/puppet/indirector/resource/active_record.rb +3 -10
  18. data/lib/puppet/indirector/resource/ral.rb +2 -2
  19. data/lib/puppet/indirector/rest.rb +1 -1
  20. data/lib/puppet/network/handler/ca.rb +16 -106
  21. data/lib/puppet/network/handler/master.rb +0 -3
  22. data/lib/puppet/network/handler/runner.rb +1 -0
  23. data/lib/puppet/parser/scope.rb +10 -0
  24. data/lib/puppet/provider/file/posix.rb +72 -34
  25. data/lib/puppet/provider/file/windows.rb +100 -0
  26. data/lib/puppet/provider/group/windows_adsi.rb +2 -2
  27. data/lib/puppet/provider/user/windows_adsi.rb +19 -4
  28. data/lib/puppet/resource.rb +16 -0
  29. data/lib/puppet/resource/catalog.rb +1 -1
  30. data/lib/puppet/ssl/certificate.rb +2 -2
  31. data/lib/puppet/ssl/certificate_authority.rb +86 -10
  32. data/lib/puppet/ssl/certificate_authority/interface.rb +64 -19
  33. data/lib/puppet/ssl/certificate_factory.rb +112 -91
  34. data/lib/puppet/ssl/certificate_request.rb +88 -1
  35. data/lib/puppet/ssl/host.rb +20 -3
  36. data/lib/puppet/type/file.rb +15 -34
  37. data/lib/puppet/type/file/group.rb +11 -91
  38. data/lib/puppet/type/file/mode.rb +11 -41
  39. data/lib/puppet/type/file/owner.rb +18 -34
  40. data/lib/puppet/type/file/source.rb +22 -7
  41. data/lib/puppet/type/group.rb +4 -3
  42. data/lib/puppet/type/user.rb +4 -1
  43. data/lib/puppet/util.rb +59 -6
  44. data/lib/puppet/util/adsi.rb +11 -0
  45. data/lib/puppet/util/log.rb +4 -0
  46. data/lib/puppet/util/log/destinations.rb +7 -1
  47. data/lib/puppet/util/monkey_patches.rb +19 -0
  48. data/lib/puppet/util/network_device/config.rb +4 -5
  49. data/lib/puppet/util/settings.rb +5 -0
  50. data/lib/puppet/util/suidmanager.rb +0 -1
  51. data/lib/puppet/util/windows.rb +4 -0
  52. data/lib/puppet/util/windows/error.rb +16 -0
  53. data/lib/puppet/util/windows/security.rb +593 -0
  54. data/spec/integration/defaults_spec.rb +27 -0
  55. data/spec/integration/network/handler_spec.rb +1 -1
  56. data/spec/integration/type/file_spec.rb +382 -145
  57. data/spec/integration/util/windows/security_spec.rb +468 -0
  58. data/spec/shared_behaviours/file_serving.rb +4 -3
  59. data/spec/unit/application/agent_spec.rb +1 -0
  60. data/spec/unit/application/device_spec.rb +5 -0
  61. data/spec/unit/application/resource_spec.rb +62 -101
  62. data/spec/unit/configurer/downloader_spec.rb +2 -2
  63. data/spec/unit/configurer/plugin_handler_spec.rb +15 -8
  64. data/spec/unit/configurer_spec.rb +2 -2
  65. data/spec/unit/face/ca_spec.rb +34 -0
  66. data/spec/unit/face/certificate_spec.rb +168 -1
  67. data/spec/unit/file_serving/fileset_spec.rb +1 -1
  68. data/spec/unit/file_serving/indirection_hooks_spec.rb +1 -1
  69. data/spec/unit/file_serving/metadata_spec.rb +151 -107
  70. data/spec/unit/indirector/certificate_request/ca_spec.rb +0 -3
  71. data/spec/unit/indirector/direct_file_server_spec.rb +10 -9
  72. data/spec/unit/indirector/file_metadata/file_spec.rb +6 -4
  73. data/spec/unit/indirector/request_spec.rb +13 -3
  74. data/spec/unit/indirector/resource/active_record_spec.rb +4 -10
  75. data/spec/unit/indirector/resource/ral_spec.rb +6 -4
  76. data/spec/unit/indirector/rest_spec.rb +5 -6
  77. data/spec/unit/network/handler/ca_spec.rb +86 -0
  78. data/spec/unit/parser/collector_spec.rb +7 -7
  79. data/spec/unit/parser/scope_spec.rb +20 -0
  80. data/spec/unit/provider/file/posix_spec.rb +226 -0
  81. data/spec/unit/provider/file/windows_spec.rb +136 -0
  82. data/spec/unit/provider/group/windows_adsi_spec.rb +7 -2
  83. data/spec/unit/provider/user/windows_adsi_spec.rb +36 -3
  84. data/spec/unit/resource/catalog_spec.rb +20 -10
  85. data/spec/unit/resource_spec.rb +55 -8
  86. data/spec/unit/ssl/certificate_authority/interface_spec.rb +97 -54
  87. data/spec/unit/ssl/certificate_authority_spec.rb +133 -23
  88. data/spec/unit/ssl/certificate_factory_spec.rb +90 -70
  89. data/spec/unit/ssl/certificate_request_spec.rb +62 -1
  90. data/spec/unit/ssl/certificate_spec.rb +20 -14
  91. data/spec/unit/ssl/host_spec.rb +52 -6
  92. data/spec/unit/type/file/content_spec.rb +4 -4
  93. data/spec/unit/type/file/group_spec.rb +34 -96
  94. data/spec/unit/type/file/mode_spec.rb +88 -0
  95. data/spec/unit/type/file/owner_spec.rb +32 -123
  96. data/spec/unit/type/file/source_spec.rb +120 -41
  97. data/spec/unit/type/file_spec.rb +1033 -753
  98. data/spec/unit/type_spec.rb +19 -1
  99. data/spec/unit/util/adsi_spec.rb +19 -0
  100. data/spec/unit/util/log/destinations_spec.rb +75 -0
  101. data/spec/unit/util/log_spec.rb +15 -0
  102. data/spec/unit/util/network_device/config_spec.rb +7 -0
  103. data/spec/unit/util/settings_spec.rb +10 -0
  104. data/spec/unit/util_spec.rb +126 -13
  105. data/test/language/functions.rb +0 -1
  106. data/test/language/snippets.rb +0 -9
  107. data/test/lib/puppettest/exetest.rb +1 -1
  108. data/test/lib/puppettest/servertest.rb +0 -1
  109. data/test/rails/rails.rb +0 -1
  110. data/test/ral/type/filesources.rb +0 -60
  111. metadata +13 -33
  112. data/lib/puppet/network/client.rb +0 -174
  113. data/lib/puppet/network/client/ca.rb +0 -56
  114. data/lib/puppet/network/client/file.rb +0 -6
  115. data/lib/puppet/network/client/proxy.rb +0 -27
  116. data/lib/puppet/network/client/report.rb +0 -26
  117. data/lib/puppet/network/client/runner.rb +0 -10
  118. data/lib/puppet/network/client/status.rb +0 -4
  119. data/lib/puppet/network/http_server.rb +0 -3
  120. data/lib/puppet/network/http_server/mongrel.rb +0 -130
  121. data/lib/puppet/network/http_server/webrick.rb +0 -155
  122. data/lib/puppet/network/xmlrpc/client.rb +0 -211
  123. data/lib/puppet/provider/file/win32.rb +0 -72
  124. data/lib/puppet/sslcertificates.rb +0 -146
  125. data/lib/puppet/sslcertificates/ca.rb +0 -375
  126. data/lib/puppet/sslcertificates/certificate.rb +0 -255
  127. data/lib/puppet/sslcertificates/inventory.rb +0 -38
  128. data/lib/puppet/sslcertificates/support.rb +0 -146
  129. data/spec/integration/network/client_spec.rb +0 -18
  130. data/spec/unit/network/xmlrpc/client_spec.rb +0 -172
  131. data/spec/unit/sslcertificates/ca_spec.rb +0 -106
  132. data/test/certmgr/certmgr.rb +0 -308
  133. data/test/certmgr/inventory.rb +0 -69
  134. data/test/certmgr/support.rb +0 -105
  135. data/test/network/client/ca.rb +0 -69
  136. data/test/network/client/dipper.rb +0 -34
  137. data/test/network/handler/ca.rb +0 -273
  138. data/test/network/server/mongrel_test.rb +0 -99
  139. data/test/network/server/webrick.rb +0 -111
  140. data/test/network/xmlrpc/client.rb +0 -45
@@ -1,99 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest')
4
-
5
- require 'puppettest'
6
- require 'mocha'
7
-
8
- class TestMongrelServer < PuppetTest::TestCase
9
- confine "Missing mongrel" => Puppet.features.mongrel?
10
-
11
- include PuppetTest::ServerTest
12
-
13
- def mkserver(handlers = nil)
14
- handlers ||= { :Status => nil }
15
- mongrel = Puppet::Network::HTTPServer::Mongrel.new(handlers)
16
- end
17
-
18
- # Make sure client info is correctly extracted.
19
- def test_client_info
20
- obj = Object.new
21
- obj.singleton_class.send(:attr_accessor, :params)
22
- params = {}
23
- obj.params = params
24
-
25
- mongrel = mkserver
26
-
27
- ip = Facter.value(:ipaddress)
28
- params["REMOTE_ADDR"] = ip
29
- params[Puppet[:ssl_client_header]] = ""
30
- params[Puppet[:ssl_client_verify_header]] = "failure"
31
- info = nil
32
- Resolv.expects(:getname).with(ip).returns("host.domain.com").times(4)
33
- assert_nothing_raised("Could not call client_info") do
34
- info = mongrel.send(:client_info, obj)
35
- end
36
- assert(! info.authenticated?, "Client info object was marked valid even though headers were missing")
37
- assert_equal(ip, info.ip, "Did not copy over ip correctly")
38
-
39
- assert_equal("host.domain.com", info.name, "Did not copy over hostname correctly")
40
-
41
- # Now pass the X-Forwarded-For header and check it is preferred over REMOTE_ADDR
42
- params["REMOTE_ADDR"] = '127.0.0.1'
43
- params["HTTP_X_FORWARDED_FOR"] = ip
44
- info = nil
45
- assert_nothing_raised("Could not call client_info") do
46
- info = mongrel.send(:client_info, obj)
47
- end
48
- assert(! info.authenticated?, "Client info object was marked valid even though headers were missing")
49
- assert_equal(ip, info.ip, "Did not copy over ip correctly")
50
-
51
- assert_equal("host.domain.com", info.name, "Did not copy over hostname correctly")
52
-
53
- # Now add a valid auth header.
54
- params["REMOTE_ADDR"] = ip
55
- params["HTTP_X_FORWARDED_FOR"] = nil
56
- params[Puppet[:ssl_client_header]] = "/CN=host.domain.com"
57
- assert_nothing_raised("Could not call client_info") do
58
- info = mongrel.send(:client_info, obj)
59
- end
60
- assert(! info.authenticated?, "Client info object was marked valid even though the verify header was fals")
61
- assert_equal(ip, info.ip, "Did not copy over ip correctly")
62
- assert_equal("host.domain.com", info.name, "Did not copy over hostname correctly")
63
-
64
- # Now change the verify header to be true
65
- params[Puppet[:ssl_client_verify_header]] = "SUCCESS"
66
- assert_nothing_raised("Could not call client_info") do
67
- info = mongrel.send(:client_info, obj)
68
- end
69
-
70
- assert(info.authenticated?, "Client info object was not marked valid even though all headers were correct")
71
- assert_equal(ip, info.ip, "Did not copy over ip correctly")
72
- assert_equal("host.domain.com", info.name, "Did not copy over hostname correctly")
73
-
74
- # Now try it with a different header name
75
- params.delete(Puppet[:ssl_client_header])
76
- Puppet[:ssl_client_header] = "header_testing"
77
- params["header_testing"] = "/CN=other.domain.com"
78
- info = nil
79
- assert_nothing_raised("Could not call client_info with other header") do
80
- info = mongrel.send(:client_info, obj)
81
- end
82
-
83
- assert(info.authenticated?, "Client info object was not marked valid even though the header was present")
84
- assert_equal(ip, info.ip, "Did not copy over ip correctly")
85
- assert_equal("other.domain.com", info.name, "Did not copy over hostname correctly")
86
-
87
- # Now make sure it's considered invalid without that header
88
- params.delete("header_testing")
89
- info = nil
90
- assert_nothing_raised("Could not call client_info with no header") do
91
- info = mongrel.send(:client_info, obj)
92
- end
93
-
94
- assert(! info.authenticated?, "Client info object was marked valid without header")
95
- assert_equal(ip, info.ip, "Did not copy over ip correctly")
96
- assert_equal(Resolv.getname(ip), info.name, "Did not look up hostname correctly")
97
- end
98
- end
99
-
@@ -1,111 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest')
4
-
5
- require 'puppettest'
6
- require 'puppet/network/http_server/webrick'
7
- require 'mocha'
8
-
9
- class TestWebrickServer < Test::Unit::TestCase
10
- include PuppetTest::ServerTest
11
-
12
- def setup
13
- Puppet::Util::SUIDManager.stubs(:asuser).yields
14
- Puppet::SSL::Host.instance_variable_set(:@localhost, nil)
15
- super
16
- end
17
-
18
- # Make sure we can create a server, and that it knows how to create its
19
- # certs by default.
20
- def test_basics
21
- server = nil
22
- assert_raise(Puppet::Error, "server succeeded with no cert") do
23
- server = Puppet::Network::HTTPServer::WEBrick.new(
24
- :Port => @@port,
25
- :Handlers => {
26
- :Status => nil
27
- }
28
- )
29
- end
30
-
31
- assert_nothing_raised("Could not create simple server") do
32
- server = Puppet::Network::HTTPServer::WEBrick.new(
33
- :Port => @@port,
34
- :Handlers => {
35
- :CA => {}, # so that certs autogenerate
36
- :Status => nil
37
- }
38
- )
39
- end
40
-
41
- assert(server, "did not create server")
42
-
43
- assert(server.cert, "did not retrieve cert")
44
- end
45
-
46
- # test that we can connect to the server
47
- # we have to use fork here, because we apparently can't use threads
48
- # to talk to other threads
49
- def test_connect_with_fork
50
- Puppet[:autosign] = true
51
- serverpid, server = mk_status_server
52
-
53
- # create a status client, and verify it can talk
54
- client = mk_status_client
55
-
56
- assert(client.cert, "did not get cert for client")
57
-
58
- retval = nil
59
- assert_nothing_raised("Could not connect to server") {
60
- retval = client.status
61
- }
62
- assert_equal(1, retval)
63
- end
64
-
65
- def mk_status_client
66
- client = nil
67
-
68
- assert_nothing_raised {
69
- client = Puppet::Network::Client.status.new(
70
- :Server => "localhost",
71
- :Port => @@port
72
- )
73
- }
74
- client
75
- end
76
-
77
- def mk_status_server
78
- server = nil
79
- Puppet[:certdnsnames] = "localhost"
80
- assert_nothing_raised {
81
- server = Puppet::Network::HTTPServer::WEBrick.new(
82
- :Port => @@port,
83
- :Handlers => {
84
- :CA => {}, # so that certs autogenerate
85
- :Status => nil
86
- }
87
- )
88
- }
89
-
90
- pid = fork {
91
- Puppet.run_mode.stubs(:master?).returns true
92
- assert_nothing_raised {
93
- trap(:INT) { server.shutdown }
94
- server.start
95
- }
96
- }
97
- @@tmppids << pid
98
- [pid, server]
99
- end
100
-
101
- def kill_and_wait(pid, file)
102
- %x{kill -INT #{pid} 2>/dev/null}
103
- count = 0
104
- while count < 30 && File::exist?(file)
105
- count += 1
106
- sleep(1)
107
- end
108
- assert(count < 30, "Killing server #{pid} failed")
109
- end
110
- end
111
-
@@ -1,45 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest')
4
-
5
- require 'puppettest'
6
- require 'puppet/network/xmlrpc/client'
7
- require 'mocha'
8
-
9
- class TestXMLRPCClient < Test::Unit::TestCase
10
- include PuppetTest
11
-
12
- def setup
13
- Puppet::Util::SUIDManager.stubs(:asuser).yields
14
- super
15
- end
16
-
17
- def test_set_backtrace
18
- error = Puppet::Network::XMLRPCClientError.new("An error")
19
- assert_nothing_raised do
20
- error.set_backtrace ["caller"]
21
- end
22
- assert_equal(["caller"], error.backtrace)
23
- end
24
-
25
- # Make sure we correctly generate a netclient
26
- def test_handler_class
27
- # Create a test handler
28
- klass = Puppet::Network::XMLRPCClient
29
- yay = Class.new(Puppet::Network::Handler) do
30
- @interface = XMLRPC::Service::Interface.new("yay") { |iface|
31
- iface.add_method("array getcert(csr)")
32
- }
33
-
34
- @name = :Yay
35
- end
36
- Object.const_set("Yay", yay)
37
-
38
- net = nil
39
- assert_nothing_raised("Failed when retrieving client for handler") do
40
- net = klass.handler_class(yay)
41
- end
42
-
43
- assert(net, "did not get net client")
44
- end
45
- end