On Apr 13, 2011, at 5:10 PM, Nick Lewis <[email protected]> wrote: > On Wed, Apr 13, 2011 at 3:56 PM, Luke Kanies <[email protected]> wrote: >> What happens to 'import' calls in manifests being validated by the new >> action? >> >> It looks to me like this is still needed there. >> > > It would validate all of the imported manifests, wouldn't it? We > didn't think that really seemed like undesirable behavior. However, we > reverted this particular patch for other similar reasons (puppetdoc > for instance). And reverting it does allow --ignoreimport as an option > to 'puppet parser validate' to only validate the files you specify.
That is indeed undesirable behavior - when syntax-checking as part of a commit hook, usually only the single file is available. This ended up being one of the main use cases for validation, so it is very important to a lot of users. >> On Apr 13, 2011, at 3:51 PM, Nick Lewis wrote: >> >>> This was only used with --parseonly, which is gone. >>> >>> Paired-With: Jesse Wolfe >>> >>> Signed-off-by: Nick Lewis <[email protected]> >>> --- >>> Local-branch: ticket/next/6928 >>> lib/puppet/application/agent.rb | 4 ---- >>> lib/puppet/application/apply.rb | 5 +++++ >>> lib/puppet/application/master.rb | 5 +++++ >>> lib/puppet/defaults.rb | 3 --- >>> lib/puppet/node/environment.rb | 1 - >>> lib/puppet/parser/type_loader.rb | 2 -- >>> lib/puppet/util/rdoc.rb | 3 --- >>> man/man5/puppet.conf.5 | 12 ++---------- >>> spec/unit/node/environment_spec.rb | 8 -------- >>> spec/unit/parser/type_loader_spec.rb | 6 ------ >>> spec/unit/util/rdoc_spec.rb | 12 ------------ >>> 11 files changed, 12 insertions(+), 49 deletions(-) >>> >>> diff --git a/lib/puppet/application/agent.rb >>> b/lib/puppet/application/agent.rb >>> index fc86168..317a614 100644 >>> --- a/lib/puppet/application/agent.rb >>> +++ b/lib/puppet/application/agent.rb >>> @@ -429,10 +429,6 @@ 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 5779e79..a63c2dd 100644 >>> --- a/lib/puppet/application/apply.rb >>> +++ b/lib/puppet/application/apply.rb >>> @@ -31,6 +31,11 @@ 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 a90829a..924e671 100644 >>> --- a/lib/puppet/application/master.rb >>> +++ b/lib/puppet/application/master.rb >>> @@ -30,6 +30,11 @@ 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 680762b..47e6258 100644 >>> --- a/lib/puppet/defaults.rb >>> +++ b/lib/puppet/defaults.rb >>> @@ -90,9 +90,6 @@ 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 dc63197..4589ea6 100644 >>> --- a/lib/puppet/node/environment.rb >>> +++ b/lib/puppet/node/environment.rb >>> @@ -150,7 +150,6 @@ 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 1fba73d..23fb78c 100644 >>> --- a/lib/puppet/parser/type_loader.rb >>> +++ b/lib/puppet/parser/type_loader.rb >>> @@ -60,8 +60,6 @@ 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 c00bc6f..2a6dbdf 100644 >>> --- a/lib/puppet/util/rdoc.rb >>> +++ b/lib/puppet/util/rdoc.rb >>> @@ -6,8 +6,6 @@ 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' >>> @@ -41,7 +39,6 @@ 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 930cec5..cf6cb47 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:24:43 \-0700 2011)\fR >>> +\fBThis page is autogenerated; any changes will get overwritten\fR >>> \fI(last generated on Wed Apr 13 14:37:15 \-0700 2011)\fR >>> . >>> .SH "Specifying Configuration Parameters" >>> . >>> @@ -770,14 +770,6 @@ 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\. >>> . >>> @@ -1605,4 +1597,4 @@ Boolean; whether to use the zlib library >>> .IP "" 0 >>> . >>> .P >>> -\fIThis page autogenerated on Wed Apr 13 14:24:43 \-0700 2011\fR >>> +\fIThis page autogenerated on Wed Apr 13 14:37:15 \-0700 2011\fR >>> diff --git a/spec/unit/node/environment_spec.rb >>> b/spec/unit/node/environment_spec.rb >>> index d1badfa..b5efbd4 100755 >>> --- a/spec/unit/node/environment_spec.rb >>> +++ b/spec/unit/node/environment_spec.rb >>> @@ -315,14 +315,6 @@ 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 9367b61..48a3f29 100755 >>> --- a/spec/unit/parser/type_loader_spec.rb >>> +++ b/spec/unit/parser/type_loader_spec.rb >>> @@ -44,12 +44,6 @@ 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 067b5b8..df5f6d2 100755 >>> --- a/spec/unit/util/rdoc_spec.rb >>> +++ b/spec/unit/util/rdoc_spec.rb >>> @@ -12,12 +12,6 @@ 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", []) >>> >>> @@ -76,12 +70,6 @@ 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) >>> -- >>> 1.7.4.1 >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Puppet Developers" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/puppet-dev?hl=en. >>> >> >> >> -- >> Men never do evil so completely and cheerfully as when they do it from a >> religious conviction. --Blaise Pascal >> --------------------------------------------------------------------- >> Luke Kanies -|- http://puppetlabs.com -|- http://about.me/lak >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Developers" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/puppet-dev?hl=en. >> >> -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
