puppet 0.9.2 → 0.13.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 (213) hide show
  1. data/CHANGELOG +58 -0
  2. data/README +21 -18
  3. data/Rakefile +176 -36
  4. data/bin/puppet +34 -48
  5. data/bin/puppetca +41 -28
  6. data/bin/puppetd +87 -65
  7. data/bin/puppetdoc +99 -23
  8. data/bin/puppetmasterd +72 -91
  9. data/conf/redhat/client.init +80 -0
  10. data/conf/redhat/client.sysconfig +11 -0
  11. data/conf/redhat/fileserver.conf +12 -0
  12. data/conf/redhat/puppet.spec +130 -0
  13. data/conf/redhat/server.init +89 -0
  14. data/conf/redhat/server.sysconfig +9 -0
  15. data/examples/code/allatonce +2 -2
  16. data/examples/code/assignments +1 -1
  17. data/examples/code/classing +2 -2
  18. data/examples/code/components +2 -2
  19. data/examples/code/file.bl +5 -5
  20. data/examples/code/filedefaults +2 -2
  21. data/examples/code/fileparsing +1 -1
  22. data/examples/code/filerecursion +1 -1
  23. data/examples/code/functions +1 -1
  24. data/examples/code/groups +1 -1
  25. data/examples/code/importing +1 -1
  26. data/examples/code/nodes +1 -1
  27. data/examples/code/one +1 -1
  28. data/examples/code/relationships +2 -2
  29. data/examples/code/simpletests +5 -5
  30. data/examples/code/snippets/argumentdefaults +2 -2
  31. data/examples/code/snippets/casestatement +16 -8
  32. data/examples/code/snippets/classheirarchy.pp +4 -4
  33. data/examples/code/snippets/classincludes.pp +4 -4
  34. data/examples/code/snippets/classpathtest +2 -2
  35. data/examples/code/snippets/componentmetaparams.pp +11 -0
  36. data/examples/code/snippets/dirchmod +5 -5
  37. data/examples/code/snippets/emptyclass.pp +9 -0
  38. data/examples/code/snippets/failmissingexecpath.pp +1 -1
  39. data/examples/code/snippets/falsevalues.pp +1 -1
  40. data/examples/code/snippets/filecreate +5 -5
  41. data/examples/code/snippets/implicititeration +5 -5
  42. data/examples/code/snippets/multipleinstances +4 -4
  43. data/examples/code/snippets/namevartest +3 -3
  44. data/examples/code/snippets/scopetest +1 -1
  45. data/examples/code/snippets/selectorvalues.pp +3 -3
  46. data/examples/code/snippets/simpledefaults +2 -2
  47. data/examples/code/snippets/simpleselector +5 -5
  48. data/examples/code/snippets/singleary.pp +19 -0
  49. data/examples/root/etc/init.d/sleeper +3 -2
  50. data/ext/emacs/puppet-mode-init.el +6 -0
  51. data/ext/emacs/puppet-mode.el +189 -0
  52. data/ext/ldap/puppet.schema +17 -0
  53. data/ext/{module:puppet → module_puppet} +30 -31
  54. data/ext/vim/filetype.vim +9 -0
  55. data/ext/vim/puppet.vim +87 -0
  56. data/install.rb +63 -30
  57. data/lib/puppet.rb +216 -122
  58. data/lib/puppet/client.rb +51 -416
  59. data/lib/puppet/client/ca.rb +17 -0
  60. data/lib/puppet/client/dipper.rb +78 -0
  61. data/lib/puppet/client/file.rb +20 -0
  62. data/lib/puppet/client/log.rb +17 -0
  63. data/lib/puppet/client/master.rb +246 -0
  64. data/lib/puppet/client/proxy.rb +27 -0
  65. data/lib/puppet/client/status.rb +7 -0
  66. data/lib/puppet/config.rb +563 -13
  67. data/lib/puppet/daemon.rb +50 -22
  68. data/lib/puppet/element.rb +4 -4
  69. data/lib/puppet/event-loop.rb +1 -0
  70. data/lib/puppet/event-loop/better-definers.rb +367 -0
  71. data/lib/puppet/event-loop/event-loop.rb +355 -0
  72. data/lib/puppet/event-loop/signal-system.rb +220 -0
  73. data/lib/puppet/event.rb +9 -11
  74. data/lib/puppet/filetype.rb +195 -0
  75. data/lib/puppet/log.rb +35 -12
  76. data/lib/puppet/metric.rb +2 -2
  77. data/lib/puppet/networkclient.rb +145 -0
  78. data/lib/puppet/parameter.rb +335 -0
  79. data/lib/puppet/parser/ast.rb +42 -1453
  80. data/lib/puppet/parser/ast/astarray.rb +88 -0
  81. data/lib/puppet/parser/ast/branch.rb +47 -0
  82. data/lib/puppet/parser/ast/caseopt.rb +66 -0
  83. data/lib/puppet/parser/ast/casestatement.rb +78 -0
  84. data/lib/puppet/parser/ast/classdef.rb +78 -0
  85. data/lib/puppet/parser/ast/compdef.rb +111 -0
  86. data/lib/puppet/parser/ast/component.rb +105 -0
  87. data/lib/puppet/parser/ast/hostclass.rb +82 -0
  88. data/lib/puppet/parser/ast/leaf.rb +86 -0
  89. data/lib/puppet/parser/ast/node.rb +103 -0
  90. data/lib/puppet/parser/ast/nodedef.rb +68 -0
  91. data/lib/puppet/parser/ast/objectdef.rb +336 -0
  92. data/lib/puppet/parser/ast/objectparam.rb +30 -0
  93. data/lib/puppet/parser/ast/objectref.rb +76 -0
  94. data/lib/puppet/parser/ast/selector.rb +60 -0
  95. data/lib/puppet/parser/ast/typedefaults.rb +45 -0
  96. data/lib/puppet/parser/ast/vardef.rb +44 -0
  97. data/lib/puppet/parser/interpreter.rb +31 -14
  98. data/lib/puppet/parser/lexer.rb +2 -4
  99. data/lib/puppet/parser/parser.rb +332 -242
  100. data/lib/puppet/parser/scope.rb +55 -38
  101. data/lib/puppet/server.rb +43 -44
  102. data/lib/puppet/server/authstore.rb +3 -6
  103. data/lib/puppet/server/ca.rb +5 -2
  104. data/lib/puppet/server/filebucket.rb +2 -4
  105. data/lib/puppet/server/fileserver.rb +28 -12
  106. data/lib/puppet/server/logger.rb +15 -4
  107. data/lib/puppet/server/master.rb +62 -7
  108. data/lib/puppet/sslcertificates.rb +41 -607
  109. data/lib/puppet/sslcertificates/ca.rb +291 -0
  110. data/lib/puppet/sslcertificates/certificate.rb +283 -0
  111. data/lib/puppet/statechange.rb +6 -1
  112. data/lib/puppet/storage.rb +67 -56
  113. data/lib/puppet/transaction.rb +25 -9
  114. data/lib/puppet/transportable.rb +102 -22
  115. data/lib/puppet/type.rb +1096 -315
  116. data/lib/puppet/type/component.rb +30 -21
  117. data/lib/puppet/type/cron.rb +409 -448
  118. data/lib/puppet/type/exec.rb +234 -174
  119. data/lib/puppet/type/group.rb +65 -82
  120. data/lib/puppet/type/nameservice.rb +247 -3
  121. data/lib/puppet/type/nameservice/netinfo.rb +29 -40
  122. data/lib/puppet/type/nameservice/objectadd.rb +52 -66
  123. data/lib/puppet/type/nameservice/posix.rb +6 -194
  124. data/lib/puppet/type/package.rb +447 -295
  125. data/lib/puppet/type/package/apt.rb +51 -50
  126. data/lib/puppet/type/package/bsd.rb +82 -0
  127. data/lib/puppet/type/package/dpkg.rb +85 -88
  128. data/lib/puppet/type/package/rpm.rb +67 -63
  129. data/lib/puppet/type/package/sun.rb +119 -98
  130. data/lib/puppet/type/package/yum.rb +41 -37
  131. data/lib/puppet/type/parsedtype.rb +295 -0
  132. data/lib/puppet/type/parsedtype/host.rb +143 -0
  133. data/lib/puppet/type/parsedtype/port.rb +232 -0
  134. data/lib/puppet/type/parsedtype/sshkey.rb +129 -0
  135. data/lib/puppet/type/pfile.rb +484 -460
  136. data/lib/puppet/type/pfile/checksum.rb +237 -181
  137. data/lib/puppet/type/pfile/content.rb +67 -0
  138. data/lib/puppet/type/pfile/ensure.rb +212 -0
  139. data/lib/puppet/type/pfile/group.rb +106 -105
  140. data/lib/puppet/type/pfile/mode.rb +98 -101
  141. data/lib/puppet/type/pfile/source.rb +228 -209
  142. data/lib/puppet/type/pfile/type.rb +18 -21
  143. data/lib/puppet/type/pfile/uid.rb +127 -130
  144. data/lib/puppet/type/pfilebucket.rb +68 -63
  145. data/lib/puppet/type/schedule.rb +341 -0
  146. data/lib/puppet/type/service.rb +351 -255
  147. data/lib/puppet/type/service/base.rb +9 -14
  148. data/lib/puppet/type/service/debian.rb +32 -38
  149. data/lib/puppet/type/service/init.rb +130 -130
  150. data/lib/puppet/type/service/smf.rb +48 -20
  151. data/lib/puppet/type/state.rb +229 -16
  152. data/lib/puppet/type/symlink.rb +51 -63
  153. data/lib/puppet/type/tidy.rb +105 -102
  154. data/lib/puppet/type/user.rb +118 -180
  155. data/lib/puppet/util.rb +100 -6
  156. data/test/certmgr/certmgr.rb +0 -1
  157. data/test/client/client.rb +4 -4
  158. data/test/executables/puppetbin.rb +7 -14
  159. data/test/executables/puppetca.rb +18 -24
  160. data/test/executables/puppetd.rb +7 -16
  161. data/test/executables/puppetmasterd.rb +7 -9
  162. data/test/executables/puppetmodule.rb +11 -16
  163. data/test/language/ast.rb +11 -7
  164. data/test/language/interpreter.rb +1 -1
  165. data/test/language/scope.rb +2 -0
  166. data/test/language/snippets.rb +30 -5
  167. data/test/language/transportable.rb +77 -0
  168. data/test/other/config.rb +316 -0
  169. data/test/other/events.rb +22 -21
  170. data/test/other/log.rb +14 -14
  171. data/test/other/metrics.rb +4 -8
  172. data/test/other/overrides.rb +5 -5
  173. data/test/other/relationships.rb +4 -2
  174. data/test/other/storage.rb +64 -3
  175. data/test/other/transactions.rb +20 -20
  176. data/test/parser/parser.rb +7 -4
  177. data/test/puppet/conffiles.rb +12 -12
  178. data/test/puppet/defaults.rb +13 -11
  179. data/test/puppet/utiltest.rb +14 -11
  180. data/test/puppettest.rb +156 -48
  181. data/test/server/bucket.rb +2 -2
  182. data/test/server/fileserver.rb +6 -6
  183. data/test/server/logger.rb +19 -11
  184. data/test/server/master.rb +33 -4
  185. data/test/server/server.rb +2 -7
  186. data/test/types/basic.rb +5 -7
  187. data/test/types/component.rb +22 -18
  188. data/test/types/cron.rb +111 -44
  189. data/test/types/exec.rb +116 -59
  190. data/test/types/file.rb +262 -137
  191. data/test/types/filebucket.rb +13 -15
  192. data/test/types/fileignoresource.rb +12 -16
  193. data/test/types/filesources.rb +73 -48
  194. data/test/types/filetype.rb +13 -15
  195. data/test/types/group.rb +15 -13
  196. data/test/types/host.rb +146 -0
  197. data/test/types/package.rb +74 -63
  198. data/test/types/port.rb +139 -0
  199. data/test/types/query.rb +8 -8
  200. data/test/types/schedule.rb +335 -0
  201. data/test/types/service.rb +137 -21
  202. data/test/types/sshkey.rb +140 -0
  203. data/test/types/symlink.rb +3 -5
  204. data/test/types/tidy.rb +5 -14
  205. data/test/types/type.rb +67 -11
  206. data/test/types/user.rb +25 -23
  207. metadata +186 -122
  208. data/lib/puppet/type/pfile/create.rb +0 -108
  209. data/lib/puppet/type/pprocess.rb +0 -97
  210. data/lib/puppet/type/typegen.rb +0 -149
  211. data/lib/puppet/type/typegen/filerecord.rb +0 -243
  212. data/lib/puppet/type/typegen/filetype.rb +0 -316
  213. data/test/other/state.rb +0 -106
data/CHANGELOG CHANGED
@@ -0,0 +1,58 @@
1
+ 0.13.0
2
+ Added support for configuration files.
3
+ Even more bug fixes, including the infamous 'frozen object' bug, which was a
4
+ problem with 'waitforcert'.
5
+ David Lutterkort got RPM into good shape.
6
+
7
+ 0.12.0
8
+ Added Scheduling, and many bug fixes, of course.
9
+
10
+ 0.11.2
11
+ Fixed bugs related to specifying arrays of requirements
12
+ Fixed a key bug in retrieving checksums
13
+ Fixed lots of usability bugs
14
+ Added 'fail' methods that automatically add file and line info when possible,
15
+ and converted many errors to use that method
16
+
17
+ 0.11.1
18
+ Fixed bug with recursive copying with 'ignore' set.
19
+ Added OpenBSD package support.
20
+
21
+ 0.11.0
22
+ Added 'ensure' state to many elements.
23
+ Modified puppetdoc to correctly handle indentation and such.
24
+ Significantly rewrote much of the builtin documentation to take advantage
25
+ of the new features in puppetdoc, including many examples.
26
+
27
+ 0.10.2
28
+ Added SMF support
29
+ Added autorequire functionality, with specific support for exec and file
30
+ Exec elements autorequire any mentioned files, including the scripts,
31
+ along with their CWDs.
32
+ Files autorequire any parent directories.
33
+ Added 'alias' metaparam.
34
+ Fixed dependencies so they don't depend on file order.
35
+
36
+ 0.10.1
37
+ Added Solaris package support and changed puppetmasterd to run as
38
+ a non-root user.
39
+
40
+ 0.10.0
41
+ Significant refactoring of how types, states, and parameters work, including
42
+ breaking out parameters into a separate class. This refactoring did not
43
+ introduce much new functionality, but made extension of Puppet significantly
44
+ easier
45
+
46
+ Also, fixed the bug with 'waitforcert' in puppetd.
47
+
48
+ 0.9.4
49
+ Small fix to wrap the StatusServer class in the checks for required classes.
50
+
51
+ 0.9.3
52
+ Fixed some significant bugs in cron job management.
53
+
54
+ 0.9.2
55
+ Second Public Beta
56
+
57
+ 0.9.0
58
+ First Public Beta
data/README CHANGED
@@ -1,24 +1,27 @@
1
- $Id: README 722 2005-10-21 22:51:26Z luke $
2
-
3
1
  Documentation (and detailed install instructions) can be found
4
- online: http://reductivelabs.com/projects/puppet/documentation/
2
+ online at http://reductivelabs.com/projects/puppet/documentation.
3
+
4
+ Generally, you need the following things installed:
5
+
6
+ * Ruby >= 1.8.1 (earlier releases might work but probably not)
5
7
 
6
- This is what you need to get puppet running:
7
- -- Check you have Ruby version 1.8.2 or later
8
- You can download it from
9
- ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.2.tar.gz
10
- Un tar it, then: ./configure; make; make install
8
+ * The Ruby OpenSSL library. For some reason, this often isn't included
9
+ in the main ruby distributions. You can test for it by running
10
+ 'ruby -ropenssl -e "puts :yep"'. If that errors out, you're missing the
11
+ library.
11
12
 
12
- -- http://reductivelabs.com/downloads/facter/facter-latest.tgz
13
- A library that puppet needs to run. Un tar it, and calling
14
- 'ruby install.rb' file should successfully install it; let
15
- me know if it doesn't. Otherwise, you can just set RUBYLIB
16
- to contain its lib directory.
13
+ If your distribution doesn't come with the necessary library (e.g., on Debian
14
+ and Ubuntu you need to install libopenssl-ruby), then you'll probably have to
15
+ compile Ruby yourself, since it's part of the standard library and not
16
+ available separately. You could probably just compile and install that one
17
+ library, though.
17
18
 
18
- There should also be a recent snapshot there.
19
+ * The Ruby XMLRPC client and server libraries. For some reason, this often
20
+ isn't included in the main ruby distributions. You can test for it by
21
+ running 'ruby -rxmlrpc/client -e "puts :yep"'. If that errors out, you're missing
22
+ the library.
19
23
 
20
- -- Install puppet
21
- Run 'ruby install.rb' or add the 'lib/' directory to your RUBYLIB path.
24
+ * Facter => 1.1.1
25
+ You can get this from http://reductivelabs.com/projects/facter
22
26
 
23
- -- After that, you should be able to go into test/ and run ./test,
24
- or run 'bin/puppet' on whichever puppet config files you want.
27
+ $Id: README 815 2006-01-12 19:01:41Z luke $
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ # -*- ruby -*- (Make emacs happy)
1
2
  # Rakefile for Puppet
2
3
 
3
4
  begin
@@ -7,18 +8,26 @@ rescue Exception
7
8
  nil
8
9
  end
9
10
 
11
+ $rdoc = true
12
+ begin
13
+ require 'rdoc/rdoc'
14
+ rescue => detail
15
+ $rdoc = false
16
+ puts "No rdoc: %s" % detail
17
+ end
10
18
  require 'rake/clean'
11
19
  require 'rake/testtask'
12
20
 
13
- #require 'rake/rdoctask'
14
- #CLEAN.include('**/*.o')
15
- #CLOBBER.include('doc/*')
21
+ if $rdoc
22
+ require 'rake/rdoctask'
23
+ end
24
+ CLEAN.include('**/*.o')
25
+ CLOBBER.include('doc/*')
16
26
 
17
27
  def announce(msg='')
18
28
  STDERR.puts msg
19
29
  end
20
30
 
21
-
22
31
  # Determine the current version
23
32
 
24
33
  if `ruby -Ilib ./bin/puppet --version` =~ /\S+$/
@@ -33,6 +42,14 @@ else
33
42
  PKG_VERSION = CURRENT_VERSION
34
43
  end
35
44
 
45
+ DOWNDIR = "/export/docroots/reductivelabs.com/htdocs/downloads"
46
+
47
+ if ENV['HOSTS']
48
+ TESTHOSTS = ENV['HOSTS'].split(/\s+/)
49
+ else
50
+ TESTHOSTS = %w{fedora1 rh3a kirby culain openbsd1 centos1}
51
+ end
52
+ #TESTHOSTS = %w{sol10b}
36
53
 
37
54
  # The default task is run if rake is given no explicit arguments.
38
55
 
@@ -44,17 +61,21 @@ task :default => :alltests
44
61
  task :u => :unittests
45
62
  task :a => :alltests
46
63
 
47
- Rake::TestTask.new(:alltests) do |t|
48
- t.test_files = FileList['test/tc*.rb']
49
- t.warning = true
50
- t.verbose = false
64
+ task :alltests do
65
+ sh %{cd test; ./test}
51
66
  end
52
67
 
53
- Rake::TestTask.new(:unittests) do |t|
54
- t.test_files = FileList['test/test']
55
- t.warning = true
56
- t.verbose = false
57
- end
68
+ #Rake::TestTask.new(:alltests) do |t|
69
+ # t.test_files = FileList['test/*/*.rb']
70
+ # t.warning = true
71
+ # t.verbose = false
72
+ #end
73
+
74
+ #Rake::TestTask.new(:unittests) do |t|
75
+ # t.test_files = FileList['test/test']
76
+ # t.warning = true
77
+ # t.verbose = false
78
+ #end
58
79
 
59
80
  # SVN Tasks ----------------------------------------------------------
60
81
  # ... none.
@@ -68,15 +89,44 @@ end
68
89
 
69
90
  # Create a task to build the RDOC documentation tree.
70
91
 
71
- #rd = Rake::RDocTask.new("rdoc") { |rdoc|
72
- # rdoc.rdoc_dir = 'html'
73
- # rdoc.template = 'css2'
74
- # rdoc.title = "Puppet"
75
- # rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
76
- # rdoc.rdoc_files.include('README', 'LICENSE', 'TODO', 'CHANGELOG')
77
- # rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
92
+ #Rake::RDocTask.new("ri") { |rdoc|
93
+ # #rdoc.rdoc_dir = 'html'
94
+ # #rdoc.template = 'html'
95
+ # rdoc.title = "Puppet"
96
+ # rdoc.options << '--ri' << '--line-numbers' << '--inline-source' << '--main' << 'README'
97
+ # rdoc.rdoc_files.include('README', 'LICENSE', 'TODO', 'CHANGELOG')
98
+ # rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
78
99
  #}
79
100
 
101
+ if $rdoc
102
+ Rake::RDocTask.new(:html) { |rdoc|
103
+ rdoc.rdoc_dir = 'html'
104
+ rdoc.template = 'html'
105
+ rdoc.title = "Puppet"
106
+ rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
107
+ rdoc.rdoc_files.include('README', 'LICENSE', 'TODO', 'CHANGELOG')
108
+ rdoc.rdoc_files.include('lib/**/*.rb')
109
+ CLEAN.include("html")
110
+ }
111
+ end
112
+
113
+ if $rdoc
114
+ task :ri do |ri|
115
+ files = ['README', 'LICENSE', 'TODO', 'CHANGELOG'] + Dir.glob('lib/**/*.rb')
116
+ puts "files are \n%s" % files.join("\n")
117
+ begin
118
+ ri = RDoc::RDoc.new
119
+ ri.document(["--ri-site"] + files)
120
+ rescue RDoc::RDocError => detail
121
+ puts "Failed to build docs: %s" % detail
122
+ return nil
123
+ rescue LoadError
124
+ puts "Missing rdoc; cannot build documentation"
125
+ return nil
126
+ end
127
+ end
128
+ end
129
+
80
130
  # ====================================================================
81
131
  # Create a task that will package the Rake software into distributable
82
132
  # tar, zip and gem files.
@@ -88,7 +138,8 @@ PKG_FILES = FileList[
88
138
  'test/**/*.rb',
89
139
  'bin/**/*',
90
140
  'ext/**/*',
91
- 'examples/**/*'
141
+ 'examples/**/*',
142
+ 'conf/**/*'
92
143
  ]
93
144
  PKG_FILES.delete_if {|item| item.include?(".svn")}
94
145
 
@@ -111,7 +162,10 @@ the configuration.
111
162
 
112
163
  #### Dependencies and requirements.
113
164
 
114
- s.add_dependency('facter', '>= 1.0.0')
165
+ # I'd love to explicitly list all of the libraries that I need,
166
+ # but gems seem to only be able to handle dependencies on other
167
+ # gems, which is, um, stupid.
168
+ s.add_dependency('facter', '>= 1.1.0')
115
169
  #s.requirements << ""
116
170
 
117
171
  s.files = PKG_FILES.to_a
@@ -128,12 +182,12 @@ the configuration.
128
182
 
129
183
  #### Documentation and testing.
130
184
 
131
- s.has_rdoc = false
185
+ s.has_rdoc = true
132
186
  #s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
133
- #s.rdoc_options <<
134
- # '--title' << 'Puppet - Configuration Management' <<
135
- # '--main' << 'README' <<
136
- # '--line-numbers'
187
+ s.rdoc_options <<
188
+ '--title' << 'Puppet - Configuration Management' <<
189
+ '--main' << 'README' <<
190
+ '--line-numbers'
137
191
  s.test_file = "test/test"
138
192
 
139
193
  #### Signing key and cert chain
@@ -145,13 +199,14 @@ the configuration.
145
199
  s.author = "Luke Kanies"
146
200
  s.email = "dev@reductivelabs.com"
147
201
  s.homepage = "http://reductivelabs.com/projects/puppet"
148
- #s.rubyforge_project = "puppet"
202
+ s.rubyforge_project = "puppet"
149
203
  }
150
204
 
151
205
  Rake::GemPackageTask.new(spec) { |pkg|
152
206
  #pkg.need_zip = true
153
207
  pkg.need_tar = true
154
208
  }
209
+ CLEAN.include("pkg")
155
210
  end
156
211
 
157
212
  # Misc tasks =========================================================
@@ -206,12 +261,13 @@ desc "Make a new release"
206
261
  task :release => [
207
262
  :prerelease,
208
263
  :clobber,
209
- :alltests,
210
264
  :update_version,
265
+ :tag, # tag everything before we make a bunch of extra dirs
266
+ :html,
211
267
  :package,
212
- :tag
268
+ :fedorarpm,
269
+ :copy
213
270
  ] do
214
- puts "okay?"
215
271
 
216
272
  announce
217
273
  announce "**************************************************************"
@@ -262,24 +318,48 @@ task :update_version => [:prerelease] do
262
318
  open("lib/puppet.rb") do |rakein|
263
319
  open("lib/puppet.rb.new", "w") do |rakeout|
264
320
  rakein.each do |line|
265
- if line =~ /^PUPPETVERSION\s*=\s*/
266
- rakeout.puts "PUPPETVERSION = '#{PKG_VERSION}'"
321
+ if line =~ /^(\s*)PUPPETVERSION\s*=\s*/
322
+ rakeout.puts "#{$1}PUPPETVERSION = '#{PKG_VERSION}'"
267
323
  else
268
324
  rakeout.puts line
269
325
  end
270
326
  end
271
327
  end
272
328
  end
273
-
274
329
  mv "lib/puppet.rb.new", "lib/puppet.rb"
330
+
331
+ open("conf/redhat/puppet.spec") do |rakein|
332
+ open("conf/redhat/puppet.spec.new", "w") do |rakeout|
333
+ rakein.each do |line|
334
+ if line =~ /^Version:\s*/
335
+ rakeout.puts "Version: #{PKG_VERSION}"
336
+ else
337
+ rakeout.puts line
338
+ end
339
+ end
340
+ end
341
+ end
342
+ mv "conf/redhat/puppet.spec.new", "conf/redhat/puppet.spec"
343
+
275
344
  if ENV['RELTEST']
276
345
  announce "Release Task Testing, skipping commiting of new version"
277
346
  else
278
- sh %{svn commit -m "Updated to version #{PKG_VERSION}" lib/puppet.rb}
347
+ sh %{svn commit -m "Updated to version #{PKG_VERSION}" lib/puppet.rb conf/redhat/puppet.spec}
279
348
  end
280
349
  end
281
350
  end
282
351
 
352
+ desc "Copy the newly created package into the downloads directory"
353
+ task :copy => [:package, :html, :fedorarpm] do
354
+ puts Dir.getwd
355
+ sh %{cp pkg/puppet-#{PKG_VERSION}.gem #{DOWNDIR}/gems}
356
+ sh %{generate_yaml_index.rb -d #{DOWNDIR}}
357
+ sh %{cp pkg/puppet-#{PKG_VERSION}.tgz #{DOWNDIR}/puppet}
358
+ sh %{ln -sf puppet-#{PKG_VERSION}.tgz #{DOWNDIR}/puppet/puppet-latest.tgz}
359
+ sh %{cp -r html #{DOWNDIR}/puppet/apidocs}
360
+ sh %{rsync -av /home/luke/rpm/. #{DOWNDIR}/rpm}
361
+ end
362
+
283
363
  desc "Tag all the SVN files with the latest release number (REL=x.y.z)"
284
364
  task :tag => [:prerelease] do
285
365
  reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}"
@@ -288,7 +368,67 @@ task :tag => [:prerelease] do
288
368
  if ENV['RELTEST']
289
369
  announce "Release Task Testing, skipping SVN tagging"
290
370
  else
291
- #sh %{svn copy ../trunk/ ../tags/#{reltag}}
371
+ sh %{svn copy ../trunk/ ../tags/#{reltag}}
372
+ sh %{cd ../tags; svn ci -m "Adding release tag #{reltag}"}
373
+ end
374
+ end
375
+
376
+ desc "Test Puppet on each test host"
377
+ task :hosttest do
378
+ out = ""
379
+ TESTHOSTS.each { |host|
380
+ puts "testing %s" % host
381
+ cwd = Dir.getwd
382
+ out += %x{ssh #{host} 'cd puppet/test; sudo ./test' 2>&1}
383
+
384
+ if $? != 0
385
+ file = File.join("/tmp", "%stest.out" % host)
386
+ File.open(file, "w") { |of| of.print out }
387
+ puts "%s failed; output is in %s" % [host, file]
388
+ puts out
389
+ end
390
+ #sh %{ssh #{host} 'cd #{cwd}/test; sudo ./test' 2>&1}
391
+ }
392
+
393
+ #IO.popen("mail -s 'Puppet Test Results' luke@madstop.com") do |m|
394
+ # m.puts out
395
+ #end
396
+ end
397
+
398
+ desc "Create an RPM"
399
+ task :rpm do
400
+ tarball = File.join(Dir.getwd, "pkg", "puppet-#{PKG_VERSION}.tgz")
401
+
402
+ sourcedir = `rpm --define 'name puppet' --define 'version #{PKG_VERSION}' --eval '%_sourcedir'`.chomp
403
+ specdir = `rpm --define 'name puppet' --define 'version #{PKG_VERSION}' --eval '%_specdir'`.chomp
404
+ basedir = File.dirname(sourcedir)
405
+
406
+ if ! FileTest::exist?(sourcedir)
407
+ FileUtils.mkdir_p(sourcedir)
408
+ end
409
+ FileUtils.mkdir_p(basedir)
410
+
411
+ target = "#{sourcedir}/#{File::basename(tarball)}"
412
+
413
+ sh %{cp %s %s} % [tarball, target]
414
+ sh %{cp conf/redhat/puppet.spec %s/puppet.spec} % basedir
415
+
416
+ Dir.chdir(basedir) do
417
+ sh %{rpmbuild -ba puppet.spec}
292
418
  end
419
+
420
+ sh %{mv %s/puppet.spec %s} % [basedir, specdir]
421
+ end
422
+
423
+ desc "Create an rpm on a system that can actually do so"
424
+ task :fedorarpm => [:package] do
425
+ sh %{ssh fedora1 'cd puppet; rake rpm'}
426
+ end
427
+
428
+ desc "Create a Native Package"
429
+ task :nativepkg do
430
+ # Okay, first we get a file list
431
+
293
432
  end
294
433
 
434
+ # $Id$
data/bin/puppet CHANGED
@@ -8,8 +8,7 @@
8
8
  # = Usage
9
9
  #
10
10
  # puppet [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose]
11
- # [-l|--logfile <file>] [-p|--parse-only] <file>
12
- # [-c|--confdir <configuration directory>] [--vardir <var directory>]
11
+ # [-l|--logfile <file>] <file>
13
12
  #
14
13
  # = Description
15
14
  #
@@ -19,9 +18,11 @@
19
18
  #
20
19
  # = Options
21
20
  #
22
- # confdir::
23
- # The configuration root directory, where +puppetmasterd+ defaults to looking
24
- # for all of its configuration files. Defaults to +/etc/puppet+.
21
+ # Note that any configuration parameter that's valid in the configuration file
22
+ # is also a valid long argument. For example, 'ssldir' is a valid configuration
23
+ # parameter, so you can specify '--ssldir <directory>' as an argument.
24
+ #
25
+ # See the configuration file for the full list of acceptable parameters.
25
26
  #
26
27
  # debug::
27
28
  # Enable full debugging.
@@ -33,13 +34,6 @@
33
34
  # Where to send messages. Choose between syslog, the console, and a log file.
34
35
  # Defaults to sending messages to the console.
35
36
  #
36
- # parse-only::
37
- # Just verify syntax, do not apply anything.
38
- #
39
- # vardir::
40
- # The variable-size directory, used for storing state. Defaults to
41
- # /var/puppet.
42
- #
43
37
  # verbose::
44
38
  # Print extra information.
45
39
  #
@@ -69,18 +63,19 @@ rescue LoadError
69
63
  $haveusage = false
70
64
  end
71
65
 
72
- result = GetoptLong.new(
73
- [ "--confdir", "-c", GetoptLong::REQUIRED_ARGUMENT ],
66
+ options = [
74
67
  [ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
75
68
  [ "--help", "-h", GetoptLong::NO_ARGUMENT ],
76
69
  [ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ],
77
70
  [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
78
- [ "--noop", "-n", GetoptLong::NO_ARGUMENT ],
79
71
  [ "--use-nodes", GetoptLong::NO_ARGUMENT ],
80
- [ "--parse-only", "-p", GetoptLong::NO_ARGUMENT ],
81
- [ "--vardir", GetoptLong::REQUIRED_ARGUMENT ],
82
72
  [ "--version", "-V", GetoptLong::NO_ARGUMENT ]
83
- )
73
+ ]
74
+
75
+ # Add all of the config parameters as valid options.
76
+ Puppet.config.addargs(options)
77
+
78
+ result = GetoptLong.new(*options)
84
79
 
85
80
  debug = false
86
81
  verbose = false
@@ -92,13 +87,11 @@ master = {
92
87
  :Local => true
93
88
  }
94
89
 
95
- Puppet[:logdest] = :console
90
+ Puppet::Log.newdestination(:console)
96
91
 
97
92
  begin
98
93
  result.each { |opt,arg|
99
94
  case opt
100
- when "--confdir"
101
- Puppet[:puppetconf] = arg
102
95
  when "--version"
103
96
  puts "%s" % Puppet.version
104
97
  exit
@@ -109,24 +102,20 @@ begin
109
102
  puts "No help available unless you have RDoc::usage installed"
110
103
  exit
111
104
  end
112
- when "--noop"
113
- Puppet[:noop] = true
114
105
  when "--use-nodes"
115
106
  master[:UseNodes] = true
116
107
  when "--verbose"
117
108
  verbose = true
118
- when "--parse-only"
119
- parseonly = true
120
109
  when "--debug"
121
110
  debug = true
122
111
  when "--logdest"
123
112
  begin
124
- Puppet[:logdest] = arg
113
+ Puppet::Log.newdestination(arg)
125
114
  rescue => detail
126
115
  $stderr.puts detail.to_s
127
116
  end
128
- when "--vardir"
129
- Puppet[:puppetvar] = arg
117
+ else
118
+ Puppet.config.handlearg(opt, arg)
130
119
  end
131
120
  }
132
121
  rescue GetoptLong::InvalidOption => detail
@@ -138,39 +127,36 @@ rescue GetoptLong::InvalidOption => detail
138
127
  end
139
128
 
140
129
  if debug
141
- Puppet[:loglevel] = :debug
130
+ Puppet::Log.level = :debug
142
131
  elsif verbose
143
- Puppet[:loglevel] = :info
132
+ Puppet::Log.level = :info
133
+ end
134
+
135
+ # Now parse the config
136
+ if Puppet[:config] and File.exists? Puppet[:config]
137
+ Puppet.config.parse(Puppet[:config])
144
138
  end
145
139
 
140
+ Puppet.genconfig
141
+ Puppet.genmanifest
142
+
146
143
  master[:File] = ARGV.shift
147
144
 
148
145
  begin
149
146
  server = Puppet::Server::Master.new(master)
150
- rescue => detail
151
- $stderr.puts detail
152
- exit(1)
153
- end
154
-
155
- begin
156
147
  client = Puppet::Client::MasterClient.new(
157
148
  :Master => server,
158
149
  :Cache => false
159
150
  )
160
- rescue => detail
161
- $stderr.puts detail
162
- exit(1)
163
- end
164
-
165
-
166
- if parseonly
167
- exit(0)
168
- end
169
-
170
- begin
151
+ if parseonly
152
+ exit(0)
153
+ end
171
154
  client.getconfig
172
155
  client.apply
173
156
  rescue => detail
174
- Puppet.err detail
157
+ $stderr.puts detail
158
+ if Puppet[:debug]
159
+ puts detail.backtrace
160
+ end
175
161
  exit(1)
176
162
  end