puppet 0.22.4 → 0.23.0

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 (266) hide show
  1. data/CHANGELOG +156 -0
  2. data/README +2 -2
  3. data/Rakefile +6 -6
  4. data/bin/filebucket +212 -0
  5. data/bin/puppet +2 -0
  6. data/bin/puppetca +2 -4
  7. data/bin/puppetd +16 -15
  8. data/bin/puppetdoc +46 -496
  9. data/bin/puppetmasterd +3 -5
  10. data/bin/puppetrun +8 -3
  11. data/bin/ralsh +271 -0
  12. data/conf/redhat/client.init +1 -1
  13. data/conf/redhat/puppet.spec +13 -2
  14. data/conf/solaris/pkginfo +1 -1
  15. data/ext/puppet-test +374 -0
  16. data/install.rb +40 -31
  17. data/lib/puppet.rb +39 -4
  18. data/lib/puppet/config_stores/rest.rb +60 -0
  19. data/lib/puppet/configuration.rb +312 -17
  20. data/lib/puppet/external/event-loop/event-loop.rb +4 -0
  21. data/lib/puppet/external/gratr/rdot.rb +1 -1
  22. data/lib/puppet/fact_stores/yaml.rb +42 -0
  23. data/lib/puppet/feature/base.rb +4 -1
  24. data/lib/puppet/metatype/attributes.rb +20 -43
  25. data/lib/puppet/metatype/container.rb +1 -36
  26. data/lib/puppet/metatype/evaluation.rb +48 -19
  27. data/lib/puppet/metatype/instances.rb +35 -1
  28. data/lib/puppet/metatype/metaparams.rb +23 -19
  29. data/lib/puppet/metatype/providers.rb +25 -38
  30. data/lib/puppet/network/client/ca.rb +8 -5
  31. data/lib/puppet/network/client/master.rb +59 -17
  32. data/lib/puppet/network/handler.rb +18 -1
  33. data/lib/puppet/network/handler/ca.rb +9 -3
  34. data/lib/puppet/network/handler/facts.rb +70 -0
  35. data/lib/puppet/network/handler/filebucket.rb +4 -1
  36. data/lib/puppet/network/handler/fileserver.rb +65 -21
  37. data/lib/puppet/network/handler/master.rb +6 -3
  38. data/lib/puppet/network/handler/report.rb +12 -26
  39. data/lib/puppet/network/handler/resource.rb +14 -2
  40. data/lib/puppet/network/handler/runner.rb +5 -1
  41. data/lib/puppet/network/handler/status.rb +5 -1
  42. data/lib/puppet/network/server/mongrel.rb +4 -4
  43. data/lib/puppet/network/server/webrick.rb +14 -3
  44. data/lib/puppet/parameter.rb +30 -25
  45. data/lib/puppet/parser/ast.rb +1 -6
  46. data/lib/puppet/parser/ast/component.rb +23 -20
  47. data/lib/puppet/parser/ast/hostclass.rb +7 -11
  48. data/lib/puppet/parser/ast/leaf.rb +4 -1
  49. data/lib/puppet/parser/ast/node.rb +6 -8
  50. data/lib/puppet/parser/functions.rb +7 -4
  51. data/lib/puppet/parser/interpreter.rb +155 -205
  52. data/lib/puppet/parser/lexer.rb +35 -2
  53. data/lib/puppet/parser/parser.rb +705 -612
  54. data/lib/puppet/parser/resource.rb +91 -48
  55. data/lib/puppet/parser/resource/param.rb +52 -29
  56. data/lib/puppet/parser/scope.rb +28 -23
  57. data/lib/puppet/pgraph.rb +26 -21
  58. data/lib/puppet/propertychange.rb +12 -12
  59. data/lib/puppet/provider.rb +102 -31
  60. data/lib/puppet/provider/cron/crontab.rb +7 -8
  61. data/lib/puppet/provider/group/groupadd.rb +4 -4
  62. data/lib/puppet/provider/group/pw.rb +3 -3
  63. data/lib/puppet/provider/mount.rb +8 -8
  64. data/lib/puppet/provider/mount/netinfo.rb +5 -5
  65. data/lib/puppet/provider/mount/parsed.rb +2 -2
  66. data/lib/puppet/provider/nameservice.rb +19 -31
  67. data/lib/puppet/provider/nameservice/netinfo.rb +14 -14
  68. data/lib/puppet/provider/nameservice/objectadd.rb +4 -4
  69. data/lib/puppet/provider/nameservice/pw.rb +4 -4
  70. data/lib/puppet/provider/package.rb +31 -0
  71. data/lib/puppet/provider/package/appdmg.rb +118 -0
  72. data/lib/puppet/provider/package/apple.rb +18 -16
  73. data/lib/puppet/provider/package/apt.rb +13 -15
  74. data/lib/puppet/provider/package/aptitude.rb +5 -3
  75. data/lib/puppet/provider/package/aptrpm.rb +9 -11
  76. data/lib/puppet/provider/package/blastwave.rb +9 -9
  77. data/lib/puppet/provider/package/darwinport.rb +12 -11
  78. data/lib/puppet/provider/package/dpkg.rb +20 -12
  79. data/lib/puppet/provider/package/fink.rb +87 -0
  80. data/lib/puppet/provider/package/freebsd.rb +10 -11
  81. data/lib/puppet/provider/package/gem.rb +15 -15
  82. data/lib/puppet/provider/package/openbsd.rb +12 -17
  83. data/lib/puppet/provider/package/pkgdmg.rb +90 -16
  84. data/lib/puppet/provider/package/portage.rb +20 -14
  85. data/lib/puppet/provider/package/ports.rb +15 -13
  86. data/lib/puppet/provider/package/rpm.rb +20 -23
  87. data/lib/puppet/provider/package/rug.rb +6 -8
  88. data/lib/puppet/provider/package/sun.rb +20 -18
  89. data/lib/puppet/provider/package/sunfreeware.rb +2 -2
  90. data/lib/puppet/provider/package/up2date.rb +6 -10
  91. data/lib/puppet/provider/package/urpmi.rb +51 -0
  92. data/lib/puppet/provider/package/yum.rb +15 -13
  93. data/lib/puppet/provider/parsedfile.rb +53 -63
  94. data/lib/puppet/provider/service/base.rb +13 -15
  95. data/lib/puppet/provider/service/debian.rb +4 -4
  96. data/lib/puppet/provider/service/gentoo.rb +4 -4
  97. data/lib/puppet/provider/service/init.rb +22 -15
  98. data/lib/puppet/provider/service/redhat.rb +6 -6
  99. data/lib/puppet/provider/service/smf.rb +6 -6
  100. data/lib/puppet/provider/user/netinfo.rb +5 -5
  101. data/lib/puppet/provider/user/pw.rb +10 -5
  102. data/lib/puppet/provider/user/useradd.rb +9 -14
  103. data/lib/puppet/provider/zone/solaris.rb +80 -45
  104. data/lib/puppet/rails.rb +3 -34
  105. data/lib/puppet/rails/database/schema.rb +45 -24
  106. data/lib/puppet/rails/fact_value.rb +1 -0
  107. data/lib/puppet/rails/host.rb +69 -40
  108. data/lib/puppet/rails/param_name.rb +3 -8
  109. data/lib/puppet/rails/param_value.rb +2 -1
  110. data/lib/puppet/rails/puppet_class.rb +0 -2
  111. data/lib/puppet/rails/puppet_tag.rb +5 -0
  112. data/lib/puppet/rails/resource.rb +41 -17
  113. data/lib/puppet/rails/resource_tag.rb +4 -0
  114. data/lib/puppet/reference/configuration.rb +149 -0
  115. data/lib/puppet/reference/function.rb +13 -0
  116. data/lib/puppet/reference/network.rb +37 -0
  117. data/lib/puppet/reference/providers.rb +118 -0
  118. data/lib/puppet/reference/report.rb +21 -0
  119. data/lib/puppet/reference/type.rb +152 -0
  120. data/lib/puppet/reports/rrdgraph.rb +21 -7
  121. data/lib/puppet/reports/tagmail.rb +4 -1
  122. data/lib/puppet/sslcertificates.rb +1 -49
  123. data/lib/puppet/sslcertificates/ca.rb +2 -79
  124. data/lib/puppet/sslcertificates/inventory.rb +0 -10
  125. data/lib/puppet/transaction.rb +24 -41
  126. data/lib/puppet/transaction/report.rb +27 -1
  127. data/lib/puppet/type.rb +7 -43
  128. data/lib/puppet/type/component.rb +198 -124
  129. data/lib/puppet/type/cron.rb +51 -42
  130. data/lib/puppet/type/exec.rb +20 -19
  131. data/lib/puppet/type/group.rb +6 -55
  132. data/lib/puppet/type/host.rb +16 -37
  133. data/lib/puppet/type/mount.rb +30 -17
  134. data/lib/puppet/type/notify.rb +7 -8
  135. data/lib/puppet/type/package.rb +44 -80
  136. data/lib/puppet/type/pfile.rb +50 -41
  137. data/lib/puppet/type/pfile/checksum.rb +82 -95
  138. data/lib/puppet/type/pfile/content.rb +21 -25
  139. data/lib/puppet/type/pfile/ensure.rb +32 -30
  140. data/lib/puppet/type/pfile/group.rb +21 -26
  141. data/lib/puppet/type/pfile/mode.rb +25 -32
  142. data/lib/puppet/type/pfile/owner.rb +23 -27
  143. data/lib/puppet/type/pfile/source.rb +42 -33
  144. data/lib/puppet/type/pfile/target.rb +20 -18
  145. data/lib/puppet/type/pfile/type.rb +6 -7
  146. data/lib/puppet/type/pfilebucket.rb +3 -3
  147. data/lib/puppet/type/port.rb +5 -7
  148. data/lib/puppet/type/property.rb +58 -61
  149. data/lib/puppet/type/resources.rb +12 -8
  150. data/lib/puppet/type/schedule.rb +8 -8
  151. data/lib/puppet/type/service.rb +26 -33
  152. data/lib/puppet/type/sshkey.rb +6 -7
  153. data/lib/puppet/type/tidy.rb +41 -35
  154. data/lib/puppet/type/user.rb +34 -67
  155. data/lib/puppet/type/yumrepo.rb +27 -12
  156. data/lib/puppet/type/zone.rb +71 -110
  157. data/lib/puppet/util.rb +46 -61
  158. data/lib/puppet/util/autoload.rb +59 -47
  159. data/lib/puppet/util/config.rb +160 -18
  160. data/lib/puppet/util/config_store.rb +61 -0
  161. data/lib/puppet/util/fact_store.rb +60 -0
  162. data/lib/puppet/util/instance_loader.rb +74 -0
  163. data/lib/puppet/util/loadedfile.rb +5 -8
  164. data/lib/puppet/util/metric.rb +17 -25
  165. data/lib/puppet/util/posix.rb +39 -7
  166. data/lib/puppet/util/provider_features.rb +9 -1
  167. data/lib/puppet/util/rails/collection_merger.rb +16 -1
  168. data/lib/puppet/util/reference.rb +189 -0
  169. data/lib/puppet/util/storage.rb +2 -2
  170. data/lib/puppet/util/subclass_loader.rb +9 -2
  171. data/test/language/ast.rb +4 -148
  172. data/test/language/ast/component.rb +10 -1
  173. data/test/language/collector.rb +1 -191
  174. data/test/language/interpreter.rb +284 -327
  175. data/test/language/lexer.rb +13 -1
  176. data/test/language/node.rb +1 -1
  177. data/test/language/parser.rb +17 -4
  178. data/test/language/resource.rb +67 -101
  179. data/test/language/scope.rb +18 -3
  180. data/test/language/snippets.rb +114 -151
  181. data/test/lib/puppettest.rb +13 -0
  182. data/test/lib/puppettest/exetest.rb +7 -0
  183. data/test/lib/puppettest/fakes.rb +39 -28
  184. data/test/lib/puppettest/railstesting.rb +1 -1
  185. data/test/lib/puppettest/support/assertions.rb +2 -2
  186. data/test/lib/puppettest/support/collection.rb +30 -0
  187. data/test/network/client/ca.rb +27 -1
  188. data/test/network/client/client.rb +3 -3
  189. data/test/network/client/master.rb +102 -1
  190. data/test/network/handler/ca.rb +35 -1
  191. data/test/network/handler/facts.rb +112 -0
  192. data/test/network/handler/fileserver.rb +25 -1
  193. data/test/network/handler/handler.rb +2 -2
  194. data/test/network/handler/master.rb +2 -49
  195. data/test/network/handler/resource.rb +5 -6
  196. data/test/network/server/mongrel_test.rb +65 -0
  197. data/test/network/server/webrick.rb +2 -2
  198. data/test/network/xmlrpc/client.rb +2 -1
  199. data/test/network/xmlrpc/processor.rb +2 -1
  200. data/test/other/pgraph.rb +6 -5
  201. data/test/other/propertychange.rb +11 -12
  202. data/test/other/report.rb +44 -27
  203. data/test/other/transactions.rb +17 -16
  204. data/test/puppet/tc_suidmanager.rb +2 -2
  205. data/test/rails/ast.rb +74 -0
  206. data/test/rails/collection.rb +214 -0
  207. data/test/rails/host.rb +49 -24
  208. data/test/rails/interpreter.rb +91 -0
  209. data/test/rails/railsparameter.rb +22 -11
  210. data/test/rails/railsresource.rb +140 -7
  211. data/test/ral/manager/attributes.rb +37 -13
  212. data/test/ral/manager/instances.rb +82 -0
  213. data/test/ral/manager/provider.rb +60 -22
  214. data/test/ral/manager/type.rb +9 -6
  215. data/test/ral/providers/cron/crontab.rb +59 -7
  216. data/test/ral/providers/group.rb +7 -7
  217. data/test/ral/providers/host/netinfo.rb +5 -6
  218. data/test/ral/providers/host/parsed.rb +4 -4
  219. data/test/ral/providers/mount/parsed.rb +11 -6
  220. data/test/ral/providers/nameservice.rb +2 -2
  221. data/test/ral/providers/package.rb +39 -14
  222. data/test/ral/providers/package/apt.rb +72 -3
  223. data/test/ral/providers/package/aptitude.rb +15 -12
  224. data/test/ral/providers/package/aptrpm.rb +3 -3
  225. data/test/ral/providers/package/dpkg.rb +2 -2
  226. data/test/ral/providers/parsedfile.rb +114 -88
  227. data/test/ral/providers/{parsedport.rb → port/parsed.rb} +1 -1
  228. data/test/ral/providers/provider.rb +93 -13
  229. data/test/ral/providers/service.rb +52 -26
  230. data/test/ral/providers/sshkey/parsed.rb +3 -3
  231. data/test/ral/providers/user.rb +19 -20
  232. data/test/ral/providers/user/useradd.rb +1 -5
  233. data/test/ral/types/cron.rb +49 -36
  234. data/test/ral/types/file.rb +38 -35
  235. data/test/ral/types/file/target.rb +4 -4
  236. data/test/ral/types/filesources.rb +24 -22
  237. data/test/ral/types/group.rb +4 -2
  238. data/test/ral/types/host.rb +17 -10
  239. data/test/ral/types/mount.rb +40 -23
  240. data/test/ral/types/package.rb +62 -5
  241. data/test/ral/types/parameter.rb +2 -2
  242. data/test/ral/types/property.rb +27 -20
  243. data/test/ral/types/resources.rb +4 -16
  244. data/test/ral/types/schedule.rb +2 -2
  245. data/test/ral/types/service.rb +2 -3
  246. data/test/ral/types/sshkey.rb +3 -3
  247. data/test/ral/types/tidy.rb +6 -15
  248. data/test/ral/types/user.rb +17 -17
  249. data/test/ral/types/yumrepo.rb +2 -2
  250. data/test/ral/types/zone.rb +71 -87
  251. data/test/util/autoload.rb +6 -21
  252. data/test/util/config.rb +201 -101
  253. data/test/util/fact_store.rb +67 -0
  254. data/test/util/features.rb +9 -6
  255. data/test/util/instance_loader.rb +53 -0
  256. data/test/util/loadedfile.rb +17 -1
  257. data/test/util/metrics.rb +54 -57
  258. data/test/util/posixtest.rb +8 -11
  259. data/test/util/utiltest.rb +31 -2
  260. metadata +520 -492
  261. data/TODO +0 -4
  262. data/lib/puppet/network/client/logger.rb +0 -6
  263. data/lib/puppet/network/handler/logger.rb +0 -52
  264. data/lib/puppet/rails/database/001_add_indexes.rb +0 -38
  265. data/lib/puppet/type/parsedtype.rb +0 -219
  266. data/test/network/handler/logger.rb +0 -183
data/CHANGELOG CHANGED
@@ -1,3 +1,159 @@
1
+ Modified the fileserver to cache file information, so that
2
+ each file isn't being read on every connection. Also,
3
+ added londo's patch from #678 to avoid reading entire files
4
+ into memory.
5
+
6
+ Fixed environment handling in the crontab provider (#669).
7
+
8
+ Added patch by trombik in #572, supporting old-style
9
+ freebsd init scripts with '.sh' endings.
10
+
11
+ Added fink package provider (#642), as provided by 'do'.
12
+
13
+ Marked the dpkg package provider as versionable (#647).
14
+
15
+ Applied patches by trombik to fix FreeBSD ports (#624 and #628).
16
+
17
+ Fixed the CA server so that it refuses to send back a certificate
18
+ whose public key doesn't match the CSR. Instead, it tells the
19
+ user to run 'puppetca --clean'.
20
+
21
+ Invalid certificates are no longer written to disk (#578).
22
+
23
+ Added a package provider (appdmg) able to install .app packages
24
+ on .dmg files on OS X (#641).
25
+
26
+ Applied the patch from #667 to hopefully kill the client hanging
27
+ problems (permanently, this time).
28
+
29
+ Fixed functions so that they accept most other rvalues as valid values
30
+ (#548).
31
+
32
+ COMPATIBILITY ALERT:
33
+ Significantly reworked external node support, in a way that's NOT
34
+ backward-compatible:
35
+
36
+ Only ONE node source can be used -- you can use LDAP, code, or
37
+ an external node program, but not more than one.
38
+
39
+ LDAP node support has two changes: First, the "ldapattrs" attribute is
40
+ now used for setting the attributes to retrieve from the server (in
41
+ addition to required attriutes), and second, all retrieved attributes
42
+ are set as variables in the top scope. This means you can set attributes
43
+ on your LDAP nodes and they will automatically appear as variables
44
+ in your configurations.
45
+
46
+ External node support has been completely rewritten. These programs must
47
+ now generate a YAML dump of a hash, with "classes" and "parameters" keys.
48
+ The classes should be an array, and the parameters should be a hash. The
49
+ external node program has no support for parent nodes -- the script must
50
+ handle that on its own.
51
+
52
+ Reworked the database schema used to store configurations with the
53
+ storeconfigs option.
54
+
55
+ Replaced the obsolete RRD ruby library with the maintained
56
+ RubyRRDtool library (which requires rrdtool2) (#659).
57
+
58
+ The Portage package provider now calls eix-update automatically
59
+ when eix's database is absent or out of sync (#666).
60
+
61
+ Mounts now correctly handle existing fstabs with no pass or dump values
62
+ (#550).
63
+
64
+ Mounts now default to 0 for pass and dump (#112).
65
+
66
+ Added urpmi support (#592).
67
+
68
+ Finishing up the type => provider interface work. Basically, package
69
+ providers now return lists of provider instances. In the proces,
70
+ I rewrote the interface between package types and providers, and also
71
+ enabled prefetching on all packages. This should significantly speed
72
+ up most package operations.
73
+
74
+ Hopefully fixing the file descriptor/open port problems, with patches
75
+ from Valentin Vidic.
76
+
77
+ Significantly reworked the type => provider interface with respect to
78
+ listing existing provider instances. The class method on both
79
+ class heirarchies has been renamed to 'instances', to start. Providers
80
+ are now expected to return provider instances, instead of creating
81
+ resources, and the resource's 'instances' method is expected to
82
+ find the matching resource, if any, and set the resource's
83
+ provider appropriately. This *significantly* reduces the reliance on
84
+ effectively global state (resource references in the resource classes).
85
+ This global state will go away soon.
86
+
87
+ Along with this change, the 'prefetch' class method on providers now
88
+ accepts the list of resources for prefetching. This again reduces
89
+ reliance on global state, and makes the execution path much easier
90
+ to follow.
91
+
92
+ Fixed #532 -- reparsing config files now longer throws an exception.
93
+
94
+ Added some warnings and logs to the service type so
95
+ users will be encouraged to specify either "ensure"
96
+ or "enabled" and added debugging to indicate why
97
+ restarting is skipped when it is.
98
+
99
+ Changed the location of the classes.txt to the state
100
+ directory.
101
+
102
+ Added better error reporting on unmatched brackets.
103
+
104
+ Moved puppetd and puppetmasterd to sbin in svn and fixed install.rb
105
+ to copy them into sbin on the local system appropriately. (#323)
106
+
107
+ Added a splay option (#501). It's disabled when running under
108
+ --test in puppetd. The value is random but cached. It defaults
109
+ to the runinterval but can be tuned with --splaylimit
110
+
111
+ Changing the notify type so that it always uses
112
+ the loglevel.
113
+
114
+ Fixing #568 - nodes can inherit from quoted node names.
115
+
116
+ Tags (and thus definitions and classes) can now be a single
117
+ character. (#566)
118
+
119
+ Added an 'undef' keyword (#629), which will evaluate to ""
120
+ within strings but when used as a resource parameter value
121
+ will cause that parameter to be evaluated as undefined.
122
+
123
+ Changed the topological sort algorithm (#507) so it will always
124
+ fail on cycles.
125
+
126
+ Added a 'dynamicfacts' configuration option; any facts in that
127
+ comma-separated list will be ignored when comparing facts to
128
+ see if they have changed and thus whether a recompile is necessary.
129
+
130
+ Renamed some poorly named internal variables:
131
+ @models in providers are now either @resource or
132
+ @resource_type (#605).
133
+
134
+ @children is no longer used except by components (#606).
135
+
136
+ @parent is now @resource within parameters (#607).
137
+
138
+ The old variables are still set for backward compatibility.
139
+
140
+ Significantly reworking configuration parsing. Executables all now
141
+ look for 'puppet.conf' (#206), although they will parse the old-style
142
+ configuration files if they are present, although they throw a deprecation
143
+ warning. Also, file parameters (owner, mode, group) are now set on the
144
+ same line as the parameter, in brackets. (#422)
145
+
146
+ Added transaction summaries (available with the --summarize option),
147
+ useful for getting a quick idea of what happened in a transaction.
148
+ Currently only useful on the client or with the puppet interpreter.
149
+
150
+ Changed the interal workings for retrieve and removed the :is attribute
151
+ from Property. The retrieve methods now return the current value of
152
+ the property for the system.
153
+
154
+ Removed acts_as_taggable from the rails models.
155
+
156
+ 0.22.4
1
157
  Execs now autorequire the user they run as, as long as the user
2
158
  is specified by name. (#430)
3
159
 
data/README CHANGED
@@ -22,6 +22,6 @@ Generally, you need the following things installed:
22
22
  the library.
23
23
 
24
24
  * Facter => 1.1.1
25
- You can get this from http://reductivelabs.com/projects/facter
25
+ You can get this from < http://reductivelabs.com/projects/facter >
26
26
 
27
- $Id: README 2113 2007-01-29 18:32:46Z ajax $
27
+ $Id: README 2549 2007-06-03 19:36:02Z ajax $
data/Rakefile CHANGED
@@ -28,13 +28,13 @@ project = Rake::RedLabProject.new("puppet") do |p|
28
28
  'examples/**/*',
29
29
  'conf/**/*'
30
30
  ]
31
- p.filelist.exclude("bin/pi", "bin/ralsh", "bin/filebucket")
31
+ p.filelist.exclude("bin/pi")
32
32
 
33
33
  p.add_dependency('facter', '1.1.0')
34
34
 
35
35
  #p.epmhosts = %w{culain}
36
- p.sunpkghost = "sol10b"
37
- p.rpmhost = "fedora1"
36
+ #p.sunpkghost = "sol10b"
37
+ #p.rpmhost = "fedora1"
38
38
  end
39
39
 
40
40
  if project.has?(:gem)
@@ -45,7 +45,7 @@ if project.has?(:gem)
45
45
 
46
46
  task.bindir = "bin" # Use these for applications.
47
47
  task.executables = ["puppet", "puppetd", "puppetmasterd", "puppetdoc",
48
- "puppetca"]
48
+ "puppetca", "puppetrun", "ralsh"]
49
49
  task.default_executable = "puppet"
50
50
  task.autorequire = 'puppet'
51
51
 
@@ -111,7 +111,7 @@ def daily(package)
111
111
  end
112
112
 
113
113
  def downdir
114
- ENV['DOWNLOAD_DIR'] || "/export/docroots/reductivelabs.com/htdocs/downloads"
114
+ ENV['DOWNLOAD_DIR'] || "/opt/rl/docroots/reductivelabs.com/htdocs/downloads"
115
115
  end
116
116
 
117
117
  def stamp
@@ -138,4 +138,4 @@ task :dailyclean do
138
138
  end
139
139
  end
140
140
 
141
- # $Id: Rakefile 2354 2007-03-26 17:19:24Z luke $
141
+ # $Id: Rakefile 2630 2007-06-19 23:11:10Z luke $
@@ -0,0 +1,212 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #
4
+ # = Synopsis
5
+ #
6
+ # A stand-alone Puppet filebucket client.
7
+ #
8
+ # = Usage
9
+ #
10
+ # pbucket [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose]
11
+ # [-l|--local] [-r|--remote]
12
+ # [-s|--server <server>] [-b|--bucket <directory>] <file> <file> ...
13
+ #
14
+ # = Description
15
+ #
16
+ # This is a stand-alone filebucket client for sending files to a local
17
+ # or central filebucket.
18
+ #
19
+ # = Usage
20
+ #
21
+ # This client can operate in three modes, with only one mode per call:
22
+ #
23
+ # backup::
24
+ # Send one or more files to the specified file bucket. Each sent file
25
+ # is printed with its resulting md5 sum.
26
+ #
27
+ # get::
28
+ # Return the text associated with an md5 sum. The text is printed to
29
+ # stdout, and only one file can be retrieved at a time.
30
+ #
31
+ # restore::
32
+ # Given a file path and an md5 sum, store the content associated with the
33
+ # sum into the specified file path. You can specify an entirely new path
34
+ # to this argument; you are not restricted to restoring the content to its
35
+ # original location.
36
+ #
37
+ # Note that +pbucket+ defaults to using a network-based filebucket available on
38
+ # the server named +puppet+. To use this, you'll have to be running as a user
39
+ # with valid Puppet certificates. Alternatively, you can use your local file bucket
40
+ # by specifying +--local+.
41
+ #
42
+ # = Example
43
+ #
44
+ # $ pbucket backup /etc/passwd
45
+ # /etc/passwd: 429b225650b912a2ee067b0a4cf1e949
46
+ # $ pbucket restore /tmp/passwd 429b225650b912a2ee067b0a4cf1e949
47
+ # $
48
+ #
49
+ # = Options
50
+ #
51
+ # Note that any configuration parameter that's valid in the configuration file
52
+ # is also a valid long argument. For example, 'ssldir' is a valid configuration
53
+ # parameter, so you can specify '--ssldir <directory>' as an argument.
54
+ #
55
+ # See the configuration file documentation at
56
+ # http://reductivelabs.com/projects/puppet/reference/configref.html for
57
+ # the full list of acceptable parameters. A commented list of all
58
+ # configuration options can also be generated by running puppet with
59
+ # '--genconfig'.
60
+ #
61
+ # debug::
62
+ # Enable full debugging.
63
+ #
64
+ # help::
65
+ # Print this help message
66
+ #
67
+ # local::
68
+ # Use the local filebucket. This will use the default configuration
69
+ # information.
70
+ #
71
+ # remote::
72
+ # Use a remote filebucket. This will use the default configuration
73
+ # information.
74
+ #
75
+ # server::
76
+ # The server to send the file to, instead of locally.
77
+ #
78
+ # verbose::
79
+ # Print extra information.
80
+ #
81
+ # version::
82
+ # Print version information.
83
+ #
84
+ # = Example
85
+ #
86
+ # pbucket -b /tmp/filebucket /my/file
87
+ #
88
+ # = Author
89
+ #
90
+ # Luke Kanies
91
+ #
92
+ # = Copyright
93
+ #
94
+ # Copyright (c) 2005 Reductive Labs, LLC
95
+ # Licensed under the GNU Public License
96
+
97
+ require 'puppet'
98
+ require 'puppet/network/client'
99
+ require 'getoptlong'
100
+
101
+ options = [
102
+ [ "--bucket", "-b", GetoptLong::REQUIRED_ARGUMENT ],
103
+ [ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
104
+ [ "--help", "-h", GetoptLong::NO_ARGUMENT ],
105
+ [ "--local", "-l", GetoptLong::NO_ARGUMENT ],
106
+ [ "--remote", "-r", GetoptLong::NO_ARGUMENT ],
107
+ [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
108
+ [ "--version", "-V", GetoptLong::NO_ARGUMENT ]
109
+ ]
110
+
111
+ # Add all of the config parameters as valid options.
112
+ Puppet.config.addargs(options)
113
+
114
+ result = GetoptLong.new(*options)
115
+
116
+ options = {}
117
+
118
+ begin
119
+ result.each { |opt,arg|
120
+ case opt
121
+ when "--version"
122
+ puts "%s" % Puppet.version
123
+ exit
124
+ when "--help"
125
+ if Puppet.features.usage?
126
+ RDoc::usage && exit
127
+ else
128
+ puts "No help available unless you have RDoc::usage installed"
129
+ exit
130
+ end
131
+ when "--bucket"
132
+ options[:bucket] = arg
133
+ when "--verbose"
134
+ options[:verbose] = true
135
+ when "--debug"
136
+ options[:debug] = true
137
+ when "--local"
138
+ options[:local] = true
139
+ when "--remote"
140
+ options[:remote] = true
141
+ else
142
+ Puppet.config.handlearg(opt, arg)
143
+ end
144
+ }
145
+ rescue GetoptLong::InvalidOption => detail
146
+ $stderr.puts "Try '#{$0} --help'"
147
+ exit(1)
148
+ end
149
+
150
+ Puppet::Log.newdestination(:console)
151
+
152
+ client = nil
153
+ server = nil
154
+
155
+ Puppet.settraps
156
+
157
+ if options[:debug]
158
+ Puppet::Log.level = :debug
159
+ elsif options[:verbose]
160
+ Puppet::Log.level = :info
161
+ end
162
+
163
+ # Now parse the config
164
+ Puppet.parse_config
165
+
166
+ Puppet.genconfig
167
+ Puppet.genmanifest
168
+
169
+ begin
170
+ if options[:local] or options[:bucket]
171
+ path = options[:bucket] || Puppet[:bucketdir]
172
+ client = Puppet::Network::Client.dipper.new(:Path => path)
173
+ else
174
+ require 'puppet/network/handler'
175
+ client = Puppet::Network::Client.dipper.new(:Server => Puppet[:server])
176
+ end
177
+ rescue => detail
178
+ $stderr.puts detail
179
+ if Puppet[:trace]
180
+ puts detail.backtrace
181
+ end
182
+ exit(1)
183
+ end
184
+
185
+ mode = ARGV.shift
186
+ case mode
187
+ when "get":
188
+ md5 = ARGV.shift
189
+ out = client.getfile(md5)
190
+ print out
191
+ when "backup":
192
+ ARGV.each do |file|
193
+ unless FileTest.exists?(file)
194
+ $stderr.puts "%s: no such file" % file
195
+ next
196
+ end
197
+ unless FileTest.readable?(file)
198
+ $stderr.puts "%s: cannot read file" % file
199
+ next
200
+ end
201
+ md5 = client.backup(file)
202
+ puts "%s: %s" % [file, md5]
203
+ end
204
+ when "restore":
205
+ file = ARGV.shift
206
+ md5 = ARGV.shift
207
+ client.restore(file, md5)
208
+ else
209
+ raise "Invalid mode %s" % mode
210
+ end
211
+
212
+ # $Id: filebucket 2464 2007-05-06 05:42:53Z luke $
data/bin/puppet CHANGED
@@ -132,6 +132,8 @@ rescue GetoptLong::InvalidOption => detail
132
132
  exit(1)
133
133
  end
134
134
 
135
+ Puppet.parse_config
136
+
135
137
  unless logset
136
138
  Puppet::Util::Log.newdestination(:console)
137
139
  end
@@ -152,9 +152,7 @@ rescue GetoptLong::InvalidOption => detail
152
152
  end
153
153
 
154
154
  # Now parse the config
155
- if Puppet[:config] and File.exists? Puppet[:config]
156
- Puppet.config.parse(Puppet[:config])
157
- end
155
+ Puppet.parse_config
158
156
 
159
157
  Puppet.genconfig
160
158
  Puppet.genmanifest
@@ -278,4 +276,4 @@ else
278
276
  exit(42)
279
277
  end
280
278
 
281
- # $Id: puppetca 2391 2007-04-17 18:54:52Z luke $
279
+ # $Id: puppetca 2464 2007-05-06 05:42:53Z luke $
@@ -34,7 +34,7 @@
34
34
  # configuration every 30 minutes.
35
35
  #
36
36
  # Some flags are meant specifically for interactive use -- in particular,
37
- # +test+ and +tags+ are useful. +test+ enables verobse logging, causes
37
+ # +test+ and +tags+ are useful. +test+ enables verbose logging, causes
38
38
  # the daemon to stay in the foreground, exits if the server's configuration is
39
39
  # invalid (this happens if, for instance, you've left a syntax error on the
40
40
  # server), and exits after running the configuration once (rather than hanging
@@ -111,11 +111,12 @@
111
111
  # useful for interactively running puppetd.
112
112
  #
113
113
  # serve::
114
- # Start another type of server. By default default, +puppetd+ will start
115
- # a server that allows authenticated and authorized remote nodes to trigger
116
- # the configuration to be pulled down and applied. You can specify
117
- # any other type of service here that does not require configuration,
118
- # e.g., filebucket, ca, or pelement.
114
+ # Start another type of server. By default, +puppetd+ will start
115
+ # a service handler that allows authenticated and authorized remote nodes to
116
+ # trigger the configuration to be pulled down and applied. You can specify
117
+ # any handler here that does not require configuration, e.g., filebucket, ca,
118
+ # or resource. The handlers are in +lib/puppet/network/handler+, and the names
119
+ # must match exactly, both in the call to +serve+ and in +namespaceauth.conf+.
119
120
  #
120
121
  # test::
121
122
  # Enable the most common options used for testing. These are +onetime+,
@@ -169,6 +170,7 @@ options = [
169
170
  [ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ],
170
171
  [ "--onetime", "-o", GetoptLong::NO_ARGUMENT ],
171
172
  [ "--test", "-t", GetoptLong::NO_ARGUMENT ],
173
+ [ "--serve", "-s", GetoptLong::REQUIRED_ARGUMENT ],
172
174
  [ "--no-client", GetoptLong::NO_ARGUMENT ],
173
175
  [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
174
176
  [ "--version", "-V", GetoptLong::NO_ARGUMENT ],
@@ -205,8 +207,10 @@ begin
205
207
  when "--disable"
206
208
  options[:disable] = true
207
209
  when "--serve"
208
- if klass = Puppet::Network::Server::Handler.handler(arg)
209
- options[:serve][klass.name] = klass
210
+ if Puppet::Network::Handler.handler(arg)
211
+ options[:serve][arg.to_sym] = {}
212
+ else
213
+ raise "Could not find handler for %s" % arg
210
214
  end
211
215
  when "--enable"
212
216
  options[:enable] = true
@@ -214,6 +218,7 @@ begin
214
218
  # Enable all of the most common test options.
215
219
  Puppet.config.handlearg("--ignorecache")
216
220
  Puppet.config.handlearg("--no-usecacheonfailure")
221
+ Puppet.config.handlearg("--no-splay")
217
222
  options[:onetime] = true
218
223
  options[:waitforcert] = 0
219
224
  unless Puppet::Util::Log.level == :debug
@@ -268,9 +273,7 @@ rescue GetoptLong::InvalidOption => detail
268
273
  end
269
274
 
270
275
  # Now parse the config
271
- if Puppet[:config] and File.exists? Puppet[:config]
272
- Puppet.config.parse(Puppet[:config])
273
- end
276
+ Puppet.parse_config
274
277
 
275
278
  Puppet.genconfig
276
279
  Puppet.genmanifest
@@ -376,9 +379,7 @@ if Puppet[:listen] and ! options[:onetime]
376
379
  if options[:serve].empty?
377
380
  handlers = {:Runner => {}}
378
381
  else
379
- handlers = options[:serve].inject({}) do |hash, name, klass|
380
- hash[name] = {}
381
- end
382
+ handlers = options[:serve]
382
383
  end
383
384
 
384
385
  handlers.each do |name, hash|
@@ -445,4 +446,4 @@ else
445
446
  Puppet.start
446
447
  end
447
448
 
448
- # $Id: puppetd 2375 2007-03-30 23:17:40Z luke $
449
+ # $Id: puppetd 2594 2007-06-15 23:11:43Z luke $