puppet 0.25.1 → 0.25.2

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 (198) hide show
  1. data/CHANGELOG +159 -135
  2. data/Rakefile +4 -1
  3. data/conf/gentoo/conf.d/puppetmaster +1 -1
  4. data/conf/osx/createpackage.sh +12 -0
  5. data/conf/osx/preflight +4 -0
  6. data/conf/redhat/puppet.spec +12 -2
  7. data/conf/redhat/server.init +1 -0
  8. data/conf/redhat/server.sysconfig +1 -1
  9. data/ext/ldap/puppet.schema +5 -9
  10. data/ext/puppetlast +2 -1
  11. data/ext/rack/README +2 -2
  12. data/ext/regexp_nodes/classes/databases +2 -0
  13. data/ext/regexp_nodes/classes/webservers +2 -0
  14. data/ext/regexp_nodes/parameters/environment/prod +1 -0
  15. data/ext/regexp_nodes/parameters/environment/qa +3 -0
  16. data/ext/regexp_nodes/regexp_nodes.rb +215 -0
  17. data/lib/puppet.rb +1 -1
  18. data/lib/puppet/agent.rb +2 -2
  19. data/lib/puppet/application/puppet.rb +1 -1
  20. data/lib/puppet/application/puppetd.rb +1 -1
  21. data/lib/puppet/application/puppetdoc.rb +4 -3
  22. data/lib/puppet/application/puppetrun.rb +5 -14
  23. data/lib/puppet/application/ralsh.rb +9 -25
  24. data/lib/puppet/configurer.rb +2 -1
  25. data/lib/puppet/configurer/fact_handler.rb +8 -6
  26. data/lib/puppet/daemon.rb +2 -2
  27. data/lib/puppet/defaults.rb +21 -2
  28. data/lib/puppet/external/pson/common.rb +1 -1
  29. data/lib/puppet/external/pson/pure.rb +3 -3
  30. data/lib/puppet/feature/base.rb +3 -0
  31. data/lib/puppet/feature/selinux.rb +3 -0
  32. data/lib/puppet/feature/zlib.rb +6 -0
  33. data/lib/puppet/file_serving/base.rb +16 -1
  34. data/lib/puppet/file_serving/metadata.rb +46 -9
  35. data/lib/puppet/file_serving/mount/file.rb +4 -1
  36. data/lib/puppet/indirector/catalog/active_record.rb +5 -0
  37. data/lib/puppet/indirector/envelope.rb +1 -3
  38. data/lib/puppet/indirector/indirection.rb +13 -16
  39. data/lib/puppet/indirector/node/ldap.rb +7 -4
  40. data/lib/puppet/indirector/ssl_file.rb +1 -1
  41. data/lib/puppet/network/authstore.rb +48 -118
  42. data/lib/puppet/network/client/resource.rb +2 -15
  43. data/lib/puppet/network/format.rb +2 -12
  44. data/lib/puppet/network/format_handler.rb +15 -1
  45. data/lib/puppet/network/formats.rb +19 -4
  46. data/lib/puppet/network/handler/fileserver.rb +1 -0
  47. data/lib/puppet/network/http/handler.rb +1 -0
  48. data/lib/puppet/network/http/rack/httphandler.rb +0 -18
  49. data/lib/puppet/network/http/rack/rest.rb +4 -4
  50. data/lib/puppet/network/http/rack/xmlrpc.rb +4 -4
  51. data/lib/puppet/network/http/webrick.rb +2 -1
  52. data/lib/puppet/network/server.rb +1 -1
  53. data/lib/puppet/node/environment.rb +20 -9
  54. data/lib/puppet/parameter.rb +17 -1
  55. data/lib/puppet/parser/ast/boolean_operator.rb +2 -2
  56. data/lib/puppet/parser/ast/leaf.rb +5 -1
  57. data/lib/puppet/parser/ast/resourceparam.rb +4 -0
  58. data/lib/puppet/parser/ast/selector.rb +4 -0
  59. data/lib/puppet/parser/functions/generate.rb +2 -2
  60. data/lib/puppet/parser/functions/shellquote.rb +1 -1
  61. data/lib/puppet/property.rb +3 -11
  62. data/lib/puppet/provider/cron/crontab.rb +2 -0
  63. data/lib/puppet/provider/host/parsed.rb +9 -9
  64. data/lib/puppet/provider/package/blastwave.rb +7 -6
  65. data/lib/puppet/provider/package/portage.rb +23 -27
  66. data/lib/puppet/provider/package/rug.rb +1 -1
  67. data/lib/puppet/provider/package/sun.rb +5 -3
  68. data/lib/puppet/provider/service/daemontools.rb +1 -1
  69. data/lib/puppet/provider/service/debian.rb +1 -1
  70. data/lib/puppet/provider/service/runit.rb +1 -1
  71. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +2 -1
  72. data/lib/puppet/provider/sshkey/parsed.rb +3 -5
  73. data/lib/puppet/provider/zone/solaris.rb +1 -1
  74. data/lib/puppet/rails.rb +9 -2
  75. data/lib/puppet/rails/benchmark.rb +1 -1
  76. data/lib/puppet/rails/host.rb +2 -7
  77. data/lib/puppet/rails/resource.rb +20 -26
  78. data/lib/puppet/resource/catalog.rb +3 -3
  79. data/lib/puppet/resource/reference.rb +13 -25
  80. data/lib/puppet/ssl/certificate.rb +3 -2
  81. data/lib/puppet/ssl/host.rb +14 -33
  82. data/lib/puppet/sslcertificates.rb +1 -5
  83. data/lib/puppet/sslcertificates/ca.rb +8 -7
  84. data/lib/puppet/transaction.rb +15 -12
  85. data/lib/puppet/type.rb +12 -5
  86. data/lib/puppet/type/file.rb +26 -32
  87. data/lib/puppet/type/file/content.rb +5 -5
  88. data/lib/puppet/type/file/ensure.rb +6 -17
  89. data/lib/puppet/type/file/mode.rb +18 -1
  90. data/lib/puppet/type/file/source.rb +12 -12
  91. data/lib/puppet/type/host.rb +6 -9
  92. data/lib/puppet/type/k5login.rb +1 -1
  93. data/lib/puppet/type/maillist.rb +4 -7
  94. data/lib/puppet/type/port.rb +6 -5
  95. data/lib/puppet/type/resources.rb +12 -12
  96. data/lib/puppet/type/sshkey.rb +5 -5
  97. data/lib/puppet/type/tidy.rb +9 -2
  98. data/lib/puppet/type/yumrepo.rb +3 -1
  99. data/lib/puppet/util.rb +64 -56
  100. data/lib/puppet/util/backups.rb +2 -1
  101. data/lib/puppet/util/filetype.rb +46 -0
  102. data/lib/puppet/util/log.rb +10 -18
  103. data/lib/puppet/util/log_paths.rb +14 -0
  104. data/lib/puppet/util/methodhelper.rb +3 -4
  105. data/lib/puppet/util/monkey_patches.rb +8 -0
  106. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +5 -3
  107. data/lib/puppet/util/rdoc/parser.rb +32 -16
  108. data/lib/puppet/util/reference.rb +6 -3
  109. data/lib/puppet/util/selinux.rb +21 -14
  110. data/lib/puppet/util/settings.rb +30 -25
  111. data/lib/puppet/util/settings/file_setting.rb +7 -4
  112. data/lib/puppet/util/subclass_loader.rb +1 -1
  113. data/lib/puppet/util/suidmanager.rb +11 -1
  114. data/lib/puppet/util/tagging.rb +22 -4
  115. data/man/man8/filebucket.8 +23 -18
  116. data/man/man8/pi.8 +42 -20
  117. data/man/man8/puppet.8 +47 -32
  118. data/man/man8/puppet.conf.8 +807 -764
  119. data/man/man8/puppetca.8 +24 -14
  120. data/man/man8/puppetd.8 +33 -16
  121. data/man/man8/puppetdoc.8 +71 -18
  122. data/man/man8/puppetmasterd.8 +18 -25
  123. data/man/man8/puppetqd.8 +60 -0
  124. data/man/man8/puppetrun.8 +27 -14
  125. data/man/man8/ralsh.8 +33 -40
  126. data/spec/integration/bin/puppetmasterd.rb +3 -2
  127. data/spec/integration/defaults.rb +11 -0
  128. data/spec/integration/file_serving/metadata.rb +1 -0
  129. data/spec/integration/indirector/file_content/file_server.rb +2 -1
  130. data/spec/integration/ssl/certificate_request.rb +2 -0
  131. data/spec/integration/type/file.rb +20 -1
  132. data/spec/shared_behaviours/file_serving.rb +1 -1
  133. data/spec/spec_helper.rb +1 -1
  134. data/spec/unit/application/puppet.rb +11 -30
  135. data/spec/unit/application/puppetd.rb +1 -0
  136. data/spec/unit/application/puppetdoc.rb +13 -4
  137. data/spec/unit/application/puppetmasterd.rb +1 -0
  138. data/spec/unit/application/puppetrun.rb +12 -2
  139. data/spec/unit/application/ralsh.rb +39 -22
  140. data/spec/unit/configurer.rb +6 -0
  141. data/spec/unit/configurer/fact_handler.rb +15 -1
  142. data/spec/unit/file_serving/metadata.rb +128 -16
  143. data/spec/unit/file_serving/mount/file.rb +8 -0
  144. data/spec/unit/indirector/catalog/active_record.rb +20 -1
  145. data/spec/unit/indirector/catalog/compiler.rb +2 -1
  146. data/spec/unit/indirector/indirection.rb +29 -18
  147. data/spec/unit/indirector/node/ldap.rb +20 -6
  148. data/spec/unit/network/authstore.rb +197 -0
  149. data/spec/unit/network/format_handler.rb +28 -8
  150. data/spec/unit/network/formats.rb +31 -0
  151. data/spec/unit/network/http/handler.rb +10 -0
  152. data/spec/unit/network/http/webrick.rb +2 -2
  153. data/spec/unit/network/rest_authconfig.rb +2 -2
  154. data/spec/unit/network/rights.rb +1 -1
  155. data/spec/unit/node/environment.rb +39 -23
  156. data/spec/unit/other/selinux.rb +2 -2
  157. data/spec/unit/parameter.rb +8 -0
  158. data/spec/unit/parser/ast/leaf.rb +9 -0
  159. data/spec/unit/parser/ast/selector.rb +8 -1
  160. data/spec/unit/parser/lexer.rb +1 -1
  161. data/spec/unit/parser/resource.rb +11 -0
  162. data/spec/unit/parser/resource/reference.rb +13 -1
  163. data/spec/unit/property.rb +6 -0
  164. data/spec/unit/provider/mount/parsed.rb +3 -1
  165. data/spec/unit/provider/service/debian.rb +1 -1
  166. data/spec/unit/provider/ssh_authorized_key/parsed.rb +9 -1
  167. data/spec/unit/provider/sshkey/parsed.rb +19 -0
  168. data/spec/unit/rails.rb +22 -9
  169. data/spec/unit/rails/resource.rb +20 -0
  170. data/spec/unit/ssl/host.rb +19 -57
  171. data/spec/unit/transaction.rb +39 -4
  172. data/spec/unit/type.rb +9 -0
  173. data/spec/unit/type/file/content.rb +29 -0
  174. data/spec/unit/type/maillist.rb +42 -0
  175. data/spec/unit/type/resources.rb +66 -1
  176. data/spec/unit/type/tidy.rb +14 -1
  177. data/spec/unit/util/autoload.rb +2 -0
  178. data/spec/unit/util/ldap/connection.rb +1 -1
  179. data/spec/unit/util/log.rb +14 -0
  180. data/spec/unit/util/monkey_patches.rb +103 -0
  181. data/spec/unit/util/queue.rb +10 -2
  182. data/spec/unit/util/selinux.rb +61 -2
  183. data/spec/unit/util/settings.rb +19 -0
  184. data/spec/unit/util/settings/file_setting.rb +25 -0
  185. data/spec/unit/util/tagging.rb +10 -0
  186. data/tasks/rake/changelog.rake +15 -0
  187. data/tasks/rake/ci.rake +22 -0
  188. data/tasks/rake/dailybuild.rake +9 -0
  189. data/tasks/rake/gem.rake +46 -0
  190. data/tasks/rake/git_workflow.rake +121 -0
  191. data/tasks/rake/metrics.rake +6 -0
  192. data/tasks/rake/sign.rake +14 -0
  193. data/tasks/rake/testbranch.rake +16 -0
  194. data/tasks/rake/tracdocs.rake +8 -0
  195. data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +1 -0
  196. metadata +1042 -1288
  197. data/ext/bin/sleeper +0 -67
  198. data/ext/module_puppet +0 -209
@@ -0,0 +1,60 @@
1
+ .TH Synopsis "" "" ""
2
+ .SH NAME
3
+ Synopsis \-
4
+ .\" Man page generated from reStructeredText.
5
+ Retrieve serialized records from a queue and process them in order.
6
+
7
+
8
+ .SH USAGE
9
+ .INDENT 0.0
10
+ .INDENT 3.5
11
+ puppetqd [\-d|\-\-debug] [\-v|\-\-verbose]
12
+
13
+ .UNINDENT
14
+ .UNINDENT
15
+
16
+ .SH DESCRIPTION
17
+ This is a simple application that just processes entities in a queue as
18
+ they are recieved.
19
+
20
+
21
+ .SH OPTIONS
22
+ Note that any configuration parameter that\'s valid in the configuration
23
+ file is also a valid long argument. For example, \'server\' is a valid
24
+ configuration parameter, so you can specify \'\-\-server <servername>\' as
25
+ an argument.
26
+
27
+ See the configuration file documentation at
28
+ \fI\%http://reductivelabs.com/trac/puppet/wiki/ConfigurationReference\fP for the
29
+ full list of acceptable parameters. A commented list of all
30
+ configuration options can also be generated by running puppetd with
31
+ \'\-\-genconfig\'.
32
+
33
+ debug: Enable full debugging.
34
+
35
+ help: Print this help message
36
+
37
+ verbose: Turn on verbose reporting.
38
+
39
+ version: Print the puppet version number and exit.
40
+
41
+
42
+ .SH EXAMPLE
43
+ .INDENT 0.0
44
+ .INDENT 3.5
45
+ puppetqd
46
+
47
+ .UNINDENT
48
+ .UNINDENT
49
+
50
+ .SH AUTHOR
51
+ Luke Kanies
52
+
53
+
54
+ .SH COPYRIGHT
55
+ Copyright (c) 2009 Reductive Labs, LLC Licensed under the GNU Public
56
+ License
57
+
58
+
59
+ .\" Generated by docutils manpage writer on 2009-12-30 19:32.
60
+ .\"
@@ -1,7 +1,6 @@
1
1
  .TH "" "" ""
2
2
  .SH NAME
3
- \-
4
-
3
+ \-
5
4
  .\" Man page generated from reStructeredText.
6
5
 
7
6
  .SH SYNOPSIS
@@ -9,16 +8,18 @@ Trigger a puppetd run on a set of hosts.
9
8
 
10
9
 
11
10
  .SH USAGE
12
-
13
- .\" visit_block_quote
11
+ .INDENT 0.0
12
+ .INDENT 3.5
13
+ .INDENT 0.0
14
14
 
15
15
  .TP
16
16
  .B puppetrun [\-a|\-\-all] [\-c|\-\-class <class>] [\-d|\-\-debug] [\-f|\-\-foreground]
17
17
  [\-h|\-\-help] [\-\-host <host>] [\-\-no\-fqdn] [\-\-ignoreschedules]
18
- [\-t|\-\-tag <tag>] [\-\-test]
19
-
18
+ [\-t|\-\-tag <tag>] [\-\-test] [\-p|\-\-ping]
20
19
 
21
- .\" depart_block_quote
20
+ .UNINDENT
21
+ .UNINDENT
22
+ .UNINDENT
22
23
 
23
24
  .SH DESCRIPTION
24
25
  This script can be used to connect to a set of machines running
@@ -75,11 +76,12 @@ configuration parameter, so you can specify \'\-\-ssldir <directory>\' as an
75
76
  argument.
76
77
 
77
78
  See the configuration file documentation at
78
- http://reductivelabs.com/projects/puppet/reference/configref.html for
79
+ \fI\%http://reductivelabs.com/projects/puppet/reference/configref.html\fP for
79
80
  the full list of acceptable parameters. A commented list of all
80
81
  configuration options can also be generated by running puppetmasterdd
81
82
  with \'\-\-genconfig\'.
82
83
 
84
+ .INDENT 0.0
83
85
 
84
86
  .TP
85
87
  .B all: Connect to all available hosts. Requires LDAP support
@@ -90,16 +92,20 @@ at this point.
90
92
  .B class: Specify a class of machines to which to connect. This
91
93
  only works if you have LDAP configured, at the moment.
92
94
 
95
+ .UNINDENT
93
96
  debug: Enable full debugging.
94
97
 
98
+ .INDENT 0.0
95
99
 
96
100
  .TP
97
101
  .B foreground: Run each configuration in the foreground; that is, when
98
102
  connecting to a host, do not return until the host has
99
103
  finished its run. The default is false.
100
104
 
105
+ .UNINDENT
101
106
  help: Print this help message
102
107
 
108
+ .INDENT 0.0
103
109
 
104
110
  .TP
105
111
  .B host: A specific host to which to connect. This flag can be
@@ -129,14 +135,21 @@ not work with the \-\-test option.
129
135
  actually connect. This option requires LDAP support at
130
136
  this point.
131
137
 
138
+ .UNINDENT
139
+ ping:
132
140
 
133
- .SH EXAMPLE
134
141
 
135
- .\" visit_block_quote
136
- sudo puppetrun \-p 10 \-\-host host1 \-\-host host2 \-t remotefile \-t webserver
142
+ .nf
143
+ Do a ICMP echo against the target host. Skip hosts that don\'t respond to ping.
144
+ .fi
137
145
 
146
+ .SH EXAMPLE
147
+ .INDENT 0.0
148
+ .INDENT 3.5
149
+ sudo puppetrun \-p 10 \-\-host host1 \-\-host host2 \-t remotefile \-t webserver
138
150
 
139
- .\" depart_block_quote
151
+ .UNINDENT
152
+ .UNINDENT
140
153
 
141
154
  .SH AUTHOR
142
155
  Luke Kanies
@@ -147,5 +160,5 @@ Copyright (c) 2005 Reductive Labs, LLC Licensed under the GNU Public
147
160
  License
148
161
 
149
162
 
150
- .\" Generated by docutils manpage writer on 2008-05-05 09:33.
151
- .\"
163
+ .\" Generated by docutils manpage writer on 2009-12-30 19:31.
164
+ .\"
@@ -1,7 +1,6 @@
1
1
  .TH "" "" ""
2
2
  .SH NAME
3
- \-
4
-
3
+ \-
5
4
  .\" Man page generated from reStructeredText.
6
5
  vim: softtabstop=4 shiftwidth=4 expandtab
7
6
 
@@ -11,15 +10,17 @@ Use the Puppet RAL to directly interact with the system.
11
10
 
12
11
 
13
12
  .SH USAGE
14
-
15
- .\" visit_block_quote
13
+ .INDENT 0.0
14
+ .INDENT 3.5
15
+ .INDENT 0.0
16
16
 
17
17
  .TP
18
18
  .B ralsh [\-h|\-\-help] [\-d|\-\-debug] [\-v|\-\-verbose] [\-e|\-\-edit] [\-H|\-\-host <host>]
19
19
  [\-p|\-\-param <param>] [\-t|\-\-types] type <name>
20
20
 
21
-
22
- .\" depart_block_quote
21
+ .UNINDENT
22
+ .UNINDENT
23
+ .UNINDENT
23
24
 
24
25
  .SH DESCRIPTION
25
26
  This command provides simple facilities for converting current system
@@ -44,8 +45,8 @@ configuration parameter, so you can specify \'\-\-ssldir <directory>\' as an
44
45
  argument.
45
46
 
46
47
  See the configuration file documentation at
47
- http://reductivelabs.com/projects/puppet/reference/configref.html for
48
- the full list of acceptable parameters. A commented list of all
48
+ \fI\%http://reductivelabs.com/trac/puppet/wiki/ConfigurationReference\fP for the
49
+ full list of acceptable parameters. A commented list of all
49
50
  configuration options can also be generated by running puppet with
50
51
  \'\-\-genconfig\'.
51
52
 
@@ -53,60 +54,52 @@ debug: Enable full debugging.
53
54
 
54
55
  edit:
55
56
 
56
-
57
- .\" visit_block_quote
57
+ .INDENT 0.0
58
+ .INDENT 3.5
58
59
  Write the results of the query to a file, open the file in an editor,
59
60
  and read the file back in as an executable Puppet manifest.
60
61
 
61
-
62
- .\" depart_block_quote
62
+ .UNINDENT
63
+ .UNINDENT
63
64
  host:
64
65
 
65
-
66
- .\" visit_block_quote
66
+ .INDENT 0.0
67
+ .INDENT 3.5
67
68
  When specified, connect to the resource server on the named host
68
69
  and retrieve the list of resouces of the type specified.
69
70
 
70
-
71
- .\" depart_block_quote
71
+ .UNINDENT
72
+ .UNINDENT
72
73
  help:
73
74
 
74
-
75
- .\" visit_block_quote
75
+ .INDENT 0.0
76
+ .INDENT 3.5
76
77
  Print this help message.
77
78
 
78
-
79
- .\" depart_block_quote
79
+ .UNINDENT
80
+ .UNINDENT
80
81
  param:
81
82
 
82
-
83
- .\" visit_block_quote
83
+ .INDENT 0.0
84
+ .INDENT 3.5
84
85
  Add more parameters to be outputted from queries.
85
86
 
86
-
87
- .\" depart_block_quote
87
+ .UNINDENT
88
+ .UNINDENT
88
89
  types:
89
90
 
90
-
91
- .\" visit_block_quote
91
+ .INDENT 0.0
92
+ .INDENT 3.5
92
93
  List all available types.
93
94
 
94
-
95
- .\" depart_block_quote
95
+ .UNINDENT
96
+ .UNINDENT
96
97
  verbose: Print extra information.
97
98
 
98
99
 
99
100
  .SH EXAMPLE
100
- This example uses
101
- .\" visit_literal
102
- ralsh
103
- .\" depart_literal
104
- to return Puppet configuration for the user
105
-
106
- .\" visit_literal
107
- luke
108
- .\" depart_literal
109
- :
101
+ This example uses \fBralsh\fP to return Puppet configuration for the user
102
+ \fBluke\fP:
110
103
 
111
104
 
112
105
  .nf
@@ -131,5 +124,5 @@ Copyright (c) 2005\-2007 Reductive Labs, LLC Licensed under the GNU
131
124
  Public License
132
125
 
133
126
 
134
- .\" Generated by docutils manpage writer on 2008-05-05 09:33.
135
- .\"
127
+ .\" Generated by docutils manpage writer on 2009-12-30 19:24.
128
+ .\"
@@ -51,7 +51,8 @@ describe "puppetmasterd" do
51
51
  args = arguments + addl_args
52
52
 
53
53
  bin = File.join(File.dirname(__FILE__), "..", "..", "..", "sbin", "puppetmasterd")
54
- output = %x{#{bin} #{args}}.chomp
54
+ lib = File.join(File.dirname(__FILE__), "..", "..", "..", "lib")
55
+ output = %x{/usr/bin/env ruby -I #{lib} #{bin} #{args}}.chomp
55
56
  end
56
57
 
57
58
  def stop
@@ -72,7 +73,7 @@ describe "puppetmasterd" do
72
73
  it "should be serving status information over xmlrpc" do
73
74
  start
74
75
 
75
- sleep 0.5
76
+ sleep 5
76
77
 
77
78
  client = Puppet::Network::Client.status.new(:Server => "localhost", :Port => @@port)
78
79
 
@@ -29,6 +29,17 @@ describe "Puppet defaults" do
29
29
  end
30
30
  end
31
31
 
32
+ describe "when setting the :catalog_format" do
33
+ it "should log a deprecation notice" do
34
+ Puppet.expects(:warning)
35
+ Puppet.settings[:catalog_format] = 'marshal'
36
+ end
37
+ it "should copy the value to :preferred_serialization_format" do
38
+ Puppet.settings[:catalog_format] = 'marshal'
39
+ Puppet.settings[:preferred_serialization_format].should == 'marshal'
40
+ end
41
+ end
42
+
32
43
  it "should have a clientyamldir setting" do
33
44
  Puppet.settings[:clientyamldir].should_not be_nil
34
45
  end
@@ -7,6 +7,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
7
7
 
8
8
  require 'puppet/file_serving/metadata'
9
9
  require 'shared_behaviours/file_serving'
10
+ require 'puppet/indirector/file_metadata/file_server'
10
11
 
11
12
  describe Puppet::FileServing::Metadata, " when finding files" do
12
13
  it_should_behave_like "Puppet::FileServing::Files"
@@ -29,9 +29,10 @@ describe Puppet::Indirector::FileContent::FileServer, " when finding files" do
29
29
  file = File.join(modpath, "lib", "file.rb")
30
30
  File.open(file, "w") { |f| f.puts "1" }
31
31
 
32
+ Puppet.settings[:modulepath] = "/no/such/file"
33
+
32
34
  env = Puppet::Node::Environment.new("foo")
33
35
  env.stubs(:modulepath).returns [path]
34
- Puppet.settings[:modulepath] = "/no/such/file"
35
36
 
36
37
  result = Puppet::FileServing::Content.search("plugins", :environment => "foo", :recurse => true)
37
38
 
@@ -22,6 +22,8 @@ describe Puppet::SSL::CertificateRequest do
22
22
  Puppet.settings[:confdir] = @dir
23
23
  Puppet.settings[:vardir] = @dir
24
24
 
25
+ Puppet::SSL::Host.ca_location = :none
26
+
25
27
  @csr = Puppet::SSL::CertificateRequest.new("luke.madstop.com")
26
28
 
27
29
  @key = OpenSSL::PKey::RSA.new(512)
@@ -223,7 +223,7 @@ describe Puppet::Type.type(:file) do
223
223
  end
224
224
 
225
225
  it "should not recursively manage files managed by a more specific explicit file" do
226
- dir = tmpfile("file_source_integration_source")
226
+ dir = tmpfile("recursion_vs_explicit_1")
227
227
 
228
228
  subdir = File.join(dir, "subdir")
229
229
  file = File.join(subdir, "file")
@@ -242,6 +242,25 @@ describe Puppet::Type.type(:file) do
242
242
 
243
243
  (File.stat(file).mode & 007777).should == 0644
244
244
  end
245
+
246
+ it "should recursively manage files even if there is an explicit file whose name is a prefix of the managed file" do
247
+ dir = tmpfile("recursion_vs_explicit_2")
248
+
249
+ managed = File.join(dir, "file")
250
+ generated = File.join(dir, "file_with_a_name_starting_with_the_word_file")
251
+
252
+ FileUtils.mkdir_p(dir)
253
+ File.open(managed, "w") { |f| f.puts "" }
254
+ File.open(generated, "w") { |f| f.puts "" }
255
+
256
+ @catalog = Puppet::Resource::Catalog.new
257
+ @catalog.add_resource Puppet::Type::File.new(:name => dir, :recurse => true, :backup => false, :mode => "755")
258
+ @catalog.add_resource Puppet::Type::File.new(:name => managed, :recurse => true, :backup => false, :mode => "644")
259
+
260
+ @catalog.apply
261
+
262
+ (File.stat(generated).mode & 007777).should == 0755
263
+ end
245
264
  end
246
265
 
247
266
  describe "when generating resources" do
@@ -26,7 +26,7 @@ describe "Puppet::FileServing::Files", :shared => true do
26
26
 
27
27
  it "should use the file_server terminus when the 'puppet' URI scheme is used, no host name is present, and the process name is 'puppet'" do
28
28
  uri = "puppet:///fakemod/my/file"
29
- Puppet::Node::Environment.stubs(:new).returns(stub("env", :name => "testing", :module => nil))
29
+ Puppet::Node::Environment.stubs(:new).returns(stub("env", :name => "testing", :module => nil, :modulepath => []))
30
30
  Puppet.settings.stubs(:value).returns ""
31
31
  Puppet.settings.stubs(:value).with(:name).returns("puppet")
32
32
  Puppet.settings.stubs(:value).with(:fileserverconfig).returns("/whatever")
@@ -18,7 +18,7 @@ end
18
18
  require 'puppettest'
19
19
  require 'puppettest/runnable_test'
20
20
  require 'mocha'
21
- gem 'rspec', '=1.2.2'
21
+ gem 'rspec', '>=1.2.2'
22
22
  require 'spec/autorun'
23
23
 
24
24
  # So everyone else doesn't have to include this base constant.
@@ -332,70 +332,51 @@ describe "Puppet" do
332
332
  end
333
333
 
334
334
  describe "the 'apply' command" do
335
- confine "PSON library is missing; cannot test applying catalogs" => Puppet.features.pson?
336
-
337
- before do
338
- #Puppet::Resource::Catalog.stubs(:pson_create).returns Puppet::Resource::Catalog.new
339
- PSON.stubs(:parse).returns Puppet::Resource::Catalog.new
340
- end
341
-
342
335
  it "should read the catalog in from disk if a file name is provided" do
343
336
  @puppet.options[:catalog] = "/my/catalog.pson"
344
-
345
337
  File.expects(:read).with("/my/catalog.pson").returns "something"
346
-
338
+ Puppet::Resource::Catalog.stubs(:convert_from).with(:pson,'something').returns Puppet::Resource::Catalog.new
347
339
  @puppet.apply
348
340
  end
349
341
 
350
342
  it "should read the catalog in from stdin if '-' is provided" do
351
343
  @puppet.options[:catalog] = "-"
352
-
353
344
  $stdin.expects(:read).returns "something"
354
-
345
+ Puppet::Resource::Catalog.stubs(:convert_from).with(:pson,'something').returns Puppet::Resource::Catalog.new
355
346
  @puppet.apply
356
347
  end
357
348
 
358
- it "should deserialize the catalog from pson" do
349
+ it "should deserialize the catalog from the default format" do
359
350
  @puppet.options[:catalog] = "/my/catalog.pson"
360
-
361
- File.expects(:read).returns "something"
362
- PSON.expects(:parse).with("something").returns Puppet::Resource::Catalog.new
363
-
351
+ File.stubs(:read).with("/my/catalog.pson").returns "something"
352
+ Puppet::Resource::Catalog.stubs(:default_format).returns :rot13_piglatin
353
+ Puppet::Resource::Catalog.stubs(:convert_from).with(:rot13_piglatin,'something').returns Puppet::Resource::Catalog.new
364
354
  @puppet.apply
365
355
  end
366
356
 
367
357
  it "should fail helpfully if deserializing fails" do
368
358
  @puppet.options[:catalog] = "/my/catalog.pson"
369
-
370
- File.expects(:read).returns "something"
371
- PSON.expects(:parse).raises ArgumentError
372
-
359
+ File.stubs(:read).with("/my/catalog.pson").returns "something syntacically invalid"
373
360
  lambda { @puppet.apply }.should raise_error(Puppet::Error)
374
361
  end
375
362
 
376
363
  it "should convert plain data structures into a catalog if deserialization does not do so" do
377
364
  @puppet.options[:catalog] = "/my/catalog.pson"
378
-
379
- File.expects(:read).returns "something"
380
- PSON.expects(:parse).with("something").returns({:foo => "bar"})
365
+ File.stubs(:read).with("/my/catalog.pson").returns "something"
366
+ Puppet::Resource::Catalog.stubs(:convert_from).with(:pson,"something").returns({:foo => "bar"})
381
367
  Puppet::Resource::Catalog.expects(:pson_create).with({:foo => "bar"}).returns(Puppet::Resource::Catalog.new)
382
-
383
368
  @puppet.apply
384
369
  end
385
370
 
386
371
  it "should convert the catalog to a RAL catalog and use a Configurer instance to apply it" do
387
372
  @puppet.options[:catalog] = "/my/catalog.pson"
388
-
389
- File.expects(:read).returns "something"
390
-
373
+ File.stubs(:read).with("/my/catalog.pson").returns "something"
391
374
  catalog = Puppet::Resource::Catalog.new
392
- PSON.expects(:parse).returns catalog
393
-
375
+ Puppet::Resource::Catalog.stubs(:convert_from).with(:pson,'something').returns catalog
394
376
  catalog.expects(:to_ral).returns "mycatalog"
395
377
 
396
378
  configurer = stub 'configurer'
397
379
  Puppet::Configurer.expects(:new).returns configurer
398
-
399
380
  configurer.expects(:run).with(:catalog => "mycatalog")
400
381
 
401
382
  @puppet.apply