[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Jesse Wolfe jes5199 at gmail.com
Tue May 10 07:58:57 UTC 2011


The following commit has been merged in the experimental branch:
commit fb9034731ddae41f1009745eb8eb1ea53aa05cfb
Merge: 16f701edd89a320ad73b5468d883dfb017fe6e96 8be1929043f4560bb17a4b06293b3f9a4efcfdbf
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Fri Aug 27 12:33:15 2010 -0700

    Merge commit '2.6.1rc3' into next

diff --combined lib/puppet/resource/type.rb
index 57ccba5,f6d3785..b71eb55
--- a/lib/puppet/resource/type.rb
+++ b/lib/puppet/resource/type.rb
@@@ -13,8 -13,8 +13,8 @@@ class Puppet::Resource::Typ
  
    RESOURCE_SUPERTYPES = [:hostclass, :node, :definition]
  
 -  attr_accessor :file, :line, :doc, :code, :ruby_code, :parent, :resource_type_collection, :module_name
 -  attr_reader :type, :namespace, :arguments, :behaves_like
 +  attr_accessor :file, :line, :doc, :code, :ruby_code, :parent, :resource_type_collection
 +  attr_reader :type, :namespace, :arguments, :behaves_like, :module_name
  
    RESOURCE_SUPERTYPES.each do |t|
      define_method("#{t}?") { self.type == t }
@@@ -69,6 -69,7 +69,7 @@@
      end
  
      scope = subscope(scope, resource) unless resource.title == :main
+     scope.compiler.add_class(name) unless definition?
  
      set_resource_parameters(resource, scope)
  
@@@ -91,8 -92,6 +92,8 @@@
      end
  
      set_arguments(options[:arguments])
 +
 +    @module_name = options[:module_name]
    end
  
    # This is only used for node names, and really only when the node name
diff --combined spec/unit/application/apply_spec.rb
index a79ddba,8c53136..b073d1a
--- a/spec/unit/application/apply_spec.rb
+++ b/spec/unit/application/apply_spec.rb
@@@ -3,6 -3,7 +3,7 @@@
  require File.dirname(__FILE__) + '/../../spec_helper'
  
  require 'puppet/application/apply'
+ require 'puppet/file_bucket/dipper'
  
  describe Puppet::Application::Apply do
    before :each do
@@@ -53,7 -54,6 +54,6 @@@
        Puppet.stubs(:trap)
        Puppet::Log.stubs(:level=)
        Puppet.stubs(:parse_config)
-       require 'lib/puppet/file_bucket/dipper'
        Puppet::FileBucket::Dipper.stubs(:new)
        STDIN.stubs(:read)
  
@@@ -142,16 -142,17 +142,16 @@@
  
      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)
          @apply.stubs(:exit)
          @apply.options.stubs(:[]).with(:code).returns "some code"
 -        @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)
 +      it "should use the environment to parse the file" do
 +        @environment.stubs(:perform_initial_import)
          @apply.parseonly
        end
  
@@@ -161,7 -162,7 +161,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)
          @apply.expects(:exit).with(1)
          @apply.parseonly
        end
@@@ -211,7 -212,8 +211,8 @@@
          @apply.main
        end
  
-       it "should set the manifest if some files are passed on command line" do
+       it "should set the manifest if a file is passed on command line and the file exists" do
+         File.stubs(:exist?).with('site.pp').returns true
          @apply.command_line.stubs(:args).returns(['site.pp'])
  
          Puppet.expects(:[]=).with(:manifest,"site.pp")
@@@ -219,6 -221,23 +220,23 @@@
          @apply.main
        end
  
+       it "should raise an error if a file is passed on command line and the file does not exist" do
+         File.stubs(:exist?).with('noexist.pp').returns false
+         @apply.command_line.stubs(:args).returns(['noexist.pp'])
+         lambda { @apply.main }.should raise_error(RuntimeError, 'Could not find file noexist.pp')
+       end
+ 
+       it "should set the manifest to the first file and warn other files will be skipped" do
+         File.stubs(:exist?).with('starwarsIV').returns true
+         File.expects(:exist?).with('starwarsI').never
+         @apply.command_line.stubs(:args).returns(['starwarsIV', 'starwarsI', 'starwarsII'])
+ 
+         Puppet.expects(:[]=).with(:manifest,"starwarsIV")
+         Puppet.expects(:warning).with('Only one file can be applied per run.  Skipping starwarsI, starwarsII')
+ 
+         @apply.main
+       end
+ 
        it "should collect the node facts" do
          Puppet::Node::Facts.expects(:find).returns(@facts)
  
@@@ -231,7 -250,7 +249,7 @@@
          lambda { @apply.main }.should raise_error
        end
  
-       it "should find the node" do
+       it "should look for the node" do
          Puppet::Node.expects(:find).returns(@node)
  
          @apply.main
diff --combined spec/unit/resource/type_spec.rb
index 29c13c5,f58092e..7701e55
--- a/spec/unit/resource/type_spec.rb
+++ b/spec/unit/resource/type_spec.rb
@@@ -322,7 -322,7 +322,7 @@@ describe Puppet::Resource::Type d
      end
  
      it "should set its module name in the scope if available" do
 -      @type.module_name = "mymod"
 +      @type.instance_eval { @module_name = "mymod" }
  
        @type.set_resource_parameters(@resource, @scope)
  
@@@ -412,6 -412,23 +412,23 @@@
        @type = Puppet::Resource::Type.new(:hostclass, "foo")
      end
  
+     it "should add hostclass names to the classes list" do
+       @type.evaluate_code(@resource)
+       @compiler.catalog.classes.should be_include("foo")
+     end
+ 
+     it "should add node names to the classes list" do
+       @type = Puppet::Resource::Type.new(:node, "foo")
+       @type.evaluate_code(@resource)
+       @compiler.catalog.classes.should be_include("foo")
+     end
+ 
+     it "should not add defined resource names to the classes list" do
+       @type = Puppet::Resource::Type.new(:definition, "foo")
+       @type.evaluate_code(@resource)
+       @compiler.catalog.classes.should_not be_include("foo")
+     end
+ 
      it "should set all of its parameters in a subscope" do
        subscope = stub 'subscope', :compiler => @compiler
        @type.expects(:subscope).with(@scope, @resource).returns subscope
@@@ -514,7 -531,8 +531,7 @@@
          @compiler.add_resource @scope, @parent_resource
  
          @type.resource_type_collection = @scope.known_resource_types
 -        @type.resource_type_collection.stubs(:node).with("parent").returns(@parent_type)
 -        @type.resource_type_collection.stubs(:node).with("Parent").returns(@parent_type)
 +        @type.resource_type_collection.add(@parent_type)
        end
  
        it "should evaluate the parent's resource" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list