From fc36e8de8cdf32ae13b9241f9a9eef4c2727056e Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Wed, 13 Apr 2011 14:25:41 -0700 Subject: (#6928) Remove --parseonly This has been removed in favor of 'puppet parser validate '. Paired-With: Jesse Wolfe --- lib/puppet/application/apply.rb | 23 ++++-------------- lib/puppet/application/master.rb | 17 ++++---------- lib/puppet/defaults.rb | 1 - lib/puppet/faces/help/action.erb | 3 +++ lib/puppet/faces/help/face.erb | 7 ++++++ lib/puppet/faces/help/global.erb | 20 ++++++++++++++++ lib/puppet/parser/grammar.ra | 6 ++--- lib/puppet/parser/parser.rb | 6 ++--- man/man5/puppet.conf.5 | 44 ++++++++++++++++++++++++----------- spec/unit/application/apply_spec.rb | 45 +----------------------------------- spec/unit/application/master_spec.rb | 42 +-------------------------------- test/language/parser.rb | 1 - 12 files changed, 78 insertions(+), 137 deletions(-) create mode 100644 lib/puppet/faces/help/action.erb create mode 100644 lib/puppet/faces/help/face.erb create mode 100644 lib/puppet/faces/help/global.erb diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index bf7b8a988..5779e799c 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -26,6 +26,11 @@ class Puppet::Application::Apply < Puppet::Application end end + option("--parseonly") do + puts "--parseonly has been removed. Please use 'puppet parser validate '" + exit 1 + end + def help <<-HELP @@ -125,8 +130,6 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License def run_command if options[:catalog] apply - elsif Puppet[:parseonly] - parseonly else main end @@ -153,22 +156,6 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License configurer.run :catalog => catalog end - def parseonly - # Set our code or file to use. - if options[:code] or command_line.args.length == 0 - Puppet[:code] = options[:code] || STDIN.read - else - Puppet[:manifest] = command_line.args.shift - end - begin - Puppet::Node::Environment.new(Puppet[:environment]).known_resource_types - rescue => detail - Puppet.err detail - exit 1 - end - exit 0 - end - def main # Set our code or file to use. if options[:code] or command_line.args.length == 0 diff --git a/lib/puppet/application/master.rb b/lib/puppet/application/master.rb index f93894d99..a90829ae0 100644 --- a/lib/puppet/application/master.rb +++ b/lib/puppet/application/master.rb @@ -25,6 +25,11 @@ class Puppet::Application::Master < Puppet::Application end end + option("--parseonly") do + puts "--parseonly has been removed. Please use 'puppet parser validate '" + exit 1 + end + def help <<-HELP @@ -125,8 +130,6 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License def run_command if options[:node] compile - elsif Puppet[:parseonly] - parseonly else main end @@ -148,16 +151,6 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License exit(0) end - def parseonly - begin - Puppet::Node::Environment.new(Puppet[:environment]).known_resource_types - rescue => detail - Puppet.err detail - exit 1 - end - exit(0) - end - def main require 'etc' require 'puppet/file_serving/content' diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 89f3e169d..680762b94 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -418,7 +418,6 @@ module Puppet :desc => "Where the puppet master web server logs." }, :masterport => [8140, "Which port puppet master listens on."], - :parseonly => [false, "Just check the syntax of the manifests."], :node_name => ["cert", "How the puppetmaster determines the client's identity and sets the 'hostname', 'fqdn' and 'domain' facts for use in the manifest, in particular for determining which 'node' statement applies to the client. diff --git a/lib/puppet/faces/help/action.erb b/lib/puppet/faces/help/action.erb new file mode 100644 index 000000000..eaf131464 --- /dev/null +++ b/lib/puppet/faces/help/action.erb @@ -0,0 +1,3 @@ +Use: puppet <%= face.name %> [options] <%= action.name %> [options] + +Summary: <%= action.summary %> diff --git a/lib/puppet/faces/help/face.erb b/lib/puppet/faces/help/face.erb new file mode 100644 index 000000000..efe5fd809 --- /dev/null +++ b/lib/puppet/faces/help/face.erb @@ -0,0 +1,7 @@ +Use: puppet <%= face.name %> [options] [options] + +Available actions: +% face.actions.each do |actionname| +% action = face.get_action(actionname) + <%= action.name.to_s.ljust(16) %> <%= action.summary %> +% end diff --git a/lib/puppet/faces/help/global.erb b/lib/puppet/faces/help/global.erb new file mode 100644 index 000000000..e123367a2 --- /dev/null +++ b/lib/puppet/faces/help/global.erb @@ -0,0 +1,20 @@ +puppet [options] [options] + +Available subcommands, from Puppet Faces: +% Puppet::Faces.faces.sort.each do |name| +% face = Puppet::Faces[name, :current] + <%= face.name.to_s.ljust(16) %> <%= face.summary %> +% end + +% unless legacy_applications.empty? then # great victory when this is true! +Available applications, soon to be ported to Faces: +% legacy_applications.each do |appname| +% summary = horribly_extract_summary_from appname + <%= appname.to_s.ljust(16) %> <%= summary %> +% end +% end + +See 'puppet help ' for help on a specific subcommand action. +See 'puppet help ' for help on a specific subcommand. +See 'puppet man ' for the full man page. +Puppet v<%= Puppet::PUPPETVERSION %> diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index 8339c51b7..d2bd06e94 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -156,7 +156,7 @@ resourceoverride: resourceref LBRACE anyparams endcomma RBRACE { virtualresource: at resource { type = val[0] - if (type == :exported and ! Puppet[:storeconfigs]) and ! Puppet[:parseonly] + if (type == :exported and ! Puppet[:storeconfigs]) Puppet.warning addcontext("You cannot collect without storeconfigs being set") end @@ -188,7 +188,7 @@ collection: classref collectrhand LBRACE anyparams endcomma RBRACE { else args[:form] = val[1] end - if args[:form] == :exported and ! Puppet[:storeconfigs] and ! Puppet[:parseonly] + if args[:form] == :exported and ! Puppet[:storeconfigs] Puppet.warning addcontext("You cannot collect exported resources without storeconfigs being set; the collection will be ignored") end args[:override] = val[3] @@ -208,7 +208,7 @@ collection: classref collectrhand LBRACE anyparams endcomma RBRACE { else args[:form] = val[1] end - if args[:form] == :exported and ! Puppet[:storeconfigs] and ! Puppet[:parseonly] + if args[:form] == :exported and ! Puppet[:storeconfigs] Puppet.warning addcontext("You cannot collect exported resources without storeconfigs being set; the collection will be ignored") end result = ast AST::Collection, args diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index 300ddddd6..611398d14 100644 --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -1366,7 +1366,7 @@ module_eval(<<'.,.,', 'grammar.ra', 156) def _reduce_50(val, _values, result) type = val[0] - if (type == :exported and ! Puppet[:storeconfigs]) and ! Puppet[:parseonly] + if (type == :exported and ! Puppet[:storeconfigs]) Puppet.warning addcontext("You cannot collect without storeconfigs being set") end @@ -1411,7 +1411,7 @@ module_eval(<<'.,.,', 'grammar.ra', 178) else args[:form] = val[1] end - if args[:form] == :exported and ! Puppet[:storeconfigs] and ! Puppet[:parseonly] + if args[:form] == :exported and ! Puppet[:storeconfigs] Puppet.warning addcontext("You cannot collect exported resources without storeconfigs being set; the collection will be ignored") end args[:override] = val[3] @@ -1436,7 +1436,7 @@ module_eval(<<'.,.,', 'grammar.ra', 197) else args[:form] = val[1] end - if args[:form] == :exported and ! Puppet[:storeconfigs] and ! Puppet[:parseonly] + if args[:form] == :exported and ! Puppet[:storeconfigs] Puppet.warning addcontext("You cannot collect exported resources without storeconfigs being set; the collection will be ignored") end result = ast AST::Collection, args diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index f6c9926c3..930cec533 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,8 +1,8 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "February 2011" "Puppet Labs, LLC" "Puppet manual" -\fBThis page is autogenerated; any changes will get overwritten\fR \fI(last generated on Thu Feb 17 09:56:34 \-0800 2011)\fR +.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 . .SH "Specifying Configuration Parameters" . @@ -117,7 +117,7 @@ Puppet can also create user and group accounts for itself (one \fBpuppet\fR grou . .nf -$ puppet agent \-\-mkusers +$ puppet master \-\-mkusers . .fi . @@ -132,6 +132,14 @@ Sending the \fBSIGUSR1\fR signal to an instance of \fBpuppet agent\fR will cause .SH "Configuration Parameter Reference" Below is a list of all documented parameters\. Not all of them are valid with all Puppet executables, but the executables will ignore any inappropriate values\. . +.SS "allow_duplicate_certs" +Whether to allow a new certificate request to overwrite an existing certificate\. +. +.IP "\(bu" 4 +\fIDefault\fR: false +. +.IP "" 0 +. .SS "archive_file_server" During an inspect run, the file bucket server to archive files to if archive_files is set\. . @@ -340,7 +348,7 @@ Whether certificate revocation should be supported by downloading a Certificate The name to use when handling certificates\. Defaults to the fully qualified domain name\. . .IP "\(bu" 4 -\fIDefault\fR: magpie\.puppetlabs\.lan +\fIDefault\fR: nick\-lewiss\-macbook\-pro\.local . .IP "" 0 . @@ -522,6 +530,14 @@ Which arguments to pass to the diff command when printing differences between fi . .IP "" 0 . +.SS "document_all" +Document all resources +. +.IP "\(bu" 4 +\fIDefault\fR: false +. +.IP "" 0 +. .SS "downcasefacts" Whether facts should be made all lowercase when sent to the server\. . @@ -1067,14 +1083,6 @@ Run the configuration once, rather than as a long\-running daemon\. This is usef . .IP "" 0 . -.SS "parseonly" -Just check the syntax of the manifests\. -. -.IP "\(bu" 4 -\fIDefault\fR: false -. -.IP "" 0 -. .SS "passfile" Where puppet agent stores the password for its private key\. Generally unused\. . @@ -1261,7 +1269,7 @@ The directory in which to store reports received from the client\. Each client g The \'from\' email address for the reports\. . .IP "\(bu" 4 -\fIDefault\fR: report@magpie\.puppetlabs\.lan +\fIDefault\fR: report@Nick\-Lewiss\-MacBook\-Pro\.local . .IP "" 0 . @@ -1313,6 +1321,14 @@ The configuration file that defines the rights to the different rest indirection . .IP "" 0 . +.SS "route_file" +The YAML file containing indirector route configuration\. +. +.IP "\(bu" 4 +\fIDefault\fR: $confdir/routes\.yaml +. +.IP "" 0 +. .SS "rrddir" The directory where RRD database files are stored\. Directories for each reporting host will be created under this directory\. . @@ -1589,4 +1605,4 @@ Boolean; whether to use the zlib library .IP "" 0 . .P -\fIThis page autogenerated on Thu Feb 17 09:56:34 \-0800 2011\fR +\fIThis page autogenerated on Wed Apr 13 14:24:43 \-0700 2011\fR diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb index 66c658e7f..dca2a4156 100755 --- a/spec/unit/application/apply_spec.rb +++ b/spec/unit/application/apply_spec.rb @@ -122,14 +122,6 @@ describe Puppet::Application::Apply do describe "when executing" do - it "should dispatch to parseonly if parseonly is set" do - @apply.stubs(:options).returns({}) - Puppet.stubs(:[]).with(:parseonly).returns(true) - - @apply.expects(:parseonly) - @apply.run_command - end - it "should dispatch to 'apply' if it was called with 'apply'" do @apply.options[:catalog] = "foo" @@ -137,48 +129,13 @@ describe Puppet::Application::Apply do @apply.run_command end - it "should dispatch to main if parseonly is not set" do + it "should dispatch to main otherwise" do @apply.stubs(:options).returns({}) - Puppet.stubs(:[]).with(:parseonly).returns(false) @apply.expects(:main) @apply.run_command end - describe "the parseonly command" do - before :each do - @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" - end - - it "should use the environment to parse the file" do - @environment.stubs(:perform_initial_import) - @apply.parseonly - end - - it "should exit with exit code 0 if no error" do - @apply.expects(:exit).with(0) - @apply.parseonly - end - - it "should exit with exit code 1 if error" do - @environment.stubs(:perform_initial_import).raises(Puppet::ParseError) - @apply.expects(:exit).with(1) - @apply.parseonly - end - - it "should exit with exit code 1 if error, even if --noop is set" do - Puppet[:noop] = true - @environment.stubs(:perform_initial_import).raises(Puppet::ParseError) - @apply.expects(:exit).with(1) - @apply.parseonly - end - end - describe "the main command" do before :each do Puppet.stubs(:[]) diff --git a/spec/unit/application/master_spec.rb b/spec/unit/application/master_spec.rb index 890f8eebc..ea5d3f518 100755 --- a/spec/unit/application/master_spec.rb +++ b/spec/unit/application/master_spec.rb @@ -34,10 +34,6 @@ describe Puppet::Application::Master do @master.should respond_to(:main) end - it "should declare a parseonly command" do - @master.should respond_to(:parseonly) - end - it "should declare a compile command" do @master.should respond_to(:compile) end @@ -232,55 +228,19 @@ describe Puppet::Application::Master do @master.preinit end - it "should dispatch to parseonly if parseonly is set" do - Puppet.stubs(:[]).with(:parseonly).returns(true) - @master.options[:node] = nil - - @master.expects(:parseonly) - @master.run_command - end - it "should dispatch to compile if called with --compile" do @master.options[:node] = "foo" @master.expects(:compile) @master.run_command end - it "should dispatch to main if parseonly is not set" do - Puppet.stubs(:[]).with(:parseonly).returns(false) + it "should dispatch to main otherwise" do @master.options[:node] = nil @master.expects(:main) @master.run_command end - - describe "the parseonly command" do - before :each do - @environment = Puppet::Node::Environment.new("env") - Puppet.stubs(:[]).with(:environment).returns(@environment) - Puppet.stubs(:[]).with(:manifest).returns("site.pp") - Puppet.stubs(:err) - @master.stubs(:exit) - end - - it "should use a Puppet Resource Type Collection to parse the file" do - @environment.expects(:perform_initial_import) - @master.parseonly - end - - it "should exit with exit code 0 if no error" do - @master.expects(:exit).with(0) - @master.parseonly - end - - it "should exit with exit code 1 if error" do - @environment.stubs(:perform_initial_import).raises(Puppet::ParseError) - @master.expects(:exit).with(1) - @master.parseonly - end - end - describe "the compile command" do before do Puppet.stubs(:[]).with(:environment) diff --git a/test/language/parser.rb b/test/language/parser.rb index 36a9c4787..f7e636add 100755 --- a/test/language/parser.rb +++ b/test/language/parser.rb @@ -14,7 +14,6 @@ class TestParser < Test::Unit::TestCase include PuppetTest::Support::Utils def setup super - Puppet[:parseonly] = true #@lexer = Puppet::Parser::Lexer.new end -- cgit