puppet 2.6.0 → 2.6.1

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 (246) hide show
  1. data/CHANGELOG +123 -0
  2. data/conf/redhat/puppet.spec +8 -2
  3. data/conf/solaris/smf/svc-puppetd +1 -1
  4. data/conf/solaris/smf/svc-puppetmasterd +1 -1
  5. data/conf/suse/client.init +4 -4
  6. data/conf/suse/fileserver.conf +12 -0
  7. data/conf/suse/logrotate +10 -0
  8. data/conf/suse/puppet.conf +25 -0
  9. data/conf/suse/puppet.spec +114 -49
  10. data/conf/suse/ruby-env.patch +17 -0
  11. data/conf/suse/server.init +4 -4
  12. data/ext/logcheck/puppet +23 -23
  13. data/ext/puppet-load.rb +357 -0
  14. data/ext/puppetstoredconfigclean.rb +3 -3
  15. data/ext/rack/files/config.ru +3 -5
  16. data/ext/vim/syntax/puppet.vim +6 -5
  17. data/install.rb +12 -11
  18. data/lib/puppet.rb +1 -1
  19. data/lib/puppet/agent.rb +3 -1
  20. data/lib/puppet/application.rb +2 -3
  21. data/lib/puppet/application/agent.rb +4 -0
  22. data/lib/puppet/application/apply.rb +14 -6
  23. data/lib/puppet/application/describe.rb +1 -1
  24. data/lib/puppet/application/doc.rb +2 -36
  25. data/lib/puppet/application/master.rb +0 -3
  26. data/lib/puppet/application/queue.rb +1 -0
  27. data/lib/puppet/configurer.rb +4 -0
  28. data/lib/puppet/daemon.rb +1 -1
  29. data/lib/puppet/defaults.rb +38 -44
  30. data/lib/puppet/file_serving/indirection_hooks.rb +2 -2
  31. data/lib/puppet/indirector/facts/memory.rb +1 -1
  32. data/lib/puppet/indirector/node/exec.rb +1 -1
  33. data/lib/puppet/indirector/node/ldap.rb +9 -53
  34. data/lib/puppet/indirector/node/memory.rb +1 -1
  35. data/lib/puppet/indirector/yaml.rb +6 -9
  36. data/lib/puppet/network/format_handler.rb +6 -0
  37. data/lib/puppet/network/formats.rb +4 -4
  38. data/lib/puppet/network/http/handler.rb +1 -1
  39. data/lib/puppet/network/http/rack.rb +3 -0
  40. data/lib/puppet/network/http/rack/rest.rb +1 -1
  41. data/lib/puppet/network/rest_authconfig.rb +6 -3
  42. data/lib/puppet/node/environment.rb +15 -5
  43. data/lib/puppet/parameter/value_collection.rb +3 -3
  44. data/lib/puppet/parser/ast/function.rb +0 -1
  45. data/lib/puppet/parser/ast/leaf.rb +1 -1
  46. data/lib/puppet/parser/ast/resource.rb +4 -3
  47. data/lib/puppet/parser/ast/resource_reference.rb +9 -2
  48. data/lib/puppet/parser/compiler.rb +12 -14
  49. data/lib/puppet/parser/files.rb +1 -1
  50. data/lib/puppet/parser/functions.rb +2 -2
  51. data/lib/puppet/parser/functions/defined.rb +1 -1
  52. data/lib/puppet/parser/functions/extlookup.rb +157 -0
  53. data/lib/puppet/parser/functions/file.rb +1 -1
  54. data/lib/puppet/parser/functions/inline_template.rb +6 -5
  55. data/lib/puppet/parser/functions/md5.rb +5 -0
  56. data/lib/puppet/parser/functions/realize.rb +1 -1
  57. data/lib/puppet/parser/functions/regsubst.rb +19 -19
  58. data/lib/puppet/parser/functions/require.rb +2 -3
  59. data/lib/puppet/parser/functions/split.rb +1 -1
  60. data/lib/puppet/parser/functions/sprintf.rb +1 -1
  61. data/lib/puppet/parser/functions/template.rb +4 -2
  62. data/lib/puppet/parser/functions/versioncmp.rb +12 -12
  63. data/lib/puppet/parser/lexer.rb +13 -14
  64. data/lib/puppet/parser/resource.rb +2 -7
  65. data/lib/puppet/parser/resource/param.rb +1 -1
  66. data/lib/puppet/parser/scope.rb +35 -0
  67. data/lib/puppet/parser/type_loader.rb +1 -1
  68. data/lib/puppet/property.rb +5 -5
  69. data/lib/puppet/provider.rb +3 -3
  70. data/lib/puppet/provider/group/groupadd.rb +1 -1
  71. data/lib/puppet/provider/group/ldap.rb +3 -3
  72. data/lib/puppet/provider/group/pw.rb +1 -1
  73. data/lib/puppet/provider/package/apple.rb +1 -1
  74. data/lib/puppet/provider/package/apt.rb +5 -1
  75. data/lib/puppet/provider/package/aptitude.rb +1 -1
  76. data/lib/puppet/provider/package/aptrpm.rb +1 -1
  77. data/lib/puppet/provider/package/blastwave.rb +1 -1
  78. data/lib/puppet/provider/package/dpkg.rb +2 -2
  79. data/lib/puppet/provider/package/fink.rb +1 -1
  80. data/lib/puppet/provider/package/gem.rb +1 -1
  81. data/lib/puppet/provider/package/openbsd.rb +1 -1
  82. data/lib/puppet/provider/package/rpm.rb +1 -1
  83. data/lib/puppet/provider/package/rug.rb +1 -1
  84. data/lib/puppet/provider/package/sunfreeware.rb +2 -2
  85. data/lib/puppet/provider/package/up2date.rb +1 -1
  86. data/lib/puppet/provider/package/urpmi.rb +1 -1
  87. data/lib/puppet/provider/package/yum.rb +1 -1
  88. data/lib/puppet/provider/package/zypper.rb +1 -1
  89. data/lib/puppet/provider/service/base.rb +1 -1
  90. data/lib/puppet/provider/service/bsd.rb +2 -2
  91. data/lib/puppet/provider/service/debian.rb +2 -2
  92. data/lib/puppet/provider/service/gentoo.rb +2 -2
  93. data/lib/puppet/provider/service/init.rb +2 -2
  94. data/lib/puppet/provider/service/redhat.rb +2 -2
  95. data/lib/puppet/provider/user/ldap.rb +3 -3
  96. data/lib/puppet/provider/user/pw.rb +1 -1
  97. data/lib/puppet/provider/user/user_role_add.rb +1 -1
  98. data/lib/puppet/provider/user/useradd.rb +1 -1
  99. data/lib/puppet/rails/host.rb +1 -0
  100. data/lib/puppet/reference/configuration.rb +37 -34
  101. data/lib/puppet/reference/indirection.rb +3 -4
  102. data/lib/puppet/reference/metaparameter.rb +0 -8
  103. data/lib/puppet/reference/network.rb +6 -4
  104. data/lib/puppet/reference/providers.rb +4 -4
  105. data/lib/puppet/reference/report.rb +5 -6
  106. data/lib/puppet/reference/type.rb +14 -14
  107. data/lib/puppet/reports/http.rb +1 -1
  108. data/lib/puppet/reports/rrdgraph.rb +8 -9
  109. data/lib/puppet/reports/store.rb +2 -2
  110. data/lib/puppet/reports/tagmail.rb +12 -13
  111. data/lib/puppet/resource.rb +15 -115
  112. data/lib/puppet/resource/catalog.rb +1 -1
  113. data/lib/puppet/resource/type.rb +26 -3
  114. data/lib/puppet/resource/type_collection.rb +3 -6
  115. data/lib/puppet/simple_graph.rb +4 -5
  116. data/lib/puppet/transaction/resource_harness.rb +1 -1
  117. data/lib/puppet/type.rb +100 -92
  118. data/lib/puppet/type/augeas.rb +44 -45
  119. data/lib/puppet/type/computer.rb +2 -2
  120. data/lib/puppet/type/cron.rb +29 -29
  121. data/lib/puppet/type/exec.rb +66 -67
  122. data/lib/puppet/type/file.rb +25 -25
  123. data/lib/puppet/type/file/content.rb +7 -1
  124. data/lib/puppet/type/file/ensure.rb +13 -13
  125. data/lib/puppet/type/file/mode.rb +6 -6
  126. data/lib/puppet/type/file/selcontext.rb +5 -5
  127. data/lib/puppet/type/file/source.rb +36 -26
  128. data/lib/puppet/type/filebucket.rb +5 -6
  129. data/lib/puppet/type/group.rb +1 -2
  130. data/lib/puppet/type/host.rb +3 -6
  131. data/lib/puppet/type/k5login.rb +3 -3
  132. data/lib/puppet/type/macauthorization.rb +1 -2
  133. data/lib/puppet/type/mailalias.rb +0 -1
  134. data/lib/puppet/type/maillist.rb +0 -1
  135. data/lib/puppet/type/mcx.rb +9 -9
  136. data/lib/puppet/type/mount.rb +9 -10
  137. data/lib/puppet/type/notify.rb +0 -1
  138. data/lib/puppet/type/package.rb +34 -36
  139. data/lib/puppet/type/resources.rb +1 -5
  140. data/lib/puppet/type/schedule.rb +9 -12
  141. data/lib/puppet/type/selboolean.rb +2 -7
  142. data/lib/puppet/type/selmodule.rb +3 -4
  143. data/lib/puppet/type/service.rb +9 -9
  144. data/lib/puppet/type/ssh_authorized_key.rb +2 -3
  145. data/lib/puppet/type/sshkey.rb +4 -7
  146. data/lib/puppet/type/stage.rb +5 -4
  147. data/lib/puppet/type/tidy.rb +3 -3
  148. data/lib/puppet/type/user.rb +1 -2
  149. data/lib/puppet/type/whit.rb +7 -0
  150. data/lib/puppet/type/yumrepo.rb +16 -3
  151. data/lib/puppet/type/zfs.rb +1 -2
  152. data/lib/puppet/type/zone.rb +28 -28
  153. data/lib/puppet/type/zpool.rb +10 -5
  154. data/lib/puppet/util/autoload.rb +17 -5
  155. data/lib/puppet/util/cacher.rb +15 -10
  156. data/lib/puppet/util/command_line/puppetdoc +5 -5
  157. data/lib/puppet/util/command_line/puppetrun +0 -2
  158. data/lib/puppet/util/command_line/ralsh +13 -13
  159. data/lib/puppet/util/docs.rb +5 -12
  160. data/lib/puppet/util/monkey_patches.rb +5 -2
  161. data/lib/puppet/util/nagios_maker.rb +4 -5
  162. data/lib/puppet/util/provider_features.rb +2 -2
  163. data/lib/puppet/util/rdoc.rb +1 -1
  164. data/lib/puppet/util/rdoc/parser.rb +5 -3
  165. data/lib/puppet/util/reference.rb +3 -52
  166. data/man/man5/puppet.conf.5 +2072 -1526
  167. data/man/man8/filebucket.8 +104 -106
  168. data/man/man8/pi.8 +14 -47
  169. data/man/man8/puppet.8 +8 -9
  170. data/man/man8/puppetca.8 +168 -129
  171. data/man/man8/puppetd.8 +282 -226
  172. data/man/man8/puppetdoc.8 +103 -103
  173. data/man/man8/puppetmasterd.8 +51 -71
  174. data/man/man8/puppetqd.8 +18 -53
  175. data/man/man8/puppetrun.8 +163 -143
  176. data/man/man8/ralsh.8 +77 -114
  177. data/spec/integration/indirector/bucket_file/rest_spec.rb +1 -0
  178. data/spec/integration/indirector/certificate/rest_spec.rb +1 -0
  179. data/spec/integration/indirector/certificate_request/rest_spec.rb +1 -0
  180. data/spec/integration/indirector/certificate_revocation_list/rest_spec.rb +1 -0
  181. data/spec/integration/indirector/report/rest_spec.rb +1 -0
  182. data/spec/integration/indirector/rest_spec.rb +1 -0
  183. data/spec/integration/network/server/webrick_spec.rb +1 -0
  184. data/spec/integration/parser/compiler_spec.rb +43 -0
  185. data/spec/integration/provider/mailalias/aliases_spec.rb +5 -5
  186. data/spec/integration/ssl/certificate_authority_spec.rb +1 -0
  187. data/spec/integration/ssl/certificate_request_spec.rb +1 -0
  188. data/spec/integration/ssl/certificate_revocation_list_spec.rb +1 -0
  189. data/spec/integration/ssl/host_spec.rb +1 -0
  190. data/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb +0 -1
  191. data/spec/monkey_patches/publicize_methods.rb +11 -0
  192. data/spec/shared_behaviours/file_serving.rb +12 -1
  193. data/spec/spec_helper.rb +6 -25
  194. data/spec/unit/application/apply_spec.rb +22 -4
  195. data/spec/unit/application/cert_spec.rb +1 -1
  196. data/spec/unit/application/doc_spec.rb +0 -19
  197. data/spec/unit/application/master_spec.rb +1 -1
  198. data/spec/unit/application_spec.rb +2 -12
  199. data/spec/unit/indirector/node/ldap_spec.rb +19 -21
  200. data/spec/unit/indirector/yaml_spec.rb +18 -6
  201. data/spec/unit/network/http/rack/rest_spec.rb +3 -3
  202. data/spec/unit/network/http/webrick/rest_spec.rb +1 -0
  203. data/spec/unit/node/environment_spec.rb +32 -3
  204. data/spec/unit/node/facts_spec.rb +13 -2
  205. data/spec/unit/parameter/value_collection_spec.rb +2 -2
  206. data/spec/unit/parser/ast/leaf_spec.rb +4 -0
  207. data/spec/unit/parser/ast/resource_reference_spec.rb +0 -5
  208. data/spec/unit/parser/ast/resource_spec.rb +7 -0
  209. data/spec/unit/parser/compiler_spec.rb +12 -1
  210. data/spec/unit/parser/files_spec.rb +3 -3
  211. data/spec/unit/parser/functions/extlookup_spec.rb +95 -0
  212. data/spec/unit/parser/functions/include_spec.rb +33 -0
  213. data/spec/unit/parser/functions/require_spec.rb +1 -1
  214. data/spec/unit/parser/functions/tag_spec.rb +1 -0
  215. data/spec/unit/parser/lexer_spec.rb +10 -1
  216. data/spec/unit/parser/resource_spec.rb +3 -9
  217. data/spec/unit/parser/type_loader_spec.rb +1 -1
  218. data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +4 -2
  219. data/spec/unit/rails/resource_spec.rb +1 -1
  220. data/spec/unit/reports/tagmail_spec.rb +2 -2
  221. data/spec/unit/resource/catalog_spec.rb +1 -1
  222. data/spec/unit/resource/type_collection_spec.rb +35 -0
  223. data/spec/unit/resource/type_spec.rb +19 -1
  224. data/spec/unit/resource_spec.rb +0 -36
  225. data/spec/unit/simple_graph_spec.rb +12 -2
  226. data/spec/unit/transaction/resource_harness_spec.rb +1 -1
  227. data/spec/unit/type/file/content_spec.rb +2 -1
  228. data/spec/unit/type/schedule_spec.rb +1 -1
  229. data/spec/unit/type/service_spec.rb +8 -0
  230. data/spec/unit/type/user_spec.rb +5 -0
  231. data/spec/unit/util/backups_spec.rb +0 -1
  232. data/spec/unit/util/rdoc/parser_spec.rb +3 -3
  233. data/spec/unit/util/rdoc_spec.rb +13 -0
  234. data/test/certmgr/support.rb +2 -1
  235. data/test/language/parser.rb +6 -6
  236. data/test/lib/puppettest.rb +3 -23
  237. data/test/lib/puppettest/fakes.rb +1 -1
  238. data/test/lib/puppettest/support/assertions.rb +0 -2
  239. data/test/lib/puppettest/support/utils.rb +25 -20
  240. data/test/ral/manager/attributes.rb +4 -1
  241. metadata +15 -9
  242. data/conf/suse/puppet.suse.patch +0 -16
  243. data/ext/extlookup.rb +0 -181
  244. data/ext/puppetlast +0 -16
  245. data/tasks/rake/tracdocs.rake +0 -8
  246. data/test/lib/mocha_standalone.rb +0 -2
@@ -10,7 +10,7 @@ Puppet::Type.newtype(:computer) do
10
10
  This provider only manages Computer objects in the local directory service
11
11
  domain, not in remote directories.
12
12
 
13
- If you wish to manage /etc/hosts on Mac OS X, then simply use the host
13
+ If you wish to manage `/etc/hosts` file on Mac OS X, then simply use the host
14
14
  type as per other platforms.
15
15
 
16
16
  This type primarily exists to create localhost Computer objects that MCX
@@ -31,7 +31,7 @@ Puppet::Type.newtype(:computer) do
31
31
 
32
32
  newproperty(:ensure, :parent => Puppet::Property::Ensure) do
33
33
  desc "Control the existences of this computer record. Set this attribute to
34
- ``present`` to ensure the computer record exists. Set it to ``absent``
34
+ `present` to ensure the computer record exists. Set it to `absent`
35
35
  to delete any computer records with this name"
36
36
  newvalue(:present) do
37
37
  provider.create
@@ -15,32 +15,32 @@ Puppet::Type.newtype(:cron) do
15
15
  association is made and synced to disk, you can then manage the job
16
16
  normally (e.g., change the schedule of the job).
17
17
 
18
- Example::
19
-
20
- cron { logrotate:
21
- command => \"/usr/sbin/logrotate\",
22
- user => root,
23
- hour => 2,
24
- minute => 0
25
- }
26
-
27
- Note that all cron values can be specified as an array of values::
28
-
29
- cron { logrotate:
30
- command => \"/usr/sbin/logrotate\",
31
- user => root,
32
- hour => [2, 4]
33
- }
34
-
35
- Or using ranges, or the step syntax ``*/2`` (although there's no guarantee that
36
- your ``cron`` daemon supports it)::
37
-
38
- cron { logrotate:
39
- command => \"/usr/sbin/logrotate\",
40
- user => root,
41
- hour => ['2-4'],
42
- minute => '*/10'
43
- }
18
+ Example:
19
+
20
+ cron { logrotate:
21
+ command => \"/usr/sbin/logrotate\",
22
+ user => root,
23
+ hour => 2,
24
+ minute => 0
25
+ }
26
+
27
+ Note that all cron values can be specified as an array of values:
28
+
29
+ cron { logrotate:
30
+ command => \"/usr/sbin/logrotate\",
31
+ user => root,
32
+ hour => [2, 4]
33
+ }
34
+
35
+ Or using ranges, or the step syntax `*/2` (although there's no guarantee that
36
+ your `cron` daemon supports it):
37
+
38
+ cron { logrotate:
39
+ command => \"/usr/sbin/logrotate\",
40
+ user => root,
41
+ hour => ['2-4'],
42
+ minute => '*/10'
43
+ }
44
44
  "
45
45
  ensurable
46
46
 
@@ -169,7 +169,7 @@ Puppet::Type.newtype(:cron) do
169
169
  end
170
170
 
171
171
  if value == "*"
172
- return value
172
+ return :absent
173
173
  end
174
174
 
175
175
  return value unless self.class.boundaries
@@ -206,7 +206,7 @@ Puppet::Type.newtype(:cron) do
206
206
  profile is not sourced when the command is run, so if the
207
207
  user's environment is desired it should be sourced manually.
208
208
 
209
- All cron parameters support ``absent`` as a value; this will
209
+ All cron parameters support `absent` as a value; this will
210
210
  remove any existing values for that field."
211
211
 
212
212
  def retrieve
@@ -293,7 +293,7 @@ Puppet::Type.newtype(:cron) do
293
293
  but will not associate them with a specific job.
294
294
 
295
295
  Settings should be specified exactly as they should appear in
296
- the crontab, e.g., ``PATH=/bin:/usr/bin:/usr/sbin``."
296
+ the crontab, e.g., `PATH=/bin:/usr/bin:/usr/sbin`."
297
297
 
298
298
  validate do |value|
299
299
  unless value =~ /^\s*(\w+)\s*=\s*(.*)\s*$/ or value == :absent or value == "absent"
@@ -6,51 +6,51 @@ module Puppet
6
6
  @doc = "Executes external commands. It is critical that all commands
7
7
  executed using this mechanism can be run multiple times without
8
8
  harm, i.e., they are *idempotent*. One useful way to create idempotent
9
- commands is to use the checks like ``creates`` to avoid running the
9
+ commands is to use the checks like `creates` to avoid running the
10
10
  command unless some condition is met.
11
11
 
12
- Note also that you can restrict an ``exec`` to only run when it receives
13
- events by using the ``refreshonly`` parameter; this is a useful way to
12
+ Note also that you can restrict an `exec` to only run when it receives
13
+ events by using the `refreshonly` parameter; this is a useful way to
14
14
  have your configuration respond to events with arbitrary commands.
15
15
 
16
- It is worth noting that ``exec`` is special, in that it is not
17
- currently considered an error to have multiple ``exec`` instances
16
+ It is worth noting that `exec` is special, in that it is not
17
+ currently considered an error to have multiple `exec` instances
18
18
  with the same name. This was done purely because it had to be this
19
19
  way in order to get certain functionality, but it complicates things.
20
- In particular, you will not be able to use ``exec`` instances that
20
+ In particular, you will not be able to use `exec` instances that
21
21
  share their commands with other instances as a dependency, since
22
22
  Puppet has no way of knowing which instance you mean.
23
23
 
24
- For example::
24
+ For example:
25
25
 
26
- # defined in the production class
27
- exec { \"make\":
28
- cwd => \"/prod/build/dir\",
29
- path => \"/usr/bin:/usr/sbin:/bin\"
30
- }
26
+ # defined in the production class
27
+ exec { \"make\":
28
+ cwd => \"/prod/build/dir\",
29
+ path => \"/usr/bin:/usr/sbin:/bin\"
30
+ }
31
31
 
32
- . etc. .
32
+ . etc. .
33
33
 
34
- # defined in the test class
35
- exec { \"make\":
36
- cwd => \"/test/build/dir\",
37
- path => \"/usr/bin:/usr/sbin:/bin\"
38
- }
34
+ # defined in the test class
35
+ exec { \"make\":
36
+ cwd => \"/test/build/dir\",
37
+ path => \"/usr/bin:/usr/sbin:/bin\"
38
+ }
39
39
 
40
40
  Any other type would throw an error, complaining that you had
41
41
  the same instance being managed in multiple places, but these are
42
- obviously different images, so ``exec`` had to be treated specially.
42
+ obviously different images, so `exec` had to be treated specially.
43
43
 
44
44
  It is recommended to avoid duplicate names whenever possible.
45
45
 
46
- Note that if an ``exec`` receives an event from another resource,
47
- it will get executed again (or execute the command specified in ``refresh``, if there is one).
46
+ Note that if an `exec` receives an event from another resource,
47
+ it will get executed again (or execute the command specified in `refresh`, if there is one).
48
48
 
49
- There is a strong tendency to use ``exec`` to do whatever work Puppet
49
+ There is a strong tendency to use `exec` to do whatever work Puppet
50
50
  can't already do; while this is obviously acceptable (and unavoidable)
51
- in the short term, it is highly recommended to migrate work from ``exec``
51
+ in the short term, it is highly recommended to migrate work from `exec`
52
52
  to native Puppet types as quickly as possible. If you find that
53
- you are doing a lot of work with ``exec``, please at least notify
53
+ you are doing a lot of work with `exec`, please at least notify
54
54
  us at Puppet Labs what you are doing, and hopefully we can work with
55
55
  you to get a native resource type for the work you are doing."
56
56
 
@@ -159,9 +159,9 @@ module Puppet
159
159
  desc "The actual command to execute. Must either be fully qualified
160
160
  or a search path for the command must be provided. If the command
161
161
  succeeds, any output produced will be logged at the instance's
162
- normal log level (usually ``notice``), but if the command fails
162
+ normal log level (usually `notice`), but if the command fails
163
163
  (meaning its return code does not match the specified code) then
164
- any output is logged at the ``err`` log level."
164
+ any output is logged at the `err` log level."
165
165
  end
166
166
 
167
167
  newparam(:path) do
@@ -223,7 +223,7 @@ module Puppet
223
223
 
224
224
  newparam(:logoutput) do
225
225
  desc "Whether to log output. Defaults to logging output at the
226
- loglevel for the ``exec`` resource. Use *on_failure* to only
226
+ loglevel for the `exec` resource. Use *on_failure* to only
227
227
  log the output when the command reports an error. Values are
228
228
  **true**, *false*, *on_failure*, and any legal log level."
229
229
 
@@ -253,7 +253,7 @@ module Puppet
253
253
  newparam(:environment) do
254
254
  desc "Any additional environment variables you want to set for a
255
255
  command. Note that if you use this to set PATH, it will override
256
- the ``path`` attribute. Multiple environment variables should be
256
+ the `path` attribute. Multiple environment variables should be
257
257
  specified as an array."
258
258
 
259
259
  validate do |values|
@@ -330,22 +330,22 @@ module Puppet
330
330
  desc "The command should only be run as a
331
331
  refresh mechanism for when a dependent object is changed. It only
332
332
  makes sense to use this option when this command depends on some
333
- other object; it is useful for triggering an action::
334
-
335
- # Pull down the main aliases file
336
- file { \"/etc/aliases\":
337
- source => \"puppet://server/module/aliases\"
338
- }
339
-
340
- # Rebuild the database, but only when the file changes
341
- exec { newaliases:
342
- path => [\"/usr/bin\", \"/usr/sbin\"],
343
- subscribe => File[\"/etc/aliases\"],
344
- refreshonly => true
345
- }
333
+ other object; it is useful for triggering an action:
334
+
335
+ # Pull down the main aliases file
336
+ file { \"/etc/aliases\":
337
+ source => \"puppet://server/module/aliases\"
338
+ }
339
+
340
+ # Rebuild the database, but only when the file changes
341
+ exec { newaliases:
342
+ path => [\"/usr/bin\", \"/usr/sbin\"],
343
+ subscribe => File[\"/etc/aliases\"],
344
+ refreshonly => true
345
+ }
346
346
 
347
- Note that only ``subscribe`` and ``notify`` can trigger actions, not ``require``,
348
- so it only makes sense to use ``refreshonly`` with ``subscribe`` or ``notify``."
347
+ Note that only `subscribe` and `notify` can trigger actions, not `require`,
348
+ so it only makes sense to use `refreshonly` with `subscribe` or `notify`."
349
349
 
350
350
  newvalues(:true, :false)
351
351
 
@@ -364,13 +364,13 @@ module Puppet
364
364
  newcheck(:creates) do
365
365
  desc "A file that this command creates. If this
366
366
  parameter is provided, then the command will only be run
367
- if the specified file does not exist::
367
+ if the specified file does not exist:
368
368
 
369
- exec { \"tar xf /my/tar/file.tar\":
370
- cwd => \"/var/tmp\",
371
- creates => \"/var/tmp/myfile\",
372
- path => [\"/usr/bin\", \"/usr/sbin\"]
373
- }
369
+ exec { \"tar xf /my/tar/file.tar\":
370
+ cwd => \"/var/tmp\",
371
+ creates => \"/var/tmp/myfile\",
372
+ path => [\"/usr/bin\", \"/usr/sbin\"]
373
+ }
374
374
 
375
375
  "
376
376
 
@@ -396,16 +396,16 @@ module Puppet
396
396
  end
397
397
 
398
398
  newcheck(:unless) do
399
- desc "If this parameter is set, then this ``exec`` will run unless
400
- the command returns 0. For example::
399
+ desc "If this parameter is set, then this `exec` will run unless
400
+ the command returns 0. For example:
401
401
 
402
- exec { \"/bin/echo root >> /usr/lib/cron/cron.allow\":
403
- path => \"/usr/bin:/usr/sbin:/bin\",
404
- unless => \"grep root /usr/lib/cron/cron.allow 2>/dev/null\"
405
- }
402
+ exec { \"/bin/echo root >> /usr/lib/cron/cron.allow\":
403
+ path => \"/usr/bin:/usr/sbin:/bin\",
404
+ unless => \"grep root /usr/lib/cron/cron.allow 2>/dev/null\"
405
+ }
406
406
 
407
- This would add ``root`` to the cron.allow file (on Solaris) unless
408
- ``grep`` determines it's already there.
407
+ This would add `root` to the cron.allow file (on Solaris) unless
408
+ `grep` determines it's already there.
409
409
 
410
410
  Note that this command follows the same rules as the main command,
411
411
  which is to say that it must be fully qualified if the path is not set.
@@ -433,22 +433,22 @@ module Puppet
433
433
  end
434
434
 
435
435
  newcheck(:onlyif) do
436
- desc "If this parameter is set, then this ``exec`` will only run if
437
- the command returns 0. For example::
436
+ desc "If this parameter is set, then this `exec` will only run if
437
+ the command returns 0. For example:
438
438
 
439
- exec { \"logrotate\":
440
- path => \"/usr/bin:/usr/sbin:/bin\",
441
- onlyif => \"test `du /var/log/messages | cut -f1` -gt 100000\"
442
- }
439
+ exec { \"logrotate\":
440
+ path => \"/usr/bin:/usr/sbin:/bin\",
441
+ onlyif => \"test `du /var/log/messages | cut -f1` -gt 100000\"
442
+ }
443
443
 
444
- This would run ``logrotate`` only if that test returned true.
444
+ This would run `logrotate` only if that test returned true.
445
445
 
446
446
  Note that this command follows the same rules as the main command,
447
447
  which is to say that it must be fully qualified if the path is not set.
448
448
 
449
- Also note that onlyif can take an array as its value, eg::
449
+ Also note that onlyif can take an array as its value, e.g.:
450
450
 
451
- onlyif => [\"test -f /tmp/file1\", \"test -f /tmp/file2\"]
451
+ onlyif => [\"test -f /tmp/file1\", \"test -f /tmp/file2\"]
452
452
 
453
453
  This will only run the exec if /all/ conditions in the array return true.
454
454
  "
@@ -683,4 +683,3 @@ module Puppet
683
683
  end
684
684
  end
685
685
  end
686
-
@@ -16,7 +16,7 @@ Puppet::Type.newtype(:file) do
16
16
  @doc = "Manages local files, including setting ownership and
17
17
  permissions, creation of both files and directories, and
18
18
  retrieving entire files from remote servers. As Puppet matures, it
19
- expected that the ``file`` resource will be used less and less to
19
+ expected that the `file` resource will be used less and less to
20
20
  manage content, and instead native resources will be used to do so.
21
21
 
22
22
  If you find that you are often copying files in from a central
@@ -61,33 +61,33 @@ Puppet::Type.newtype(:file) do
61
61
  newparam(:backup) do
62
62
  desc "Whether files should be backed up before
63
63
  being replaced. The preferred method of backing files up is via
64
- a ``filebucket``, which stores files by their MD5 sums and allows
64
+ a `filebucket`, which stores files by their MD5 sums and allows
65
65
  easy retrieval without littering directories with backups. You
66
66
  can specify a local filebucket or a network-accessible
67
- server-based filebucket by setting ``backup => bucket-name``.
68
- Alternatively, if you specify any value that begins with a ``.``
69
- (e.g., ``.puppet-bak``), then Puppet will use copy the file in
67
+ server-based filebucket by setting `backup => bucket-name`.
68
+ Alternatively, if you specify any value that begins with a `.`
69
+ (e.g., `.puppet-bak`), then Puppet will use copy the file in
70
70
  the same directory with that value as the extension of the
71
- backup. Setting ``backup => false`` disables all backups of the
71
+ backup. Setting `backup => false` disables all backups of the
72
72
  file in question.
73
73
 
74
- Puppet automatically creates a local filebucket named ``puppet`` and
74
+ Puppet automatically creates a local filebucket named `puppet` and
75
75
  defaults to backing up there. To use a server-based filebucket,
76
- you must specify one in your configuration::
76
+ you must specify one in your configuration
77
77
 
78
- filebucket { main:
79
- server => puppet
80
- }
78
+ filebucket { main:
79
+ server => puppet
80
+ }
81
81
 
82
- The ``puppet master`` daemon creates a filebucket by default,
82
+ The `puppet master` daemon creates a filebucket by default,
83
83
  so you can usually back up to your main server with this
84
84
  configuration. Once you've described the bucket in your
85
- configuration, you can use it in any file::
85
+ configuration, you can use it in any file
86
86
 
87
- file { \"/my/file\":
88
- source => \"/path/in/nfs/or/something\",
89
- backup => main
90
- }
87
+ file { \"/my/file\":
88
+ source => \"/path/in/nfs/or/something\",
89
+ backup => main
90
+ }
91
91
 
92
92
  This will back the file up to the central server.
93
93
 
@@ -192,9 +192,9 @@ Puppet::Type.newtype(:file) do
192
192
  newparam(:ignore) do
193
193
  desc "A parameter which omits action on files matching
194
194
  specified patterns during recursion. Uses Ruby's builtin globbing
195
- engine, so shell metacharacters are fully supported, e.g. ``[a-z]*``.
195
+ engine, so shell metacharacters are fully supported, e.g. `[a-z]*`.
196
196
  Matches that would descend into the directory structure are ignored,
197
- e.g., ``*/*``."
197
+ e.g., `*/*`."
198
198
 
199
199
  validate do |value|
200
200
  unless value.is_a?(Array) or value.is_a?(String) or value == false
@@ -205,10 +205,10 @@ Puppet::Type.newtype(:file) do
205
205
 
206
206
  newparam(:links) do
207
207
  desc "How to handle links during file actions. During file copying,
208
- ``follow`` will copy the target file instead of the link, ``manage``
209
- will copy the link itself, and ``ignore`` will just pass it by.
210
- When not copying, ``manage`` and ``ignore`` behave equivalently
211
- (because you cannot really ignore links entirely during local recursion), and ``follow`` will manage the file to which the
208
+ `follow` will copy the target file instead of the link, `manage`
209
+ will copy the link itself, and `ignore` will just pass it by.
210
+ When not copying, `manage` and `ignore` behave equivalently
211
+ (because you cannot really ignore links entirely during local recursion), and `follow` will manage the file to which the
212
212
  link points."
213
213
 
214
214
  newvalues(:follow, :manage)
@@ -223,7 +223,7 @@ Puppet::Type.newtype(:file) do
223
223
  files unless you really know what you are doing. This option only
224
224
  makes sense when recursively managing directories.
225
225
 
226
- Note that when using ``purge`` with ``source``, Puppet will purge any files
226
+ Note that when using `purge` with `source`, Puppet will purge any files
227
227
  that are not on the remote system."
228
228
 
229
229
  defaultto :false
@@ -234,7 +234,7 @@ Puppet::Type.newtype(:file) do
234
234
  newparam(:sourceselect) do
235
235
  desc "Whether to copy all valid sources, or just the first one. This parameter
236
236
  is only used in recursive copies; by default, the first valid source is the
237
- only one used as a recursive source, but if this parameter is set to ``all``,
237
+ only one used as a recursive source, but if this parameter is set to `all`,
238
238
  then all valid sources will have all of their contents copied to the local host,
239
239
  and for sources that have the same file, the source earlier in the list will
240
240
  be used."
@@ -161,11 +161,17 @@ module Puppet
161
161
  }
162
162
  end
163
163
 
164
+ def self.standalone?
165
+ Puppet.settings[:name] == "apply"
166
+ end
167
+
164
168
  def each_chunk_from(source_or_content)
165
169
  if source_or_content.is_a?(String)
166
170
  yield source_or_content
167
171
  elsif source_or_content.nil?
168
172
  yield read_file_from_filebucket
173
+ elsif self.class.standalone?
174
+ yield source_or_content.content
169
175
  elsif source_or_content.local?
170
176
  chunk_file_from_disk(source_or_content) { |chunk| yield chunk }
171
177
  else
@@ -184,7 +190,7 @@ module Puppet
184
190
  end
185
191
 
186
192
  def chunk_file_from_source(source_or_content)
187
- request = Puppet::Indirector::Request.new(:file_content, :find, source_or_content.full_path)
193
+ request = Puppet::Indirector::Request.new(:file_content, :find, source_or_content.full_path.sub(/^\//,''))
188
194
  connection = Puppet::Network::HttpPool.http_instance(source_or_content.server, source_or_content.port)
189
195
  connection.request_get(indirection2uri(request), add_accept_encoding({"Accept" => "raw"})) do |response|
190
196
  case response.code