puppet 0.25.1 → 0.25.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (198) hide show
  1. data/CHANGELOG +159 -135
  2. data/Rakefile +4 -1
  3. data/conf/gentoo/conf.d/puppetmaster +1 -1
  4. data/conf/osx/createpackage.sh +12 -0
  5. data/conf/osx/preflight +4 -0
  6. data/conf/redhat/puppet.spec +12 -2
  7. data/conf/redhat/server.init +1 -0
  8. data/conf/redhat/server.sysconfig +1 -1
  9. data/ext/ldap/puppet.schema +5 -9
  10. data/ext/puppetlast +2 -1
  11. data/ext/rack/README +2 -2
  12. data/ext/regexp_nodes/classes/databases +2 -0
  13. data/ext/regexp_nodes/classes/webservers +2 -0
  14. data/ext/regexp_nodes/parameters/environment/prod +1 -0
  15. data/ext/regexp_nodes/parameters/environment/qa +3 -0
  16. data/ext/regexp_nodes/regexp_nodes.rb +215 -0
  17. data/lib/puppet.rb +1 -1
  18. data/lib/puppet/agent.rb +2 -2
  19. data/lib/puppet/application/puppet.rb +1 -1
  20. data/lib/puppet/application/puppetd.rb +1 -1
  21. data/lib/puppet/application/puppetdoc.rb +4 -3
  22. data/lib/puppet/application/puppetrun.rb +5 -14
  23. data/lib/puppet/application/ralsh.rb +9 -25
  24. data/lib/puppet/configurer.rb +2 -1
  25. data/lib/puppet/configurer/fact_handler.rb +8 -6
  26. data/lib/puppet/daemon.rb +2 -2
  27. data/lib/puppet/defaults.rb +21 -2
  28. data/lib/puppet/external/pson/common.rb +1 -1
  29. data/lib/puppet/external/pson/pure.rb +3 -3
  30. data/lib/puppet/feature/base.rb +3 -0
  31. data/lib/puppet/feature/selinux.rb +3 -0
  32. data/lib/puppet/feature/zlib.rb +6 -0
  33. data/lib/puppet/file_serving/base.rb +16 -1
  34. data/lib/puppet/file_serving/metadata.rb +46 -9
  35. data/lib/puppet/file_serving/mount/file.rb +4 -1
  36. data/lib/puppet/indirector/catalog/active_record.rb +5 -0
  37. data/lib/puppet/indirector/envelope.rb +1 -3
  38. data/lib/puppet/indirector/indirection.rb +13 -16
  39. data/lib/puppet/indirector/node/ldap.rb +7 -4
  40. data/lib/puppet/indirector/ssl_file.rb +1 -1
  41. data/lib/puppet/network/authstore.rb +48 -118
  42. data/lib/puppet/network/client/resource.rb +2 -15
  43. data/lib/puppet/network/format.rb +2 -12
  44. data/lib/puppet/network/format_handler.rb +15 -1
  45. data/lib/puppet/network/formats.rb +19 -4
  46. data/lib/puppet/network/handler/fileserver.rb +1 -0
  47. data/lib/puppet/network/http/handler.rb +1 -0
  48. data/lib/puppet/network/http/rack/httphandler.rb +0 -18
  49. data/lib/puppet/network/http/rack/rest.rb +4 -4
  50. data/lib/puppet/network/http/rack/xmlrpc.rb +4 -4
  51. data/lib/puppet/network/http/webrick.rb +2 -1
  52. data/lib/puppet/network/server.rb +1 -1
  53. data/lib/puppet/node/environment.rb +20 -9
  54. data/lib/puppet/parameter.rb +17 -1
  55. data/lib/puppet/parser/ast/boolean_operator.rb +2 -2
  56. data/lib/puppet/parser/ast/leaf.rb +5 -1
  57. data/lib/puppet/parser/ast/resourceparam.rb +4 -0
  58. data/lib/puppet/parser/ast/selector.rb +4 -0
  59. data/lib/puppet/parser/functions/generate.rb +2 -2
  60. data/lib/puppet/parser/functions/shellquote.rb +1 -1
  61. data/lib/puppet/property.rb +3 -11
  62. data/lib/puppet/provider/cron/crontab.rb +2 -0
  63. data/lib/puppet/provider/host/parsed.rb +9 -9
  64. data/lib/puppet/provider/package/blastwave.rb +7 -6
  65. data/lib/puppet/provider/package/portage.rb +23 -27
  66. data/lib/puppet/provider/package/rug.rb +1 -1
  67. data/lib/puppet/provider/package/sun.rb +5 -3
  68. data/lib/puppet/provider/service/daemontools.rb +1 -1
  69. data/lib/puppet/provider/service/debian.rb +1 -1
  70. data/lib/puppet/provider/service/runit.rb +1 -1
  71. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +2 -1
  72. data/lib/puppet/provider/sshkey/parsed.rb +3 -5
  73. data/lib/puppet/provider/zone/solaris.rb +1 -1
  74. data/lib/puppet/rails.rb +9 -2
  75. data/lib/puppet/rails/benchmark.rb +1 -1
  76. data/lib/puppet/rails/host.rb +2 -7
  77. data/lib/puppet/rails/resource.rb +20 -26
  78. data/lib/puppet/resource/catalog.rb +3 -3
  79. data/lib/puppet/resource/reference.rb +13 -25
  80. data/lib/puppet/ssl/certificate.rb +3 -2
  81. data/lib/puppet/ssl/host.rb +14 -33
  82. data/lib/puppet/sslcertificates.rb +1 -5
  83. data/lib/puppet/sslcertificates/ca.rb +8 -7
  84. data/lib/puppet/transaction.rb +15 -12
  85. data/lib/puppet/type.rb +12 -5
  86. data/lib/puppet/type/file.rb +26 -32
  87. data/lib/puppet/type/file/content.rb +5 -5
  88. data/lib/puppet/type/file/ensure.rb +6 -17
  89. data/lib/puppet/type/file/mode.rb +18 -1
  90. data/lib/puppet/type/file/source.rb +12 -12
  91. data/lib/puppet/type/host.rb +6 -9
  92. data/lib/puppet/type/k5login.rb +1 -1
  93. data/lib/puppet/type/maillist.rb +4 -7
  94. data/lib/puppet/type/port.rb +6 -5
  95. data/lib/puppet/type/resources.rb +12 -12
  96. data/lib/puppet/type/sshkey.rb +5 -5
  97. data/lib/puppet/type/tidy.rb +9 -2
  98. data/lib/puppet/type/yumrepo.rb +3 -1
  99. data/lib/puppet/util.rb +64 -56
  100. data/lib/puppet/util/backups.rb +2 -1
  101. data/lib/puppet/util/filetype.rb +46 -0
  102. data/lib/puppet/util/log.rb +10 -18
  103. data/lib/puppet/util/log_paths.rb +14 -0
  104. data/lib/puppet/util/methodhelper.rb +3 -4
  105. data/lib/puppet/util/monkey_patches.rb +8 -0
  106. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +5 -3
  107. data/lib/puppet/util/rdoc/parser.rb +32 -16
  108. data/lib/puppet/util/reference.rb +6 -3
  109. data/lib/puppet/util/selinux.rb +21 -14
  110. data/lib/puppet/util/settings.rb +30 -25
  111. data/lib/puppet/util/settings/file_setting.rb +7 -4
  112. data/lib/puppet/util/subclass_loader.rb +1 -1
  113. data/lib/puppet/util/suidmanager.rb +11 -1
  114. data/lib/puppet/util/tagging.rb +22 -4
  115. data/man/man8/filebucket.8 +23 -18
  116. data/man/man8/pi.8 +42 -20
  117. data/man/man8/puppet.8 +47 -32
  118. data/man/man8/puppet.conf.8 +807 -764
  119. data/man/man8/puppetca.8 +24 -14
  120. data/man/man8/puppetd.8 +33 -16
  121. data/man/man8/puppetdoc.8 +71 -18
  122. data/man/man8/puppetmasterd.8 +18 -25
  123. data/man/man8/puppetqd.8 +60 -0
  124. data/man/man8/puppetrun.8 +27 -14
  125. data/man/man8/ralsh.8 +33 -40
  126. data/spec/integration/bin/puppetmasterd.rb +3 -2
  127. data/spec/integration/defaults.rb +11 -0
  128. data/spec/integration/file_serving/metadata.rb +1 -0
  129. data/spec/integration/indirector/file_content/file_server.rb +2 -1
  130. data/spec/integration/ssl/certificate_request.rb +2 -0
  131. data/spec/integration/type/file.rb +20 -1
  132. data/spec/shared_behaviours/file_serving.rb +1 -1
  133. data/spec/spec_helper.rb +1 -1
  134. data/spec/unit/application/puppet.rb +11 -30
  135. data/spec/unit/application/puppetd.rb +1 -0
  136. data/spec/unit/application/puppetdoc.rb +13 -4
  137. data/spec/unit/application/puppetmasterd.rb +1 -0
  138. data/spec/unit/application/puppetrun.rb +12 -2
  139. data/spec/unit/application/ralsh.rb +39 -22
  140. data/spec/unit/configurer.rb +6 -0
  141. data/spec/unit/configurer/fact_handler.rb +15 -1
  142. data/spec/unit/file_serving/metadata.rb +128 -16
  143. data/spec/unit/file_serving/mount/file.rb +8 -0
  144. data/spec/unit/indirector/catalog/active_record.rb +20 -1
  145. data/spec/unit/indirector/catalog/compiler.rb +2 -1
  146. data/spec/unit/indirector/indirection.rb +29 -18
  147. data/spec/unit/indirector/node/ldap.rb +20 -6
  148. data/spec/unit/network/authstore.rb +197 -0
  149. data/spec/unit/network/format_handler.rb +28 -8
  150. data/spec/unit/network/formats.rb +31 -0
  151. data/spec/unit/network/http/handler.rb +10 -0
  152. data/spec/unit/network/http/webrick.rb +2 -2
  153. data/spec/unit/network/rest_authconfig.rb +2 -2
  154. data/spec/unit/network/rights.rb +1 -1
  155. data/spec/unit/node/environment.rb +39 -23
  156. data/spec/unit/other/selinux.rb +2 -2
  157. data/spec/unit/parameter.rb +8 -0
  158. data/spec/unit/parser/ast/leaf.rb +9 -0
  159. data/spec/unit/parser/ast/selector.rb +8 -1
  160. data/spec/unit/parser/lexer.rb +1 -1
  161. data/spec/unit/parser/resource.rb +11 -0
  162. data/spec/unit/parser/resource/reference.rb +13 -1
  163. data/spec/unit/property.rb +6 -0
  164. data/spec/unit/provider/mount/parsed.rb +3 -1
  165. data/spec/unit/provider/service/debian.rb +1 -1
  166. data/spec/unit/provider/ssh_authorized_key/parsed.rb +9 -1
  167. data/spec/unit/provider/sshkey/parsed.rb +19 -0
  168. data/spec/unit/rails.rb +22 -9
  169. data/spec/unit/rails/resource.rb +20 -0
  170. data/spec/unit/ssl/host.rb +19 -57
  171. data/spec/unit/transaction.rb +39 -4
  172. data/spec/unit/type.rb +9 -0
  173. data/spec/unit/type/file/content.rb +29 -0
  174. data/spec/unit/type/maillist.rb +42 -0
  175. data/spec/unit/type/resources.rb +66 -1
  176. data/spec/unit/type/tidy.rb +14 -1
  177. data/spec/unit/util/autoload.rb +2 -0
  178. data/spec/unit/util/ldap/connection.rb +1 -1
  179. data/spec/unit/util/log.rb +14 -0
  180. data/spec/unit/util/monkey_patches.rb +103 -0
  181. data/spec/unit/util/queue.rb +10 -2
  182. data/spec/unit/util/selinux.rb +61 -2
  183. data/spec/unit/util/settings.rb +19 -0
  184. data/spec/unit/util/settings/file_setting.rb +25 -0
  185. data/spec/unit/util/tagging.rb +10 -0
  186. data/tasks/rake/changelog.rake +15 -0
  187. data/tasks/rake/ci.rake +22 -0
  188. data/tasks/rake/dailybuild.rake +9 -0
  189. data/tasks/rake/gem.rake +46 -0
  190. data/tasks/rake/git_workflow.rake +121 -0
  191. data/tasks/rake/metrics.rake +6 -0
  192. data/tasks/rake/sign.rake +14 -0
  193. data/tasks/rake/testbranch.rake +16 -0
  194. data/tasks/rake/tracdocs.rake +8 -0
  195. data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +1 -0
  196. metadata +1042 -1288
  197. data/ext/bin/sleeper +0 -67
  198. data/ext/module_puppet +0 -209
@@ -19,16 +19,24 @@ end
19
19
 
20
20
  mod = Puppet::Util::Queue
21
21
  client_classes = { :default => make_test_client_class('Bogus::Default'), :setup => make_test_client_class('Bogus::Setup') }
22
- mod.register_queue_type(client_classes[:default], :default)
23
- mod.register_queue_type(client_classes[:setup], :setup)
24
22
 
25
23
  describe Puppet::Util::Queue do
24
+ before :all do
25
+ mod.register_queue_type(client_classes[:default], :default)
26
+ mod.register_queue_type(client_classes[:setup], :setup)
27
+ end
28
+
26
29
  before :each do
27
30
  @class = Class.new do
28
31
  extend mod
29
32
  end
30
33
  end
31
34
 
35
+ after :all do
36
+ instances = mod.instance_hash(:queue_clients)
37
+ [:default, :setup, :bogus, :aardvark, :conflict, :test_a, :test_b].each{ |x| instances.delete(x) }
38
+ end
39
+
32
40
  context 'when determining a type name from a class' do
33
41
  it 'should handle a simple one-word class name' do
34
42
  mod.queue_type_from_class(make_test_client_class('Foo')).should == :foo
@@ -27,7 +27,12 @@ describe Puppet::Util::SELinux do
27
27
  Selinux.expects(:is_selinux_enabled).returns 0
28
28
  selinux_support?.should be_false
29
29
  end
30
- end
30
+
31
+ it "should return nil if /proc/mounts does not exist" do
32
+ File.stubs(:open).with("/proc/mounts").raises("No such file or directory - /proc/mounts")
33
+ read_mounts.should == nil
34
+ end
35
+ end
31
36
 
32
37
  describe "filesystem detection" do
33
38
  before :each do
@@ -61,6 +66,42 @@ describe Puppet::Util::SELinux do
61
66
  selinux_label_support?('/mnt/nfs/testfile').should be_false
62
67
  end
63
68
 
69
+ it "should follow symlinks when determining file systems" do
70
+ self.stubs(:realpath).with('/mnt/symlink/testfile').returns('/mnt/nfs/dest/testfile')
71
+
72
+ selinux_label_support?('/mnt/symlink/testfile').should be_false
73
+ end
74
+
75
+ end
76
+
77
+ describe "realpath" do
78
+ it "should handle files that don't exist" do
79
+
80
+ # Since I'm stubbing Pathname.new for this test,
81
+ # I need to also stub the internal calls to Pathname.new,
82
+ # which happen in Pathname.dirname and Parthname.basename
83
+ # I want those to return real Pathname objects,
84
+ # so I'm creating them before the stub is in place.
85
+ realpaths = Hash.new {|hash, path| hash[path] = Pathname.new(path) }
86
+ paths = ['symlink', '/mnt']
87
+ paths.each { |path| realpaths[path] }
88
+
89
+ realpaths['/mnt/symlink'] = stubs "Pathname"
90
+ realpaths['/mnt/symlink'].stubs(:realpath).returns(realpaths['/mnt/nfs/dest'])
91
+ realpaths['/mnt/symlink'].stubs(:exist?).returns(true)
92
+
93
+ realpaths['/mnt/symlink/nonexistant'] = stubs "Pathname"
94
+ realpaths['/mnt/symlink/nonexistant'].stubs(:realpath).raises(Errno::ENOENT)
95
+ realpaths['/mnt/symlink/nonexistant'].stubs(:exist?).returns(false)
96
+ realpaths['/mnt/symlink/nonexistant'].stubs(:dirname).returns(realpaths['/mnt/symlink'])
97
+ realpaths['/mnt/symlink/nonexistant'].stubs(:basename).returns(realpaths['nonexistant'])
98
+
99
+ realpaths.each do |path, value|
100
+ Pathname.stubs(:new).with(path).returns(value)
101
+ end
102
+
103
+ realpath('/mnt/symlink/nonexistant').should == '/mnt/nfs/dest/nonexistant'
104
+ end
64
105
  end
65
106
 
66
107
  describe "get_selinux_current_context" do
@@ -153,11 +194,29 @@ describe Puppet::Util::SELinux do
153
194
  end
154
195
 
155
196
  describe "set_selinux_context" do
156
- it "should return nil if there is no SELinux support" do
197
+ before :each do
198
+ fh = stub 'fh', :close => nil
199
+ File.stubs(:open).with("/proc/mounts").returns fh
200
+ fh.stubs(:read_nonblock).returns(
201
+ "rootfs / rootfs rw 0 0\n"+
202
+ "/dev/root / ext3 rw,relatime,errors=continue,user_xattr,acl,data=ordered 0 0\n"+
203
+ "/dev /dev tmpfs rw,relatime,mode=755 0 0\n"+
204
+ "/proc /proc proc rw,relatime 0 0\n"+
205
+ "/sys /sys sysfs rw,relatime 0 0\n"
206
+ ).then.raises EOFError
207
+ end
208
+
209
+ it "should return nil if there is no SELinux support" do
157
210
  self.expects(:selinux_support?).returns false
158
211
  set_selinux_context("/foo", "user_u:role_r:type_t:s0").should be_nil
159
212
  end
160
213
 
214
+ it "should return nil if selinux_label_support returns false" do
215
+ self.expects(:selinux_support?).returns true
216
+ self.expects(:selinux_label_support?).with("/foo").returns false
217
+ set_selinux_context("/foo", "user_u:role_r:type_t:s0").should be_nil
218
+ end
219
+
161
220
  it "should use lsetfilecon to set a context" do
162
221
  self.expects(:selinux_support?).returns true
163
222
  Selinux.expects(:lsetfilecon).with("/foo", "user_u:role_r:type_t:s0").returns 0
@@ -579,6 +579,25 @@ describe Puppet::Util::Settings do
579
579
  # and we should now have the new value in memory
580
580
  @settings[:two].should == "disk-replace"
581
581
  end
582
+
583
+ it "should retain in-memory values if the file has a syntax error" do
584
+ # Init the value
585
+ text = "[main]\none = initial-value\n"
586
+ @settings.expects(:read_file).returns(text)
587
+ @settings.parse
588
+ @settings[:one].should == "initial-value"
589
+
590
+ # Now replace the value with something bogus
591
+ text = "[main]\nkenny = killed-by-what-follows\n1 is 2, blah blah florp\n"
592
+ @settings.expects(:read_file).returns(text)
593
+ @settings.parse
594
+
595
+ # The originally-overridden value should not be replaced with the default
596
+ @settings[:one].should == "initial-value"
597
+
598
+ # and we should not have the new value in memory
599
+ @settings[:kenny].should be_nil
600
+ end
582
601
  end
583
602
 
584
603
  it "should provide a method for creating a catalog of resources from its configuration" do
@@ -169,18 +169,43 @@ describe Puppet::Util::Settings::FileSetting do
169
169
  @file.to_resource[:mode].should == 0755
170
170
  end
171
171
 
172
+ it "should not set the mode on a the file if manage_internal_file_permissions is disabled" do
173
+ Puppet[:manage_internal_file_permissions] = false
174
+
175
+ @file.stubs(:mode).returns(0755)
176
+
177
+ @file.to_resource[:mode].should == nil
178
+ end
179
+
172
180
  it "should set the owner if running as root and the owner is provided" do
173
181
  Puppet.features.expects(:root?).returns true
174
182
  @file.stubs(:owner).returns "foo"
175
183
  @file.to_resource[:owner].should == "foo"
176
184
  end
177
185
 
186
+ it "should not set the owner if manage_internal_file_permissions is disabled" do
187
+ Puppet[:manage_internal_file_permissions] = false
188
+ Puppet.features.stubs(:root?).returns true
189
+ @file.stubs(:owner).returns "foo"
190
+
191
+ @file.to_resource[:owner].should == nil
192
+ end
193
+
178
194
  it "should set the group if running as root and the group is provided" do
179
195
  Puppet.features.expects(:root?).returns true
180
196
  @file.stubs(:group).returns "foo"
181
197
  @file.to_resource[:group].should == "foo"
182
198
  end
183
199
 
200
+ it "should not set the group if manage_internal_file_permissions is disabled" do
201
+ Puppet[:manage_internal_file_permissions] = false
202
+ Puppet.features.stubs(:root?).returns true
203
+ @file.stubs(:group).returns "foo"
204
+
205
+ @file.to_resource[:group].should == nil
206
+ end
207
+
208
+
184
209
  it "should not set owner if not running as root" do
185
210
  Puppet.features.expects(:root?).returns false
186
211
  @file.stubs(:owner).returns "foo"
@@ -89,4 +89,14 @@ describe Puppet::Util::Tagging, "when adding tags" do
89
89
  it "should indicate when the object is not tagged with a provided tag" do
90
90
  @tagger.should_not be_tagged("one")
91
91
  end
92
+
93
+ it "should indicate when the object is tagged with any tag in an array" do
94
+ @tagger.tag("one")
95
+ @tagger.should be_tagged("one","two","three")
96
+ end
97
+
98
+ it "should indicate when the object is not tagged with any tag in an array" do
99
+ @tagger.tag("one")
100
+ @tagger.should_not be_tagged("two","three")
101
+ end
92
102
  end
@@ -0,0 +1,15 @@
1
+ desc "Create a ChangeLog based on git commits."
2
+ task :changelog do
3
+ begin
4
+ gitc = %x{which git-changelog}
5
+ rescue
6
+ puts "This task needs the git-changelog binary - http://github.com/ReinH/git-changelog"
7
+ end
8
+
9
+ CHANGELOG_DIR = "#{Dir.pwd}"
10
+ mkdir(CHANGELOG_DIR) unless File.directory?(CHANGELOG_DIR)
11
+ change_body = `git-changelog --no-limit -a`
12
+ File.open(File.join(CHANGELOG_DIR, "CHANGELOG"), 'w') do |f|
13
+ f << change_body
14
+ end
15
+ end
@@ -0,0 +1,22 @@
1
+ desc "Prep CI RSpec tests"
2
+ task :ci_prep do
3
+ require 'rubygems'
4
+ begin
5
+ gem 'ci_reporter'
6
+ require 'ci/reporter/rake/rspec'
7
+ require 'ci/reporter/rake/test_unit'
8
+ ENV['CI_REPORTS'] = 'results'
9
+ rescue LoadError
10
+ puts 'Missing ci_reporter gem. You must have the ci_reporter gem installed to run the CI spec tests'
11
+ end
12
+ end
13
+
14
+ desc "Run the CI RSpec tests"
15
+ task :ci_spec => [:ci_prep, 'ci:setup:rspec', :spec] do
16
+ sh "exit 0"
17
+ end
18
+
19
+ desc "Run CI Unit tests"
20
+ task :ci_unit => [:ci_prep, 'ci:setup:testunit'] do
21
+ sh "cd test; rake test; exit 0"
22
+ end
@@ -0,0 +1,9 @@
1
+ desc "Create a Puppet daily build"
2
+ task :daily => :changelog do
3
+ version = "puppet" + "-" + Time.now.localtime.strftime("%Y%m%d")
4
+ sh "git archive --format=tar --prefix=#{version}/ HEAD^{tree} >#{version}.tar"
5
+ sh "pax -waf #{version}.tar -s ':^:#{version}/:' ChangeLog"
6
+ sh "rm ChangeLog"
7
+ sh "gzip -f -9 #{version}.tar"
8
+ end
9
+
@@ -0,0 +1,46 @@
1
+ GEM_FILES = FileList[
2
+ '[A-Z]*',
3
+ 'install.rb',
4
+ 'bin/**/*',
5
+ 'lib/**/*',
6
+ 'conf/**/*',
7
+ 'man/**/*',
8
+ 'examples/**/*',
9
+ 'ext/**/*',
10
+ 'tasks/**/*',
11
+ 'test/**/*',
12
+ 'spec/**/*'
13
+ ]
14
+
15
+ spec = Gem::Specification.new do |spec|
16
+ spec.platform = Gem::Platform::RUBY
17
+ spec.name = 'puppet'
18
+ spec.files = GEM_FILES.to_a
19
+ spec.executables = %w{puppetca puppetd puppetmasterd puppetqd puppetrun filebucket pi puppet puppetdoc ralsh}
20
+ spec.version = Puppet::PUPPETVERSION
21
+ spec.add_dependency('facter', '>= 1.5.1')
22
+ spec.summary = 'Puppet, an automated configuration management tool'
23
+ spec.author = 'Reductive Labs'
24
+ spec.email = 'puppet@reductivelabs.com'
25
+ spec.homepage = 'http://reductivelabs.com'
26
+ spec.rubyforge_project = 'puppet'
27
+ spec.has_rdoc = true
28
+ spec.rdoc_options <<
29
+ '--title' << 'Puppet - Configuration Management' <<
30
+ '--main' << 'README' <<
31
+ '--line-numbers'
32
+ end
33
+
34
+ desc "Prepare binaries for gem creation"
35
+ task :prepare_gem do
36
+ sh "mv sbin/* bin"
37
+ end
38
+
39
+ desc "Create the gem"
40
+ task :create_gem => :prepare_gem do
41
+ sh "mkdir -p pkg"
42
+ Gem::Builder.new(spec).build
43
+ sh "mv *.gem pkg"
44
+ sh "rm bin/*"
45
+ sh "git reset --hard"
46
+ end
@@ -0,0 +1,121 @@
1
+ # This set of tasks helps automate the workflow as described on
2
+ # http://reductivelabs.com/trac/puppet/wiki/Development/DevelopmentLifecycle
3
+
4
+
5
+ def find_start(start)
6
+ # This is a case statement, as we might want to map certain
7
+ # git tags to starting points that are not currently in git.
8
+ case start
9
+ when nil?:
10
+ when @next_release: return "master"
11
+ else return start
12
+ end
13
+ end
14
+
15
+ desc "Set up git for working with Puppet"
16
+ task :git_setup do
17
+ # This should be changed as new versions get released
18
+ @next_release = '0.26.x'
19
+ @remote = {}
20
+ default_remote = {}
21
+ default_remote[:url] = 'git://github.com/reductivelabs/puppet'
22
+ default_remote[:name] = 'origin'
23
+ @remote[:name] = %x{git config puppet.defaultremote}.chomp
24
+ @remote[:name] = @remote[:name].empty? ? default_remote[:name] : @remote[:name]
25
+ @remote[:url] = default_remote[:url] if @remote[:name] == default_remote[:name]
26
+ default_fetch = '+refs/heads/*:refs/remotes/puppet/*'
27
+ @remote[:fetch] = %x{git config puppet.#{@remote[:name]}.fetch}.chomp
28
+ @remote[:fetch] = @remote[:fetch].empty? ? default_fetch : @remote[:fetch]
29
+ end
30
+
31
+ desc "Start work on a feature"
32
+ task :start_feature, [:feature,:remote,:branch] => :git_setup do |t, args|
33
+ args.with_defaults(:remote => @remote[:name])
34
+ args.with_defaults(:branch => @next_release)
35
+ start_at = find_start(args.branch)
36
+ branch = "feature/#{start_at}/#{args.feature}"
37
+ sh "git checkout -b #{branch} #{start_at}" do |ok, res|
38
+ if ! ok
39
+ raise <<EOS
40
+ Was not able to create branch for #{args.feature} on branch #{args.branch}, starting at #{start_at}: error code was: #{res.exitstatus}
41
+ EOS
42
+ end
43
+ end
44
+ sh "git config branch.#{branch}.remote #{args.remote}" do |ok, res|
45
+ raise "Could not set remote: #{$?}" unless ok
46
+ end
47
+
48
+ sh "git config branch.#{branch}.merge refs/heads/#{branch}" do |ok, res|
49
+ raise "Could not configure merge: #{$?}" unless ok
50
+ end
51
+ end
52
+
53
+ desc "Do git prep to start work on a Redmine ticket"
54
+ task :start_ticket, [:ticket, :remote, :branch] => :git_setup do |t, args|
55
+ args.with_defaults(:remote => @remote[:name])
56
+ args.with_defaults(:branch => @next_release)
57
+ start_at = find_start(args.branch)
58
+ branch = "tickets/#{start_at}/#{args.ticket}"
59
+ sh "git checkout -b #{branch} #{start_at}" do |ok, res|
60
+ unless ok
61
+ raise <<EOS
62
+ Was not able to create branch for ticket #{args.ticket} on branch #{args.branch}, starting at #{start_at}: error code was: #{$?}
63
+ Git command used was: #{command}
64
+ EOS
65
+ end
66
+ end
67
+ sh "git config branch.#{branch}.remote #{args.remote}" do |ok, res|
68
+ raise "Could not set remote: #{$?}" unless ok
69
+ end
70
+
71
+ sh "git config branch.#{branch}.merge refs/heads/#{branch}" do |ok, res|
72
+ raise "Could not configure merge: #{$?}" unless ok
73
+ end
74
+ end
75
+
76
+ # This isn't very useful by itself, but we might enhance it later, or use it
77
+ # in a dependency for a more complex task.
78
+ desc "Push out changes"
79
+ task :push_changes, [:remote] do |t, arg|
80
+ branch = %x{git branch | grep "^" | awk '{print $2}'}
81
+ sh "git push #{arg.remote} #{branch}" do |ok, res|
82
+ raise "Unable to push to #{arg.remote}" unless ok
83
+ end
84
+ end
85
+
86
+ desc "Send patch information to the puppet-dev list"
87
+ task :mail_patches do
88
+ if Dir.glob("00*.patch").length > 0
89
+ raise "Patches already exist matching '00*.patch'; clean up first"
90
+ end
91
+
92
+ unless %x{git status} =~ /On branch (.+)/
93
+ raise "Could not get branch from 'git status'"
94
+ end
95
+ branch = $1
96
+
97
+ unless branch =~ %r{^([^\/]+)/([^\/]+)/([^\/]+)$}
98
+ raise "Branch name does not follow <type>/<parent>/<name> model; cannot autodetect parent branch"
99
+ end
100
+
101
+ type, parent, name = $1, $2, $3
102
+
103
+ # Create all of the patches
104
+ sh "git format-patch -C -M -s -n --subject-prefix='PATCH/puppet' #{parent}..HEAD"
105
+
106
+ # And then mail them out.
107
+
108
+ # If we've got more than one patch, add --compose
109
+ if Dir.glob("00*.patch").length > 1
110
+ compose = "--compose"
111
+ else
112
+ compose = ""
113
+ end
114
+
115
+ # Now send the mail.
116
+ sh "git send-email #{compose} --no-signed-off-by-cc --suppress-from --to puppet-dev@googlegroups.com 00*.patch"
117
+
118
+ # Finally, clean up the patches
119
+ sh "rm 00*.patch"
120
+ end
121
+
@@ -0,0 +1,6 @@
1
+ begin
2
+ require 'metric_fu'
3
+ rescue LoadError
4
+ # Metric-fu not installed
5
+ # http://metric-fu.rubyforge.org/
6
+ end
@@ -0,0 +1,14 @@
1
+ desc "Sign to the package with the Reductive Labs release key"
2
+ task :sign_packages do
3
+
4
+ version = Puppet::PUPPETVERSION
5
+
6
+ # Sign package
7
+
8
+ sh "gpg --homedir $HOME/release_key --detach-sign --output pkg/puppet-#{version}.tar.gz.sign --armor pkg/puppet-#{version}.tar.gz"
9
+
10
+ # Sign gem
11
+
12
+ sh "gpg --homedir $HOME/release_key --detach-sign --output pkg/puppet-#{version}.gem.sign --armor pkg/puppet-#{version}.gem"
13
+
14
+ end
@@ -0,0 +1,16 @@
1
+ desc "Rebuild the 'testng' branch"
2
+ task :testbranch do
3
+ TEST_SERIES = %x{git config --get puppet.testseriesfile}.chomp
4
+
5
+ sh 'git checkout master'
6
+ if %x{git branch}.split("\n").detect { |l| l =~ /\s+testing$/ }
7
+ sh 'git branch -D testing'
8
+ end
9
+ sh 'git checkout -b testing'
10
+ File.readlines(TEST_SERIES).each do |line|
11
+ line.chomp!
12
+
13
+ # Always create a commit for our merge
14
+ sh "git merge --no-ff #{line}"
15
+ end
16
+ end