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
@@ -180,9 +180,7 @@ unless options[:setdest]
180
180
  end
181
181
 
182
182
  # Now parse the config
183
- if Puppet[:config] and File.exists? Puppet[:config]
184
- Puppet.config.parse(Puppet[:config])
185
- end
183
+ Puppet.parse_config
186
184
 
187
185
  Puppet.genconfig
188
186
  Puppet.genmanifest
@@ -252,7 +250,7 @@ begin
252
250
  server = Puppet::Network::Server::WEBrick.new(:Handlers => handlers)
253
251
  when "mongrel":
254
252
  require 'puppet/network/server/mongrel'
255
- handler = Puppet::Network::Server::MongrelHandler.new(handlers)
253
+ handler = Puppet::Network::Server::Mongrel.new(handlers)
256
254
  addr = Puppet[:bindaddress]
257
255
  if addr == ""
258
256
  addr = "127.0.0.1"
@@ -301,4 +299,4 @@ when "mongrel":
301
299
  server.run.join
302
300
  end
303
301
 
304
- # $Id: puppetmasterd 2417 2007-04-26 18:58:07Z luke $
302
+ # $Id: puppetmasterd 2594 2007-06-15 23:11:43Z luke $
@@ -100,10 +100,13 @@
100
100
  # for each client to which to connect. The default is 1, meaning serial execution.
101
101
  #
102
102
  # tag::
103
- # Specify a tag for selecting the objects to apply.
103
+ # Specify a tag for selecting the objects to apply. Does not work with the
104
+ # --test option.
105
+ #
104
106
  #
105
107
  # test::
106
- # Print the hosts you would connect to but do not actually connect.
108
+ # Print the hosts you would connect to but do not actually connect. This
109
+ # option requires LDAP support at this point.
107
110
  #
108
111
  # = Example
109
112
  #
@@ -272,6 +275,8 @@ end
272
275
 
273
276
  # Now parse the config
274
277
  config = File.join(Puppet[:confdir], "puppetmasterd.conf")
278
+ Puppet.parse_config(config)
279
+
275
280
  if File.exists? config
276
281
  Puppet.config.parse(config)
277
282
  end
@@ -397,4 +402,4 @@ while go
397
402
  end
398
403
 
399
404
 
400
- # $Id: puppetrun 2352 2007-03-24 22:07:19Z luke $
405
+ # $Id: puppetrun 2464 2007-05-06 05:42:53Z luke $
@@ -0,0 +1,271 @@
1
+ #!/usr/bin/ruby
2
+ # vim: softtabstop=4 shiftwidth=4 expandtab
3
+ #
4
+ # = Synopsis
5
+ #
6
+ # Use the Puppet RAL to directly interact with the system.
7
+ #
8
+ # = Usage
9
+ #
10
+ # ralsh [-h|--help] [-d|--debug] [-v|--verbose] [-e|--edit] [-H|--host <host>]
11
+ # [-p|--param <param>] [-t|--types] type <name>
12
+ #
13
+ # = Description
14
+ #
15
+ # This command provides simple facilities for converting current system state
16
+ # into Puppet code, along with some ability to use Puppet to affect the current
17
+ # state.
18
+ #
19
+ # By default, you must at least provide a type to list, which case ralsh
20
+ # will tell you everything it knows about all instances of that type. You can
21
+ # optionally specify an instance name, and ralsh will only describe that single
22
+ # instance.
23
+ #
24
+ # You can also add +--edit+ as an argument, and ralsh will write its output
25
+ # to a file, open that file in an editor, and then apply the file as a Puppet
26
+ # transaction. You can easily use this to use Puppet to make simple changes to
27
+ # a system.
28
+ #
29
+ # = Options
30
+ #
31
+ # Note that any configuration parameter that's valid in the configuration file
32
+ # is also a valid long argument. For example, 'ssldir' is a valid configuration
33
+ # parameter, so you can specify '--ssldir <directory>' as an argument.
34
+ #
35
+ # See the configuration file documentation at
36
+ # http://reductivelabs.com/projects/puppet/reference/configref.html for
37
+ # the full list of acceptable parameters. A commented list of all
38
+ # configuration options can also be generated by running puppet with
39
+ # '--genconfig'.
40
+ #
41
+ # debug::
42
+ # Enable full debugging.
43
+ #
44
+ # edit:
45
+ # Write the results of the query to a file, open the file in an editor,
46
+ # and read the file back in as an executable Puppet manifest.
47
+ #
48
+ # host:
49
+ # When specified, connect to the resource server on the named host
50
+ # and retrieve the list of resouces of the type specified.
51
+ #
52
+ # help:
53
+ # Print this help message.
54
+ #
55
+ # param:
56
+ # Add more parameters to be outputted from queries.
57
+ #
58
+ # types:
59
+ # List all available types.
60
+ #
61
+ # verbose::
62
+ # Print extra information.
63
+ #
64
+ # = Example
65
+ #
66
+ # $ ralsh user luke
67
+ # user { 'luke':
68
+ # home => '/home/luke',
69
+ # uid => '100',
70
+ # ensure => 'present',
71
+ # comment => 'Luke Kanies,,,',
72
+ # gid => '1000',
73
+ # shell => '/bin/bash',
74
+ # groups => ['sysadmin','audio','video','puppet']
75
+ # }
76
+ # $
77
+ #
78
+ # = Author
79
+ #
80
+ # Luke Kanies
81
+ #
82
+ # = Copyright
83
+ #
84
+ # Copyright (c) 2005-2007 Reductive Labs, LLC
85
+ # Licensed under the GNU Public License
86
+
87
+
88
+ require 'getoptlong'
89
+ require 'puppet'
90
+
91
+ options = [
92
+ [ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
93
+ [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
94
+ [ "--types", "-t", GetoptLong::NO_ARGUMENT ],
95
+ [ "--param", "-p", GetoptLong::REQUIRED_ARGUMENT ],
96
+ [ "--host", "-H", GetoptLong::REQUIRED_ARGUMENT ],
97
+ [ "--edit", "-e", GetoptLong::NO_ARGUMENT ],
98
+ [ "--help", "-h", GetoptLong::NO_ARGUMENT ]
99
+ ]
100
+
101
+ # Add all of the config parameters as valid options.
102
+ Puppet.config.addargs(options)
103
+
104
+ result = GetoptLong.new(*options)
105
+
106
+ debug = false
107
+ verbose = false
108
+ edit = false
109
+ extra_params = []
110
+ host = nil
111
+
112
+ result.each { |opt,arg|
113
+ case opt
114
+ when "--host"
115
+ host = arg
116
+ when "--types"
117
+ types = []
118
+ Puppet::Type.loadall
119
+ Puppet::Type.eachtype do |t|
120
+ next if t.name == :component
121
+ types << t.name.to_s
122
+ end
123
+ puts types.sort
124
+ exit
125
+ when "--param"
126
+ extra_params << arg.to_sym
127
+ when "--edit"
128
+ edit = true
129
+ when "--help"
130
+ if Puppet.features.usage?
131
+ RDoc::usage
132
+ else
133
+ puts "install RDoc:usage for help"
134
+ end
135
+ exit
136
+ when "--verbose"
137
+ verbose = true
138
+ when "--debug"
139
+ debug = true
140
+ else
141
+ # Anything else is handled by the config stuff
142
+ Puppet.config.handlearg(opt, arg)
143
+ end
144
+ }
145
+
146
+ Puppet::Util::Log.newdestination(:console)
147
+
148
+ # Now parse the config
149
+ Puppet.parse_config
150
+
151
+ if debug
152
+ Puppet::Util::Log.level = :debug
153
+ elsif verbose
154
+ Puppet::Util::Log.level = :info
155
+ end
156
+
157
+
158
+ if ARGV.length > 0
159
+ type = ARGV.shift
160
+ else
161
+ raise "You must specify the type to display"
162
+ end
163
+
164
+ name = nil
165
+ params = {}
166
+ if ARGV.length > 0
167
+ name = ARGV.shift
168
+ end
169
+
170
+ if ARGV.length > 0
171
+ ARGV.each do |setting|
172
+ if setting =~ /^(\w+)=(.+)$/
173
+ params[$1] = $2
174
+ else
175
+ raise "Invalid parameter setting %s" % setting
176
+ end
177
+ end
178
+ end
179
+
180
+ if edit and host
181
+ raise "You cannot edit a remote host"
182
+ end
183
+
184
+ typeobj = nil
185
+
186
+ unless typeobj = Puppet::Type.type(type)
187
+ raise "Could not find type %s" % type
188
+ end
189
+
190
+ properties = typeobj.properties.collect { |s| s.name }
191
+
192
+ format = proc {|trans|
193
+ trans.dup.collect do |param, value|
194
+ if value == "" or value == []
195
+ trans.delete(param)
196
+ end
197
+
198
+ unless properties.include?(param) or extra_params.include?(param)
199
+ trans.delete(param)
200
+ end
201
+ end
202
+ trans.to_manifest
203
+ }
204
+
205
+ text = if host
206
+ client = Puppet::Network::Client.resource.new(:Server => host, :Port => Puppet[:puppetport])
207
+ unless client.read_cert
208
+ raise "client.read_cert failed"
209
+ end
210
+ begin
211
+ # They asked for a single resource.
212
+ if name
213
+ transbucket = [client.describe(type, name)]
214
+ else
215
+ # Else, list the whole thing out.
216
+ transbucket = client.instances(type)
217
+ end
218
+ rescue Puppet::Network::XMLRPCClientError => exc
219
+ raise "client.list(#{type}) failed: #{exc.message}"
220
+ end
221
+ transbucket.sort { |a,b| a.name <=> b.name }.collect(&format)
222
+ else
223
+ if name
224
+ obj = typeobj.create(:name => name, :check => properties)
225
+ vals = obj.retrieve
226
+
227
+ unless params.empty?
228
+ params.each do |param, value|
229
+ obj[param] = value
230
+ end
231
+ comp = Puppet::Type.type(:component).create(:name => "ralsh")
232
+ comp.push(obj)
233
+ transaction = comp.evaluate
234
+ begin
235
+ transaction.evaluate
236
+ rescue => detail
237
+ if Puppet[:trace]
238
+ puts detail.backtrace
239
+ end
240
+ end
241
+
242
+ end
243
+ [format.call(obj.to_trans(true))]
244
+ else
245
+ typeobj.instances.collect do |obj|
246
+ next if ARGV.length > 0 and ! ARGV.include? obj.name
247
+ trans = obj.to_trans(true)
248
+ format.call(trans)
249
+ end
250
+ end
251
+ end.compact.join("\n")
252
+
253
+ if edit
254
+ file = "/tmp/x2puppet-#{Process.pid}.pp"
255
+ begin
256
+ File.open(file, "w") do |f|
257
+ f.puts text
258
+ end
259
+ ENV["EDITOR"] ||= "vi"
260
+ system(ENV["EDITOR"], file)
261
+ system("puppet -v " + file)
262
+ ensure
263
+ #if FileTest.exists? file
264
+ # File.unlink(file)
265
+ #end
266
+ end
267
+ else
268
+ puts text
269
+ end
270
+
271
+ # $Id: ralsh 2573 2007-06-13 22:31:52Z luke $
@@ -15,7 +15,7 @@ export PATH
15
15
 
16
16
  [ -f /etc/sysconfig/puppet ] && . /etc/sysconfig/puppet
17
17
  lockfile=${LOCKFILE-/var/lock/subsys/puppet}
18
- pidfile=${PIDFILE-/var/run/puppet.pid}
18
+ pidfile=${PIDFILE-/var/run/puppet/puppet.pid}
19
19
  puppetd=${PUPPETD-/usr/sbin/puppetd}
20
20
  RETVAL=0
21
21
 
@@ -7,12 +7,12 @@
7
7
 
8
8
  Summary: A network tool for managing many disparate systems
9
9
  Name: puppet
10
- Version: 0.22.4
10
+ Version: 0.23.0
11
11
  Release: 1%{?dist}
12
12
  License: GPL
13
13
  Group: System Environment/Base
14
14
 
15
- URL: http://reductivelabs.com/projects/puppet/
15
+ URL: http://puppet.reductivelabs.com/
16
16
  Source: http://reductivelabs.com/downloads/puppet/%{name}-%{version}.tgz
17
17
 
18
18
  Requires: ruby >= 1.8.1
@@ -61,6 +61,8 @@ done
61
61
  %{__install} -d -m0755 %{buildroot}%{_localstatedir}/log/puppet
62
62
  %{__install} -Dp -m0755 %{pbuild}/bin/* %{buildroot}%{_sbindir}
63
63
  %{__mv} %{buildroot}%{_sbindir}/puppet %{buildroot}%{_bindir}/puppet
64
+ %{__mv} %{buildroot}%{_sbindir}/ralsh %{buildroot}%{_bindir}/ralsh
65
+ %{__mv} %{buildroot}%{_sbindir}/filebucket %{buildroot}%{_bindir}/filebucket
64
66
  %{__mv} %{buildroot}%{_sbindir}/puppetrun %{buildroot}%{_bindir}/puppetrun
65
67
  %{__install} -Dp -m0644 %{pbuild}/lib/puppet.rb %{buildroot}%{ruby_sitelibdir}/puppet.rb
66
68
  %{__cp} -a %{pbuild}/lib/puppet %{buildroot}%{ruby_sitelibdir}
@@ -78,9 +80,12 @@ find %{buildroot}%{ruby_sitelibdir} -type f -perm +ugo+x -print0 | xargs -0 -r %
78
80
  %files
79
81
  %defattr(-, root, root, 0755)
80
82
  %{_bindir}/puppet
83
+ %{_bindir}/ralsh
84
+ %{_bindir}/filebucket
81
85
  %{_sbindir}/puppetd
82
86
  %{ruby_sitelibdir}/*
83
87
  %{_initrddir}/puppet
88
+ %dir %{_sysconfdir}/puppet
84
89
  %config(noreplace) %{_sysconfdir}/sysconfig/puppet
85
90
  %config(noreplace) %{_sysconfdir}/puppet/puppetd.conf
86
91
  %doc CHANGELOG COPYING LICENSE README TODO examples
@@ -136,6 +141,12 @@ fi
136
141
  %{__rm} -rf %{buildroot}
137
142
 
138
143
  %changelog
144
+ * Wed May 2 2007 David Lutterkort <dlutter@redhat.com> - 0.22.4-1
145
+ - New version
146
+
147
+ * Thu Mar 29 2007 David Lutterkort <dlutter@redhat.com> - 0.22.3-1
148
+ - Claim ownership of _sysconfdir/puppet (bz 233908)
149
+
139
150
  * Mon Mar 19 2007 David Lutterkort <dlutter@redhat.com> - 0.22.2-1
140
151
  - Set puppet's homedir to /var/lib/puppet, not /var/puppet
141
152
  - Remove no-lockdir patch, not needed anymore
@@ -1,6 +1,6 @@
1
1
  PKG=CSWpuppet
2
2
  NAME=puppet - System Automation Framework
3
- VERSION=0.22.4
3
+ VERSION=0.23.0
4
4
  CATEGORY=application
5
5
  VENDOR=http://reductivelabs.com/projects/puppet
6
6
  HOTLINE=http://reductivelabs.com/cgi-bin/puppet.cgi
@@ -0,0 +1,374 @@
1
+ #!/usr/bin/env ruby
2
+ # == Synopsis
3
+ #
4
+ # Test individual client performance. Can compile configurations, describe
5
+ # files, or retrieve files.
6
+ #
7
+ # = Usage
8
+ #
9
+ # puppet-test [-c|--compile] [-D|--describe <file>] [-d|--debug]
10
+ # [--fork <num>] [-h|--help] [-H|--hostname <host name>] [-l|--list] [-r|--repeat <number=1>]
11
+ # [-R|--retrieve <file>] [-t|--test <test>] [-V|--version] [-v|--verbose]
12
+ #
13
+ # = Description
14
+ #
15
+ # This is a simple script meant for doing performance tests with Puppet. By
16
+ # default it pulls down a compiled configuration, but it supports multiple
17
+ # other tests.
18
+ #
19
+ # = Options
20
+ #
21
+ # Note that any configuration parameter that's valid in the configuration file
22
+ # is also a valid long argument. For example, 'server' is a valid configuration
23
+ # parameter, so you can specify '--server <servername>' as an argument.
24
+ #
25
+ # See the configuration file documentation at
26
+ # http://reductivelabs.com/projects/puppet/reference/configref.html for
27
+ # the full list of acceptable parameters. A commented list of all
28
+ # configuration $options can also be generated by running puppetd with
29
+ # '--genconfig'.
30
+ #
31
+ # compile::
32
+ # Compile the client's configuration. The default.
33
+ #
34
+ # debug::
35
+ # Enable full debugging.
36
+ #
37
+ # describe::
38
+ # Describe the file being tested. This is a query to get information about
39
+ # the file from the server, to determine if it should be copied, and is the
40
+ # first half of every file transfer.
41
+ #
42
+ # fork::
43
+ # Fork the specified number of times, thus acting as multiple clients.
44
+ #
45
+ # fqdn::
46
+ # Set the fully-qualified domain name of the client. This is only used for
47
+ # certificate purposes, but can be used to override the discovered hostname.
48
+ # If you need to use this flag, it is generally an indication of a setup problem.
49
+ #
50
+ # help::
51
+ # Print this help message
52
+ #
53
+ # list::
54
+ # List all available tests.
55
+ #
56
+ # repeat::
57
+ # How many times to perform the test.
58
+ #
59
+ # retrieve::
60
+ # Test file retrieval performance. Retrieves the specified file from the
61
+ # remote system. Note that the server should be specified via --server,
62
+ # so the argument to this option is just the remote module name and path,
63
+ # e.g., "/dist/apps/myapp/myfile", where "dist" is the module and
64
+ # "apps/myapp/myfile" is the path to the file relative to the module.
65
+ #
66
+ # test::
67
+ # Specify the test to run. You can see the list of tests by running this command with --list.
68
+ #
69
+ # verbose::
70
+ # Turn on verbose reporting.
71
+ #
72
+ # version::
73
+ # Print the puppet version number and exit.
74
+ #
75
+ # = Example
76
+ #
77
+ # puppet-test --retrieve /module/path/to/file
78
+ #
79
+ # = Author
80
+ #
81
+ # Luke Kanies
82
+ #
83
+ # = Copyright
84
+ #
85
+ # Copyright (c) 2005, 2006 Reductive Labs, LLC
86
+ # Licensed under the GNU Public License
87
+
88
+ # Do an initial trap, so that cancels don't get a stack trace.
89
+ trap(:INT) do
90
+ $stderr.puts "Cancelling startup"
91
+ exit(0)
92
+ end
93
+
94
+ require 'puppet'
95
+ require 'puppet/network/client'
96
+ require 'getoptlong'
97
+
98
+ class Suite
99
+ attr_reader :name, :doc
100
+
101
+ @@suites = {}
102
+ @@tests = {}
103
+
104
+ def self.[](name)
105
+ @@suites[name]
106
+ end
107
+
108
+ # Run a test by first finding the suite then running the appropriate test.
109
+ def self.run(test)
110
+ unless suite_name = @@tests[test]
111
+ raise "Unknown test %s" % test
112
+
113
+ end
114
+ unless suite = @@suites[suite_name]
115
+ raise "Unknown test suite %s from test %s" % [suite_name, test]
116
+ end
117
+
118
+ suite.run(test)
119
+ end
120
+
121
+ # What suites are available?
122
+ def self.suites
123
+ @@suites.keys
124
+ end
125
+
126
+ def forked?
127
+ defined? @forking
128
+ end
129
+
130
+ # Create a new test suite.
131
+ def initialize(name, doc, &block)
132
+ @name = name
133
+ @doc = doc
134
+
135
+ @tests = {}
136
+
137
+ @@suites[name] = self
138
+
139
+ raise "You must pass a block to the Test" unless block_given?
140
+ instance_eval(&block)
141
+ end
142
+
143
+ def prepare
144
+ raise "Test %s did not override 'prepare'" % @name
145
+ end
146
+
147
+ # Define a new type of test on this suite.
148
+ def newtest(name, doc, &block)
149
+ @tests[name] = doc
150
+
151
+ if @@tests[name]
152
+ raise "Test names must be unique; cannot redefine %s" % name
153
+ end
154
+
155
+ @@tests[name] = @name
156
+
157
+ meta_def(name, &block)
158
+ end
159
+
160
+ # Run the actual test.
161
+ def run(test)
162
+ unless doc = @tests[test]
163
+ raise "Suite %s only supports tests %s; not %s" % [@name, @tests.keys.collect { |k| k.to_s }.join(","), test]
164
+ end
165
+ puts "Running %s %s test" % [@name, test]
166
+ prepare()
167
+
168
+ if $options[:fork] > 0
169
+ @forking = true
170
+ $options[:fork].times {
171
+ if pid = fork
172
+ $pids << pid
173
+ else
174
+ break
175
+ end
176
+ }
177
+ end
178
+
179
+ $options[:repeat].times do
180
+ if forked?
181
+ msg = doc + " in PID %s" % Process.pid
182
+ else
183
+ msg = doc
184
+ end
185
+ Puppet::Util.benchmark(:notice, msg) do
186
+ begin
187
+ send(test)
188
+ rescue => detail
189
+ puts detail.backtrace if Puppet[:trace]
190
+ Puppet.err "%s failed: %s" % [@name, detail.to_s]
191
+ end
192
+ end
193
+ end
194
+ end
195
+
196
+ # What tests are available on this suite?
197
+ def tests
198
+ @tests.keys
199
+ end
200
+ end
201
+
202
+ Suite.new :configuration, "Configuration handling" do
203
+ def prepare
204
+ $args[:cache] = false
205
+ # Create a config client and pull the config down
206
+ @client = Puppet::Network::Client.master.new($args)
207
+ unless @client.read_cert
208
+ fail "Could not read client certificate"
209
+ end
210
+
211
+ # Use the facts from the cache, to skip the time it takes
212
+ # to load them.
213
+ @client.dostorage
214
+ @facts = Puppet::Util::Storage.cache(:configuration)[:facts]
215
+
216
+ if @facts.empty?
217
+ @facts = @client.master.getfacts
218
+ end
219
+
220
+ if host = $options[:fqdn]
221
+ @facts["fqdn"] = host
222
+ @facts["hostname"] = host.sub(/\..+/, '')
223
+ @facts["domain"] = host.sub(/^[^.]+\./, '')
224
+ end
225
+
226
+ @facts = YAML.dump(@facts)
227
+ end
228
+
229
+ newtest :compile, "Compiled configuration" do
230
+ @client.driver.getconfig(@facts, "yaml")
231
+ end
232
+
233
+ # This test will always force a false answer.
234
+ newtest :fresh, "Checked freshness" do
235
+ @client.driver.freshness
236
+ end
237
+ end
238
+
239
+ Suite.new :file, "File interactions" do
240
+ def prepare
241
+ unless $options[:file]
242
+ fail "You must specify a file (using --file <file>) to interact with on the server"
243
+ end
244
+ @client = Puppet::Network::Client.file.new($args)
245
+ unless @client.read_cert
246
+ fail "Could not read client certificate"
247
+ end
248
+ end
249
+
250
+ newtest :describe, "Described file" do
251
+ @client.describe($options[:file], :ignore)
252
+ end
253
+
254
+ newtest :retrieve, "Retrieved file" do
255
+ @client.retrieve($options[:file], :ignore)
256
+ end
257
+ end
258
+
259
+ $cmdargs = [
260
+ [ "--compile", "-c", GetoptLong::NO_ARGUMENT ],
261
+ [ "--describe", "-D", GetoptLong::REQUIRED_ARGUMENT ],
262
+ [ "--retrieve", "-R", GetoptLong::REQUIRED_ARGUMENT ],
263
+ [ "--fork", GetoptLong::REQUIRED_ARGUMENT ],
264
+ [ "--fqdn", "-F", GetoptLong::REQUIRED_ARGUMENT ],
265
+ [ "--suite", "-s", GetoptLong::REQUIRED_ARGUMENT ],
266
+ [ "--test", "-t", GetoptLong::REQUIRED_ARGUMENT ],
267
+ [ "--repeat", "-r", GetoptLong::REQUIRED_ARGUMENT ],
268
+ [ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
269
+ [ "--help", "-h", GetoptLong::NO_ARGUMENT ],
270
+ [ "--list", "-l", GetoptLong::NO_ARGUMENT ],
271
+ [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
272
+ [ "--version", "-V", GetoptLong::NO_ARGUMENT ],
273
+ ]
274
+
275
+ # Add all of the config parameters as valid $options.
276
+ Puppet.config.addargs($cmdargs)
277
+ Puppet::Util::Log.newdestination(:console)
278
+
279
+ result = GetoptLong.new(*$cmdargs)
280
+
281
+ $args = {}
282
+
283
+ $options = {:repeat => 1, :fork => 0}
284
+
285
+ begin
286
+ explicit_waitforcert = false
287
+ result.each { |opt,arg|
288
+ case opt
289
+ # First check to see if the argument is a valid configuration parameter;
290
+ # if so, set it.
291
+ when "--compile"
292
+ $options[:suite] = :configuration
293
+ $options[:test] = :compile
294
+ when "--retrieve"
295
+ $options[:suite] = :file
296
+ $options[:test] = :retrieve
297
+ $options[:file] = arg
298
+ when "--fork"
299
+ begin
300
+ $options[:fork] = Integer(arg)
301
+ rescue => detail
302
+ $stderr.puts "The argument to 'fork' must be an integer"
303
+ exit(14)
304
+ end
305
+ when "--describe"
306
+ $options[:suite] = :file
307
+ $options[:test] = :describe
308
+ $options[:file] = arg
309
+ when "--fqdn"
310
+ $options[:fqdn] = arg
311
+ when "--repeat"
312
+ $options[:repeat] = Integer(arg)
313
+ when "--help"
314
+ if Puppet.features.usage?
315
+ RDoc::usage && exit
316
+ else
317
+ puts "No help available unless you have RDoc::usage installed"
318
+ exit
319
+ end
320
+ when "--version"
321
+ puts "%s" % Puppet.version
322
+ exit
323
+ when "--verbose"
324
+ Puppet::Util::Log.level = :info
325
+ Puppet::Util::Log.newdestination(:console)
326
+ when "--debug"
327
+ Puppet::Util::Log.level = :debug
328
+ Puppet::Util::Log.newdestination(:console)
329
+ when "--suite"
330
+ $options[:suite] = arg.intern
331
+ when "--test"
332
+ $options[:test] = arg.intern
333
+ when "--file"
334
+ $options[:file] = arg
335
+ when "--list"
336
+ Suite.suites.sort { |a,b| a.to_s <=> b.to_s }.each do |suite_name|
337
+ suite = Suite[suite_name]
338
+ tests = suite.tests.sort { |a,b| a.to_s <=> b.to_s }.join(", ")
339
+ puts "%20s: %s" % [suite_name, tests]
340
+ end
341
+ exit(0)
342
+ else
343
+ Puppet.config.handlearg(opt, arg)
344
+ end
345
+ }
346
+ rescue GetoptLong::InvalidOption => detail
347
+ $stderr.puts detail
348
+ $stderr.puts "Try '#{$0} --help'"
349
+ exit(1)
350
+ end
351
+
352
+ # Now parse the config
353
+ Puppet.parse_config
354
+
355
+ $args[:Server] = Puppet[:server]
356
+
357
+ unless $options[:test]
358
+ $options[:suite] = :configuration
359
+ $options[:test] = :compile
360
+ end
361
+
362
+ unless $options[:test]
363
+ raise "A suite was specified without a test"
364
+ end
365
+
366
+ $pids = []
367
+
368
+ Suite.run($options[:test])
369
+
370
+ if $options[:fork] > 0
371
+ Process.waitall
372
+ end
373
+
374
+ # $Id: puppet-test 2628 2007-06-19 20:04:52Z luke $