[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Max Martin
max at puppetlabs.com
Tue May 10 08:10:02 UTC 2011
The following commit has been merged in the experimental branch:
commit 11309a214148abb2167c1bd0adba0e035b2d8384
Merge: 9290b2f990fd4b267b2eb0da719b8f320484c4d7 9d17809e5b240aa80d2c30f4d9625d4812802b8f
Author: Max Martin <max at puppetlabs.com>
Date: Wed Mar 30 13:01:46 2011 -0700
Merge branch '2.6.x' into next
* 2.6.x:
(#5908) Add support for new update-rc.d disable API
(#6862) Add a default subject for the mail_patches rake task
Fixed #6256 - Creation of rrd directory.
diff --combined lib/puppet/application/master.rb
index 3bfad89,c5e9ada..78499a9
--- a/lib/puppet/application/master.rb
+++ b/lib/puppet/application/master.rb
@@@ -25,92 -25,6 +25,92 @@@ class Puppet::Application::Master < Pup
end
end
+ def help
+ <<-HELP
+
+puppet-master(8) -- The puppet master daemon
+========
+
+SYNOPSIS
+--------
+The central puppet server. Functions as a certificate authority by
+default.
+
+
+USAGE
+-----
+puppet master [-D|--daemonize|--no-daemonize] [-d|--debug] [-h|--help]
+ [-l|--logdest <file>|console|syslog] [-v|--verbose] [-V|--version]
+ [--compile <node-name>]
+
+
+DESCRIPTION
+-----------
+This command starts an instance of puppet master, running as a daemon
+and using Ruby's built-in Webrick webserver. Puppet master can also be
+managed by other application servers; when this is the case, this
+executable is not used.
+
+
+OPTIONS
+-------
+Note that any configuration parameter that's valid in the configuration
+file is also a valid long argument. For example, 'ssldir' is a valid
+configuration parameter, so you can specify '--ssldir <directory>' as an
+argument.
+
+See the configuration file documentation at
+http://docs.puppetlabs.com/references/stable/configuration.html for the
+full list of acceptable parameters. A commented list of all
+configuration options can also be generated by running puppet master
+with '--genconfig'.
+
+* --daemonize:
+ Send the process into the background. This is the default.
+
+* --no-daemonize:
+ Do not send the process into the background.
+
+* --debug:
+ Enable full debugging.
+
+* --help:
+ Print this help message.
+
+* --logdest:
+ Where to send messages. Choose between syslog, the console, and a log
+ file. Defaults to sending messages to syslog, or the console if
+ debugging or verbosity is enabled.
+
+* --verbose:
+ Enable verbosity.
+
+* --version:
+ Print the puppet version number and exit.
+
+* --compile:
+ Compile a catalogue and output it in JSON from the puppet master. Uses
+ facts contained in the $vardir/yaml/ directory to compile the catalog.
+
+
+EXAMPLE
+-------
+ puppet master
+
+
+AUTHOR
+------
+Luke Kanies
+
+
+COPYRIGHT
+---------
+Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public
+License
+
+ HELP
+ end
+
def preinit
Signal.trap(:INT) do
$stderr.puts "Cancelling startup"
@@@ -137,7 -51,7 +137,7 @@@
Puppet::Util::Log.newdestination :console
raise ArgumentError, "Cannot render compiled catalogs without pson support" unless Puppet.features.pson?
begin
- unless catalog = Puppet::Resource::Catalog.find(options[:node])
+ unless catalog = Puppet::Resource::Catalog.indirection.find(options[:node])
raise "Could not compile catalog for #{options[:node]}"
end
@@@ -222,10 -136,10 +222,10 @@@
exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs?
- Puppet.settings.use :main, :master, :ssl
+ Puppet.settings.use :main, :master, :ssl, :metrics
# Cache our nodes in yaml. Currently not configurable.
- Puppet::Node.cache_class = :yaml
+ Puppet::Node.indirection.cache_class = :yaml
# Configure all of the SSL stuff.
if Puppet::SSL::CertificateAuthority.ca?
diff --combined lib/puppet/defaults.rb
index f308d44,36159bc..989ef3f
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@@ -120,12 -120,12 +120,12 @@@ module Puppe
:catalog_terminus => ["compiler", "Where to get node catalogs. This is useful to change if, for instance,
you'd like to pre-compile catalogs and store them in memcached or some other easily-accessed store."],
:facts_terminus => {
- :default => Puppet.application_name.to_s == "master" ? 'yaml' : 'facter',
+ :default => Puppet.application_name.to_s == "master" ? 'yaml' : 'facter',
:desc => "The node facts terminus.",
:hook => proc do |value|
require 'puppet/node/facts'
if value.to_s == "rest"
- Puppet::Node::Facts.cache_class = :yaml
+ Puppet::Node::Facts.indirection.cache_class = :yaml
end
end
},
@@@ -156,7 -156,7 +156,7 @@@
Puppet.settings[:storeconfigs] = true
# But then we modify the configuration
- Puppet::Resource::Catalog.cache_class = :queue
+ Puppet::Resource::Catalog.indirection.cache_class = :queue
else
raise "Cannot disable asynchronous storeconfigs in a running process"
end
@@@ -474,6 -474,7 +474,7 @@@
setdefaults(:metrics,
:rrddir => {:default => "$vardir/rrd",
+ :mode => 0750,
:owner => "service",
:group => "service",
:desc => "The directory where RRD database files are stored.
@@@ -603,17 -604,9 +604,17 @@@
:inventory_port => ["$masterport",
"The port to communicate with the inventory_server."
],
- :report => [false,
+ :report => [true,
"Whether to send reports after every transaction."
],
+ :lastrunfile => { :default => "$statedir/last_run_summary.yaml",
+ :mode => 0660,
+ :desc => "Where puppet agent stores the last run report summary in yaml format."
+ },
+ :lastrunreport => { :default => "$statedir/last_run_report.yaml",
+ :mode => 0660,
+ :desc => "Where puppet agent stores the last run report in yaml format."
+ },
:graph => [false, "Whether to create dot graph files for the different
configuration graphs. These dot files can be interpreted by tools
like OmniGraffle or dot (which is part of ImageMagick)."],
@@@ -803,9 -796,9 +804,9 @@@
if value
require 'puppet/rails'
raise "StoreConfigs not supported without ActiveRecord 2.1 or higher" unless Puppet.features.rails?
- Puppet::Resource::Catalog.cache_class = :active_record unless Puppet.settings[:async_storeconfigs]
- Puppet::Node::Facts.cache_class = :active_record
- Puppet::Node.cache_class = :active_record
+ Puppet::Resource::Catalog.indirection.cache_class = :active_record unless Puppet.settings[:async_storeconfigs]
+ Puppet::Node::Facts.indirection.cache_class = :active_record
+ Puppet::Node.indirection.cache_class = :active_record
end
end
}
@@@ -822,8 -815,4 +823,8 @@@
directories."
]
)
+ setdefaults(
+ :puppetdoc,
+ :document_all => [false, "Document all resources"]
+ )
end
diff --combined spec/unit/application/master_spec.rb
index 1173752,d99b22d..14478a6
--- a/spec/unit/application/master_spec.rb
+++ b/spec/unit/application/master_spec.rb
@@@ -1,6 -1,6 +1,6 @@@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../spec_helper'
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require 'puppet/application/master'
require 'puppet/daemon'
@@@ -14,13 -14,12 +14,13 @@@ describe Puppet::Application::Master d
Puppet::Util::Log.stubs(:newdestination)
Puppet::Util::Log.stubs(:level=)
- Puppet::Node.stubs(:terminus_class=)
- Puppet::Node.stubs(:cache_class=)
- Puppet::Node::Facts.stubs(:terminus_class=)
- Puppet::Node::Facts.stubs(:cache_class=)
- Puppet::Transaction::Report.stubs(:terminus_class=)
- Puppet::Resource::Catalog.stubs(:terminus_class=)
+ Puppet::Node.indirection.stubs(:terminus_class=)
+ Puppet::Node.indirection.stubs(:cache_class=)
+ Puppet::Node::Facts.indirection.stubs(:terminus_class=)
+ Puppet::Node::Facts.indirection.stubs(:cache_class=)
+ Puppet::Transaction::Report.indirection.stubs(:terminus_class=)
+ Puppet::Resource::Catalog.indirection.stubs(:terminus_class=)
+ Puppet::SSL::Host.stubs(:ca_location=)
end
it "should operate in master run_mode" do
@@@ -177,14 -176,14 +177,14 @@@
lambda { @master.setup }.should raise_error(SystemExit)
end
- it "should tell Puppet.settings to use :main,:ssl and :master category" do
- Puppet.settings.expects(:use).with(:main,:master,:ssl)
+ it "should tell Puppet.settings to use :main,:ssl,:master and :metrics category" do
+ Puppet.settings.expects(:use).with(:main,:master,:ssl,:metrics)
@master.setup
end
it "should cache class in yaml" do
- Puppet::Node.expects(:cache_class=).with(:yaml)
+ Puppet::Node.indirection.expects(:cache_class=).with(:yaml)
@master.setup
end
@@@ -258,15 -257,16 +258,15 @@@
describe "the parseonly command" do
before :each do
- Puppet.stubs(:[]).with(:environment)
+ @environment = Puppet::Node::Environment.new("env")
+ Puppet.stubs(:[]).with(:environment).returns(@environment)
Puppet.stubs(:[]).with(:manifest).returns("site.pp")
Puppet.stubs(:err)
@master.stubs(:exit)
end
it "should use a Puppet Resource Type Collection to parse the file" do
- @collection.expects(:perform_initial_import)
+ @environment.expects(:perform_initial_import)
@master.parseonly
end
@@@ -276,7 -276,7 +276,7 @@@
end
it "should exit with exit code 1 if error" do
- @collection.stubs(:perform_initial_import).raises(Puppet::ParseError)
+ @environment.stubs(:perform_initial_import).raises(Puppet::ParseError)
@master.expects(:exit).with(1)
@master.parseonly
end
@@@ -299,7 -299,7 +299,7 @@@
it "should compile a catalog for the specified node" do
@master.options[:node] = "foo"
- Puppet::Resource::Catalog.expects(:find).with("foo").returns Puppet::Resource::Catalog.new
+ Puppet::Resource::Catalog.indirection.expects(:find).with("foo").returns Puppet::Resource::Catalog.new
$stdout.stubs(:puts)
@master.compile
@@@ -307,7 -307,7 +307,7 @@@
it "should convert the catalog to a pure-resource catalog and use 'jj' to pretty-print the catalog" do
catalog = Puppet::Resource::Catalog.new
- Puppet::Resource::Catalog.expects(:find).returns catalog
+ Puppet::Resource::Catalog.indirection.expects(:find).returns catalog
catalog.expects(:to_resource).returns("rescat")
@@@ -319,7 -319,7 +319,7 @@@
it "should exit with error code 30 if no catalog can be found" do
@master.options[:node] = "foo"
- Puppet::Resource::Catalog.expects(:find).returns nil
+ Puppet::Resource::Catalog.indirection.expects(:find).returns nil
@master.expects(:exit).with(30)
$stderr.expects(:puts)
@@@ -328,7 -328,7 +328,7 @@@
it "should exit with error code 30 if there's a failure" do
@master.options[:node] = "foo"
- Puppet::Resource::Catalog.expects(:find).raises ArgumentError
+ Puppet::Resource::Catalog.indirection.expects(:find).raises ArgumentError
@master.expects(:exit).with(30)
$stderr.expects(:puts)
diff --combined spec/unit/provider/service/debian_spec.rb
index 8c9522d,440d449..b5edf68
--- a/spec/unit/provider/service/debian_spec.rb
+++ b/spec/unit/provider/service/debian_spec.rb
@@@ -3,7 -3,7 +3,7 @@@
# Unit testing for the debian service provider
#
-require File.dirname(__FILE__) + '/../../../spec_helper'
+require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
provider_class = Puppet::Type.type(:service).provider(:debian)
@@@ -52,8 -52,20 +52,20 @@@ describe provider_class d
end
describe "when disabling" do
- it "should call update-rc.d twice" do
- @provider.expects(:update_rc).twice
+ it "should be able to disable services with newer sysv-rc versions" do
+ @provider.stubs(:`).with("dpkg --compare-versions $(dpkg-query -W --showformat '${Version}' sysv-rc) ge 2.88 ; echo $?").returns "0"
+
+ @provider.expects(:update_rc).with(@resource[:name], "disable")
+
+ @provider.disable
+ end
+
+ it "should be able to enable services with older sysv-rc versions" do
+ @provider.stubs(:`).with("dpkg --compare-versions $(dpkg-query -W --showformat '${Version}' sysv-rc) ge 2.88 ; echo $?").returns "1"
+
+ @provider.expects(:update_rc).with("-f", @resource[:name], "remove")
+ @provider.expects(:update_rc).with(@resource[:name], "stop", "00", "1", "2", "3", "4", "5", "6", ".")
+
@provider.disable
end
end
diff --combined tasks/rake/git_workflow.rake
index 75dc883,f2ae7ee..56a4145
--- a/tasks/rake/git_workflow.rake
+++ b/tasks/rake/git_workflow.rake
@@@ -5,82 -5,82 +5,82 @@@
def find_start(start)
# This is a case statement, as we might want to map certain
# git tags to starting points that are not currently in git.
- case start
- when nil?:
- when @next_release: return "master"
- else return start
- end
+ case start
+ when nil?;
+ when @next_release; return "master"
+ else return start
+ end
end
desc "Set up git for working with Puppet"
task :git_setup do
- # This should be changed as new versions get released
- @next_release = '0.26.x'
- @remote = {}
- default_remote = {}
- default_remote[:url] = 'git://github.com/reductivelabs/puppet'
- default_remote[:name] = 'origin'
- @remote[:name] = %x{git config puppet.defaultremote}.chomp
- @remote[:name] = @remote[:name].empty? ? default_remote[:name] : @remote[:name]
- @remote[:url] = default_remote[:url] if @remote[:name] == default_remote[:name]
- default_fetch = '+refs/heads/*:refs/remotes/puppet/*'
- @remote[:fetch] = %x{git config puppet.#{@remote[:name]}.fetch}.chomp
- @remote[:fetch] = @remote[:fetch].empty? ? default_fetch : @remote[:fetch]
+ # This should be changed as new versions get released
+ @next_release = '0.26.x'
+ @remote = {}
+ default_remote = {}
+ default_remote[:url] = 'git://github.com/reductivelabs/puppet'
+ default_remote[:name] = 'origin'
+ @remote[:name] = %x{git config puppet.defaultremote}.chomp
+ @remote[:name] = @remote[:name].empty? ? default_remote[:name] : @remote[:name]
+ @remote[:url] = default_remote[:url] if @remote[:name] == default_remote[:name]
+ default_fetch = '+refs/heads/*:refs/remotes/puppet/*'
+ @remote[:fetch] = %x{git config puppet.#{@remote[:name]}.fetch}.chomp
+ @remote[:fetch] = @remote[:fetch].empty? ? default_fetch : @remote[:fetch]
end
desc "Start work on a feature"
task :start_feature, [:feature,:remote,:branch] => :git_setup do |t, args|
- args.with_defaults(:remote => @remote[:name])
- args.with_defaults(:branch => @next_release)
- start_at = find_start(args.branch)
- branch = "feature/#{start_at}/#{args.feature}"
- sh "git checkout -b #{branch} #{start_at}" do |ok, res|
- if ! ok
- raise <<EOS
+ args.with_defaults(:remote => @remote[:name])
+ args.with_defaults(:branch => @next_release)
+ start_at = find_start(args.branch)
+ branch = "feature/#{start_at}/#{args.feature}"
+ sh "git checkout -b #{branch} #{start_at}" do |ok, res|
+ if ! ok
+ raise <<EOS
Was not able to create branch for #{args.feature} on branch #{args.branch}, starting at #{start_at}: error code was: #{res.exitstatus}
EOS
- end
- end
- sh "git config branch.#{branch}.remote #{args.remote}" do |ok, res|
- raise "Could not set remote: #{$?}" unless ok
- end
-
- sh "git config branch.#{branch}.merge refs/heads/#{branch}" do |ok, res|
- raise "Could not configure merge: #{$?}" unless ok
- end
+ end
+ end
+ sh "git config branch.#{branch}.remote #{args.remote}" do |ok, res|
+ raise "Could not set remote: #{$?}" unless ok
+ end
+
+ sh "git config branch.#{branch}.merge refs/heads/#{branch}" do |ok, res|
+ raise "Could not configure merge: #{$?}" unless ok
+ end
end
desc "Do git prep to start work on a Redmine ticket"
task :start_ticket, [:ticket, :remote, :branch] => :git_setup do |t, args|
- args.with_defaults(:remote => @remote[:name])
- args.with_defaults(:branch => @next_release)
- start_at = find_start(args.branch)
- branch = "tickets/#{start_at}/#{args.ticket}"
- sh "git checkout -b #{branch} #{start_at}" do |ok, res|
- unless ok
- raise <<EOS
+ args.with_defaults(:remote => @remote[:name])
+ args.with_defaults(:branch => @next_release)
+ start_at = find_start(args.branch)
+ branch = "tickets/#{start_at}/#{args.ticket}"
+ sh "git checkout -b #{branch} #{start_at}" do |ok, res|
+ unless ok
+ raise <<EOS
Was not able to create branch for ticket #{args.ticket} on branch #{args.branch}, starting at #{start_at}: error code was: #{$?}
Git command used was: #{command}
EOS
- end
- end
+ end
+ end
sh "git config branch.#{branch}.remote #{args.remote}" do |ok, res|
- raise "Could not set remote: #{$?}" unless ok
- end
+ raise "Could not set remote: #{$?}" unless ok
+ end
sh "git config branch.#{branch}.merge refs/heads/#{branch}" do |ok, res|
- raise "Could not configure merge: #{$?}" unless ok
- end
+ raise "Could not configure merge: #{$?}" unless ok
+ end
end
# This isn't very useful by itself, but we might enhance it later, or use it
# in a dependency for a more complex task.
desc "Push out changes"
task :push_changes, [:remote] do |t, arg|
- branch = %x{git branch | grep "^" | awk '{print $2}'}
- sh "git push #{arg.remote} #{branch}" do |ok, res|
- raise "Unable to push to #{arg.remote}" unless ok
- end
+ branch = %x{git branch | grep "^" | awk '{print $2}'}
+ sh "git push #{arg.remote} #{branch}" do |ok, res|
+ raise "Unable to push to #{arg.remote}" unless ok
+ end
end
desc "Send patch information to the puppet-dev list"
@@@ -103,28 -103,19 +103,30 @@@ task :mail_patches d
# Create all of the patches
sh "git format-patch -C -M -s -n --subject-prefix='PATCH/puppet' #{parent}..HEAD"
+ # Add info to the patches
+ additional_info = "Local-branch: #{branch}\n"
+ files = Dir.glob("00*.patch")
+ files.each do |file|
+ contents = File.read(file)
+ contents.sub!(/^---\n/, "---\n#{additional_info}")
+ File.open(file, 'w') do |file_handle|
+ file_handle.print contents
+ end
+ end
+
# And then mail them out.
# If we've got more than one patch, add --compose
- if Dir.glob("00*.patch").length > 1
+ if files.length > 1
compose = "--compose"
+ subject = "--subject \"#{type} #{name} against #{parent}\""
else
compose = ""
+ subject = ""
end
# Now send the mail.
- sh "git send-email #{compose} --no-signed-off-by-cc --suppress-from --to puppet-dev at googlegroups.com 00*.patch"
+ sh "git send-email #{compose} #{subject} --no-signed-off-by-cc --suppress-from --to puppet-dev at googlegroups.com 00*.patch"
# Finally, clean up the patches
sh "rm 00*.patch"
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list