[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:33:14 UTC 2010


The following commit has been merged in the upstream branch:
commit f9783fcdee928c80339b2b1567350b2450e1ea05
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Mon Apr 19 17:37:51 2010 -0700

    feature #2276 Single Executable: "puppet master"
    
    Add "puppet master" as the new invocation of "puppetmasterd"
    
    Signed-off-by: Jesse Wolfe <jes5199 at gmail.com>

diff --git a/lib/puppet/application/server.rb b/lib/puppet/application/master.rb
similarity index 97%
rename from lib/puppet/application/server.rb
rename to lib/puppet/application/master.rb
index 7aeb6ad..8f1c0cd 100644
--- a/lib/puppet/application/server.rb
+++ b/lib/puppet/application/master.rb
@@ -4,7 +4,7 @@ require 'puppet/daemon'
 require 'puppet/network/server'
 require 'puppet/network/http/rack' if Puppet.features.rack?
 
-Puppet::Application.new(:server) do
+Puppet::Application.new(:master) do
 
     should_parse_config
 
@@ -115,7 +115,7 @@ Puppet::Application.new(:server) do
             @app = Puppet::Network::HTTP::Rack.new(:xmlrpc_handlers => xmlrpc_handlers, :protocols => [:rest, :xmlrpc])
         end
 
-        Puppet.notice "Starting Puppet server version %s" % [Puppet.version]
+        Puppet.notice "Starting Puppet master version %s" % [Puppet.version]
 
         unless options[:rack]
             @daemon.start
diff --git a/sbin/puppetmasterd b/sbin/puppetmasterd
index c38c648..454703b 100755
--- a/sbin/puppetmasterd
+++ b/sbin/puppetmasterd
@@ -62,5 +62,5 @@
 # Copyright (c) 2005 Reductive Labs, LLC
 # Licensed under the GNU Public License
 
-require 'puppet/application/server'
-Puppet::Application[:server].run
+require 'puppet/application/master'
+Puppet::Application[:master].run
diff --git a/spec/unit/application/server.rb b/spec/unit/application/master.rb
similarity index 73%
rename from spec/unit/application/server.rb
rename to spec/unit/application/master.rb
index b300e94..b3c1a72 100644
--- a/spec/unit/application/server.rb
+++ b/spec/unit/application/master.rb
@@ -2,11 +2,11 @@
 
 require File.dirname(__FILE__) + '/../../spec_helper'
 
-require 'puppet/application/server'
+require 'puppet/application/master'
 
 describe "PuppetMaster" do
     before :each do
-        @server_app = Puppet::Application[:server]
+        @master = Puppet::Application[:master]
         @daemon = stub_everything 'daemon'
         Puppet::Daemon.stubs(:new).returns(@daemon)
         Puppet::Util::Log.stubs(:newdestination)
@@ -21,40 +21,40 @@ describe "PuppetMaster" do
     end
 
     it "should ask Puppet::Application to parse Puppet configuration file" do
-        @server_app.should_parse_config?.should be_true
+        @master.should_parse_config?.should be_true
     end
 
     it "should declare a main command" do
-        @server_app.should respond_to(:main)
+        @master.should respond_to(:main)
     end
 
     it "should declare a parseonly command" do
-        @server_app.should respond_to(:parseonly)
+        @master.should respond_to(:parseonly)
     end
 
     it "should declare a compile command" do
-        @server_app.should respond_to(:compile)
+        @master.should respond_to(:compile)
     end
 
     it "should declare a preinit block" do
-        @server_app.should respond_to(:run_preinit)
+        @master.should respond_to(:run_preinit)
     end
 
     describe "during preinit" do
         before :each do
-            @server_app.stubs(:trap)
+            @master.stubs(:trap)
         end
 
         it "should catch INT" do
-            @server_app.stubs(:trap).with { |arg,block| arg == :INT }
+            @master.stubs(:trap).with { |arg,block| arg == :INT }
 
-            @server_app.run_preinit
+            @master.run_preinit
         end
 
         it "should create a Puppet Daemon" do
             Puppet::Daemon.expects(:new).returns(@daemon)
 
-            @server_app.run_preinit
+            @master.run_preinit
         end
 
         it "should give ARGV to the Daemon" do
@@ -62,19 +62,19 @@ describe "PuppetMaster" do
             ARGV.stubs(:dup).returns(argv)
             @daemon.expects(:argv=).with(argv)
 
-            @server_app.run_preinit
+            @master.run_preinit
         end
 
     end
 
     [:debug,:verbose].each do |option|
         it "should declare handle_#{option} method" do
-            @server_app.should respond_to("handle_#{option}".to_sym)
+            @master.should respond_to("handle_#{option}".to_sym)
         end
 
         it "should store argument value when calling handle_#{option}" do
-            @server_app.options.expects(:[]=).with(option, 'arg')
-            @server_app.send("handle_#{option}".to_sym, 'arg')
+            @master.options.expects(:[]=).with(option, 'arg')
+            @master.send("handle_#{option}".to_sym, 'arg')
         end
     end
 
@@ -92,13 +92,13 @@ describe "PuppetMaster" do
         it "should set the log destination with --logdest" do
             Puppet::Log.expects(:newdestination).with("console")
 
-            @server_app.handle_logdest("console")
+            @master.handle_logdest("console")
         end
 
         it "should put the setdest options to true" do
-            @server_app.options.expects(:[]=).with(:setdest,true)
+            @master.options.expects(:[]=).with(:setdest,true)
 
-            @server_app.handle_logdest("console")
+            @master.handle_logdest("console")
         end
 
         it "should parse the log destination from ARGV" do
@@ -106,7 +106,7 @@ describe "PuppetMaster" do
 
             Puppet::Util::Log.expects(:newdestination).with("/my/file")
 
-            @server_app.parse_options
+            @master.parse_options
         end
     end
 
@@ -120,78 +120,78 @@ describe "PuppetMaster" do
             Puppet::SSL::CertificateAuthority.stubs(:ca?)
             Puppet.settings.stubs(:use)
 
-            @server_app.options.stubs(:[]).with(any_parameters)
+            @master.options.stubs(:[]).with(any_parameters)
         end
 
         it "should set log level to debug if --debug was passed" do
-            @server_app.options.stubs(:[]).with(:debug).returns(true)
+            @master.options.stubs(:[]).with(:debug).returns(true)
 
             Puppet::Log.expects(:level=).with(:debug)
 
-            @server_app.run_setup
+            @master.run_setup
         end
 
         it "should set log level to info if --verbose was passed" do
-            @server_app.options.stubs(:[]).with(:verbose).returns(true)
+            @master.options.stubs(:[]).with(:verbose).returns(true)
 
             Puppet::Log.expects(:level=).with(:info)
 
-            @server_app.run_setup
+            @master.run_setup
         end
 
         it "should set console as the log destination if no --logdest and --daemonize" do
-            @server_app.stubs(:[]).with(:daemonize).returns(:false)
+            @master.stubs(:[]).with(:daemonize).returns(:false)
 
             Puppet::Log.expects(:newdestination).with(:syslog)
 
-            @server_app.run_setup
+            @master.run_setup
         end
 
         it "should set syslog as the log destination if no --logdest and not --daemonize" do
             Puppet::Log.expects(:newdestination).with(:syslog)
 
-            @server_app.run_setup
+            @master.run_setup
         end
 
         it "should set syslog as the log destination if --rack" do
-            @server_app.options.stubs(:[]).with(:rack).returns(:true)
+            @master.options.stubs(:[]).with(:rack).returns(:true)
 
             Puppet::Log.expects(:newdestination).with(:syslog)
 
-            @server_app.run_setup
+            @master.run_setup
         end
 
         it "should print puppet config if asked to in Puppet config" do
-            @server_app.stubs(:exit)
+            @master.stubs(:exit)
             Puppet.settings.stubs(:print_configs?).returns(true)
 
             Puppet.settings.expects(:print_configs)
 
-            @server_app.run_setup
+            @master.run_setup
         end
 
         it "should exit after printing puppet config if asked to in Puppet config" do
             Puppet.settings.stubs(:print_configs?).returns(true)
 
-            lambda { @server_app.run_setup }.should raise_error(SystemExit)
+            lambda { @master.run_setup }.should raise_error(SystemExit)
         end
 
-        it "should tell Puppet.settings to use :main,:ssl and :server_app category" do
+        it "should tell Puppet.settings to use :main,:ssl and :puppetmasterd category" do
             Puppet.settings.expects(:use).with(:main,:puppetmasterd,:ssl)
 
-            @server_app.run_setup
+            @master.run_setup
         end
 
         it "should set node facst terminus to yaml" do
             Puppet::Node::Facts.expects(:terminus_class=).with(:yaml)
 
-            @server_app.run_setup
+            @master.run_setup
         end
 
         it "should cache class in yaml" do
             Puppet::Node.expects(:cache_class=).with(:yaml)
 
-            @server_app.run_setup
+            @master.run_setup
         end
 
         describe "with no ca" do
@@ -199,7 +199,7 @@ describe "PuppetMaster" do
             it "should set the ca_location to none" do
                 Puppet::SSL::Host.expects(:ca_location=).with(:none)
 
-                @server_app.run_setup
+                @master.run_setup
             end
 
         end
@@ -213,19 +213,19 @@ describe "PuppetMaster" do
             it "should set the ca_location to local" do
                 Puppet::SSL::Host.expects(:ca_location=).with(:local)
 
-                @server_app.run_setup
+                @master.run_setup
             end
 
             it "should tell Puppet.settings to use :ca category" do
                 Puppet.settings.expects(:use).with(:ca)
 
-                @server_app.run_setup
+                @master.run_setup
             end
 
             it "should instantiate the CertificateAuthority singleton" do
                 Puppet::SSL::CertificateAuthority.expects(:instance)
 
-                @server_app.run_setup
+                @master.run_setup
             end
 
 
@@ -237,21 +237,21 @@ describe "PuppetMaster" do
 
         it "should dispatch to parseonly if parseonly is set" do
             Puppet.stubs(:[]).with(:parseonly).returns(true)
-            @server_app.options[:node] = nil
+            @master.options[:node] = nil
 
-            @server_app.get_command.should == :parseonly
+            @master.get_command.should == :parseonly
         end
 
         it "should dispatch to compile if called with --compile" do
-            @server_app.options[:node] = "foo"
-            @server_app.get_command.should == :compile
+            @master.options[:node] = "foo"
+            @master.get_command.should == :compile
         end
 
         it "should dispatch to main if parseonly is not set" do
             Puppet.stubs(:[]).with(:parseonly).returns(false)
-            @server_app.options[:node] = nil
+            @master.options[:node] = nil
 
-            @server_app.get_command.should == :main
+            @master.get_command.should == :main
         end
 
 
@@ -260,25 +260,25 @@ describe "PuppetMaster" do
                 Puppet.stubs(:[]).with(:environment)
                 Puppet.stubs(:[]).with(:manifest).returns("site.pp")
                 Puppet.stubs(:err)
-                @server_app.stubs(:exit)
+                @master.stubs(:exit)
                 @collection = stub_everything
                 Puppet::Resource::TypeCollection.stubs(:new).returns(@collection)
             end
 
             it "should use a Puppet Resource Type Collection to parse the file" do
                 @collection.expects(:perform_initial_import)
-                @server_app.parseonly
+                @master.parseonly
             end
 
             it "should exit with exit code 0 if no error" do
-                @server_app.expects(:exit).with(0)
-                @server_app.parseonly
+                @master.expects(:exit).with(0)
+                @master.parseonly
             end
 
             it "should exit with exit code 1 if error" do
                 @collection.stubs(:perform_initial_import).raises(Puppet::ParseError)
-                @server_app.expects(:exit).with(1)
-                @server_app.parseonly
+                @master.expects(:exit).with(1)
+                @master.parseonly
             end
         end
 
@@ -287,55 +287,55 @@ describe "PuppetMaster" do
                 Puppet.stubs(:[]).with(:environment)
                 Puppet.stubs(:[]).with(:manifest).returns("site.pp")
                 Puppet.stubs(:err)
-                @server_app.stubs(:exit)
+                @master.stubs(:exit)
                 Puppet.features.stubs(:pson?).returns true
             end
 
             it "should fail if pson isn't available" do
                 Puppet.features.expects(:pson?).returns false
-                lambda { @server_app.compile }.should raise_error
+                lambda { @master.compile }.should raise_error
             end
 
             it "should compile a catalog for the specified node" do
-                @server_app.options[:node] = "foo"
+                @master.options[:node] = "foo"
                 Puppet::Resource::Catalog.expects(:find).with("foo").returns Puppet::Resource::Catalog.new
                 $stdout.stubs(:puts)
 
-                @server_app.compile
+                @master.compile
             end
 
             it "should render the catalog to pson and print the output" do
-                @server_app.options[:node] = "foo"
+                @master.options[:node] = "foo"
                 catalog = Puppet::Resource::Catalog.new
                 catalog.expects(:render).with(:pson).returns "mypson"
                 Puppet::Resource::Catalog.expects(:find).returns catalog
 
                 $stdout.expects(:puts).with("mypson")
-                @server_app.compile
+                @master.compile
             end
 
             it "should exit with error code 30 if no catalog can be found" do
-                @server_app.options[:node] = "foo"
+                @master.options[:node] = "foo"
                 Puppet::Resource::Catalog.expects(:find).returns nil
-                @server_app.expects(:exit).with(30)
+                @master.expects(:exit).with(30)
                 $stderr.expects(:puts)
 
-                @server_app.compile
+                @master.compile
             end
 
             it "should exit with error code 30 if there's a failure" do
-                @server_app.options[:node] = "foo"
+                @master.options[:node] = "foo"
                 Puppet::Resource::Catalog.expects(:find).raises ArgumentError
-                @server_app.expects(:exit).with(30)
+                @master.expects(:exit).with(30)
                 $stderr.expects(:puts)
 
-                @server_app.compile
+                @master.compile
             end
         end
 
         describe "the main command" do
             before :each do
-                @server_app.run_preinit
+                @master.run_preinit
                 @server = stub_everything 'server'
                 Puppet::Network::Server.stubs(:new).returns(@server)
                 @app = stub_everything 'app'
@@ -351,32 +351,32 @@ describe "PuppetMaster" do
             it "should create a Server" do
                 Puppet::Network::Server.expects(:new)
 
-                @server_app.main
+                @master.main
             end
 
             it "should give the server to the daemon" do
                 @daemon.expects(:server=).with(@server)
 
-                @server_app.main
+                @master.main
             end
 
             it "should create the server with the right XMLRPC handlers" do
                 Puppet::Network::Server.expects(:new).with { |args| args[:xmlrpc_handlers] == [:Status, :FileServer, :Master, :Report, :Filebucket]}
 
-                @server_app.main
+                @master.main
             end
 
             it "should create the server with a :ca xmlrpc handler if needed" do
                 Puppet.stubs(:[]).with(:ca).returns(true)
                 Puppet::Network::Server.expects(:new).with { |args| args[:xmlrpc_handlers].include?(:CA) }
 
-                @server_app.main
+                @master.main
             end
 
             it "should generate a SSL cert for localhost" do
                 Puppet::SSL::Host.expects(:localhost)
 
-                @server_app.main
+                @master.main
             end
 
             it "should make sure to *only* hit the CA for data" do
@@ -384,7 +384,7 @@ describe "PuppetMaster" do
 
                 Puppet::SSL::Host.expects(:ca_location=).with(:only)
 
-                @server_app.main
+                @master.main
             end
 
             it "should drop privileges if running as root" do
@@ -392,7 +392,7 @@ describe "PuppetMaster" do
 
                 Puppet::Util.expects(:chuser)
 
-                @server_app.main
+                @master.main
             end
 
             it "should daemonize if needed" do
@@ -400,13 +400,13 @@ describe "PuppetMaster" do
 
                 @daemon.expects(:daemonize)
 
-                @server_app.main
+                @master.main
             end
 
             it "should start the service" do
                 @daemon.expects(:start)
 
-                @server_app.main
+                @master.main
             end
 
             describe "with --rack" do
@@ -418,28 +418,28 @@ describe "PuppetMaster" do
                 end
 
                 it "it should create the app with REST and XMLRPC support" do
-                    @server_app.options.stubs(:[]).with(:rack).returns(:true)
+                    @master.options.stubs(:[]).with(:rack).returns(:true)
 
                     Puppet::Network::HTTP::Rack.expects(:new).with { |args|
                         args[:xmlrpc_handlers] == [:Status, :FileServer, :Master, :Report, :Filebucket] and
                         args[:protocols] == [:rest, :xmlrpc]
                     }
 
-                    @server_app.main
+                    @master.main
                 end
 
                 it "it should not start a daemon" do
-                    @server_app.options.stubs(:[]).with(:rack).returns(:true)
+                    @master.options.stubs(:[]).with(:rack).returns(:true)
 
                     @daemon.expects(:start).never
 
-                    @server_app.main
+                    @master.main
                 end
 
                 it "it should return the app" do
-                    @server_app.options.stubs(:[]).with(:rack).returns(:true)
+                    @master.options.stubs(:[]).with(:rack).returns(:true)
 
-                    app = @server_app.main
+                    app = @master.main
                     app.should equal(@app)
                 end
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list