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

Markus Roberts Markus at reality.com
Wed Jul 14 10:36:18 UTC 2010


The following commit has been merged in the upstream branch:
commit 08b49c6f52452f6aec7d5345bce6c6e126454380
Author: Matt Robinson <matt at puppetlabs.com>
Date:   Thu Jul 1 14:18:03 2010 -0700

    [#4090] Fix the run_mode for certs and put tests on the applications to assert their run_mode
    
    Also cleanup of an unecessary puts line, make master tests run when
    on their own, and moving a require to a more usual spot.

diff --git a/lib/puppet.rb b/lib/puppet.rb
index 2e0066c..b5c4806 100644
--- a/lib/puppet.rb
+++ b/lib/puppet.rb
@@ -13,6 +13,7 @@ require 'puppet/util/autoload'
 require 'puppet/util/settings'
 require 'puppet/util/feature'
 require 'puppet/util/suidmanager'
+require 'puppet/util/run_mode'
 
 #------------------------------------------------------------
 # the top-level module
@@ -92,7 +93,6 @@ module Puppet
     end
 
     def self.run_mode
-        require 'puppet/util/run_mode'
         $puppet_application_mode || Puppet::Util::RunMode[:user]
     end
 
diff --git a/lib/puppet/application/cert.rb b/lib/puppet/application/cert.rb
index b368728..9625a7f 100644
--- a/lib/puppet/application/cert.rb
+++ b/lib/puppet/application/cert.rb
@@ -3,7 +3,7 @@ require 'puppet/application'
 class Puppet::Application::Cert < Puppet::Application
 
     should_parse_config
-    run_mode :server
+    run_mode :master
 
     attr_accessor :cert_mode, :all, :ca, :digest, :signed
 
@@ -51,7 +51,7 @@ class Puppet::Application::Cert < Puppet::Application
         elsif @signed
             hosts = :signed
         else
-            hosts = command_line.args.collect { |h| puts h; h.downcase }
+            hosts = command_line.args.collect { |h| h.downcase }
         end
         begin
             @ca.apply(:revoke, :to => hosts) if @cert_mode == :destroy
diff --git a/lib/puppet/util/run_mode.rb b/lib/puppet/util/run_mode.rb
index 029c1f9..fe9e07c 100644
--- a/lib/puppet/util/run_mode.rb
+++ b/lib/puppet/util/run_mode.rb
@@ -27,14 +27,14 @@ module Puppet
 
             def conf_dir
                 which_dir(
-                    (Puppet.features.win32? ? File.join(Dir::WINDOWS, "puppet", "etc") : "/etc/puppet"), 
+                    (Puppet.features.win32? ? File.join(Dir::WINDOWS, "puppet", "etc") : "/etc/puppet"),
                     "~/.puppet"
                 )
             end
 
             def var_dir
                 which_dir(
-                    (Puppet.features.win32? ? File.join(Dir::WINDOWS, "puppet", "var") : "/var/lib/puppet"), 
+                    (Puppet.features.win32? ? File.join(Dir::WINDOWS, "puppet", "var") : "/var/lib/puppet"),
                     "~/.puppet/var"
                 )
             end
diff --git a/spec/unit/application/agent_spec.rb b/spec/unit/application/agent_spec.rb
index 21f5143..edaf04b 100755
--- a/spec/unit/application/agent_spec.rb
+++ b/spec/unit/application/agent_spec.rb
@@ -49,6 +49,10 @@ describe Puppet::Application::Agent do
         Puppet::Node::Facts.stubs(:terminus_class=)
     end
 
+    it "should operate in agent run_mode" do
+        @puppetd.class.run_mode.name.should == :agent
+    end
+
     it "should ask Puppet::Application to parse Puppet configuration file" do
         @puppetd.should_parse_config?.should be_true
     end
diff --git a/spec/unit/application/cert_spec.rb b/spec/unit/application/cert_spec.rb
index 871c9d1..a72532e 100755
--- a/spec/unit/application/cert_spec.rb
+++ b/spec/unit/application/cert_spec.rb
@@ -11,6 +11,10 @@ describe Puppet::Application::Cert do
         Puppet::Util::Log.stubs(:level=)
     end
 
+    it "should operate in master run_mode" do
+        @cert_app.class.run_mode.name.should equal :master
+    end
+
     it "should ask Puppet::Application to parse Puppet configuration file" do
         @cert_app.should_parse_config?.should be_true
     end
@@ -59,7 +63,7 @@ describe Puppet::Application::Cert do
         @cert_app.handle_signed(0)
         @cert_app.signed.should be_true
     end
-    
+
     Puppet::SSL::CertificateAuthority::Interface::INTERFACE_METHODS.reject { |m| m == :destroy }.each do |method|
         it "should set cert_mode to #{method} with option --#{method}" do
             @cert_app.send("handle_#{method}".to_sym, nil)
diff --git a/spec/unit/application/master_spec.rb b/spec/unit/application/master_spec.rb
index c3f4d9e..419f63d 100644
--- a/spec/unit/application/master_spec.rb
+++ b/spec/unit/application/master_spec.rb
@@ -3,6 +3,8 @@
 require File.dirname(__FILE__) + '/../../spec_helper'
 
 require 'puppet/application/master'
+require 'puppet/daemon'
+require 'puppet/network/server'
 
 describe Puppet::Application::Master do
     before :each do
@@ -20,6 +22,10 @@ describe Puppet::Application::Master do
         Puppet::Resource::Catalog.stubs(:terminus_class=)
     end
 
+    it "should operate in master run_mode" do
+        @master.class.run_mode.name.should equal :master
+    end
+
     it "should ask Puppet::Application to parse Puppet configuration file" do
         @master.should_parse_config?.should be_true
     end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list