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

Nick Lewis nick at puppetlabs.com
Tue May 10 08:14:08 UTC 2011


The following commit has been merged in the experimental branch:
commit 5915814c47649bb4b957b4be4fcee5919b859451
Author: Nick Lewis <nick at puppetlabs.com>
Date:   Wed Apr 13 16:57:11 2011 -0700

    Revert "(#6928) Removed --ignoreimport"
    
    This reverts commit 24a277c5e805ce16e0b86e17e6cb2fbe1945ae07.
    
    Despite not needing --ignoreimport as an option anymore, it's still used
    internally and has to stay.

diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb
index 317a614..fc86168 100644
--- a/lib/puppet/application/agent.rb
+++ b/lib/puppet/application/agent.rb
@@ -429,6 +429,10 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
 
     Puppet.settings.use :main, :agent, :ssl
 
+    # Always ignoreimport for agent. It really shouldn't even try to import,
+    # but this is just a temporary band-aid.
+    Puppet[:ignoreimport] = true
+
     # We need to specify a ca location for all of the SSL-related i
     # indirected classes to work; in fingerprint mode we just need
     # access to the local files and we don't need a ca.
diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb
index a63c2dd..5779e79 100644
--- a/lib/puppet/application/apply.rb
+++ b/lib/puppet/application/apply.rb
@@ -31,11 +31,6 @@ class Puppet::Application::Apply < Puppet::Application
     exit 1
   end
 
-  option("--ignoreimport") do
-    puts "--ignoreimport has been removed. Please use 'puppet parser validate <manifest>'"
-    exit 1
-  end
-
   def help
     <<-HELP
 
diff --git a/lib/puppet/application/master.rb b/lib/puppet/application/master.rb
index 924e671..a90829a 100644
--- a/lib/puppet/application/master.rb
+++ b/lib/puppet/application/master.rb
@@ -30,11 +30,6 @@ class Puppet::Application::Master < Puppet::Application
     exit 1
   end
 
-  option("--ignoreimport") do
-    puts "--ignoreimport has been removed. Please use 'puppet parser validate <manifest>'"
-    exit 1
-  end
-
   def help
     <<-HELP
 
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index 47e6258..680762b 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -90,6 +90,9 @@ module Puppet
         $LOAD_PATH << value
       end
     },
+    :ignoreimport => [false, "A parameter that can be used in commit
+      hooks, since it enables you to parse-check a single file rather
+      than requiring that all files exist."],
     :authconfig => [ "$confdir/namespaceauth.conf",
       "The configuration file that defines the rights to the different
       namespaces and methods.  This can be used as a coarse-grained
diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb
index 4589ea6..dc63197 100644
--- a/lib/puppet/node/environment.rb
+++ b/lib/puppet/node/environment.rb
@@ -150,6 +150,7 @@ class Puppet::Node::Environment
   private
 
   def perform_initial_import
+    return empty_parse_result if Puppet.settings[:ignoreimport]
     parser = Puppet::Parser::Parser.new(self)
     if code = Puppet.settings.uninterpolated_value(:code, name.to_s) and code != ""
       parser.string = code
diff --git a/lib/puppet/parser/type_loader.rb b/lib/puppet/parser/type_loader.rb
index 23fb78c..1fba73d 100644
--- a/lib/puppet/parser/type_loader.rb
+++ b/lib/puppet/parser/type_loader.rb
@@ -60,6 +60,8 @@ class Puppet::Parser::TypeLoader
 
   # Import our files.
   def import(file, current_file = nil)
+    return if Puppet[:ignoreimport]
+
     # use a path relative to the file doing the importing
     if current_file
       dir = current_file.sub(%r{[^/]+$},'').sub(/\/$/, '')
diff --git a/lib/puppet/util/rdoc.rb b/lib/puppet/util/rdoc.rb
index 2a6dbdf..c00bc6f 100644
--- a/lib/puppet/util/rdoc.rb
+++ b/lib/puppet/util/rdoc.rb
@@ -6,6 +6,8 @@ module Puppet::Util::RDoc
   # launch a rdoc documenation process
   # with the files/dir passed in +files+
   def rdoc(outputdir, files, charset = nil)
+      Puppet[:ignoreimport] = true
+
       # then rdoc
       require 'rdoc/rdoc'
       require 'rdoc/options'
@@ -39,6 +41,7 @@ module Puppet::Util::RDoc
 
   # launch a output to console manifest doc
   def manifestdoc(files)
+    Puppet[:ignoreimport] = true
     files.select { |f| FileTest.file?(f) }.each do |f|
       parser = Puppet::Parser::Parser.new(Puppet::Node::Environment.new(Puppet[:environment]))
       parser.file = f
diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5
index cf6cb47..930cec5 100644
--- a/man/man5/puppet.conf.5
+++ b/man/man5/puppet.conf.5
@@ -2,7 +2,7 @@
 .\" http://github.com/rtomayko/ronn/tree/0.7.3
 .
 .TH "PUPPETCONF" "5" "April 2011" "Puppet Labs, LLC" "Puppet manual"
-\fBThis page is autogenerated; any changes will get overwritten\fR \fI(last generated on Wed Apr 13 14:37:15 \-0700 2011)\fR
+\fBThis page is autogenerated; any changes will get overwritten\fR \fI(last generated on Wed Apr 13 14:24:43 \-0700 2011)\fR
 .
 .SH "Specifying Configuration Parameters"
 .
@@ -770,6 +770,14 @@ Ignore cache and always recompile the configuration\. This is useful for testing
 .
 .IP "" 0
 .
+.SS "ignoreimport"
+A parameter that can be used in commit hooks, since it enables you to parse\-check a single file rather than requiring that all files exist\.
+.
+.IP "\(bu" 4
+\fIDefault\fR: false
+.
+.IP "" 0
+.
 .SS "ignoreschedules"
 Boolean; whether puppet agent should ignore schedules\. This is useful for initial puppet agent runs\.
 .
@@ -1597,4 +1605,4 @@ Boolean; whether to use the zlib library
 .IP "" 0
 .
 .P
-\fIThis page autogenerated on Wed Apr 13 14:37:15 \-0700 2011\fR
+\fIThis page autogenerated on Wed Apr 13 14:24:43 \-0700 2011\fR
diff --git a/spec/unit/node/environment_spec.rb b/spec/unit/node/environment_spec.rb
index b5efbd4..d1badfa 100755
--- a/spec/unit/node/environment_spec.rb
+++ b/spec/unit/node/environment_spec.rb
@@ -315,6 +315,14 @@ describe Puppet::Node::Environment do
       lambda { @env.instance_eval { perform_initial_import } }.should raise_error(Puppet::Error)
     end
 
+    it "should not do anything if the ignore_import settings is set" do
+      Puppet.settings[:ignoreimport] = true
+      @parser.expects(:string=).never
+      @parser.expects(:file=).never
+      @parser.expects(:parse).never
+      @env.instance_eval { perform_initial_import }
+    end
+
     it "should mark the type collection as needing a reparse when there is an error parsing" do
       @parser.expects(:parse).raises Puppet::ParseError.new("Syntax error at ...")
       @env.stubs(:known_resource_types).returns Puppet::Resource::TypeCollection.new(@env)
diff --git a/spec/unit/parser/type_loader_spec.rb b/spec/unit/parser/type_loader_spec.rb
index 48a3f29..9367b61 100755
--- a/spec/unit/parser/type_loader_spec.rb
+++ b/spec/unit/parser/type_loader_spec.rb
@@ -44,6 +44,12 @@ describe Puppet::Parser::TypeLoader do
       Puppet::Parser::Parser.any_instance.stubs(:file=)
     end
 
+    it "should return immediately when imports are being ignored" do
+      Puppet::Parser::Files.expects(:find_manifests).never
+      Puppet[:ignoreimport] = true
+      @loader.import("foo").should be_nil
+    end
+
     it "should find all manifests matching the file or pattern" do
       Puppet::Parser::Files.expects(:find_manifests).with { |pat, opts| pat == "myfile" }.returns ["modname", %w{one}]
       @loader.import("myfile")
diff --git a/spec/unit/util/rdoc_spec.rb b/spec/unit/util/rdoc_spec.rb
index df5f6d2..067b5b8 100755
--- a/spec/unit/util/rdoc_spec.rb
+++ b/spec/unit/util/rdoc_spec.rb
@@ -12,6 +12,12 @@ describe Puppet::Util::RDoc do
       RDoc::RDoc.stubs(:new).returns(@rdoc)
     end
 
+    it "should tell the parser to ignore import" do
+      Puppet.expects(:[]=).with(:ignoreimport, true)
+
+      Puppet::Util::RDoc.rdoc("output", [])
+    end
+
     it "should install the Puppet HTML Generator into RDoc generators" do
       Puppet::Util::RDoc.rdoc("output", [])
 
@@ -70,6 +76,12 @@ describe Puppet::Util::RDoc do
   end
 
   describe "when running a manifest documentation" do
+    it "should tell the parser to ignore import" do
+      Puppet.expects(:[]=).with(:ignoreimport, true)
+
+      Puppet::Util::RDoc.manifestdoc([])
+    end
+
     it "should use a parser with the correct environment" do
       FileTest.stubs(:file?).returns(true)
       Puppet::Util::RDoc.stubs(:output)

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list