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

Jesse Wolfe jes5199 at gmail.com
Wed Jul 14 10:35:56 UTC 2010


The following commit has been merged in the upstream branch:
commit 255628e101e9da3ef4024c6e3b446e354b95b21d
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Wed Jun 30 16:06:23 2010 -0700

    [#3961] Rename cert's @mode to @cert_mode to reduce confusion

diff --git a/lib/puppet/application/cert.rb b/lib/puppet/application/cert.rb
index 219129b..68d1f78 100644
--- a/lib/puppet/application/cert.rb
+++ b/lib/puppet/application/cert.rb
@@ -5,17 +5,17 @@ class Puppet::Application::Cert < Puppet::Application
     should_parse_config
     mode :server
 
-    attr_accessor :mode, :all, :ca, :digest, :signed
+    attr_accessor :cert_mode, :all, :ca, :digest, :signed
 
     def find_mode(opt)
         require 'puppet/ssl/certificate_authority'
         modes = Puppet::SSL::CertificateAuthority::Interface::INTERFACE_METHODS
         tmp = opt.sub("--", '').to_sym
-        @mode = modes.include?(tmp) ? tmp : nil
+        @cert_mode = modes.include?(tmp) ? tmp : nil
     end
 
     option("--clean", "-c") do
-        @mode = :destroy
+        @cert_mode = :destroy
     end
 
     option("--all", "-a") do
@@ -54,8 +54,8 @@ class Puppet::Application::Cert < Puppet::Application
             hosts = command_line.args.collect { |h| puts h; h.downcase }
         end
         begin
-            @ca.apply(:revoke, :to => hosts) if @mode == :destroy
-            @ca.apply(@mode, :to => hosts, :digest => @digest)
+            @ca.apply(:revoke, :to => hosts) if @cert_mode == :destroy
+            @ca.apply(@cert_mode, :to => hosts, :digest => @digest)
         rescue => detail
             puts detail.backtrace if Puppet[:trace]
             puts detail.to_s
diff --git a/spec/unit/application/cert_spec.rb b/spec/unit/application/cert_spec.rb
old mode 100644
new mode 100755
index ba6ba1d..871c9d1
--- a/spec/unit/application/cert_spec.rb
+++ b/spec/unit/application/cert_spec.rb
@@ -45,9 +45,9 @@ describe Puppet::Application::Cert do
         @cert_app.digest.should == :digest
     end
 
-    it "should set mode to :destroy for --clean" do
+    it "should set cert_mode to :destroy for --clean" do
         @cert_app.handle_clean(0)
-        @cert_app.mode.should == :destroy
+        @cert_app.cert_mode.should == :destroy
     end
 
     it "should set all to true for --all" do
@@ -61,10 +61,10 @@ describe Puppet::Application::Cert do
     end
     
     Puppet::SSL::CertificateAuthority::Interface::INTERFACE_METHODS.reject { |m| m == :destroy }.each do |method|
-        it "should set mode to #{method} with option --#{method}" do
+        it "should set cert_mode to #{method} with option --#{method}" do
             @cert_app.send("handle_#{method}".to_sym, nil)
 
-            @cert_app.mode.should == method
+            @cert_app.cert_mode.should == method
         end
     end
 
@@ -127,7 +127,7 @@ describe Puppet::Application::Cert do
         it "should delegate with :all if option --all was given" do
             @cert_app.handle_all(0)
 
-            @ca.expects(:apply).with { |mode,to| to[:to] == :all }
+            @ca.expects(:apply).with { |cert_mode,to| to[:to] == :all }
 
             @cert_app.main
         end
@@ -135,7 +135,7 @@ describe Puppet::Application::Cert do
         it "should delegate to ca.apply with the hosts given on command line" do
             @cert_app.command_line.stubs(:args).returns(["host"])
 
-            @ca.expects(:apply).with { |mode,to| to[:to] == ["host"]}
+            @ca.expects(:apply).with { |cert_mode,to| to[:to] == ["host"]}
 
             @cert_app.main
         end
@@ -144,26 +144,26 @@ describe Puppet::Application::Cert do
             @cert_app.command_line.stubs(:args).returns(["host"])
             @cert_app.handle_digest(:digest)
 
-            @ca.expects(:apply).with { |mode,to| to[:digest] == :digest}
+            @ca.expects(:apply).with { |cert_mode,to| to[:digest] == :digest}
 
             @cert_app.main
         end
 
-        it "should delegate to ca.apply with current set mode" do
-            @cert_app.mode = "currentmode"
+        it "should delegate to ca.apply with current set cert_mode" do
+            @cert_app.cert_mode = "currentmode"
             @cert_app.command_line.stubs(:args).returns(["host"])
 
-            @ca.expects(:apply).with { |mode,to| mode == "currentmode" }
+            @ca.expects(:apply).with { |cert_mode,to| cert_mode == "currentmode" }
 
             @cert_app.main
         end
 
-        it "should revoke cert if mode is clean" do
-            @cert_app.mode = :destroy
+        it "should revoke cert if cert_mode is clean" do
+            @cert_app.cert_mode = :destroy
             @cert_app.command_line.stubs(:args).returns(["host"])
 
-            @ca.expects(:apply).with { |mode,to| mode == :revoke }
-            @ca.expects(:apply).with { |mode,to| mode == :destroy }
+            @ca.expects(:apply).with { |cert_mode,to| cert_mode == :revoke }
+            @ca.expects(:apply).with { |cert_mode,to| cert_mode == :destroy }
 
             @cert_app.main
         end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list