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 @@ -1,256 +1,243 @@ require 'puppet/application' class Puppet::Application::Apply < Puppet::Application should_parse_config option("--debug","-d") option("--execute EXECUTE","-e") do |arg| options[:code] = arg end option("--loadclasses","-L") option("--verbose","-v") option("--use-nodes") option("--detailed-exitcodes") option("--apply catalog", "-a catalog") do |arg| options[:catalog] = arg end option("--logdest LOGDEST", "-l") do |arg| begin Puppet::Util::Log.newdestination(arg) options[:logset] = true rescue => detail $stderr.puts detail.to_s end end + option("--parseonly") do + puts "--parseonly has been removed. Please use 'puppet parser validate '" + exit 1 + end + def help <<-HELP puppet-apply(8) -- Apply Puppet manifests locally ======== SYNOPSIS -------- Applies a standalone Puppet manifest to the local system. USAGE ----- puppet apply [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] [-e|--execute] [--detailed-exitcodes] [-l|--logdest ] [--apply ] DESCRIPTION ----------- This is the standalone puppet execution tool; use it to apply individual manifests. When provided with a modulepath, via command line or config file, puppet apply can effectively mimic the catalog that would be served by puppet master with access to the same modules, although there are some subtle differences. When combined with scheduling and an automated system for pushing manifests, this can be used to implement a serverless Puppet site. Most users should use 'puppet agent' and 'puppet master' for site-wide manifests. OPTIONS ------- Note that any configuration parameter that's valid in the configuration file is also a valid long argument. For example, 'modulepath' is a valid configuration parameter, so you can specify '--tags ,' as an argument. See the configuration file documentation at http://docs.puppetlabs.com/references/stable/configuration.html for the full list of acceptable parameters. A commented list of all configuration options can also be generated by running puppet with '--genconfig'. * --debug: Enable full debugging. * --detailed-exitcodes: Provide transaction information via exit codes. If this is enabled, an exit code of '2' means there were changes, and an exit code of '4' means that there were failures during the transaction. * --help: Print this help message * --loadclasses: Load any stored classes. 'puppet agent' caches configured classes (usually at /etc/puppet/classes.txt), and setting this option causes all of those classes to be set in your puppet manifest. * --logdest: Where to send messages. Choose between syslog, the console, and a log file. Defaults to sending messages to the console. * --execute: Execute a specific piece of Puppet code * --verbose: Print extra information. * --apply: Apply a JSON catalog (such as one generated with 'puppet master --compile'). You can either specify a JSON file or pipe in JSON from standard input. EXAMPLE ------- $ puppet apply -l /tmp/manifest.log manifest.pp $ puppet apply --modulepath=/root/dev/modules -e "include ntpd::server" AUTHOR ------ Luke Kanies COPYRIGHT --------- Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License HELP end def run_command if options[:catalog] apply - elsif Puppet[:parseonly] - parseonly else main end end def apply if options[:catalog] == "-" text = $stdin.read else text = File.read(options[:catalog]) end begin catalog = Puppet::Resource::Catalog.convert_from(Puppet::Resource::Catalog.default_format,text) catalog = Puppet::Resource::Catalog.pson_create(catalog) unless catalog.is_a?(Puppet::Resource::Catalog) rescue => detail raise Puppet::Error, "Could not deserialize catalog from pson: #{detail}" end catalog = catalog.to_ral require 'puppet/configurer' configurer = Puppet::Configurer.new 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 Puppet[:code] = options[:code] || STDIN.read else manifest = command_line.args.shift raise "Could not find file #{manifest}" unless File.exist?(manifest) Puppet.warning("Only one file can be applied per run. Skipping #{command_line.args.join(', ')}") if command_line.args.size > 0 Puppet[:manifest] = manifest end # Collect our facts. unless facts = Puppet::Node::Facts.indirection.find(Puppet[:certname]) raise "Could not find facts for #{Puppet[:certname]}" end # Find our Node unless node = Puppet::Node.indirection.find(Puppet[:certname]) raise "Could not find node #{Puppet[:certname]}" end # Merge in the facts. node.merge(facts.values) # Allow users to load the classes that puppet agent creates. if options[:loadclasses] file = Puppet[:classfile] if FileTest.exists?(file) unless FileTest.readable?(file) $stderr.puts "#{file} is not readable" exit(63) end node.classes = File.read(file).split(/[\s\n]+/) end end begin # Compile our catalog starttime = Time.now catalog = Puppet::Resource::Catalog.indirection.find(node.name, :use_node => node) # Translate it to a RAL catalog catalog = catalog.to_ral catalog.finalize catalog.retrieval_duration = Time.now - starttime require 'puppet/configurer' configurer = Puppet::Configurer.new report = configurer.run(:skip_plugin_download => true, :catalog => catalog) exit( options[:detailed_exitcodes] ? report.exit_status : 0 ) rescue => detail puts detail.backtrace if Puppet[:trace] $stderr.puts detail.message exit(1) end end def setup exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs? # If noop is set, then also enable diffs Puppet[:show_diff] = true if Puppet[:noop] Puppet::Util::Log.newdestination(:console) unless options[:logset] client = nil server = nil Signal.trap(:INT) do $stderr.puts "Exiting" exit(1) end # we want the last report to be persisted locally Puppet::Transaction::Report.indirection.cache_class = :yaml if options[:debug] Puppet::Util::Log.level = :debug elsif options[:verbose] Puppet::Util::Log.level = :info end end end 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 @@ -1,238 +1,231 @@ require 'puppet/application' class Puppet::Application::Master < Puppet::Application should_parse_config run_mode :master option("--debug", "-d") option("--verbose", "-v") # internal option, only to be used by ext/rack/config.ru option("--rack") option("--compile host", "-c host") do |arg| options[:node] = arg end option("--logdest DEST", "-l DEST") do |arg| begin Puppet::Util::Log.newdestination(arg) options[:setdest] = true rescue => detail puts detail.backtrace if Puppet[:debug] $stderr.puts detail.to_s end end + option("--parseonly") do + puts "--parseonly has been removed. Please use 'puppet parser validate '" + exit 1 + end + def help <<-HELP puppet-master(8) -- The puppet master daemon ======== SYNOPSIS -------- The central puppet server. Functions as a certificate authority by default. USAGE ----- puppet master [-D|--daemonize|--no-daemonize] [-d|--debug] [-h|--help] [-l|--logdest |console|syslog] [-v|--verbose] [-V|--version] [--compile ] DESCRIPTION ----------- This command starts an instance of puppet master, running as a daemon and using Ruby's built-in Webrick webserver. Puppet master can also be managed by other application servers; when this is the case, this executable is not used. OPTIONS ------- Note that any configuration parameter that's valid in the configuration file is also a valid long argument. For example, 'ssldir' is a valid configuration parameter, so you can specify '--ssldir ' as an argument. See the configuration file documentation at http://docs.puppetlabs.com/references/stable/configuration.html for the full list of acceptable parameters. A commented list of all configuration options can also be generated by running puppet master with '--genconfig'. * --daemonize: Send the process into the background. This is the default. * --no-daemonize: Do not send the process into the background. * --debug: Enable full debugging. * --help: Print this help message. * --logdest: Where to send messages. Choose between syslog, the console, and a log file. Defaults to sending messages to syslog, or the console if debugging or verbosity is enabled. * --verbose: Enable verbosity. * --version: Print the puppet version number and exit. * --compile: Compile a catalogue and output it in JSON from the puppet master. Uses facts contained in the $vardir/yaml/ directory to compile the catalog. EXAMPLE ------- puppet master AUTHOR ------ Luke Kanies COPYRIGHT --------- Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License HELP end def preinit Signal.trap(:INT) do $stderr.puts "Cancelling startup" exit(0) end # Create this first-off, so we have ARGV require 'puppet/daemon' @daemon = Puppet::Daemon.new @daemon.argv = ARGV.dup end def run_command if options[:node] compile - elsif Puppet[:parseonly] - parseonly else main end end def compile Puppet::Util::Log.newdestination :console raise ArgumentError, "Cannot render compiled catalogs without pson support" unless Puppet.features.pson? begin unless catalog = Puppet::Resource::Catalog.indirection.find(options[:node]) raise "Could not compile catalog for #{options[:node]}" end jj catalog.to_resource rescue => detail $stderr.puts detail exit(30) end 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' require 'puppet/file_serving/metadata' xmlrpc_handlers = [:Status, :FileServer, :Master, :Report, :Filebucket] xmlrpc_handlers << :CA if Puppet[:ca] # Make sure we've got a localhost ssl cert Puppet::SSL::Host.localhost # And now configure our server to *only* hit the CA for data, because that's # all it will have write access to. Puppet::SSL::Host.ca_location = :only if Puppet::SSL::CertificateAuthority.ca? if Puppet.features.root? begin Puppet::Util.chuser rescue => detail puts detail.backtrace if Puppet[:trace] $stderr.puts "Could not change user to #{Puppet[:user]}: #{detail}" exit(39) end end unless options[:rack] require 'puppet/network/server' @daemon.server = Puppet::Network::Server.new(:xmlrpc_handlers => xmlrpc_handlers) @daemon.daemonize if Puppet[:daemonize] else require 'puppet/network/http/rack' @app = Puppet::Network::HTTP::Rack.new(:xmlrpc_handlers => xmlrpc_handlers, :protocols => [:rest, :xmlrpc]) end Puppet.notice "Starting Puppet master version #{Puppet.version}" unless options[:rack] @daemon.start else return @app end end def setup # Handle the logging settings. if options[:debug] or options[:verbose] if options[:debug] Puppet::Util::Log.level = :debug else Puppet::Util::Log.level = :info end unless Puppet[:daemonize] or options[:rack] Puppet::Util::Log.newdestination(:console) options[:setdest] = true end end Puppet::Util::Log.newdestination(:syslog) unless options[:setdest] exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs? Puppet.settings.use :main, :master, :ssl, :metrics # Cache our nodes in yaml. Currently not configurable. Puppet::Node.indirection.cache_class = :yaml # Configure all of the SSL stuff. if Puppet::SSL::CertificateAuthority.ca? Puppet::SSL::Host.ca_location = :local Puppet.settings.use :ca Puppet::SSL::CertificateAuthority.instance else Puppet::SSL::Host.ca_location = :none end end end 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 @@ -1,833 +1,832 @@ # The majority of the system configuration parameters are set in this file. module Puppet setdefaults(:main, :confdir => [Puppet.run_mode.conf_dir, "The main Puppet configuration directory. The default for this parameter is calculated based on the user. If the process is running as root or the user that Puppet is supposed to run as, it defaults to a system directory, but if it's running as any other user, it defaults to being in the user's home directory."], :vardir => [Puppet.run_mode.var_dir, "Where Puppet stores dynamic and growing data. The default for this parameter is calculated specially, like `confdir`_."], :name => [Puppet.application_name.to_s, "The name of the application, if we are running as one. The default is essentially $0 without the path or `.rb`."], :run_mode => [Puppet.run_mode.name.to_s, "The effective 'run mode' of the application: master, agent, or user."] ) setdefaults(:main, :logdir => Puppet.run_mode.logopts) setdefaults(:main, :trace => [false, "Whether to print stack traces on some errors"], :autoflush => { :default => false, :desc => "Whether log files should always flush to disk.", :hook => proc { |value| Log.autoflush = value } }, :syslogfacility => ["daemon", "What syslog facility to use when logging to syslog. Syslog has a fixed list of valid facilities, and you must choose one of those; you cannot just make one up."], :statedir => { :default => "$vardir/state", :mode => 01755, :desc => "The directory where Puppet state is stored. Generally, this directory can be removed without causing harm (although it might result in spurious service restarts)." }, :rundir => { :default => Puppet.run_mode.run_dir, :mode => 01777, :desc => "Where Puppet PID files are kept." }, :genconfig => [false, "Whether to just print a configuration to stdout and exit. Only makes sense when used interactively. Takes into account arguments specified on the CLI."], :genmanifest => [false, "Whether to just print a manifest to stdout and exit. Only makes sense when used interactively. Takes into account arguments specified on the CLI."], :configprint => ["", "Print the value of a specific configuration parameter. If a parameter is provided for this, then the value is printed and puppet exits. Comma-separate multiple values. For a list of all values, specify 'all'. This feature is only available in Puppet versions higher than 0.18.4."], :color => ["ansi", "Whether to use colors when logging to the console. Valid values are `ansi` (equivalent to `true`), `html` (mostly used during testing with TextMate), and `false`, which produces no color."], :mkusers => [false, "Whether to create the necessary user and group that puppet agent will run as."], :manage_internal_file_permissions => [true, "Whether Puppet should manage the owner, group, and mode of files it uses internally" ], :onetime => {:default => false, :desc => "Run the configuration once, rather than as a long-running daemon. This is useful for interactively running puppetd.", :short => 'o' }, :path => {:default => "none", :desc => "The shell search path. Defaults to whatever is inherited from the parent process.", :call_on_define => true, # Call our hook with the default value, so we always get the libdir set. :hook => proc do |value| ENV["PATH"] = "" if ENV["PATH"].nil? ENV["PATH"] = value unless value == "none" paths = ENV["PATH"].split(File::PATH_SEPARATOR) %w{/usr/sbin /sbin}.each do |path| ENV["PATH"] += File::PATH_SEPARATOR + path unless paths.include?(path) end value end }, :libdir => {:default => "$vardir/lib", :desc => "An extra search path for Puppet. This is only useful for those files that Puppet will load on demand, and is only guaranteed to work for those cases. In fact, the autoload mechanism is responsible for making sure this directory is in Ruby's search path", :call_on_define => true, # Call our hook with the default value, so we always get the libdir set. :hook => proc do |value| $LOAD_PATH.delete(@oldlibdir) if defined?(@oldlibdir) and $LOAD_PATH.include?(@oldlibdir) @oldlibdir = value $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 authorization system for both `puppet agent` and `puppet master`." ], :environment => {:default => "production", :desc => "The environment Puppet is running in. For clients (e.g., `puppet agent`) this determines the environment itself, which is used to find modules and much more. For servers (i.e., `puppet master`) this provides the default environment for nodes we know nothing about." }, :diff_args => ["-u", "Which arguments to pass to the diff command when printing differences between files."], :diff => ["diff", "Which diff command to use when printing differences between files."], :show_diff => [false, "Whether to print a contextual diff when files are being replaced. The diff is printed on stdout, so this option is meaningless unless you are running Puppet interactively. This feature currently requires the `diff/lcs` Ruby library."], :daemonize => { :default => true, :desc => "Send the process into the background. This is the default.", :short => "D" }, :maximum_uid => [4294967290, "The maximum allowed UID. Some platforms use negative UIDs but then ship with tools that do not know how to handle signed ints, so the UIDs show up as huge numbers that can then not be fed back into the system. This is a hackish way to fail in a slightly more useful way when that happens."], :route_file => ["$confdir/routes.yaml", "The YAML file containing indirector route configuration."], :node_terminus => ["plain", "Where to find information about nodes."], :catalog_terminus => ["compiler", "Where to get node catalogs. This is useful to change if, for instance, you'd like to pre-compile catalogs and store them in memcached or some other easily-accessed store."], :facts_terminus => { :default => Puppet.application_name.to_s == "master" ? 'yaml' : 'facter', :desc => "The node facts terminus.", :hook => proc do |value| require 'puppet/node/facts' if value.to_s == "rest" Puppet::Node::Facts.indirection.cache_class = :yaml end end }, :inventory_terminus => [ "$facts_terminus", "Should usually be the same as the facts terminus" ], :httplog => { :default => "$logdir/http.log", :owner => "root", :mode => 0640, :desc => "Where the puppet agent web server logs." }, :http_proxy_host => ["none", "The HTTP proxy host to use for outgoing connections. Note: You may need to use a FQDN for the server hostname when using a proxy."], :http_proxy_port => [3128, "The HTTP proxy port to use for outgoing connections"], :filetimeout => [ 15, "The minimum time to wait (in seconds) between checking for updates in configuration files. This timeout determines how quickly Puppet checks whether a file (such as manifests or templates) has changed on disk." ], :queue_type => ["stomp", "Which type of queue to use for asynchronous processing."], :queue_type => ["stomp", "Which type of queue to use for asynchronous processing."], :queue_source => ["stomp://localhost:61613/", "Which type of queue to use for asynchronous processing. If your stomp server requires authentication, you can include it in the URI as long as your stomp client library is at least 1.1.1"], :async_storeconfigs => {:default => false, :desc => "Whether to use a queueing system to provide asynchronous database integration. Requires that `puppetqd` be running and that 'PSON' support for ruby be installed.", :hook => proc do |value| if value # This reconfigures the terminii for Node, Facts, and Catalog Puppet.settings[:storeconfigs] = true # But then we modify the configuration Puppet::Resource::Catalog.indirection.cache_class = :queue else raise "Cannot disable asynchronous storeconfigs in a running process" end end }, :thin_storeconfigs => {:default => false, :desc => "Boolean; wether storeconfigs store in the database only the facts and exported resources. If true, then storeconfigs performance will be higher and still allow exported/collected resources, but other usage external to Puppet might not work", :hook => proc do |value| Puppet.settings[:storeconfigs] = true if value end }, :config_version => ["", "How to determine the configuration version. By default, it will be the time that the configuration is parsed, but you can provide a shell script to override how the version is determined. The output of this script will be added to every log message in the reports, allowing you to correlate changes on your hosts to the source version on the server."], :zlib => [true, "Boolean; whether to use the zlib library", ], :prerun_command => ["", "A command to run before every agent run. If this command returns a non-zero return code, the entire Puppet run will fail."], :postrun_command => ["", "A command to run after every agent run. If this command returns a non-zero return code, the entire Puppet run will be considered to have failed, even though it might have performed work during the normal run."], :freeze_main => [false, "Freezes the 'main' class, disallowing any code to be added to it. This essentially means that you can't have any code outside of a node, class, or definition other than in the site manifest."] ) hostname = Facter["hostname"].value domain = Facter["domain"].value if domain and domain != "" fqdn = [hostname, domain].join(".") else fqdn = hostname end Puppet.setdefaults( :main, # We have to downcase the fqdn, because the current ssl stuff (as oppsed to in master) doesn't have good facilities for # manipulating naming. :certname => {:default => fqdn.downcase, :desc => "The name to use when handling certificates. Defaults to the fully qualified domain name.", :call_on_define => true, # Call our hook with the default value, so we're always downcased :hook => proc { |value| raise(ArgumentError, "Certificate names must be lower case; see #1168") unless value == value.downcase }}, :certdnsnames => ['', "The DNS names on the Server certificate as a colon-separated list. If it's anything other than an empty string, it will be used as an alias in the created certificate. By default, only the server gets an alias set up, and only for 'puppet'."], :certdir => { :default => "$ssldir/certs", :owner => "service", :desc => "The certificate directory." }, :ssldir => { :default => "$confdir/ssl", :mode => 0771, :owner => "service", :desc => "Where SSL certificates are kept." }, :publickeydir => { :default => "$ssldir/public_keys", :owner => "service", :desc => "The public key directory." }, :requestdir => { :default => "$ssldir/certificate_requests", :owner => "service", :desc => "Where host certificate requests are stored." }, :privatekeydir => { :default => "$ssldir/private_keys", :mode => 0750, :owner => "service", :desc => "The private key directory." }, :privatedir => { :default => "$ssldir/private", :mode => 0750, :owner => "service", :desc => "Where the client stores private certificate information." }, :passfile => { :default => "$privatedir/password", :mode => 0640, :owner => "service", :desc => "Where puppet agent stores the password for its private key. Generally unused." }, :hostcsr => { :default => "$ssldir/csr_$certname.pem", :mode => 0644, :owner => "service", :desc => "Where individual hosts store and look for their certificate requests." }, :hostcert => { :default => "$certdir/$certname.pem", :mode => 0644, :owner => "service", :desc => "Where individual hosts store and look for their certificates." }, :hostprivkey => { :default => "$privatekeydir/$certname.pem", :mode => 0600, :owner => "service", :desc => "Where individual hosts store and look for their private key." }, :hostpubkey => { :default => "$publickeydir/$certname.pem", :mode => 0644, :owner => "service", :desc => "Where individual hosts store and look for their public key." }, :localcacert => { :default => "$certdir/ca.pem", :mode => 0644, :owner => "service", :desc => "Where each client stores the CA certificate." }, :hostcrl => { :default => "$ssldir/crl.pem", :mode => 0644, :owner => "service", :desc => "Where the host's certificate revocation list can be found. This is distinct from the certificate authority's CRL." }, :certificate_revocation => [true, "Whether certificate revocation should be supported by downloading a Certificate Revocation List (CRL) to all clients. If enabled, CA chaining will almost definitely not work."] ) setdefaults( :ca, :ca_name => ["Puppet CA: $certname", "The name to use the Certificate Authority certificate."], :cadir => { :default => "$ssldir/ca", :owner => "service", :group => "service", :mode => 0770, :desc => "The root directory for the certificate authority." }, :cacert => { :default => "$cadir/ca_crt.pem", :owner => "service", :group => "service", :mode => 0660, :desc => "The CA certificate." }, :cakey => { :default => "$cadir/ca_key.pem", :owner => "service", :group => "service", :mode => 0660, :desc => "The CA private key." }, :capub => { :default => "$cadir/ca_pub.pem", :owner => "service", :group => "service", :desc => "The CA public key." }, :cacrl => { :default => "$cadir/ca_crl.pem", :owner => "service", :group => "service", :mode => 0664, :desc => "The certificate revocation list (CRL) for the CA. Will be used if present but otherwise ignored.", :hook => proc do |value| if value == 'false' Puppet.warning "Setting the :cacrl to 'false' is deprecated; Puppet will just ignore the crl if yours is missing" end end }, :caprivatedir => { :default => "$cadir/private", :owner => "service", :group => "service", :mode => 0770, :desc => "Where the CA stores private certificate information." }, :csrdir => { :default => "$cadir/requests", :owner => "service", :group => "service", :desc => "Where the CA stores certificate requests" }, :signeddir => { :default => "$cadir/signed", :owner => "service", :group => "service", :mode => 0770, :desc => "Where the CA stores signed certificates." }, :capass => { :default => "$caprivatedir/ca.pass", :owner => "service", :group => "service", :mode => 0660, :desc => "Where the CA stores the password for the private key" }, :serial => { :default => "$cadir/serial", :owner => "service", :group => "service", :mode => 0644, :desc => "Where the serial number for certificates is stored." }, :autosign => { :default => "$confdir/autosign.conf", :mode => 0644, :desc => "Whether to enable autosign. Valid values are true (which autosigns any key request, and is a very bad idea), false (which never autosigns any key request), and the path to a file, which uses that configuration file to determine which keys to sign."}, :allow_duplicate_certs => [false, "Whether to allow a new certificate request to overwrite an existing certificate."], :ca_days => ["", "How long a certificate should be valid. This parameter is deprecated, use ca_ttl instead"], :ca_ttl => ["5y", "The default TTL for new certificates; valid values must be an integer, optionally followed by one of the units 'y' (years of 365 days), 'd' (days), 'h' (hours), or 's' (seconds). The unit defaults to seconds. If this parameter is set, ca_days is ignored. Examples are '3600' (one hour) and '1825d', which is the same as '5y' (5 years) "], :ca_md => ["md5", "The type of hash used in certificates."], :req_bits => [2048, "The bit length of the certificates."], :keylength => [1024, "The bit length of keys."], :cert_inventory => { :default => "$cadir/inventory.txt", :mode => 0644, :owner => "service", :group => "service", :desc => "A Complete listing of all certificates" } ) # Define the config default. setdefaults( Puppet.settings[:name], :config => ["$confdir/puppet.conf", "The configuration file for #{Puppet[:name]}."], :pidfile => ["$rundir/$name.pid", "The pid file"], :bindaddress => ["", "The address a listening server should bind to. Mongrel servers default to 127.0.0.1 and WEBrick defaults to 0.0.0.0."], :servertype => {:default => "webrick", :desc => "The type of server to use. Currently supported options are webrick and mongrel. If you use mongrel, you will need a proxy in front of the process or processes, since Mongrel cannot speak SSL.", :call_on_define => true, # Call our hook with the default value, so we always get the correct bind address set. :hook => proc { |value| value == "webrick" ? Puppet.settings[:bindaddress] = "0.0.0.0" : Puppet.settings[:bindaddress] = "127.0.0.1" if Puppet.settings[:bindaddress] == "" } } ) setdefaults(:master, :user => ["puppet", "The user puppet master should run as."], :group => ["puppet", "The group puppet master should run as."], :manifestdir => ["$confdir/manifests", "Where puppet master looks for its manifests."], :manifest => ["$manifestdir/site.pp", "The entry-point manifest for puppet master."], :code => ["", "Code to parse directly. This is essentially only used by `puppet`, and should only be set if you're writing your own Puppet executable"], :masterlog => { :default => "$logdir/puppetmaster.log", :owner => "service", :group => "service", :mode => 0660, :desc => "Where puppet master logs. This is generally not used, since syslog is the default log destination." }, :masterhttplog => { :default => "$logdir/masterhttp.log", :owner => "service", :group => "service", :mode => 0660, :create => true, :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. Possible values are 'cert' (use the subject's CN in the client's certificate) and 'facter' (use the hostname that the client reported in its facts)"], :bucketdir => { :default => "$vardir/bucket", :mode => 0750, :owner => "service", :group => "service", :desc => "Where FileBucket files are stored." }, :rest_authconfig => [ "$confdir/auth.conf", "The configuration file that defines the rights to the different rest indirections. This can be used as a fine-grained authorization system for `puppet master`." ], :ca => [true, "Wether the master should function as a certificate authority."], :modulepath => {:default => "$confdir/modules:/usr/share/puppet/modules", :desc => "The search path for modules as a colon-separated list of directories.", :type => :setting }, # We don't want this to be considered a file, since it's multiple files. :ssl_client_header => ["HTTP_X_CLIENT_DN", "The header containing an authenticated client's SSL DN. Only used with Mongrel. This header must be set by the proxy to the authenticated client's SSL DN (e.g., `/CN=puppet.puppetlabs.com`). See http://projects.puppetlabs.com/projects/puppet/wiki/Using_Mongrel for more information."], :ssl_client_verify_header => ["HTTP_X_CLIENT_VERIFY", "The header containing the status message of the client verification. Only used with Mongrel. This header must be set by the proxy to 'SUCCESS' if the client successfully authenticated, and anything else otherwise. See http://projects.puppetlabs.com/projects/puppet/wiki/Using_Mongrel for more information."], # To make sure this directory is created before we try to use it on the server, we need # it to be in the server section (#1138). :yamldir => {:default => "$vardir/yaml", :owner => "service", :group => "service", :mode => "750", :desc => "The directory in which YAML data is stored, usually in a subdirectory."}, :server_datadir => {:default => "$vardir/server_data", :owner => "service", :group => "service", :mode => "750", :desc => "The directory in which serialized data is stored, usually in a subdirectory."}, :reports => ["store", "The list of reports to generate. All reports are looked for in `puppet/reports/name.rb`, and multiple report names should be comma-separated (whitespace is okay)." ], :reportdir => {:default => "$vardir/reports", :mode => 0750, :owner => "service", :group => "service", :desc => "The directory in which to store reports received from the client. Each client gets a separate subdirectory."}, :reporturl => ["http://localhost:3000/reports", "The URL used by the http reports processor to send reports"], :fileserverconfig => ["$confdir/fileserver.conf", "Where the fileserver configuration is stored."], :strict_hostname_checking => [false, "Whether to only search for the complete hostname as it is in the certificate when searching for node information in the catalogs."] ) setdefaults(:metrics, :rrddir => {:default => "$vardir/rrd", :mode => 0750, :owner => "service", :group => "service", :desc => "The directory where RRD database files are stored. Directories for each reporting host will be created under this directory." }, :rrdinterval => ["$runinterval", "How often RRD should expect data. This should match how often the hosts report back to the server."] ) setdefaults(:agent, :localconfig => { :default => "$statedir/localconfig", :owner => "root", :mode => 0660, :desc => "Where puppet agent caches the local configuration. An extension indicating the cache format is added automatically."}, :statefile => { :default => "$statedir/state.yaml", :mode => 0660, :desc => "Where puppet agent and puppet master store state associated with the running configuration. In the case of puppet master, this file reflects the state discovered through interacting with clients." }, :clientyamldir => {:default => "$vardir/client_yaml", :mode => "750", :desc => "The directory in which client-side YAML data is stored."}, :client_datadir => {:default => "$vardir/client_data", :mode => "750", :desc => "The directory in which serialized data is stored on the client."}, :classfile => { :default => "$statedir/classes.txt", :owner => "root", :mode => 0644, :desc => "The file in which puppet agent stores a list of the classes associated with the retrieved configuration. Can be loaded in the separate `puppet` executable using the `--loadclasses` option."}, :puppetdlog => { :default => "$logdir/puppetd.log", :owner => "root", :mode => 0640, :desc => "The log file for puppet agent. This is generally not used." }, :server => ["puppet", "The server to which server puppet agent should connect"], :ignoreschedules => [false, "Boolean; whether puppet agent should ignore schedules. This is useful for initial puppet agent runs."], :puppetport => [8139, "Which port puppet agent listens on."], :noop => [false, "Whether puppet agent should be run in noop mode."], :runinterval => [1800, # 30 minutes "How often puppet agent applies the client configuration; in seconds."], :listen => [false, "Whether puppet agent should listen for connections. If this is true, then by default only the `runner` server is started, which allows remote authorized and authenticated nodes to connect and trigger `puppet agent` runs."], :ca_server => ["$server", "The server to use for certificate authority requests. It's a separate server because it cannot and does not need to horizontally scale."], :ca_port => ["$masterport", "The port to use for the certificate authority."], :catalog_format => { :default => "", :desc => "(Deprecated for 'preferred_serialization_format') What format to use to dump the catalog. Only supports 'marshal' and 'yaml'. Only matters on the client, since it asks the server for a specific format.", :hook => proc { |value| if value Puppet.warning "Setting 'catalog_format' is deprecated; use 'preferred_serialization_format' instead." Puppet.settings[:preferred_serialization_format] = value end } }, :preferred_serialization_format => ["pson", "The preferred means of serializing ruby instances for passing over the wire. This won't guarantee that all instances will be serialized using this method, since not all classes can be guaranteed to support this format, but it will be used for all classes that support it."], :puppetdlockfile => [ "$statedir/puppetdlock", "A lock file to temporarily stop puppet agent from doing anything."], :usecacheonfailure => [true, "Whether to use the cached configuration when the remote configuration will not compile. This option is useful for testing new configurations, where you want to fix the broken configuration rather than reverting to a known-good one." ], :use_cached_catalog => [false, "Whether to only use the cached catalog rather than compiling a new catalog on every run. Puppet can be run with this enabled by default and then selectively disabled when a recompile is desired."], :ignorecache => [false, "Ignore cache and always recompile the configuration. This is useful for testing new configurations, where the local cache may in fact be stale even if the timestamps are up to date - if the facts change or if the server changes." ], :downcasefacts => [false, "Whether facts should be made all lowercase when sent to the server."], :dynamicfacts => ["memorysize,memoryfree,swapsize,swapfree", "Facts that are dynamic; these facts will be ignored when deciding whether changed facts should result in a recompile. Multiple facts should be comma-separated."], :splaylimit => ["$runinterval", "The maximum time to delay before runs. Defaults to being the same as the run interval."], :splay => [false, "Whether to sleep for a pseudo-random (but consistent) amount of time before a run."], :clientbucketdir => { :default => "$vardir/clientbucket", :mode => 0750, :desc => "Where FileBucket files are stored locally." }, :configtimeout => [120, "How long the client should wait for the configuration to be retrieved before considering it a failure. This can help reduce flapping if too many clients contact the server at one time." ], :reportserver => { :default => "$server", :call_on_define => false, :desc => "(Deprecated for 'report_server') The server to which to send transaction reports.", :hook => proc do |value| Puppet.settings[:report_server] = value if value end }, :report_server => ["$server", "The server to send transaction reports to." ], :report_port => ["$masterport", "The port to communicate with the report_server." ], :inventory_server => ["$server", "The server to send facts to." ], :inventory_port => ["$masterport", "The port to communicate with the inventory_server." ], :report => [true, "Whether to send reports after every transaction." ], :lastrunfile => { :default => "$statedir/last_run_summary.yaml", :mode => 0660, :desc => "Where puppet agent stores the last run report summary in yaml format." }, :lastrunreport => { :default => "$statedir/last_run_report.yaml", :mode => 0660, :desc => "Where puppet agent stores the last run report in yaml format." }, :graph => [false, "Whether to create dot graph files for the different configuration graphs. These dot files can be interpreted by tools like OmniGraffle or dot (which is part of ImageMagick)."], :graphdir => ["$statedir/graphs", "Where to store dot-outputted graphs."], :http_compression => [false, "Allow http compression in REST communication with the master. This setting might improve performance for agent -> master communications over slow WANs. Your puppetmaster needs to support compression (usually by activating some settings in a reverse-proxy in front of the puppetmaster, which rules out webrick). It is harmless to activate this settings if your master doesn't support compression, but if it supports it, this setting might reduce performance on high-speed LANs."] ) setdefaults(:inspect, :archive_files => [false, "During an inspect run, whether to archive files whose contents are audited to a file bucket."], :archive_file_server => ["$server", "During an inspect run, the file bucket server to archive files to if archive_files is set."] ) # Plugin information. setdefaults( :main, :plugindest => ["$libdir", "Where Puppet should store plugins that it pulls down from the central server."], :pluginsource => ["puppet://$server/plugins", "From where to retrieve plugins. The standard Puppet `file` type is used for retrieval, so anything that is a valid file source can be used here."], :pluginsync => [false, "Whether plugins should be synced with the central server."], :pluginsignore => [".svn CVS .git", "What files to ignore when pulling down plugins."] ) # Central fact information. setdefaults( :main, :factpath => {:default => "$vardir/lib/facter:$vardir/facts", :desc => "Where Puppet should look for facts. Multiple directories should be colon-separated, like normal PATH variables.", :call_on_define => true, # Call our hook with the default value, so we always get the value added to facter. :type => :setting, # Don't consider it a file, because it could be multiple colon-separated files :hook => proc { |value| Facter.search(value) if Facter.respond_to?(:search) }}, :factdest => ["$vardir/facts/", "Where Puppet should store facts that it pulls down from the central server."], :factsource => ["puppet://$server/facts/", "From where to retrieve facts. The standard Puppet `file` type is used for retrieval, so anything that is a valid file source can be used here."], :factsync => [false, "Whether facts should be synced with the central server."], :factsignore => [".svn CVS", "What files to ignore when pulling down facts."] ) setdefaults( :tagmail, :tagmap => ["$confdir/tagmail.conf", "The mapping between reporting tags and email addresses."], :sendmail => [which('sendmail') || '', "Where to find the sendmail binary with which to send email."], :reportfrom => ["report@" + [Facter["hostname"].value, Facter["domain"].value].join("."), "The 'from' email address for the reports."], :smtpserver => ["none", "The server through which to send email reports."] ) setdefaults( :rails, :dblocation => { :default => "$statedir/clientconfigs.sqlite3", :mode => 0660, :owner => "service", :group => "service", :desc => "The database cache for client configurations. Used for querying within the language." }, :dbadapter => [ "sqlite3", "The type of database to use." ], :dbmigrate => [ false, "Whether to automatically migrate the database." ], :dbname => [ "puppet", "The name of the database to use." ], :dbserver => [ "localhost", "The database server for caching. Only used when networked databases are used."], :dbport => [ "", "The database password for caching. Only used when networked databases are used."], :dbuser => [ "puppet", "The database user for caching. Only used when networked databases are used."], :dbpassword => [ "puppet", "The database password for caching. Only used when networked databases are used."], :dbconnections => [ '', "The number of database connections for networked databases. Will be ignored unless the value is a positive integer."], :dbsocket => [ "", "The database socket location. Only used when networked databases are used. Will be ignored if the value is an empty string."], :railslog => {:default => "$logdir/rails.log", :mode => 0600, :owner => "service", :group => "service", :desc => "Where Rails-specific logs are sent" }, :rails_loglevel => ["info", "The log level for Rails connections. The value must be a valid log level within Rails. Production environments normally use `info` and other environments normally use `debug`."] ) setdefaults( :couchdb, :couchdb_url => ["http://127.0.0.1:5984/puppet", "The url where the puppet couchdb database will be created"] ) setdefaults( :transaction, :tags => ["", "Tags to use to find resources. If this is set, then only resources tagged with the specified tags will be applied. Values must be comma-separated."], :evaltrace => [false, "Whether each resource should log when it is being evaluated. This allows you to interactively see exactly what is being done."], :summarize => [false, "Whether to print a transaction summary." ] ) setdefaults( :main, :external_nodes => ["none", "An external command that can produce node information. The output must be a YAML dump of a hash, and that hash must have one or both of `classes` and `parameters`, where `classes` is an array and `parameters` is a hash. For unknown nodes, the commands should exit with a non-zero exit code. This command makes it straightforward to store your node mapping information in other data sources like databases."]) setdefaults( :ldap, :ldapnodes => [false, "Whether to search for node configurations in LDAP. See http://projects.puppetlabs.com/projects/puppet/wiki/LDAP_Nodes for more information."], :ldapssl => [false, "Whether SSL should be used when searching for nodes. Defaults to false because SSL usually requires certificates to be set up on the client side."], :ldaptls => [false, "Whether TLS should be used when searching for nodes. Defaults to false because TLS usually requires certificates to be set up on the client side."], :ldapserver => ["ldap", "The LDAP server. Only used if `ldapnodes` is enabled."], :ldapport => [389, "The LDAP port. Only used if `ldapnodes` is enabled."], :ldapstring => ["(&(objectclass=puppetClient)(cn=%s))", "The search string used to find an LDAP node."], :ldapclassattrs => ["puppetclass", "The LDAP attributes to use to define Puppet classes. Values should be comma-separated."], :ldapstackedattrs => ["puppetvar", "The LDAP attributes that should be stacked to arrays by adding the values in all hierarchy elements of the tree. Values should be comma-separated."], :ldapattrs => ["all", "The LDAP attributes to include when querying LDAP for nodes. All returned attributes are set as variables in the top-level scope. Multiple values should be comma-separated. The value 'all' returns all attributes."], :ldapparentattr => ["parentnode", "The attribute to use to define the parent node."], :ldapuser => ["", "The user to use to connect to LDAP. Must be specified as a full DN."], :ldappassword => ["", "The password to use to connect to LDAP."], :ldapbase => ["", "The search base for LDAP searches. It's impossible to provide a meaningful default here, although the LDAP libraries might have one already set. Generally, it should be the 'ou=Hosts' branch under your main directory."] ) setdefaults(:master, :storeconfigs => {:default => false, :desc => "Whether to store each client's configuration. This requires ActiveRecord from Ruby on Rails.", :call_on_define => true, # Call our hook with the default value, so we always get the libdir set. :hook => proc do |value| require 'puppet/node' require 'puppet/node/facts' if value require 'puppet/rails' raise "StoreConfigs not supported without ActiveRecord 2.1 or higher" unless Puppet.features.rails? Puppet::Resource::Catalog.indirection.cache_class = :active_record unless Puppet.settings[:async_storeconfigs] Puppet::Node::Facts.indirection.cache_class = :active_record Puppet::Node.indirection.cache_class = :active_record end end } ) # This doesn't actually work right now. setdefaults( :parser, :lexical => [false, "Whether to use lexical scoping (vs. dynamic)."], :templatedir => ["$vardir/templates", "Where Puppet looks for template files. Can be a list of colon-seperated directories." ] ) setdefaults( :puppetdoc, :document_all => [false, "Document all resources"] ) end 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 @@ -1,796 +1,796 @@ # vim: syntax=ruby # the parser class Puppet::Parser::Parser token STRING DQPRE DQMID DQPOST token LBRACK RBRACK LBRACE RBRACE SYMBOL FARROW COMMA TRUE token FALSE EQUALS APPENDS LESSEQUAL NOTEQUAL DOT COLON LLCOLLECT RRCOLLECT token QMARK LPAREN RPAREN ISEQUAL GREATEREQUAL GREATERTHAN LESSTHAN token IF ELSE IMPORT DEFINE ELSIF VARIABLE CLASS INHERITS NODE BOOLEAN token NAME SEMIC CASE DEFAULT AT LCOLLECT RCOLLECT CLASSNAME CLASSREF token NOT OR AND UNDEF PARROW PLUS MINUS TIMES DIV LSHIFT RSHIFT UMINUS token MATCH NOMATCH REGEX IN_EDGE OUT_EDGE IN_EDGE_SUB OUT_EDGE_SUB token IN prechigh right NOT nonassoc UMINUS left IN MATCH NOMATCH left TIMES DIV left MINUS PLUS left LSHIFT RSHIFT left NOTEQUAL ISEQUAL left GREATEREQUAL GREATERTHAN LESSTHAN LESSEQUAL left AND left OR preclow rule program: statements_and_declarations | nil statements_and_declarations: statement_or_declaration { result = ast AST::ASTArray, :children => (val[0] ? [val[0]] : []) } | statements_and_declarations statement_or_declaration { if val[1] val[0].push(val[1]) end result = val[0] } # statements is like statements_and_declarations, but it doesn't allow # nested definitions, classes, or nodes. statements: statements_and_declarations { val[0].each do |stmt| if stmt.is_a?(AST::TopLevelConstruct) error "Classes, definitions, and nodes may only appear at toplevel or inside other classes", \ :line => stmt.context[:line], :file => stmt.context[:file] end end result = val[0] } # The main list of valid statements statement_or_declaration: resource | virtualresource | collection | assignment | casestatement | ifstatement_begin | import | fstatement | definition | hostclass | nodedef | resourceoverride | append | relationship relationship: relationship_side edge relationship_side { result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context) } | relationship edge relationship_side { result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context) } relationship_side: resource | resourceref | collection edge: IN_EDGE | OUT_EDGE | IN_EDGE_SUB | OUT_EDGE_SUB fstatement: NAME LPAREN funcvalues RPAREN { result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => val[2], :ftype => :statement } | NAME LPAREN funcvalues COMMA RPAREN { result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => val[2], :ftype => :statement } | NAME LPAREN RPAREN { result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => AST::ASTArray.new({}), :ftype => :statement } | NAME funcvalues { result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => val[1], :ftype => :statement } funcvalues: namestring { result = aryfy(val[0]) } | resourceref { result = aryfy(val[0]) } | funcvalues COMMA namestring { val[0].push(val[2]) result = val[0] } | funcvalues COMMA resourceref { val[0].push(val[2]) result = val[0] } # This is *almost* an rvalue, but I couldn't get a full # rvalue to work without scads of shift/reduce conflicts. namestring: name | variable | type | boolean | funcrvalue | selector | quotedtext | hasharrayaccesses | CLASSNAME { result = ast AST::Name, :value => val[0][:value] } resource: classname LBRACE resourceinstances endsemi RBRACE { @lexer.commentpop result = ast(AST::Resource, :type => val[0], :instances => val[2]) } | classname LBRACE params endcomma RBRACE { # This is a deprecated syntax. error "All resource specifications require names" } | classref LBRACE params endcomma RBRACE { # a defaults setting for a type @lexer.commentpop result = ast(AST::ResourceDefaults, :type => val[0], :parameters => val[2]) } # Override a value set elsewhere in the configuration. resourceoverride: resourceref LBRACE anyparams endcomma RBRACE { @lexer.commentpop result = ast AST::ResourceOverride, :object => val[0], :parameters => val[2] } # Exported and virtual resources; these don't get sent to the client # unless they get collected elsewhere in the db. 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 error "Defaults are not virtualizable" if val[1].is_a? AST::ResourceDefaults method = type.to_s + "=" # Just mark our resource as exported and pass it through. val[1].send(method, true) result = val[1] } at: AT { result = :virtual } | AT AT { result = :exported } # A collection statement. Currently supports no arguments at all, but eventually # will, I assume. collection: classref collectrhand LBRACE anyparams endcomma RBRACE { @lexer.commentpop Puppet.warning addcontext("Collection names must now be capitalized") if val[0] =~ /^[a-z]/ type = val[0].downcase args = {:type => type} if val[1].is_a?(AST::CollExpr) args[:query] = val[1] args[:query].type = type args[:form] = args[:query].form 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] result = ast AST::Collection, args } | classref collectrhand { if val[0] =~ /^[a-z]/ Puppet.warning addcontext("Collection names must now be capitalized") end type = val[0].downcase args = {:type => type } if val[1].is_a?(AST::CollExpr) args[:query] = val[1] args[:query].type = type args[:form] = args[:query].form 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 } collectrhand: LCOLLECT collstatements RCOLLECT { if val[1] result = val[1] result.form = :virtual else result = :virtual end } | LLCOLLECT collstatements RRCOLLECT { if val[1] result = val[1] result.form = :exported else result = :exported end } # A mini-language for handling collection comparisons. This is organized # to avoid the need for precedence indications. collstatements: nil | collstatement | collstatements colljoin collstatement { result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2] } collstatement: collexpr | LPAREN collstatements RPAREN { result = val[1] result.parens = true } colljoin: AND { result=val[0][:value] } | OR { result=val[0][:value] } collexpr: colllval ISEQUAL simplervalue { result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2] #result = ast AST::CollExpr #result.push *val } | colllval NOTEQUAL simplervalue { result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2] #result = ast AST::CollExpr #result.push *val } colllval: variable | name resourceinst: resourcename COLON params endcomma { result = ast AST::ResourceInstance, :title => val[0], :parameters => val[2] } resourceinstances: resourceinst { result = aryfy(val[0]) } | resourceinstances SEMIC resourceinst { val[0].push val[2] result = val[0] } endsemi: # nothing | SEMIC undef: UNDEF { result = ast AST::Undef, :value => :undef } name: NAME { result = ast AST::Name, :value => val[0][:value], :line => val[0][:line] } type: CLASSREF { result = ast AST::Type, :value => val[0][:value], :line => val[0][:line] } resourcename: quotedtext | name | type | selector | variable | array | hasharrayaccesses assignment: VARIABLE EQUALS expression { raise Puppet::ParseError, "Cannot assign to variables in other namespaces" if val[0][:value] =~ /::/ # this is distinct from referencing a variable variable = ast AST::Name, :value => val[0][:value], :line => val[0][:line] result = ast AST::VarDef, :name => variable, :value => val[2], :line => val[0][:line] } | hasharrayaccess EQUALS expression { result = ast AST::VarDef, :name => val[0], :value => val[2] } append: VARIABLE APPENDS expression { variable = ast AST::Name, :value => val[0][:value], :line => val[0][:line] result = ast AST::VarDef, :name => variable, :value => val[2], :append => true, :line => val[0][:line] } params: # nothing { result = ast AST::ASTArray } | param { result = aryfy(val[0]) } | params COMMA param { val[0].push(val[2]) result = val[0] } param: NAME FARROW rvalue { result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2] } addparam: NAME PARROW rvalue { result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2], :add => true } anyparam: param | addparam anyparams: # nothing { result = ast AST::ASTArray } | anyparam { result = aryfy(val[0]) } | anyparams COMMA anyparam { val[0].push(val[2]) result = val[0] } rvalues: rvalue { result = aryfy(val[0]) } | rvalues comma rvalue { result = val[0].push(val[2]) } simplervalue: quotedtext | name | type | boolean | selector | variable rvalue: quotedtext | name | type | boolean | selector | variable | array | hash | hasharrayaccesses | resourceref | funcrvalue | undef # We currently require arguments in these functions. funcrvalue: NAME LPAREN funcvalues RPAREN { result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => val[2], :ftype => :rvalue } | NAME LPAREN RPAREN { result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => AST::ASTArray.new({}), :ftype => :rvalue } quotedtext: STRING { result = ast AST::String, :value => val[0][:value], :line => val[0][:line] } | DQPRE dqrval { result = ast AST::Concat, :value => [ast(AST::String,val[0])]+val[1], :line => val[0][:line] } dqrval: expression dqtail { result = [val[0]] + val[1] } dqtail: DQPOST { result = [ast(AST::String,val[0])] } | DQMID dqrval { result = [ast(AST::String,val[0])] + val[1] } boolean: BOOLEAN { result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line] } resourceref: NAME LBRACK rvalues RBRACK { Puppet.warning addcontext("Deprecation notice: Resource references should now be capitalized") result = ast AST::ResourceReference, :type => val[0][:value], :line => val[0][:line], :title => val[2] } | classref LBRACK rvalues RBRACK { result = ast AST::ResourceReference, :type => val[0], :title => val[2] } ifstatement_begin: IF ifstatement { result = val[1] } ifstatement: expression LBRACE statements RBRACE else { @lexer.commentpop args = { :test => val[0], :statements => val[2] } args[:else] = val[4] if val[4] result = ast AST::IfStatement, args } | expression LBRACE RBRACE else { @lexer.commentpop args = { :test => val[0], :statements => ast(AST::Nop) } args[:else] = val[3] if val[3] result = ast AST::IfStatement, args } else: # nothing | ELSIF ifstatement { result = ast AST::Else, :statements => val[1] } | ELSE LBRACE statements RBRACE { @lexer.commentpop result = ast AST::Else, :statements => val[2] } | ELSE LBRACE RBRACE { @lexer.commentpop result = ast AST::Else, :statements => ast(AST::Nop) } # Unlike yacc/bison, it seems racc # gives tons of shift/reduce warnings # with the following syntax: # # expression: ... # | expression arithop expressio { ... } # # arithop: PLUS | MINUS | DIVIDE | TIMES ... # # So I had to develop the expression by adding one rule # per operator :-( expression: rvalue | expression IN rvalue { result = ast AST::InOperator, :lval => val[0], :rval => val[2] } | expression MATCH regex { result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression NOMATCH regex { result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression PLUS expression { result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression MINUS expression { result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression DIV expression { result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression TIMES expression { result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression LSHIFT expression { result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression RSHIFT expression { result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | MINUS expression =UMINUS { result = ast AST::Minus, :value => val[1] } | expression NOTEQUAL expression { result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression ISEQUAL expression { result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression GREATERTHAN expression { result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression GREATEREQUAL expression { result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression LESSTHAN expression { result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression LESSEQUAL expression { result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | NOT expression { result = ast AST::Not, :value => val[1] } | expression AND expression { result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression OR expression { result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | LPAREN expression RPAREN { result = val[1] } casestatement: CASE rvalue LBRACE caseopts RBRACE { @lexer.commentpop result = ast AST::CaseStatement, :test => val[1], :options => val[3] } caseopts: caseopt { result = aryfy(val[0]) } | caseopts caseopt { val[0].push val[1] result = val[0] } caseopt: casevalues COLON LBRACE statements RBRACE { @lexer.commentpop result = ast AST::CaseOpt, :value => val[0], :statements => val[3] } | casevalues COLON LBRACE RBRACE { @lexer.commentpop result = ast( AST::CaseOpt, :value => val[0], :statements => ast(AST::ASTArray) ) } casevalues: selectlhand { result = aryfy(val[0]) } | casevalues COMMA selectlhand { val[0].push(val[2]) result = val[0] } selector: selectlhand QMARK svalues { result = ast AST::Selector, :param => val[0], :values => val[2] } svalues: selectval | LBRACE sintvalues endcomma RBRACE { @lexer.commentpop result = val[1] } sintvalues: selectval | sintvalues comma selectval { if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] else result = ast AST::ASTArray, :children => [val[0],val[2]] end } selectval: selectlhand FARROW rvalue { result = ast AST::ResourceParam, :param => val[0], :value => val[2] } selectlhand: name | type | quotedtext | variable | funcrvalue | boolean | undef | hasharrayaccess | DEFAULT { result = ast AST::Default, :value => val[0][:value], :line => val[0][:line] } | regex # These are only used for importing, and we don't interpolate there. string: STRING { result = [val[0][:value]] } strings: string | strings COMMA string { result = val[0] += val[2] } import: IMPORT strings { val[1].each do |file| import(file) end result = nil } # Disable definition inheritance for now. 8/27/06, luke #definition: DEFINE NAME argumentlist parent LBRACE statements RBRACE { definition: DEFINE classname argumentlist LBRACE statements RBRACE { @lexer.commentpop result = Puppet::Parser::AST::Definition.new(classname(val[1]), ast_context(true).merge(:arguments => val[2], :code => val[4], :line => val[0][:line])) @lexer.indefine = false #} | DEFINE NAME argumentlist parent LBRACE RBRACE { } | DEFINE classname argumentlist LBRACE RBRACE { @lexer.commentpop result = Puppet::Parser::AST::Definition.new(classname(val[1]), ast_context(true).merge(:arguments => val[2], :line => val[0][:line])) @lexer.indefine = false } #hostclass: CLASS NAME argumentlist parent LBRACE statements RBRACE { hostclass: CLASS classname argumentlist classparent LBRACE statements_and_declarations RBRACE { @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop result = Puppet::Parser::AST::Hostclass.new(classname(val[1]), ast_context(true).merge(:arguments => val[2], :parent => val[3], :code => val[5], :line => val[0][:line])) } | CLASS classname argumentlist classparent LBRACE RBRACE { @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop result = Puppet::Parser::AST::Hostclass.new(classname(val[1]), ast_context(true).merge(:arguments => val[2], :parent => val[3], :line => val[0][:line])) } nodedef: NODE hostnames nodeparent LBRACE statements RBRACE { @lexer.commentpop result = Puppet::Parser::AST::Node.new(val[1], ast_context(true).merge(:parent => val[2], :code => val[4], :line => val[0][:line])) } | NODE hostnames nodeparent LBRACE RBRACE { @lexer.commentpop result = Puppet::Parser::AST::Node.new(val[1], ast_context(true).merge(:parent => val[2], :line => val[0][:line])) } classref: CLASSREF { result = val[0][:value] } classname: NAME { result = val[0][:value] } | CLASSNAME { result = val[0][:value] } | CLASS { result = "class" } # Multiple hostnames, as used for node names. These are all literal # strings, not AST objects. hostnames: nodename { result = [result] } | hostnames COMMA nodename { result = val[0] result << val[2] } nodename: hostname { result = ast AST::HostName, :value => val[0] } hostname: NAME { result = val[0][:value] } | STRING { result = val[0][:value] } | DEFAULT { result = val[0][:value] } | regex nil: { result = nil } nothing: { result = ast AST::ASTArray, :children => [] } argumentlist: nil | LPAREN nothing RPAREN { result = nil } | LPAREN arguments RPAREN { result = val[1] result = [result] unless result[0].is_a?(Array) } arguments: argument | arguments COMMA argument { result = val[0] result = [result] unless result[0].is_a?(Array) result << val[2] } argument: NAME EQUALS rvalue { Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") result = [val[0][:value], val[2]] } | NAME { Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") result = [val[0][:value]] } | VARIABLE EQUALS rvalue { result = [val[0][:value], val[2]] } | VARIABLE { result = [val[0][:value]] } nodeparent: nil | INHERITS hostname { result = val[1] } classparent: nil | INHERITS classnameordefault { result = val[1] } classnameordefault: classname | DEFAULT variable: VARIABLE { result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line] } array: LBRACK rvalues RBRACK { result = val[1] } | LBRACK rvalues COMMA RBRACK { result = val[1] } | LBRACK RBRACK { result = ast AST::ASTArray } comma: FARROW | COMMA endcomma: # nothing | COMMA { result = nil } regex: REGEX { result = ast AST::Regex, :value => val[0][:value] } hash: LBRACE hashpairs RBRACE { if val[1].instance_of?(AST::ASTHash) result = val[1] else result = ast AST::ASTHash, { :value => val[1] } end } | LBRACE hashpairs COMMA RBRACE { if val[1].instance_of?(AST::ASTHash) result = val[1] else result = ast AST::ASTHash, { :value => val[1] } end } | LBRACE RBRACE { result = ast AST::ASTHash } hashpairs: hashpair | hashpairs COMMA hashpair { if val[0].instance_of?(AST::ASTHash) result = val[0].merge(val[2]) else result = ast AST::ASTHash, :value => val[0] result.merge(val[2]) end } hashpair: key FARROW rvalue { result = ast AST::ASTHash, { :value => { val[0] => val[2] } } } key: NAME { result = val[0][:value] } | quotedtext { result = val[0] } hasharrayaccess: VARIABLE LBRACK rvalue RBRACK { result = ast AST::HashOrArrayAccess, :variable => val[0][:value], :key => val[2] } hasharrayaccesses: hasharrayaccess | hasharrayaccesses LBRACK rvalue RBRACK { result = ast AST::HashOrArrayAccess, :variable => val[0], :key => val[2] } end ---- header ---- require 'puppet' require 'puppet/util/loadedfile' require 'puppet/parser/lexer' require 'puppet/parser/ast' module Puppet class ParseError < Puppet::Error; end class ImportError < Racc::ParseError; end class AlreadyImportedError < ImportError; end end ---- inner ---- # It got too annoying having code in a file that needs to be compiled. require 'puppet/parser/parser_support' # Make emacs happy # Local Variables: # mode: ruby # End: 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 @@ -1,2616 +1,2616 @@ # # DO NOT MODIFY!!!! # This file is automatically generated by Racc 1.4.6 # from Racc grammer file "". # require 'racc/parser.rb' require 'puppet' require 'puppet/util/loadedfile' require 'puppet/parser/lexer' require 'puppet/parser/ast' module Puppet class ParseError < Puppet::Error; end class ImportError < Racc::ParseError; end class AlreadyImportedError < ImportError; end end module Puppet module Parser class Parser < Racc::Parser module_eval(<<'...end grammar.ra/module_eval...', 'grammar.ra', 789) # It got too annoying having code in a file that needs to be compiled. require 'puppet/parser/parser_support' # Make emacs happy # Local Variables: # mode: ruby # End: ...end grammar.ra/module_eval... ##### State transition tables begin ### racc_action_table = [ 242, 243, 55, 68, 71, 299, 157, 55, 78, 117, 199, 68, 71, 181, 186, -169, 36, 112, 341, 113, 38, 55, 177, 179, 182, 185, 170, 10, 68, 71, 231, 158, 114, 292, 293, 356, 257, 368, 68, 71, 59, 198, 100, 61, 103, 59, 180, 184, 61, 198, 189, 172, 173, 174, 176, 178, 111, 183, 187, 59, 95, 66, 61, 60, 175, 79, 253, 154, 60, 88, 345, 66, 233, 229, 139, 79, 81, 231, 84, 88, 68, 71, 60, 225, 74, 99, 68, 71, 84, 60, 100, 90, 103, 203, 203, 292, 293, 223, 296, 60, 203, 117, 231, 78, 202, 202, 295, 240, 95, 209, 209, 202, 166, 66, 186, 170, 209, 79, 253, 66, 241, 88, 177, 79, 81, 334, 139, 88, 68, 71, 84, 310, 74, 99, 68, 71, 84, 357, 100, 90, 103, 60, 183, 187, 311, 358, 307, 60, 308, 175, 189, 172, 173, 174, 176, 178, 95, 183, 187, 36, 309, 66, 288, 38, 175, 79, 253, 66, 218, 88, 10, 79, 81, 219, 139, 88, 338, 312, 84, 336, 74, 99, 68, 71, 84, 218, 100, 90, 103, 60, 219, 173, 174, 217, 285, 60, 183, 187, 257, 284, 203, 68, 71, 175, 95, 100, 36, 103, 68, 71, 127, 202, 100, 316, 103, 66, 209, 10, 15, 79, 81, 173, 174, 88, 183, 187, 183, 187, 74, 99, 95, 175, 84, 175, 66, 90, 113, 338, 79, 81, 336, 66, 88, 60, 213, 79, 81, 74, 319, 88, 216, 84, 68, 71, 74, 99, 213, 49, 84, 68, 71, 90, 60, 100, 215, 103, 47, 48, 287, 60, 154, 286, 189, 172, 173, 174, 324, 68, 71, 183, 187, 100, 213, 103, 36, 66, 175, 327, 38, 79, 253, 314, 66, 88, 200, 10, 79, 81, 139, 95, 88, -171, 84, 68, 71, 74, 330, 78, 170, 84, 66, -172, 259, 60, 79, 81, 257, 258, 88, -173, 60, -168, -170, 74, 99, 70, 228, 84, 68, 71, 90, 36, 100, -167, 103, 127, 66, -167, 60, 161, 79, 81, 10, 15, 88, -169, -171, 297, 72, 74, 95, 257, 258, 84, 68, 71, 36, -172, 100, -168, 38, 66, 112, -170, 60, 79, 81, 10, 15, 88, -22, -22, -22, -22, 74, 99, 68, 71, 84, 290, 100, 90, 103, 292, 293, -167, 167, 66, 166, 60, 335, 79, 253, 229, -187, 88, 339, 68, 71, 161, 139, 100, 49, 103, 84, 43, 44, 40, 41, 66, 234, -169, -174, 79, 81, 60, 156, 88, 154, 68, 71, 354, 74, 100, 122, 103, 84, 122, 359, 161, 66, 60, -170, 53, 79, 81, 229, 60, 88, 366, 68, 71, 52, 74, 100, -168, 103, 84, 43, 44, 40, 41, 66, 232, 51, 373, 79, 81, 60, 374, 88, -169, 95, -167, -170, 74, 68, 71, -168, 84, 100, -172, 103, 66, 60, 376, 45, 79, 81, -222, 60, 88, -24, -24, -24, -24, 74, 99, 95, 234, 84, 379, 238, 90, 39, 384, 68, 71, 385, 66, 100, 60, 103, 79, 81, nil, nil, 88, nil, nil, nil, nil, 74, 99, nil, nil, 84, nil, 95, 90, nil, nil, 68, 71, nil, nil, 100, 60, 103, 66, nil, nil, nil, 79, 81, nil, nil, 88, nil, nil, nil, nil, 74, 99, 95, nil, 84, nil, nil, 90, nil, nil, 68, 71, nil, 66, 100, 60, 103, 79, 81, nil, nil, 88, nil, nil, nil, nil, 74, 99, nil, nil, 84, nil, 95, 90, nil, nil, 68, 71, nil, nil, 100, 60, 103, 66, nil, nil, nil, 79, 81, nil, nil, 88, nil, nil, nil, nil, 74, 99, 95, nil, 84, nil, nil, 90, nil, nil, 68, 71, nil, 66, 100, 60, 103, 79, 81, nil, nil, 88, nil, nil, nil, nil, 74, 99, nil, nil, 84, nil, 95, 90, nil, nil, 68, 71, nil, nil, 100, 60, 103, 66, nil, nil, nil, 79, 81, nil, nil, 88, 68, 71, nil, nil, 74, 99, 68, 71, 84, nil, 100, 90, 103, nil, nil, nil, nil, 66, nil, 60, nil, 79, 81, nil, nil, 88, nil, nil, 95, nil, 74, 68, 71, 66, 84, 100, nil, 79, 253, 66, nil, 88, nil, 79, 81, 60, 139, 88, nil, nil, 84, nil, 74, 99, nil, nil, 84, 68, 71, 90, nil, 60, nil, nil, 66, nil, nil, 60, 79, 144, nil, nil, 88, nil, nil, nil, nil, 139, 68, 71, nil, 84, 100, nil, 103, nil, nil, nil, nil, nil, 66, nil, 60, nil, 79, 253, 68, 71, 88, nil, 100, nil, 103, 139, nil, nil, nil, 84, nil, nil, nil, 66, nil, nil, nil, 79, 81, nil, 60, 88, nil, 68, 71, nil, 74, nil, nil, nil, 84, 66, nil, nil, nil, 79, 81, nil, nil, 88, nil, 60, nil, nil, 74, nil, 261, nil, 84, 68, 71, nil, nil, 100, nil, 103, 66, nil, nil, 60, 79, 81, nil, nil, 88, nil, nil, nil, 72, 74, 68, 71, nil, 84, 100, nil, 103, nil, nil, nil, nil, nil, 66, nil, 60, nil, 79, 81, nil, nil, 88, nil, 95, nil, nil, 74, 68, 71, nil, 84, nil, nil, nil, 66, nil, nil, nil, 79, 81, nil, 60, 88, nil, nil, nil, nil, 74, 99, nil, 162, 84, 68, 71, 90, nil, 100, nil, 103, nil, 66, nil, 60, nil, 79, 81, nil, nil, 88, nil, nil, nil, 72, 74, 95, nil, nil, 84, 68, 71, nil, nil, 100, nil, 103, 66, nil, nil, 60, 79, 81, nil, nil, 88, nil, nil, nil, nil, 74, 99, 95, nil, 84, 68, 71, 90, nil, 100, nil, 103, nil, 66, nil, 60, nil, 79, 81, 68, 71, 88, nil, nil, nil, 255, 74, 99, nil, nil, 84, nil, nil, 90, nil, nil, nil, nil, 66, nil, nil, 60, 79, 81, 68, 71, 88, nil, 100, nil, 103, 74, 66, nil, nil, 84, 79, 253, nil, nil, 88, nil, nil, 68, 71, 139, 60, nil, nil, 84, nil, nil, nil, nil, nil, nil, nil, 66, nil, nil, 60, 79, 81, nil, nil, 88, 328, nil, 68, 71, 74, nil, nil, nil, 84, nil, 66, nil, nil, nil, 79, 81, nil, nil, 88, 60, 68, 71, 72, 74, 100, 193, 103, 84, nil, nil, nil, nil, nil, nil, nil, 66, nil, nil, 60, 79, 253, 68, 71, 88, nil, 100, nil, 103, 139, nil, nil, nil, 84, 66, nil, nil, nil, 79, 81, nil, nil, 88, nil, 60, nil, nil, 74, 68, 71, nil, 84, 100, nil, 103, 66, nil, nil, nil, 79, 81, nil, 60, 88, nil, nil, nil, nil, 74, nil, 95, nil, 84, nil, 68, 71, nil, nil, 100, nil, 103, 66, nil, 60, nil, 79, 81, nil, nil, 88, nil, nil, nil, nil, 74, 99, 95, nil, 84, 68, 71, 90, nil, 100, nil, 103, nil, 66, nil, 60, nil, 79, 81, 68, 71, 88, nil, nil, nil, nil, 74, 99, nil, nil, 84, nil, nil, 90, nil, nil, nil, nil, 66, nil, nil, 60, 79, 81, nil, nil, 88, nil, nil, nil, nil, 74, 66, nil, nil, 84, 79, 81, nil, nil, 88, nil, nil, nil, 72, 74, 60, 68, 71, 84, nil, 100, nil, 103, 189, 172, 173, 174, 176, 178, 60, 183, 187, nil, 189, 172, 173, 174, 175, 95, nil, 183, 187, 68, 71, nil, nil, 100, 175, 103, 66, nil, nil, nil, 79, 81, nil, nil, 88, nil, nil, nil, nil, 74, 99, 95, nil, 84, nil, nil, 90, nil, nil, 68, 71, nil, 66, 100, 60, 103, 79, 81, nil, nil, 88, nil, nil, nil, nil, 74, 99, nil, nil, 84, nil, 95, 90, nil, nil, 68, 71, nil, nil, 100, 60, 103, 66, nil, nil, nil, 79, 81, nil, nil, 88, nil, nil, nil, nil, 74, 99, 95, nil, 84, nil, nil, 90, nil, nil, nil, nil, nil, 66, nil, 60, nil, 79, 81, 188, nil, 88, nil, nil, nil, nil, 74, 99, 181, 186, 84, nil, nil, 90, nil, nil, nil, 177, 179, 182, 185, 60, nil, 181, 186, nil, nil, nil, nil, nil, nil, nil, 177, 179, 182, 185, nil, nil, nil, nil, nil, 180, 184, nil, nil, 189, 172, 173, 174, 176, 178, nil, 183, 187, nil, nil, 180, 184, nil, 175, 189, 172, 173, 174, 176, 178, nil, 183, 187, 181, 186, nil, nil, nil, 175, nil, nil, 283, 177, 179, 182, 185, nil, nil, 181, 186, nil, nil, nil, nil, nil, nil, nil, 177, 179, 182, 185, nil, nil, nil, nil, nil, 180, 184, nil, nil, 189, 172, 173, 174, 176, 178, nil, 183, 187, nil, nil, nil, 184, nil, 175, 189, 172, 173, 174, 176, 178, nil, 183, 187, 181, 186, nil, nil, nil, 175, nil, nil, nil, 177, 179, 182, 185, nil, nil, 181, 186, nil, nil, nil, nil, nil, nil, nil, 177, 179, 182, 185, nil, nil, nil, nil, nil, 180, 184, nil, nil, 189, 172, 173, 174, 176, 178, nil, 183, 187, nil, nil, 180, 184, nil, 175, 189, 172, 173, 174, 176, 178, nil, 183, 187, 181, 186, nil, nil, nil, 175, nil, nil, nil, 177, 179, 182, 185, nil, nil, 26, 186, 32, 1, nil, 8, 11, nil, 18, 177, 23, nil, 29, nil, 2, nil, nil, 10, 15, nil, 186, nil, 189, 172, 173, 174, 176, 178, 177, 183, 187, nil, nil, nil, nil, 186, 175, 189, 172, 173, 174, 176, 178, 177, 183, 187, nil, nil, nil, nil, nil, 175, nil, nil, nil, nil, 189, 172, 173, 174, 176, 178, nil, 183, 187, 281, nil, nil, nil, nil, 175, 189, 172, 173, 174, 176, 178, nil, 183, 187, nil, nil, nil, nil, 377, 175, 26, nil, 32, 1, nil, 8, 11, nil, 18, nil, 23, nil, 29, nil, 2, nil, nil, 10, 15, 26, 364, 32, 1, nil, 8, 11, nil, 18, nil, 23, nil, 29, nil, 2, nil, nil, 10, 15, nil, 383, nil, 26, nil, 32, 1, nil, 8, 11, nil, 18, nil, 23, nil, 29, nil, 2, nil, nil, 10, 15, 26, 306, 32, 1, nil, 8, 11, nil, 18, nil, 23, nil, 29, nil, 2, nil, nil, 10, 15, nil, 381, nil, 26, nil, 32, 1, nil, 8, 11, nil, 18, nil, 23, nil, 29, nil, 2, nil, nil, 10, 15, 26, 326, 32, 1, nil, 8, 11, nil, 18, nil, 23, nil, 29, nil, 2, nil, nil, 10, 15, nil, nil, nil, 26, nil, 32, 1, nil, 8, 11, nil, 18, nil, 23, nil, 29, nil, 2, nil, nil, 10, 15, 26, nil, 32, 1, nil, 8, 11, nil, 18, nil, 23, nil, 29, nil, 2, nil, nil, 10, 15, 26, nil, 32, 1, nil, 8, 11, nil, 18, nil, 23, nil, 29, nil, 2, nil, nil, 10, 15, 189, 172, 173, 174, 176, 178, nil, 183, 187, nil, nil, nil, nil, nil, 175 ] racc_action_check = [ 164, 164, 18, 103, 103, 214, 56, 157, 81, 32, 103, 286, 286, 164, 164, 136, 11, 27, 286, 27, 11, 158, 164, 164, 164, 164, 81, 11, 300, 300, 154, 56, 27, 214, 214, 300, 332, 332, 189, 189, 18, 103, 189, 18, 189, 157, 164, 164, 157, 286, 164, 164, 164, 164, 164, 164, 27, 164, 164, 158, 189, 300, 158, 18, 164, 300, 300, 200, 157, 300, 294, 189, 154, 212, 300, 189, 189, 213, 300, 189, 369, 369, 158, 134, 189, 189, 186, 186, 189, 300, 186, 189, 186, 203, 291, 294, 294, 133, 206, 189, 111, 216, 144, 127, 203, 291, 206, 163, 186, 203, 291, 111, 262, 369, 273, 144, 111, 369, 369, 186, 163, 369, 273, 186, 186, 262, 369, 186, 357, 357, 369, 221, 186, 186, 185, 185, 186, 302, 185, 186, 185, 369, 264, 264, 221, 302, 218, 186, 219, 264, 273, 273, 273, 273, 273, 273, 185, 273, 273, 1, 220, 357, 197, 1, 273, 357, 357, 185, 122, 357, 1, 185, 185, 122, 357, 185, 281, 224, 357, 281, 185, 185, 176, 176, 185, 310, 176, 185, 176, 357, 310, 282, 282, 121, 192, 185, 282, 282, 192, 192, 114, 175, 175, 282, 176, 175, 46, 175, 336, 336, 46, 114, 336, 227, 336, 176, 114, 46, 46, 176, 176, 263, 263, 176, 265, 265, 263, 263, 176, 176, 336, 265, 176, 263, 175, 176, 119, 335, 175, 175, 335, 336, 175, 176, 229, 336, 336, 175, 230, 336, 116, 175, 215, 215, 336, 336, 232, 8, 336, 330, 330, 336, 175, 330, 115, 330, 8, 8, 194, 336, 234, 194, 267, 267, 267, 267, 235, 184, 184, 267, 267, 184, 113, 184, 225, 215, 267, 239, 225, 215, 215, 225, 330, 215, 110, 225, 330, 330, 215, 184, 330, 108, 215, 23, 23, 330, 250, 23, 253, 330, 184, 107, 169, 215, 184, 184, 169, 169, 184, 106, 330, 105, 102, 184, 184, 23, 140, 184, 26, 26, 184, 42, 26, 141, 26, 42, 23, 101, 184, 96, 23, 23, 42, 42, 23, 94, 89, 211, 23, 23, 26, 211, 211, 23, 228, 228, 33, 87, 228, 85, 33, 26, 83, 82, 23, 26, 26, 33, 33, 26, 31, 31, 31, 31, 26, 26, 29, 29, 26, 201, 29, 26, 29, 201, 201, 80, 77, 228, 75, 26, 280, 228, 228, 142, 74, 228, 284, 308, 308, 69, 228, 308, 66, 308, 228, 6, 6, 6, 6, 29, 289, 65, 64, 29, 29, 228, 53, 29, 52, 307, 307, 298, 29, 307, 50, 307, 29, 37, 305, 138, 308, 187, 143, 17, 308, 308, 321, 29, 308, 325, 174, 174, 13, 308, 174, 146, 174, 308, 3, 3, 3, 3, 307, 147, 12, 338, 307, 307, 308, 343, 307, 347, 174, 348, 350, 307, 179, 179, 351, 307, 179, 352, 179, 174, 183, 358, 5, 174, 174, 368, 307, 174, 4, 4, 4, 4, 174, 174, 179, 155, 174, 370, 159, 174, 2, 380, 173, 173, 382, 179, 173, 174, 173, 179, 179, nil, nil, 179, nil, nil, nil, nil, 179, 179, nil, nil, 179, nil, 173, 179, nil, nil, 45, 45, nil, nil, 45, 179, 45, 173, nil, nil, nil, 173, 173, nil, nil, 173, nil, nil, nil, nil, 173, 173, 45, nil, 173, nil, nil, 173, nil, nil, 172, 172, nil, 45, 172, 173, 172, 45, 45, nil, nil, 45, nil, nil, nil, nil, 45, 45, nil, nil, 45, nil, 172, 45, nil, nil, 47, 47, nil, nil, 47, 45, 47, 172, nil, nil, nil, 172, 172, nil, nil, 172, nil, nil, nil, nil, 172, 172, 47, nil, 172, nil, nil, 172, nil, nil, 48, 48, nil, 47, 48, 172, 48, 47, 47, nil, nil, 47, nil, nil, nil, nil, 47, 47, nil, nil, 47, nil, 48, 47, nil, nil, 49, 49, nil, nil, 49, 47, 49, 48, nil, nil, nil, 48, 48, nil, nil, 48, 296, 296, nil, nil, 48, 48, 177, 177, 48, nil, 177, 48, 177, nil, nil, nil, nil, 49, nil, 48, nil, 49, 49, nil, nil, 49, nil, nil, 177, nil, 49, 51, 51, 296, 49, 51, nil, 296, 296, 177, nil, 296, nil, 177, 177, 49, 296, 177, nil, nil, 296, nil, 177, 177, nil, nil, 177, 295, 295, 177, nil, 296, nil, nil, 51, nil, nil, 177, 51, 51, nil, nil, 51, nil, nil, nil, nil, 51, 231, 231, nil, 51, 231, nil, 231, nil, nil, nil, nil, nil, 295, nil, 51, nil, 295, 295, 233, 233, 295, nil, 233, nil, 233, 295, nil, nil, nil, 295, nil, nil, nil, 231, nil, nil, nil, 231, 231, nil, 295, 231, nil, 170, 170, nil, 231, nil, nil, nil, 231, 233, nil, nil, nil, 233, 233, nil, nil, 233, nil, 231, nil, nil, 233, nil, 170, nil, 233, 288, 288, nil, nil, 288, nil, 288, 170, nil, nil, 233, 170, 170, nil, nil, 170, nil, nil, nil, 170, 170, 182, 182, nil, 170, 182, nil, 182, nil, nil, nil, nil, nil, 288, nil, 170, nil, 288, 288, nil, nil, 288, nil, 182, nil, nil, 288, 70, 70, nil, 288, nil, nil, nil, 182, nil, nil, nil, 182, 182, nil, 288, 182, nil, nil, nil, nil, 182, 182, nil, 70, 182, 71, 71, 182, nil, 71, nil, 71, nil, 70, nil, 182, nil, 70, 70, nil, nil, 70, nil, nil, nil, 70, 70, 71, nil, nil, 70, 180, 180, nil, nil, 180, nil, 180, 71, nil, nil, 70, 71, 71, nil, nil, 71, nil, nil, nil, nil, 71, 71, 180, nil, 71, 112, 112, 71, nil, 112, nil, 112, nil, 180, nil, 71, nil, 180, 180, 167, 167, 180, nil, nil, nil, 167, 180, 180, nil, nil, 180, nil, nil, 180, nil, nil, nil, nil, 112, nil, nil, 180, 112, 112, 78, 78, 112, nil, 78, nil, 78, 112, 167, nil, nil, 112, 167, 167, nil, nil, 167, nil, nil, 240, 240, 167, 112, nil, nil, 167, nil, nil, nil, nil, nil, nil, nil, 78, nil, nil, 167, 78, 78, nil, nil, 78, 240, nil, 255, 255, 78, nil, nil, nil, 78, nil, 240, nil, nil, nil, 240, 240, nil, nil, 240, 78, 100, 100, 240, 240, 100, 100, 100, 240, nil, nil, nil, nil, nil, nil, nil, 255, nil, nil, 240, 255, 255, 260, 260, 255, nil, 260, nil, 260, 255, nil, nil, nil, 255, 100, nil, nil, nil, 100, 100, nil, nil, 100, nil, 255, nil, nil, 100, 181, 181, nil, 100, 181, nil, 181, 260, nil, nil, nil, 260, 260, nil, 100, 260, nil, nil, nil, nil, 260, nil, 181, nil, 260, nil, 90, 90, nil, nil, 90, nil, 90, 181, nil, 260, nil, 181, 181, nil, nil, 181, nil, nil, nil, nil, 181, 181, 90, nil, 181, 161, 161, 181, nil, 161, nil, 161, nil, 90, nil, 181, nil, 90, 90, 166, 166, 90, nil, nil, nil, nil, 90, 90, nil, nil, 90, nil, nil, 90, nil, nil, nil, nil, 161, nil, nil, 90, 161, 161, nil, nil, 161, nil, nil, nil, nil, 161, 166, nil, nil, 161, 166, 166, nil, nil, 166, nil, nil, nil, 166, 166, 161, 95, 95, 166, nil, 95, nil, 95, 277, 277, 277, 277, 277, 277, 166, 277, 277, nil, 269, 269, 269, 269, 277, 95, nil, 269, 269, 178, 178, nil, nil, 178, 269, 178, 95, nil, nil, nil, 95, 95, nil, nil, 95, nil, nil, nil, nil, 95, 95, 178, nil, 95, nil, nil, 95, nil, nil, 99, 99, nil, 178, 99, 95, 99, 178, 178, nil, nil, 178, nil, nil, nil, nil, 178, 178, nil, nil, 178, nil, 99, 178, nil, nil, 242, 242, nil, nil, 242, 178, 242, 99, nil, nil, nil, 99, 99, nil, nil, 99, nil, nil, nil, nil, 99, 99, 242, nil, 99, nil, nil, 99, nil, nil, nil, nil, nil, 242, nil, 99, nil, 242, 242, 91, nil, 242, nil, nil, nil, nil, 242, 242, 91, 91, 242, nil, nil, 242, nil, nil, nil, 91, 91, 91, 91, 242, nil, 129, 129, nil, nil, nil, nil, nil, nil, nil, 129, 129, 129, 129, nil, nil, nil, nil, nil, 91, 91, nil, nil, 91, 91, 91, 91, 91, 91, nil, 91, 91, nil, nil, 129, 129, nil, 91, 129, 129, 129, 129, 129, 129, nil, 129, 129, 190, 190, nil, nil, nil, 129, nil, nil, 190, 190, 190, 190, 190, nil, nil, 271, 271, nil, nil, nil, nil, nil, nil, nil, 271, 271, 271, 271, nil, nil, nil, nil, nil, 190, 190, nil, nil, 190, 190, 190, 190, 190, 190, nil, 190, 190, nil, nil, nil, 271, nil, 190, 271, 271, 271, 271, 271, 271, nil, 271, 271, 131, 131, nil, nil, nil, 271, nil, nil, nil, 131, 131, 131, 131, nil, nil, 132, 132, nil, nil, nil, nil, nil, nil, nil, 132, 132, 132, 132, nil, nil, nil, nil, nil, 131, 131, nil, nil, 131, 131, 131, 131, 131, 131, nil, 131, 131, nil, nil, 132, 132, nil, 131, 132, 132, 132, 132, 132, 132, nil, 132, 132, 275, 275, nil, nil, nil, 132, nil, nil, nil, 275, 275, 275, 275, nil, nil, 279, 276, 279, 279, nil, 279, 279, nil, 279, 276, 279, nil, 279, nil, 279, nil, nil, 279, 279, nil, 270, nil, 275, 275, 275, 275, 275, 275, 270, 275, 275, nil, nil, nil, nil, 272, 275, 276, 276, 276, 276, 276, 276, 272, 276, 276, nil, nil, nil, nil, nil, 276, nil, nil, nil, nil, 270, 270, 270, 270, 270, 270, nil, 270, 270, 188, nil, nil, nil, nil, 270, 272, 272, 272, 272, 272, 272, nil, 272, 272, nil, nil, nil, nil, 363, 272, 188, nil, 188, 188, nil, 188, 188, nil, 188, nil, 188, nil, 188, nil, 188, nil, nil, 188, 188, 363, 312, 363, 363, nil, 363, 363, nil, 363, nil, 363, nil, 363, nil, 363, nil, nil, 363, 363, nil, 376, nil, 312, nil, 312, 312, nil, 312, 312, nil, 312, nil, 312, nil, 312, nil, 312, nil, nil, 312, 312, 376, 217, 376, 376, nil, 376, 376, nil, 376, nil, 376, nil, 376, nil, 376, nil, nil, 376, 376, nil, 373, nil, 217, nil, 217, 217, nil, 217, 217, nil, 217, nil, 217, nil, 217, nil, 217, nil, nil, 217, 217, 373, 238, 373, 373, nil, 373, 373, nil, 373, nil, 373, nil, 373, nil, 373, nil, nil, 373, 373, nil, nil, nil, 238, nil, 238, 238, nil, 238, 238, nil, 238, nil, 238, nil, 238, nil, 238, nil, nil, 238, 238, 20, nil, 20, 20, nil, 20, 20, nil, 20, nil, 20, nil, 20, nil, 20, nil, nil, 20, 20, 0, nil, 0, 0, nil, 0, 0, nil, 0, nil, 0, nil, 0, nil, 0, nil, nil, 0, 0, 268, 268, 268, 268, 268, 268, nil, 268, 268, nil, nil, nil, nil, nil, 268 ] racc_action_pointer = [ 1726, 123, 450, 384, 418, 461, 341, nil, 251, nil, nil, -20, 446, 434, nil, nil, nil, 433, 0, nil, 1707, nil, nil, 301, nil, nil, 326, 11, nil, 374, nil, 306, 7, 320, nil, nil, nil, 403, nil, nil, nil, nil, 295, nil, nil, 520, 170, 576, 606, 632, 400, 679, 378, 416, nil, nil, -6, nil, nil, nil, nil, nil, nil, nil, 389, 388, 396, nil, nil, 393, 842, 867, nil, nil, 388, 376, nil, 363, 957, nil, 362, 2, 340, 356, nil, 336, nil, 334, nil, 323, 1092, 1294, nil, nil, 322, 1179, 333, nil, nil, 1235, 1019, 314, 299, 1, nil, 298, 296, 288, 278, nil, 286, 76, 918, 242, 176, 256, 238, nil, nil, 228, nil, 185, 133, nil, nil, nil, nil, 97, nil, 1309, nil, 1416, 1431, 90, 46, nil, -8, nil, 423, nil, 285, 310, 381, 409, 91, nil, 422, 433, nil, nil, nil, nil, nil, nil, 19, 477, nil, 5, 19, 484, nil, 1117, nil, 95, -4, nil, 1131, 932, nil, 305, 769, nil, 550, 494, 438, 199, 180, 654, 1205, 464, 893, 1066, 816, 411, 275, 132, 84, 368, 1565, 36, 1355, nil, 187, nil, 259, nil, nil, 151, nil, nil, 27, 333, nil, 69, nil, nil, 80, nil, nil, nil, nil, 340, 61, 66, -17, 250, 99, 1647, 131, 133, 135, 119, nil, nil, 169, 248, nil, 204, 352, 204, 239, 726, 216, 744, 230, 267, nil, nil, 1688, 280, 976, nil, 1261, nil, nil, nil, nil, nil, nil, nil, 295, nil, nil, 284, nil, 1001, nil, nil, nil, nil, 1040, nil, 100, 165, 81, 163, nil, 218, 1721, 1144, 1511, 1370, 1526, 96, nil, 1477, 1492, 1134, nil, 1479, 381, 145, 135, nil, 389, nil, 9, nil, 795, 398, nil, 70, nil, nil, 45, 705, 648, nil, 412, nil, 26, nil, 125, nil, nil, 419, nil, 417, 395, nil, 150, nil, 1606, nil, nil, nil, nil, nil, nil, nil, nil, 424, nil, nil, nil, 430, nil, nil, nil, nil, 257, nil, 25, nil, nil, 206, 206, nil, 447, nil, nil, nil, nil, 450, nil, nil, nil, 438, 440, nil, 441, 445, 448, nil, nil, nil, nil, 126, 467, nil, nil, nil, nil, 1584, nil, nil, nil, nil, 470, 78, 482, nil, nil, 1666, nil, nil, 1625, nil, nil, nil, 486, nil, 489, nil, nil, nil ] racc_action_default = [ -198, -235, -51, -19, -8, -235, -235, -9, -235, -10, -189, -190, -235, -23, -11, -187, -12, -235, -235, -13, -1, -14, -2, -188, -15, -3, -235, -235, -16, -235, -17, -6, -235, -235, -18, -7, -190, -198, -188, -52, -27, -28, -235, -25, -26, -235, -235, -235, -235, -235, -198, -86, -93, -235, -197, -195, -198, -191, -193, -194, -223, -196, -4, -42, -233, -43, -215, -176, -118, -44, -235, -235, -45, -34, -75, -32, -33, -235, -235, -123, -37, -74, -38, -235, -73, -39, -173, -40, -175, -41, -235, -235, -126, -108, -104, -235, -112, -133, -113, -235, -235, -105, -109, -235, -111, -106, -115, -107, -114, -110, -54, -198, -235, -86, -198, -235, -180, -177, -178, -235, -50, -235, -199, -200, -24, -21, -23, -188, -22, -84, -20, -83, -85, -235, -198, -79, -76, -87, -82, -75, -71, -77, -221, -80, -74, -69, -78, -235, -172, -171, -81, -91, -92, -94, -235, -221, 386, -235, -235, -235, -209, -235, -31, -235, -235, -119, -235, -235, -96, -235, -235, -143, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -150, -235, -218, -235, -231, -227, -235, -230, -226, -93, -235, -215, -198, -58, -60, -235, -67, -57, -74, -66, -235, -221, -235, -235, -235, -235, -235, -208, -206, -235, -235, -203, -232, -235, -235, -211, -235, -72, -222, -235, -235, -86, -235, -222, -235, -192, -210, -235, -235, -235, -29, -235, -121, -120, -36, -35, -174, -169, -167, -235, -170, -161, -74, -168, -235, -162, -219, -220, -124, -235, -117, -235, -138, -140, -139, -134, -141, -145, -142, -147, -152, -149, -146, -135, -151, -148, -144, -136, -5, -235, -129, -137, -153, -220, -216, -235, -224, -235, -221, -55, -235, -63, -62, -235, -235, -235, -125, -235, -56, -235, -155, -235, -159, -179, -235, -182, -235, -235, -201, -235, -202, -235, -213, -214, -212, -46, -70, -88, -47, -89, -221, -90, -95, -49, -235, -186, -234, -30, -122, -235, -164, -221, -97, -116, -129, -235, -128, -235, -217, -228, -225, -229, -235, -59, -61, -102, -98, -99, -64, -103, -100, -101, -65, -48, -156, -154, -235, -235, -181, -207, -205, -204, -235, -184, -68, -185, -166, -220, -235, -235, -127, -130, -235, -53, -160, -235, -183, -165, -163, -235, -132, -235, -158, -131, -157 ] racc_goto_table = [ 27, 13, 20, 222, 89, 92, 115, 37, 62, 5, 65, 196, 256, 145, 230, 150, 118, 50, 155, 301, 27, 13, 246, 75, 73, 57, 133, 235, 201, 5, 250, 214, 149, 119, 337, 165, 121, 344, 136, 69, 169, 120, 27, 126, 142, 22, 27, 126, 300, 134, 128, 89, 63, 151, 128, 168, 125, 65, 280, 124, 130, 42, 192, 124, 46, 349, 353, 138, 244, 87, 163, 73, 252, 369, 211, 332, 323, 168, 303, 116, 135, 140, 123, 224, 298, 56, 69, 305, 371, 168, 195, 159, 227, 237, 220, 123, 246, 148, 221, 63, 331, 160, 110, 315, 355, 194, 212, 17, 325, nil, nil, 86, nil, nil, nil, nil, 87, nil, 250, nil, 294, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 239, 86, nil, nil, nil, nil, nil, nil, nil, 89, 149, nil, nil, 89, 266, 65, 248, nil, nil, 65, 86, nil, nil, 343, nil, 303, 236, nil, 289, 245, nil, nil, 262, 73, nil, nil, nil, 82, 247, nil, nil, 226, nil, nil, 69, nil, nil, nil, 69, nil, 27, 13, 317, 362, 150, 365, 340, 63, 149, 5, nil, 63, 304, 151, 248, 143, 370, 85, 329, nil, 320, 149, 322, nil, 87, 148, 378, 136, 87, 27, 13, nil, 375, 89, 82, nil, 247, 321, 5, 65, nil, 54, 318, 313, 250, 146, nil, 151, 149, 333, 27, 13, nil, 245, 248, 380, 138, nil, 382, 5, nil, nil, nil, nil, 85, nil, 86, 86, 69, 135, 86, nil, nil, 148, nil, 210, 247, 342, 210, 62, nil, 63, 80, nil, nil, 195, 148, nil, 149, 149, nil, 27, 13, 149, 347, 347, 360, 361, 87, 248, 5, nil, nil, nil, nil, nil, nil, nil, nil, nil, 141, nil, nil, 148, nil, 86, 247, 247, nil, 367, nil, 247, nil, nil, 27, 13, 363, 372, 86, 80, 82, 251, nil, 5, 82, nil, 346, 346, nil, nil, 86, nil, nil, nil, nil, nil, nil, nil, nil, nil, 149, nil, nil, 352, 352, 86, 248, nil, 148, nil, 85, 254, 149, 62, 85, nil, nil, 210, 248, nil, 207, nil, nil, 207, nil, 27, 13, nil, 247, 251, 54, 54, nil, nil, 5, 27, 13, nil, 27, 13, 247, nil, 143, nil, 5, 86, 86, 5, nil, nil, 86, nil, nil, nil, 82, nil, 274, nil, nil, 254, 278, nil, nil, nil, nil, 148, nil, nil, nil, 251, nil, nil, 146, nil, nil, 80, 249, 148, nil, 80, nil, nil, nil, nil, 85, nil, nil, nil, nil, nil, nil, 129, nil, 131, 132, nil, nil, nil, nil, 254, nil, nil, nil, nil, nil, 210, nil, 86, nil, 350, 350, nil, 207, nil, 251, nil, nil, 164, nil, 86, nil, nil, nil, nil, 249, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 171, 141, nil, 351, 351, 190, nil, nil, 254, 191, nil, nil, nil, 80, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 249, nil, nil, nil, nil, nil, nil, 251, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 251, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 207, 254, nil, nil, 348, 348, nil, nil, nil, 249, nil, nil, nil, 254, nil, nil, nil, nil, 263, 264, 265, nil, 267, 268, 269, 270, 271, 272, 273, nil, 275, 276, 277, nil, nil, 282, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 249, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 249, nil, nil, nil, nil, nil, nil, nil, nil, nil, 164 ] racc_goto_check = [ 38, 22, 2, 83, 29, 63, 55, 33, 4, 53, 31, 86, 71, 48, 37, 51, 73, 33, 39, 67, 38, 22, 24, 23, 22, 79, 55, 37, 42, 53, 69, 42, 29, 38, 64, 61, 75, 43, 31, 32, 58, 6, 38, 22, 36, 3, 38, 22, 66, 75, 6, 29, 30, 54, 6, 55, 20, 31, 5, 8, 20, 21, 58, 8, 21, 47, 47, 32, 62, 28, 23, 22, 70, 59, 58, 72, 57, 55, 69, 74, 30, 34, 3, 76, 37, 77, 32, 5, 64, 55, 31, 78, 35, 80, 81, 3, 24, 28, 82, 30, 71, 3, 41, 84, 67, 85, 36, 1, 5, nil, nil, 50, nil, nil, nil, nil, 28, nil, 69, nil, 42, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 55, 50, nil, nil, nil, nil, nil, nil, nil, 29, 29, nil, nil, 29, 55, 31, 31, nil, nil, 31, 50, nil, nil, 37, nil, 69, 79, nil, 39, 22, nil, nil, 23, 22, nil, nil, nil, 26, 53, nil, nil, 3, nil, nil, 32, nil, nil, nil, 32, nil, 38, 22, 48, 83, 51, 37, 86, 30, 29, 53, nil, 30, 73, 54, 31, 26, 37, 27, 61, nil, 55, 29, 55, nil, 28, 28, 71, 31, 28, 38, 22, nil, 69, 29, 26, nil, 53, 36, 53, 31, nil, 65, 54, 33, 69, 27, nil, 54, 29, 55, 38, 22, nil, 22, 31, 5, 32, nil, 5, 53, nil, nil, nil, nil, 27, nil, 50, 50, 32, 30, 50, nil, nil, 28, nil, 26, 53, 55, 26, 4, nil, 30, 25, nil, nil, 31, 28, nil, 29, 29, nil, 38, 22, 29, 31, 31, 55, 55, 28, 31, 53, nil, nil, nil, nil, nil, nil, nil, nil, nil, 25, nil, nil, 28, nil, 50, 53, 53, nil, 55, nil, 53, nil, nil, 38, 22, 2, 63, 50, 25, 26, 26, nil, 53, 26, nil, 30, 30, nil, nil, 50, nil, nil, nil, nil, nil, nil, nil, nil, nil, 29, nil, nil, 28, 28, 50, 31, nil, 28, nil, 27, 27, 29, 4, 27, nil, nil, 26, 31, nil, 25, nil, nil, 25, nil, 38, 22, nil, 53, 26, 65, 65, nil, nil, 53, 38, 22, nil, 38, 22, 53, nil, 26, nil, 53, 50, 50, 53, nil, nil, 50, nil, nil, nil, 26, nil, 65, nil, nil, 27, 65, nil, nil, nil, nil, 28, nil, nil, nil, 26, nil, nil, 27, nil, nil, 25, 25, 28, nil, 25, nil, nil, nil, nil, 27, nil, nil, nil, nil, nil, nil, 52, nil, 52, 52, nil, nil, nil, nil, 27, nil, nil, nil, nil, nil, 26, nil, 50, nil, 26, 26, nil, 25, nil, 26, nil, nil, 52, nil, 50, nil, nil, nil, nil, 25, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 52, 25, nil, 27, 27, 52, nil, nil, 27, 52, nil, nil, nil, 25, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 25, nil, nil, nil, nil, nil, nil, 26, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 26, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 25, 27, nil, nil, 25, 25, nil, nil, nil, 25, nil, nil, nil, 27, nil, nil, nil, nil, 52, 52, 52, nil, 52, 52, 52, 52, 52, 52, 52, nil, 52, 52, 52, nil, nil, 52, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 25, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 25, nil, nil, nil, nil, nil, nil, nil, nil, nil, 52 ] racc_goto_pointer = [ nil, 107, 2, 45, -12, -130, 8, nil, 17, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 14, 58, 1, 0, -144, 247, 152, 182, 46, -19, 29, -13, 16, 6, 30, -48, -7, -128, 0, -34, nil, 75, -83, -254, nil, nil, nil, -230, -38, nil, 88, -36, 384, 9, 1, -23, nil, -158, -38, -259, nil, -36, -96, -21, -247, 211, -167, -196, nil, -137, -95, -155, -180, -16, 47, -1, -51, 67, 35, 7, -65, -28, -24, -119, -122, 2, -92, nil ] racc_goto_default = [ nil, nil, 279, 208, 25, nil, 31, 35, 4, 7, 9, 14, 16, 19, 21, 24, 28, 30, 34, 3, 6, nil, 98, nil, 76, 101, 102, 105, 107, 108, 93, 94, 96, 12, nil, nil, nil, nil, 83, nil, 33, nil, nil, 204, 291, 205, 206, nil, nil, 147, 106, 109, 91, 64, 137, 97, 152, 153, nil, 260, 104, nil, nil, nil, nil, 67, nil, nil, 302, 77, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 58, nil, nil, nil, nil, nil, nil, 197 ] racc_reduce_table = [ 0, 0, :racc_error, 1, 70, :_reduce_none, 1, 70, :_reduce_none, 1, 71, :_reduce_3, 2, 71, :_reduce_4, 1, 74, :_reduce_5, 1, 73, :_reduce_none, 1, 73, :_reduce_none, 1, 73, :_reduce_none, 1, 73, :_reduce_none, 1, 73, :_reduce_none, 1, 73, :_reduce_none, 1, 73, :_reduce_none, 1, 73, :_reduce_none, 1, 73, :_reduce_none, 1, 73, :_reduce_none, 1, 73, :_reduce_none, 1, 73, :_reduce_none, 1, 73, :_reduce_none, 1, 73, :_reduce_none, 3, 88, :_reduce_20, 3, 88, :_reduce_21, 1, 89, :_reduce_none, 1, 89, :_reduce_none, 1, 89, :_reduce_none, 1, 90, :_reduce_none, 1, 90, :_reduce_none, 1, 90, :_reduce_none, 1, 90, :_reduce_none, 4, 82, :_reduce_29, 5, 82, :_reduce_30, 3, 82, :_reduce_31, 2, 82, :_reduce_32, 1, 92, :_reduce_33, 1, 92, :_reduce_34, 3, 92, :_reduce_35, 3, 92, :_reduce_36, 1, 93, :_reduce_none, 1, 93, :_reduce_none, 1, 93, :_reduce_none, 1, 93, :_reduce_none, 1, 93, :_reduce_none, 1, 93, :_reduce_none, 1, 93, :_reduce_none, 1, 93, :_reduce_none, 1, 93, :_reduce_45, 5, 75, :_reduce_46, 5, 75, :_reduce_47, 5, 75, :_reduce_48, 5, 86, :_reduce_49, 2, 76, :_reduce_50, 1, 109, :_reduce_51, 2, 109, :_reduce_52, 6, 77, :_reduce_53, 2, 77, :_reduce_54, 3, 110, :_reduce_55, 3, 110, :_reduce_56, 1, 111, :_reduce_none, 1, 111, :_reduce_none, 3, 111, :_reduce_59, 1, 112, :_reduce_none, 3, 112, :_reduce_61, 1, 113, :_reduce_62, 1, 113, :_reduce_63, 3, 114, :_reduce_64, 3, 114, :_reduce_65, 1, 115, :_reduce_none, 1, 115, :_reduce_none, 4, 117, :_reduce_68, 1, 103, :_reduce_69, 3, 103, :_reduce_70, 0, 104, :_reduce_none, 1, 104, :_reduce_none, 1, 119, :_reduce_73, 1, 94, :_reduce_74, 1, 96, :_reduce_75, 1, 118, :_reduce_none, 1, 118, :_reduce_none, 1, 118, :_reduce_none, 1, 118, :_reduce_none, 1, 118, :_reduce_none, 1, 118, :_reduce_none, 1, 118, :_reduce_none, 3, 78, :_reduce_83, 3, 78, :_reduce_84, 3, 87, :_reduce_85, 0, 105, :_reduce_86, 1, 105, :_reduce_87, 3, 105, :_reduce_88, 3, 123, :_reduce_89, 3, 125, :_reduce_90, 1, 126, :_reduce_none, 1, 126, :_reduce_none, 0, 108, :_reduce_93, 1, 108, :_reduce_94, 3, 108, :_reduce_95, 1, 127, :_reduce_96, 3, 127, :_reduce_97, 1, 116, :_reduce_none, 1, 116, :_reduce_none, 1, 116, :_reduce_none, 1, 116, :_reduce_none, 1, 116, :_reduce_none, 1, 116, :_reduce_none, 1, 124, :_reduce_none, 1, 124, :_reduce_none, 1, 124, :_reduce_none, 1, 124, :_reduce_none, 1, 124, :_reduce_none, 1, 124, :_reduce_none, 1, 124, :_reduce_none, 1, 124, :_reduce_none, 1, 124, :_reduce_none, 1, 124, :_reduce_none, 1, 124, :_reduce_none, 1, 124, :_reduce_none, 4, 98, :_reduce_116, 3, 98, :_reduce_117, 1, 100, :_reduce_118, 2, 100, :_reduce_119, 2, 130, :_reduce_120, 1, 131, :_reduce_121, 2, 131, :_reduce_122, 1, 97, :_reduce_123, 4, 91, :_reduce_124, 4, 91, :_reduce_125, 2, 80, :_reduce_126, 5, 132, :_reduce_127, 4, 132, :_reduce_128, 0, 133, :_reduce_none, 2, 133, :_reduce_130, 4, 133, :_reduce_131, 3, 133, :_reduce_132, 1, 121, :_reduce_none, 3, 121, :_reduce_134, 3, 121, :_reduce_135, 3, 121, :_reduce_136, 3, 121, :_reduce_137, 3, 121, :_reduce_138, 3, 121, :_reduce_139, 3, 121, :_reduce_140, 3, 121, :_reduce_141, 3, 121, :_reduce_142, 2, 121, :_reduce_143, 3, 121, :_reduce_144, 3, 121, :_reduce_145, 3, 121, :_reduce_146, 3, 121, :_reduce_147, 3, 121, :_reduce_148, 3, 121, :_reduce_149, 2, 121, :_reduce_150, 3, 121, :_reduce_151, 3, 121, :_reduce_152, 3, 121, :_reduce_153, 5, 79, :_reduce_154, 1, 135, :_reduce_155, 2, 135, :_reduce_156, 5, 136, :_reduce_157, 4, 136, :_reduce_158, 1, 137, :_reduce_159, 3, 137, :_reduce_160, 3, 99, :_reduce_161, 1, 139, :_reduce_none, 4, 139, :_reduce_163, 1, 141, :_reduce_none, 3, 141, :_reduce_165, 3, 140, :_reduce_166, 1, 138, :_reduce_none, 1, 138, :_reduce_none, 1, 138, :_reduce_none, 1, 138, :_reduce_none, 1, 138, :_reduce_none, 1, 138, :_reduce_none, 1, 138, :_reduce_none, 1, 138, :_reduce_none, 1, 138, :_reduce_175, 1, 138, :_reduce_none, 1, 142, :_reduce_177, 1, 143, :_reduce_none, 3, 143, :_reduce_179, 2, 81, :_reduce_180, 6, 83, :_reduce_181, 5, 83, :_reduce_182, 7, 84, :_reduce_183, 6, 84, :_reduce_184, 6, 85, :_reduce_185, 5, 85, :_reduce_186, 1, 107, :_reduce_187, 1, 102, :_reduce_188, 1, 102, :_reduce_189, 1, 102, :_reduce_190, 1, 146, :_reduce_191, 3, 146, :_reduce_192, 1, 148, :_reduce_193, 1, 149, :_reduce_194, 1, 149, :_reduce_195, 1, 149, :_reduce_196, 1, 149, :_reduce_none, 0, 72, :_reduce_198, 0, 150, :_reduce_199, 1, 144, :_reduce_none, 3, 144, :_reduce_201, 3, 144, :_reduce_202, 1, 151, :_reduce_none, 3, 151, :_reduce_204, 3, 152, :_reduce_205, 1, 152, :_reduce_206, 3, 152, :_reduce_207, 1, 152, :_reduce_208, 1, 147, :_reduce_none, 2, 147, :_reduce_210, 1, 145, :_reduce_none, 2, 145, :_reduce_212, 1, 153, :_reduce_none, 1, 153, :_reduce_none, 1, 95, :_reduce_215, 3, 120, :_reduce_216, 4, 120, :_reduce_217, 2, 120, :_reduce_218, 1, 128, :_reduce_none, 1, 128, :_reduce_none, 0, 106, :_reduce_none, 1, 106, :_reduce_222, 1, 134, :_reduce_223, 3, 129, :_reduce_224, 4, 129, :_reduce_225, 2, 129, :_reduce_226, 1, 154, :_reduce_none, 3, 154, :_reduce_228, 3, 155, :_reduce_229, 1, 156, :_reduce_230, 1, 156, :_reduce_231, 4, 122, :_reduce_232, 1, 101, :_reduce_none, 4, 101, :_reduce_234 ] racc_reduce_n = 235 racc_shift_n = 386 racc_token_table = { false => 0, :error => 1, :STRING => 2, :DQPRE => 3, :DQMID => 4, :DQPOST => 5, :LBRACK => 6, :RBRACK => 7, :LBRACE => 8, :RBRACE => 9, :SYMBOL => 10, :FARROW => 11, :COMMA => 12, :TRUE => 13, :FALSE => 14, :EQUALS => 15, :APPENDS => 16, :LESSEQUAL => 17, :NOTEQUAL => 18, :DOT => 19, :COLON => 20, :LLCOLLECT => 21, :RRCOLLECT => 22, :QMARK => 23, :LPAREN => 24, :RPAREN => 25, :ISEQUAL => 26, :GREATEREQUAL => 27, :GREATERTHAN => 28, :LESSTHAN => 29, :IF => 30, :ELSE => 31, :IMPORT => 32, :DEFINE => 33, :ELSIF => 34, :VARIABLE => 35, :CLASS => 36, :INHERITS => 37, :NODE => 38, :BOOLEAN => 39, :NAME => 40, :SEMIC => 41, :CASE => 42, :DEFAULT => 43, :AT => 44, :LCOLLECT => 45, :RCOLLECT => 46, :CLASSNAME => 47, :CLASSREF => 48, :NOT => 49, :OR => 50, :AND => 51, :UNDEF => 52, :PARROW => 53, :PLUS => 54, :MINUS => 55, :TIMES => 56, :DIV => 57, :LSHIFT => 58, :RSHIFT => 59, :UMINUS => 60, :MATCH => 61, :NOMATCH => 62, :REGEX => 63, :IN_EDGE => 64, :OUT_EDGE => 65, :IN_EDGE_SUB => 66, :OUT_EDGE_SUB => 67, :IN => 68 } racc_nt_base = 69 racc_use_result_var = true Racc_arg = [ racc_action_table, racc_action_check, racc_action_default, racc_action_pointer, racc_goto_table, racc_goto_check, racc_goto_default, racc_goto_pointer, racc_nt_base, racc_reduce_table, racc_token_table, racc_shift_n, racc_reduce_n, racc_use_result_var ] Racc_token_to_s_table = [ "$end", "error", "STRING", "DQPRE", "DQMID", "DQPOST", "LBRACK", "RBRACK", "LBRACE", "RBRACE", "SYMBOL", "FARROW", "COMMA", "TRUE", "FALSE", "EQUALS", "APPENDS", "LESSEQUAL", "NOTEQUAL", "DOT", "COLON", "LLCOLLECT", "RRCOLLECT", "QMARK", "LPAREN", "RPAREN", "ISEQUAL", "GREATEREQUAL", "GREATERTHAN", "LESSTHAN", "IF", "ELSE", "IMPORT", "DEFINE", "ELSIF", "VARIABLE", "CLASS", "INHERITS", "NODE", "BOOLEAN", "NAME", "SEMIC", "CASE", "DEFAULT", "AT", "LCOLLECT", "RCOLLECT", "CLASSNAME", "CLASSREF", "NOT", "OR", "AND", "UNDEF", "PARROW", "PLUS", "MINUS", "TIMES", "DIV", "LSHIFT", "RSHIFT", "UMINUS", "MATCH", "NOMATCH", "REGEX", "IN_EDGE", "OUT_EDGE", "IN_EDGE_SUB", "OUT_EDGE_SUB", "IN", "$start", "program", "statements_and_declarations", "nil", "statement_or_declaration", "statements", "resource", "virtualresource", "collection", "assignment", "casestatement", "ifstatement_begin", "import", "fstatement", "definition", "hostclass", "nodedef", "resourceoverride", "append", "relationship", "relationship_side", "edge", "resourceref", "funcvalues", "namestring", "name", "variable", "type", "boolean", "funcrvalue", "selector", "quotedtext", "hasharrayaccesses", "classname", "resourceinstances", "endsemi", "params", "endcomma", "classref", "anyparams", "at", "collectrhand", "collstatements", "collstatement", "colljoin", "collexpr", "colllval", "simplervalue", "resourceinst", "resourcename", "undef", "array", "expression", "hasharrayaccess", "param", "rvalue", "addparam", "anyparam", "rvalues", "comma", "hash", "dqrval", "dqtail", "ifstatement", "else", "regex", "caseopts", "caseopt", "casevalues", "selectlhand", "svalues", "selectval", "sintvalues", "string", "strings", "argumentlist", "classparent", "hostnames", "nodeparent", "nodename", "hostname", "nothing", "arguments", "argument", "classnameordefault", "hashpairs", "hashpair", "key" ] Racc_debug_parser = false ##### State transition tables end ##### # reduce 0 omitted # reduce 1 omitted # reduce 2 omitted module_eval(<<'.,.,', 'grammar.ra', 34) def _reduce_3(val, _values, result) result = ast AST::ASTArray, :children => (val[0] ? [val[0]] : []) result end .,., module_eval(<<'.,.,', 'grammar.ra', 37) def _reduce_4(val, _values, result) if val[1] val[0].push(val[1]) end result = val[0] result end .,., module_eval(<<'.,.,', 'grammar.ra', 46) def _reduce_5(val, _values, result) val[0].each do |stmt| if stmt.is_a?(AST::TopLevelConstruct) error "Classes, definitions, and nodes may only appear at toplevel or inside other classes", \ :line => stmt.context[:line], :file => stmt.context[:file] end end result = val[0] result end .,., # reduce 6 omitted # reduce 7 omitted # reduce 8 omitted # reduce 9 omitted # reduce 10 omitted # reduce 11 omitted # reduce 12 omitted # reduce 13 omitted # reduce 14 omitted # reduce 15 omitted # reduce 16 omitted # reduce 17 omitted # reduce 18 omitted # reduce 19 omitted module_eval(<<'.,.,', 'grammar.ra', 72) def _reduce_20(val, _values, result) result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context) result end .,., module_eval(<<'.,.,', 'grammar.ra', 75) def _reduce_21(val, _values, result) result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context) result end .,., # reduce 22 omitted # reduce 23 omitted # reduce 24 omitted # reduce 25 omitted # reduce 26 omitted # reduce 27 omitted # reduce 28 omitted module_eval(<<'.,.,', 'grammar.ra', 83) def _reduce_29(val, _values, result) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => val[2], :ftype => :statement result end .,., module_eval(<<'.,.,', 'grammar.ra', 90) def _reduce_30(val, _values, result) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => val[2], :ftype => :statement result end .,., module_eval(<<'.,.,', 'grammar.ra', 96) def _reduce_31(val, _values, result) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => AST::ASTArray.new({}), :ftype => :statement result end .,., module_eval(<<'.,.,', 'grammar.ra', 103) def _reduce_32(val, _values, result) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => val[1], :ftype => :statement result end .,., module_eval(<<'.,.,', 'grammar.ra', 110) def _reduce_33(val, _values, result) result = aryfy(val[0]) result end .,., module_eval(<<'.,.,', 'grammar.ra', 111) def _reduce_34(val, _values, result) result = aryfy(val[0]) result end .,., module_eval(<<'.,.,', 'grammar.ra', 113) def _reduce_35(val, _values, result) val[0].push(val[2]) result = val[0] result end .,., module_eval(<<'.,.,', 'grammar.ra', 117) def _reduce_36(val, _values, result) val[0].push(val[2]) result = val[0] result end .,., # reduce 37 omitted # reduce 38 omitted # reduce 39 omitted # reduce 40 omitted # reduce 41 omitted # reduce 42 omitted # reduce 43 omitted # reduce 44 omitted module_eval(<<'.,.,', 'grammar.ra', 132) def _reduce_45(val, _values, result) result = ast AST::Name, :value => val[0][:value] result end .,., module_eval(<<'.,.,', 'grammar.ra', 136) def _reduce_46(val, _values, result) @lexer.commentpop result = ast(AST::Resource, :type => val[0], :instances => val[2]) result end .,., module_eval(<<'.,.,', 'grammar.ra', 139) def _reduce_47(val, _values, result) # This is a deprecated syntax. error "All resource specifications require names" result end .,., module_eval(<<'.,.,', 'grammar.ra', 142) def _reduce_48(val, _values, result) # a defaults setting for a type @lexer.commentpop result = ast(AST::ResourceDefaults, :type => val[0], :parameters => val[2]) result end .,., module_eval(<<'.,.,', 'grammar.ra', 149) def _reduce_49(val, _values, result) @lexer.commentpop result = ast AST::ResourceOverride, :object => val[0], :parameters => val[2] result end .,., 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 error "Defaults are not virtualizable" if val[1].is_a? AST::ResourceDefaults method = type.to_s + "=" # Just mark our resource as exported and pass it through. val[1].send(method, true) result = val[1] result end .,., module_eval(<<'.,.,', 'grammar.ra', 172) def _reduce_51(val, _values, result) result = :virtual result end .,., module_eval(<<'.,.,', 'grammar.ra', 173) def _reduce_52(val, _values, result) result = :exported result end .,., module_eval(<<'.,.,', 'grammar.ra', 178) def _reduce_53(val, _values, result) @lexer.commentpop Puppet.warning addcontext("Collection names must now be capitalized") if val[0] =~ /^[a-z]/ type = val[0].downcase args = {:type => type} if val[1].is_a?(AST::CollExpr) args[:query] = val[1] args[:query].type = type args[:form] = args[:query].form 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] result = ast AST::Collection, args result end .,., module_eval(<<'.,.,', 'grammar.ra', 197) def _reduce_54(val, _values, result) if val[0] =~ /^[a-z]/ Puppet.warning addcontext("Collection names must now be capitalized") end type = val[0].downcase args = {:type => type } if val[1].is_a?(AST::CollExpr) args[:query] = val[1] args[:query].type = type args[:form] = args[:query].form 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 result end .,., module_eval(<<'.,.,', 'grammar.ra', 218) def _reduce_55(val, _values, result) if val[1] result = val[1] result.form = :virtual else result = :virtual end result end .,., module_eval(<<'.,.,', 'grammar.ra', 226) def _reduce_56(val, _values, result) if val[1] result = val[1] result.form = :exported else result = :exported end result end .,., # reduce 57 omitted # reduce 58 omitted module_eval(<<'.,.,', 'grammar.ra', 239) def _reduce_59(val, _values, result) result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2] result end .,., # reduce 60 omitted module_eval(<<'.,.,', 'grammar.ra', 244) def _reduce_61(val, _values, result) result = val[1] result.parens = true result end .,., module_eval(<<'.,.,', 'grammar.ra', 248) def _reduce_62(val, _values, result) result=val[0][:value] result end .,., module_eval(<<'.,.,', 'grammar.ra', 249) def _reduce_63(val, _values, result) result=val[0][:value] result end .,., module_eval(<<'.,.,', 'grammar.ra', 252) def _reduce_64(val, _values, result) result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2] #result = ast AST::CollExpr #result.push *val result end .,., module_eval(<<'.,.,', 'grammar.ra', 257) def _reduce_65(val, _values, result) result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2] #result = ast AST::CollExpr #result.push *val result end .,., # reduce 66 omitted # reduce 67 omitted module_eval(<<'.,.,', 'grammar.ra', 266) def _reduce_68(val, _values, result) result = ast AST::ResourceInstance, :title => val[0], :parameters => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 269) def _reduce_69(val, _values, result) result = aryfy(val[0]) result end .,., module_eval(<<'.,.,', 'grammar.ra', 271) def _reduce_70(val, _values, result) val[0].push val[2] result = val[0] result end .,., # reduce 71 omitted # reduce 72 omitted module_eval(<<'.,.,', 'grammar.ra', 279) def _reduce_73(val, _values, result) result = ast AST::Undef, :value => :undef result end .,., module_eval(<<'.,.,', 'grammar.ra', 283) def _reduce_74(val, _values, result) result = ast AST::Name, :value => val[0][:value], :line => val[0][:line] result end .,., module_eval(<<'.,.,', 'grammar.ra', 287) def _reduce_75(val, _values, result) result = ast AST::Type, :value => val[0][:value], :line => val[0][:line] result end .,., # reduce 76 omitted # reduce 77 omitted # reduce 78 omitted # reduce 79 omitted # reduce 80 omitted # reduce 81 omitted # reduce 82 omitted module_eval(<<'.,.,', 'grammar.ra', 299) def _reduce_83(val, _values, result) raise Puppet::ParseError, "Cannot assign to variables in other namespaces" if val[0][:value] =~ /::/ # this is distinct from referencing a variable variable = ast AST::Name, :value => val[0][:value], :line => val[0][:line] result = ast AST::VarDef, :name => variable, :value => val[2], :line => val[0][:line] result end .,., module_eval(<<'.,.,', 'grammar.ra', 305) def _reduce_84(val, _values, result) result = ast AST::VarDef, :name => val[0], :value => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 309) def _reduce_85(val, _values, result) variable = ast AST::Name, :value => val[0][:value], :line => val[0][:line] result = ast AST::VarDef, :name => variable, :value => val[2], :append => true, :line => val[0][:line] result end .,., module_eval(<<'.,.,', 'grammar.ra', 315) def _reduce_86(val, _values, result) result = ast AST::ASTArray result end .,., module_eval(<<'.,.,', 'grammar.ra', 317) def _reduce_87(val, _values, result) result = aryfy(val[0]) result end .,., module_eval(<<'.,.,', 'grammar.ra', 319) def _reduce_88(val, _values, result) val[0].push(val[2]) result = val[0] result end .,., module_eval(<<'.,.,', 'grammar.ra', 324) def _reduce_89(val, _values, result) result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 328) def _reduce_90(val, _values, result) result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2], :add => true result end .,., # reduce 91 omitted # reduce 92 omitted module_eval(<<'.,.,', 'grammar.ra', 337) def _reduce_93(val, _values, result) result = ast AST::ASTArray result end .,., module_eval(<<'.,.,', 'grammar.ra', 339) def _reduce_94(val, _values, result) result = aryfy(val[0]) result end .,., module_eval(<<'.,.,', 'grammar.ra', 341) def _reduce_95(val, _values, result) val[0].push(val[2]) result = val[0] result end .,., module_eval(<<'.,.,', 'grammar.ra', 345) def _reduce_96(val, _values, result) result = aryfy(val[0]) result end .,., module_eval(<<'.,.,', 'grammar.ra', 346) def _reduce_97(val, _values, result) result = val[0].push(val[2]) result end .,., # reduce 98 omitted # reduce 99 omitted # reduce 100 omitted # reduce 101 omitted # reduce 102 omitted # reduce 103 omitted # reduce 104 omitted # reduce 105 omitted # reduce 106 omitted # reduce 107 omitted # reduce 108 omitted # reduce 109 omitted # reduce 110 omitted # reduce 111 omitted # reduce 112 omitted # reduce 113 omitted # reduce 114 omitted # reduce 115 omitted module_eval(<<'.,.,', 'grammar.ra', 370) def _reduce_116(val, _values, result) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => val[2], :ftype => :rvalue result end .,., module_eval(<<'.,.,', 'grammar.ra', 375) def _reduce_117(val, _values, result) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => AST::ASTArray.new({}), :ftype => :rvalue result end .,., module_eval(<<'.,.,', 'grammar.ra', 381) def _reduce_118(val, _values, result) result = ast AST::String, :value => val[0][:value], :line => val[0][:line] result end .,., module_eval(<<'.,.,', 'grammar.ra', 382) def _reduce_119(val, _values, result) result = ast AST::Concat, :value => [ast(AST::String,val[0])]+val[1], :line => val[0][:line] result end .,., module_eval(<<'.,.,', 'grammar.ra', 384) def _reduce_120(val, _values, result) result = [val[0]] + val[1] result end .,., module_eval(<<'.,.,', 'grammar.ra', 386) def _reduce_121(val, _values, result) result = [ast(AST::String,val[0])] result end .,., module_eval(<<'.,.,', 'grammar.ra', 387) def _reduce_122(val, _values, result) result = [ast(AST::String,val[0])] + val[1] result end .,., module_eval(<<'.,.,', 'grammar.ra', 390) def _reduce_123(val, _values, result) result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line] result end .,., module_eval(<<'.,.,', 'grammar.ra', 394) def _reduce_124(val, _values, result) Puppet.warning addcontext("Deprecation notice: Resource references should now be capitalized") result = ast AST::ResourceReference, :type => val[0][:value], :line => val[0][:line], :title => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 397) def _reduce_125(val, _values, result) result = ast AST::ResourceReference, :type => val[0], :title => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 401) def _reduce_126(val, _values, result) result = val[1] result end .,., module_eval(<<'.,.,', 'grammar.ra', 405) def _reduce_127(val, _values, result) @lexer.commentpop args = { :test => val[0], :statements => val[2] } args[:else] = val[4] if val[4] result = ast AST::IfStatement, args result end .,., module_eval(<<'.,.,', 'grammar.ra', 416) def _reduce_128(val, _values, result) @lexer.commentpop args = { :test => val[0], :statements => ast(AST::Nop) } args[:else] = val[3] if val[3] result = ast AST::IfStatement, args result end .,., # reduce 129 omitted module_eval(<<'.,.,', 'grammar.ra', 429) def _reduce_130(val, _values, result) result = ast AST::Else, :statements => val[1] result end .,., module_eval(<<'.,.,', 'grammar.ra', 432) def _reduce_131(val, _values, result) @lexer.commentpop result = ast AST::Else, :statements => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 436) def _reduce_132(val, _values, result) @lexer.commentpop result = ast AST::Else, :statements => ast(AST::Nop) result end .,., # reduce 133 omitted module_eval(<<'.,.,', 'grammar.ra', 454) def _reduce_134(val, _values, result) result = ast AST::InOperator, :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 457) def _reduce_135(val, _values, result) result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 460) def _reduce_136(val, _values, result) result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 463) def _reduce_137(val, _values, result) result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 466) def _reduce_138(val, _values, result) result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 469) def _reduce_139(val, _values, result) result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 472) def _reduce_140(val, _values, result) result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 475) def _reduce_141(val, _values, result) result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 478) def _reduce_142(val, _values, result) result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 481) def _reduce_143(val, _values, result) result = ast AST::Minus, :value => val[1] result end .,., module_eval(<<'.,.,', 'grammar.ra', 484) def _reduce_144(val, _values, result) result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 487) def _reduce_145(val, _values, result) result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 490) def _reduce_146(val, _values, result) result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 493) def _reduce_147(val, _values, result) result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 496) def _reduce_148(val, _values, result) result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 499) def _reduce_149(val, _values, result) result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 502) def _reduce_150(val, _values, result) result = ast AST::Not, :value => val[1] result end .,., module_eval(<<'.,.,', 'grammar.ra', 505) def _reduce_151(val, _values, result) result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 508) def _reduce_152(val, _values, result) result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 511) def _reduce_153(val, _values, result) result = val[1] result end .,., module_eval(<<'.,.,', 'grammar.ra', 515) def _reduce_154(val, _values, result) @lexer.commentpop result = ast AST::CaseStatement, :test => val[1], :options => val[3] result end .,., module_eval(<<'.,.,', 'grammar.ra', 519) def _reduce_155(val, _values, result) result = aryfy(val[0]) result end .,., module_eval(<<'.,.,', 'grammar.ra', 521) def _reduce_156(val, _values, result) val[0].push val[1] result = val[0] result end .,., module_eval(<<'.,.,', 'grammar.ra', 526) def _reduce_157(val, _values, result) @lexer.commentpop result = ast AST::CaseOpt, :value => val[0], :statements => val[3] result end .,., module_eval(<<'.,.,', 'grammar.ra', 529) def _reduce_158(val, _values, result) @lexer.commentpop result = ast( AST::CaseOpt, :value => val[0], :statements => ast(AST::ASTArray) ) result end .,., module_eval(<<'.,.,', 'grammar.ra', 539) def _reduce_159(val, _values, result) result = aryfy(val[0]) result end .,., module_eval(<<'.,.,', 'grammar.ra', 541) def _reduce_160(val, _values, result) val[0].push(val[2]) result = val[0] result end .,., module_eval(<<'.,.,', 'grammar.ra', 546) def _reduce_161(val, _values, result) result = ast AST::Selector, :param => val[0], :values => val[2] result end .,., # reduce 162 omitted module_eval(<<'.,.,', 'grammar.ra', 551) def _reduce_163(val, _values, result) @lexer.commentpop result = val[1] result end .,., # reduce 164 omitted module_eval(<<'.,.,', 'grammar.ra', 557) def _reduce_165(val, _values, result) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] else result = ast AST::ASTArray, :children => [val[0],val[2]] end result end .,., module_eval(<<'.,.,', 'grammar.ra', 566) def _reduce_166(val, _values, result) result = ast AST::ResourceParam, :param => val[0], :value => val[2] result end .,., # reduce 167 omitted # reduce 168 omitted # reduce 169 omitted # reduce 170 omitted # reduce 171 omitted # reduce 172 omitted # reduce 173 omitted # reduce 174 omitted module_eval(<<'.,.,', 'grammar.ra', 578) def _reduce_175(val, _values, result) result = ast AST::Default, :value => val[0][:value], :line => val[0][:line] result end .,., # reduce 176 omitted module_eval(<<'.,.,', 'grammar.ra', 583) def _reduce_177(val, _values, result) result = [val[0][:value]] result end .,., # reduce 178 omitted module_eval(<<'.,.,', 'grammar.ra', 585) def _reduce_179(val, _values, result) result = val[0] += val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 588) def _reduce_180(val, _values, result) val[1].each do |file| import(file) end result = nil result end .,., module_eval(<<'.,.,', 'grammar.ra', 598) def _reduce_181(val, _values, result) @lexer.commentpop result = Puppet::Parser::AST::Definition.new(classname(val[1]), ast_context(true).merge(:arguments => val[2], :code => val[4], :line => val[0][:line])) @lexer.indefine = false #} | DEFINE NAME argumentlist parent LBRACE RBRACE { result end .,., module_eval(<<'.,.,', 'grammar.ra', 606) def _reduce_182(val, _values, result) @lexer.commentpop result = Puppet::Parser::AST::Definition.new(classname(val[1]), ast_context(true).merge(:arguments => val[2], :line => val[0][:line])) @lexer.indefine = false result end .,., module_eval(<<'.,.,', 'grammar.ra', 614) def _reduce_183(val, _values, result) @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop result = Puppet::Parser::AST::Hostclass.new(classname(val[1]), ast_context(true).merge(:arguments => val[2], :parent => val[3], :code => val[5], :line => val[0][:line])) result end .,., module_eval(<<'.,.,', 'grammar.ra', 621) def _reduce_184(val, _values, result) @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop result = Puppet::Parser::AST::Hostclass.new(classname(val[1]), ast_context(true).merge(:arguments => val[2], :parent => val[3], :line => val[0][:line])) result end .,., module_eval(<<'.,.,', 'grammar.ra', 630) def _reduce_185(val, _values, result) @lexer.commentpop result = Puppet::Parser::AST::Node.new(val[1], ast_context(true).merge(:parent => val[2], :code => val[4], :line => val[0][:line])) result end .,., module_eval(<<'.,.,', 'grammar.ra', 635) def _reduce_186(val, _values, result) @lexer.commentpop result = Puppet::Parser::AST::Node.new(val[1], ast_context(true).merge(:parent => val[2], :line => val[0][:line])) result end .,., module_eval(<<'.,.,', 'grammar.ra', 639) def _reduce_187(val, _values, result) result = val[0][:value] result end .,., module_eval(<<'.,.,', 'grammar.ra', 641) def _reduce_188(val, _values, result) result = val[0][:value] result end .,., module_eval(<<'.,.,', 'grammar.ra', 642) def _reduce_189(val, _values, result) result = val[0][:value] result end .,., module_eval(<<'.,.,', 'grammar.ra', 643) def _reduce_190(val, _values, result) result = "class" result end .,., module_eval(<<'.,.,', 'grammar.ra', 648) def _reduce_191(val, _values, result) result = [result] result end .,., module_eval(<<'.,.,', 'grammar.ra', 651) def _reduce_192(val, _values, result) result = val[0] result << val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 656) def _reduce_193(val, _values, result) result = ast AST::HostName, :value => val[0] result end .,., module_eval(<<'.,.,', 'grammar.ra', 659) def _reduce_194(val, _values, result) result = val[0][:value] result end .,., module_eval(<<'.,.,', 'grammar.ra', 660) def _reduce_195(val, _values, result) result = val[0][:value] result end .,., module_eval(<<'.,.,', 'grammar.ra', 661) def _reduce_196(val, _values, result) result = val[0][:value] result end .,., # reduce 197 omitted module_eval(<<'.,.,', 'grammar.ra', 665) def _reduce_198(val, _values, result) result = nil result end .,., module_eval(<<'.,.,', 'grammar.ra', 669) def _reduce_199(val, _values, result) result = ast AST::ASTArray, :children => [] result end .,., # reduce 200 omitted module_eval(<<'.,.,', 'grammar.ra', 674) def _reduce_201(val, _values, result) result = nil result end .,., module_eval(<<'.,.,', 'grammar.ra', 677) def _reduce_202(val, _values, result) result = val[1] result = [result] unless result[0].is_a?(Array) result end .,., # reduce 203 omitted module_eval(<<'.,.,', 'grammar.ra', 683) def _reduce_204(val, _values, result) result = val[0] result = [result] unless result[0].is_a?(Array) result << val[2] result end .,., module_eval(<<'.,.,', 'grammar.ra', 689) def _reduce_205(val, _values, result) Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") result = [val[0][:value], val[2]] result end .,., module_eval(<<'.,.,', 'grammar.ra', 693) def _reduce_206(val, _values, result) Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") result = [val[0][:value]] result end .,., module_eval(<<'.,.,', 'grammar.ra', 696) def _reduce_207(val, _values, result) result = [val[0][:value], val[2]] result end .,., module_eval(<<'.,.,', 'grammar.ra', 698) def _reduce_208(val, _values, result) result = [val[0][:value]] result end .,., # reduce 209 omitted module_eval(<<'.,.,', 'grammar.ra', 703) def _reduce_210(val, _values, result) result = val[1] result end .,., # reduce 211 omitted module_eval(<<'.,.,', 'grammar.ra', 708) def _reduce_212(val, _values, result) result = val[1] result end .,., # reduce 213 omitted # reduce 214 omitted module_eval(<<'.,.,', 'grammar.ra', 714) def _reduce_215(val, _values, result) result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line] result end .,., module_eval(<<'.,.,', 'grammar.ra', 717) def _reduce_216(val, _values, result) result = val[1] result end .,., module_eval(<<'.,.,', 'grammar.ra', 718) def _reduce_217(val, _values, result) result = val[1] result end .,., module_eval(<<'.,.,', 'grammar.ra', 719) def _reduce_218(val, _values, result) result = ast AST::ASTArray result end .,., # reduce 219 omitted # reduce 220 omitted # reduce 221 omitted module_eval(<<'.,.,', 'grammar.ra', 725) def _reduce_222(val, _values, result) result = nil result end .,., module_eval(<<'.,.,', 'grammar.ra', 728) def _reduce_223(val, _values, result) result = ast AST::Regex, :value => val[0][:value] result end .,., module_eval(<<'.,.,', 'grammar.ra', 732) def _reduce_224(val, _values, result) if val[1].instance_of?(AST::ASTHash) result = val[1] else result = ast AST::ASTHash, { :value => val[1] } end result end .,., module_eval(<<'.,.,', 'grammar.ra', 739) def _reduce_225(val, _values, result) if val[1].instance_of?(AST::ASTHash) result = val[1] else result = ast AST::ASTHash, { :value => val[1] } end result end .,., module_eval(<<'.,.,', 'grammar.ra', 745) def _reduce_226(val, _values, result) result = ast AST::ASTHash result end .,., # reduce 227 omitted module_eval(<<'.,.,', 'grammar.ra', 750) def _reduce_228(val, _values, result) if val[0].instance_of?(AST::ASTHash) result = val[0].merge(val[2]) else result = ast AST::ASTHash, :value => val[0] result.merge(val[2]) end result end .,., module_eval(<<'.,.,', 'grammar.ra', 759) def _reduce_229(val, _values, result) result = ast AST::ASTHash, { :value => { val[0] => val[2] } } result end .,., module_eval(<<'.,.,', 'grammar.ra', 762) def _reduce_230(val, _values, result) result = val[0][:value] result end .,., module_eval(<<'.,.,', 'grammar.ra', 763) def _reduce_231(val, _values, result) result = val[0] result end .,., module_eval(<<'.,.,', 'grammar.ra', 766) def _reduce_232(val, _values, result) result = ast AST::HashOrArrayAccess, :variable => val[0][:value], :key => val[2] result end .,., # reduce 233 omitted module_eval(<<'.,.,', 'grammar.ra', 771) def _reduce_234(val, _values, result) result = ast AST::HashOrArrayAccess, :variable => val[0], :key => val[2] result end .,., def _reduce_none(val, _values, result) val[0] end end # class Parser end # module Parser end # module Puppet 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,1592 +1,1608 @@ .\" 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" . .SS "On The Command\-Line" Every Puppet executable (with the exception of \fBpuppetdoc\fR) accepts all of the parameters below, but not all of the arguments make sense for every executable\. . .P I have tried to be as thorough as possible in the descriptions of the arguments, so it should be obvious whether an argument is appropriate or not\. . .P These parameters can be supplied to the executables either as command\-line options or in the configuration file\. For instance, the command\-line invocation below would set the configuration directory to \fB/private/puppet\fR: . .IP "" 4 . .nf $ puppet agent \-\-confdir=/private/puppet . .fi . .IP "" 0 . .P Note that boolean options are turned on and off with a slightly different syntax on the command line: . .IP "" 4 . .nf $ puppet agent \-\-storeconfigs $ puppet agent \-\-no\-storeconfigs . .fi . .IP "" 0 . .P The invocations above will enable and disable, respectively, the storage of the client configuration\. . .SS "Configuration Files" As mentioned above, the configuration parameters can also be stored in a configuration file, located in the configuration directory\. As root, the default configuration directory is \fB/etc/puppet\fR, and as a regular user, the default configuration directory is \fB~user/\.puppet\fR\. As of 0\.23\.0, all executables look for \fBpuppet\.conf\fR in their configuration directory (although they previously looked for separate files)\. For example, \fBpuppet\.conf\fR is located at \fB/etc/puppet/puppet\.conf\fR as \fBroot\fR and \fB~user/\.puppet/puppet\.conf\fR as a regular user by default\. . .P All executables will set any parameters set within the \fB[main]\fR section, and each executable will also use one of the \fB[master]\fR, \fB[agent]\fR\. . .P The file follows INI\-style formatting\. Here is an example of a very simple \fBpuppet\.conf\fR file: . .IP "" 4 . .nf [main] confdir = /private/puppet storeconfigs = true . .fi . .IP "" 0 . .P Note that boolean parameters must be explicitly specified as \fBtrue\fR or \fBfalse\fR as seen above\. . .P If you need to change file or directory parameters (e\.g\., reset the mode or owner), do so within curly braces on the same line: . .IP "" 4 . .nf [main] vardir = /new/vardir {owner = root, mode = 644} . .fi . .IP "" 0 . .P If you\'re starting out with a fresh configuration, you may wish to let the executable generate a template configuration file for you by invoking the executable in question with the \fB\-\-genconfig\fR command\. The executable will print a template configuration to standard output, which can be redirected to a file like so: . .IP "" 4 . .nf $ puppet agent \-\-genconfig > /etc/puppet/puppet\.conf . .fi . .IP "" 0 . .P Note that this invocation will replace the contents of any pre\-existing \fBpuppet\.conf\fR file, so make a backup of your present config if it contains valuable information\. . .P Like the \fB\-\-genconfig\fR argument, the executables also accept a \fB\-\-genmanifest\fR argument, which will generate a manifest that can be used to manage all of Puppet\'s directories and files and prints it to standard output\. This can likewise be redirected to a file: . .IP "" 4 . .nf $ puppet agent \-\-genmanifest > /etc/puppet/manifests/site\.pp . .fi . .IP "" 0 . .P Puppet can also create user and group accounts for itself (one \fBpuppet\fR group and one \fBpuppet\fR user) if it is invoked as \fBroot\fR with the \fB\-\-mkusers\fR argument: . .IP "" 4 . .nf -$ puppet agent \-\-mkusers +$ puppet master \-\-mkusers . .fi . .IP "" 0 . .SH "Signals" The \fBpuppet agent\fR and \fBpuppet master\fR executables catch some signals for special handling\. Both daemons catch (\fBSIGHUP\fR), which forces the server to restart tself\. Predictably, interrupt and terminate (\fBSIGINT\fR and \fBSIGTERM\fR) will shut down the server, whether it be an instance of \fBpuppet agent\fR or \fBpuppet master\fR\. . .P Sending the \fBSIGUSR1\fR signal to an instance of \fBpuppet agent\fR will cause it to immediately begin a new configuration transaction with the server\. This signal has no effect on \fBpuppet master\fR\. . .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\. . .IP "\(bu" 4 \fIDefault\fR: $server . .IP "" 0 . .SS "archive_files" During an inspect run, whether to archive files whose contents are audited to a file bucket\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "async_storeconfigs" Whether to use a queueing system to provide asynchronous database integration\. Requires that \fBpuppetqd\fR be running and that \'PSON\' support for ruby be installed\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "authconfig" The configuration file that defines the rights to the different namespaces and methods\. This can be used as a coarse\-grained authorization system for both \fBpuppet agent\fR and \fBpuppet master\fR\. . .IP "\(bu" 4 \fIDefault\fR: $confdir/namespaceauth\.conf . .IP "" 0 . .SS "autoflush" Whether log files should always flush to disk\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "autosign" Whether to enable autosign\. Valid values are true (which autosigns any key request, and is a very bad idea), false (which never autosigns any key request), and the path to a file, which uses that configuration file to determine which keys to sign\. . .IP "\(bu" 4 \fIDefault\fR: $confdir/autosign\.conf . .IP "" 0 . .SS "bindaddress" The address a listening server should bind to\. Mongrel servers default to 127\.0\.0\.1 and WEBrick defaults to 0\.0\.0\.0\. . .SS "bucketdir" Where FileBucket files are stored\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/bucket . .IP "" 0 . .SS "ca" Wether the master should function as a certificate authority\. . .IP "\(bu" 4 \fIDefault\fR: true . .IP "" 0 . .SS "ca_days" How long a certificate should be valid\. This parameter is deprecated, use ca_ttl instead . .SS "ca_md" The type of hash used in certificates\. . .IP "\(bu" 4 \fIDefault\fR: md5 . .IP "" 0 . .SS "ca_name" The name to use the Certificate Authority certificate\. . .IP "\(bu" 4 \fIDefault\fR: Puppet CA: $certname . .IP "" 0 . .SS "ca_port" The port to use for the certificate authority\. . .IP "\(bu" 4 \fIDefault\fR: $masterport . .IP "" 0 . .SS "ca_server" The server to use for certificate authority requests\. It\'s a separate server because it cannot and does not need to horizontally scale\. . .IP "\(bu" 4 \fIDefault\fR: $server . .IP "" 0 . .SS "ca_ttl" The default TTL for new certificates; valid values must be an integer, optionally followed by one of the units \'y\' (years of 365 days), \'d\' (days), \'h\' (hours), or \'s\' (seconds)\. The unit defaults to seconds\. If this parameter is set, ca_days is ignored\. Examples are \'3600\' (one hour) and \'1825d\', which is the same as \'5y\' (5 years) . .IP "\(bu" 4 \fIDefault\fR: 5y . .IP "" 0 . .SS "cacert" The CA certificate\. . .IP "\(bu" 4 \fIDefault\fR: $cadir/ca_crt\.pem . .IP "" 0 . .SS "cacrl" The certificate revocation list (CRL) for the CA\. Will be used if present but otherwise ignored\. . .IP "\(bu" 4 \fIDefault\fR: $cadir/ca_crl\.pem . .IP "" 0 . .SS "cadir" The root directory for the certificate authority\. . .IP "\(bu" 4 \fIDefault\fR: $ssldir/ca . .IP "" 0 . .SS "cakey" The CA private key\. . .IP "\(bu" 4 \fIDefault\fR: $cadir/ca_key\.pem . .IP "" 0 . .SS "capass" Where the CA stores the password for the private key . .IP "\(bu" 4 \fIDefault\fR: $caprivatedir/ca\.pass . .IP "" 0 . .SS "caprivatedir" Where the CA stores private certificate information\. . .IP "\(bu" 4 \fIDefault\fR: $cadir/private . .IP "" 0 . .SS "capub" The CA public key\. . .IP "\(bu" 4 \fIDefault\fR: $cadir/ca_pub\.pem . .IP "" 0 . .SS "catalog_format" (Deprecated for \'preferred_serialization_format\') What format to use to dump the catalog\. Only supports \'marshal\' and \'yaml\'\. Only matters on the client, since it asks the server for a specific format\. . .SS "catalog_terminus" Where to get node catalogs\. This is useful to change if, for instance, you\'d like to pre\-compile catalogs and store them in memcached or some other easily\-accessed store\. . .IP "\(bu" 4 \fIDefault\fR: compiler . .IP "" 0 . .SS "cert_inventory" A Complete listing of all certificates . .IP "\(bu" 4 \fIDefault\fR: $cadir/inventory\.txt . .IP "" 0 . .SS "certdir" The certificate directory\. . .IP "\(bu" 4 \fIDefault\fR: $ssldir/certs . .IP "" 0 . .SS "certdnsnames" The DNS names on the Server certificate as a colon\-separated list\. If it\'s anything other than an empty string, it will be used as an alias in the created certificate\. By default, only the server gets an alias set up, and only for \'puppet\'\. . .SS "certificate_revocation" Whether certificate revocation should be supported by downloading a Certificate Revocation List (CRL) to all clients\. If enabled, CA chaining will almost definitely not work\. . .IP "\(bu" 4 \fIDefault\fR: true . .IP "" 0 . .SS "certname" 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 . .SS "classfile" The file in which puppet agent stores a list of the classes associated with the retrieved configuration\. Can be loaded in the separate \fBpuppet\fR executable using the \fB\-\-loadclasses\fR option\. . .IP "\(bu" 4 \fIDefault\fR: $statedir/classes\.txt . .IP "" 0 . .SS "client_datadir" The directory in which serialized data is stored on the client\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/client_data . .IP "" 0 . .SS "clientbucketdir" Where FileBucket files are stored locally\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/clientbucket . .IP "" 0 . .SS "clientyamldir" The directory in which client\-side YAML data is stored\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/client_yaml . .IP "" 0 . .SS "code" Code to parse directly\. This is essentially only used by \fBpuppet\fR, and should only be set if you\'re writing your own Puppet executable . .SS "color" Whether to use colors when logging to the console\. Valid values are \fBansi\fR (equivalent to \fBtrue\fR), \fBhtml\fR (mostly used during testing with TextMate), and \fBfalse\fR, which produces no color\. . .IP "\(bu" 4 \fIDefault\fR: ansi . .IP "" 0 . .SS "confdir" The main Puppet configuration directory\. The default for this parameter is calculated based on the user\. If the process is running as root or the user that Puppet is supposed to run as, it defaults to a system directory, but if it\'s running as any other user, it defaults to being in the user\'s home directory\. . .IP "\(bu" 4 \fIDefault\fR: /etc/puppet . .IP "" 0 . .SS "config" The configuration file for doc\. . .IP "\(bu" 4 \fIDefault\fR: $confdir/puppet\.conf . .IP "" 0 . .SS "config_version" How to determine the configuration version\. By default, it will be the time that the configuration is parsed, but you can provide a shell script to override how the version is determined\. The output of this script will be added to every log message in the reports, allowing you to correlate changes on your hosts to the source version on the server\. . .SS "configprint" Print the value of a specific configuration parameter\. If a parameter is provided for this, then the value is printed and puppet exits\. Comma\-separate multiple values\. For a list of all values, specify \'all\'\. This feature is only available in Puppet versions higher than 0\.18\.4\. . .SS "configtimeout" How long the client should wait for the configuration to be retrieved before considering it a failure\. This can help reduce flapping if too many clients contact the server at one time\. . .IP "\(bu" 4 \fIDefault\fR: 120 . .IP "" 0 . .SS "couchdb_url" The url where the puppet couchdb database will be created . .IP "\(bu" 4 \fIDefault\fR: http://127\.0\.0\.1:5984/puppet . .IP "" 0 . .SS "csrdir" Where the CA stores certificate requests . .IP "\(bu" 4 \fIDefault\fR: $cadir/requests . .IP "" 0 . .SS "daemonize" Send the process into the background\. This is the default\. . .IP "\(bu" 4 \fIDefault\fR: true . .IP "" 0 . .SS "dbadapter" The type of database to use\. . .IP "\(bu" 4 \fIDefault\fR: sqlite3 . .IP "" 0 . .SS "dbconnections" The number of database connections for networked databases\. Will be ignored unless the value is a positive integer\. . .SS "dblocation" The database cache for client configurations\. Used for querying within the language\. . .IP "\(bu" 4 \fIDefault\fR: $statedir/clientconfigs\.sqlite3 . .IP "" 0 . .SS "dbmigrate" Whether to automatically migrate the database\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "dbname" The name of the database to use\. . .IP "\(bu" 4 \fIDefault\fR: puppet . .IP "" 0 . .SS "dbpassword" The database password for caching\. Only used when networked databases are used\. . .IP "\(bu" 4 \fIDefault\fR: puppet . .IP "" 0 . .SS "dbport" The database password for caching\. Only used when networked databases are used\. . .SS "dbserver" The database server for caching\. Only used when networked databases are used\. . .IP "\(bu" 4 \fIDefault\fR: localhost . .IP "" 0 . .SS "dbsocket" The database socket location\. Only used when networked databases are used\. Will be ignored if the value is an empty string\. . .SS "dbuser" The database user for caching\. Only used when networked databases are used\. . .IP "\(bu" 4 \fIDefault\fR: puppet . .IP "" 0 . .SS "diff" Which diff command to use when printing differences between files\. . .IP "\(bu" 4 \fIDefault\fR: diff . .IP "" 0 . .SS "diff_args" Which arguments to pass to the diff command when printing differences between files\. . .IP "\(bu" 4 \fIDefault\fR: \-u . .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\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "dynamicfacts" Facts that are dynamic; these facts will be ignored when deciding whether changed facts should result in a recompile\. Multiple facts should be comma\-separated\. . .IP "\(bu" 4 \fIDefault\fR: memorysize,memoryfree,swapsize,swapfree . .IP "" 0 . .SS "environment" The environment Puppet is running in\. For clients (e\.g\., \fBpuppet agent\fR) this determines the environment itself, which is used to find modules and much more\. For servers (i\.e\., \fBpuppet master\fR) this provides the default environment for nodes we know nothing about\. . .IP "\(bu" 4 \fIDefault\fR: production . .IP "" 0 . .SS "evaltrace" Whether each resource should log when it is being evaluated\. This allows you to interactively see exactly what is being done\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "external_nodes" An external command that can produce node information\. The output must be a YAML dump of a hash, and that hash must have one or both of \fBclasses\fR and \fBparameters\fR, where \fBclasses\fR is an array and \fBparameters\fR is a hash\. For unknown nodes, the commands should exit with a non\-zero exit code\. This command makes it straightforward to store your node mapping information in other data sources like databases\. . .IP "\(bu" 4 \fIDefault\fR: none . .IP "" 0 . .SS "factdest" Where Puppet should store facts that it pulls down from the central server\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/facts/ . .IP "" 0 . .SS "factpath" Where Puppet should look for facts\. Multiple directories should be colon\-separated, like normal PATH variables\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/lib/facter:$vardir/facts . .IP "" 0 . .SS "facts_terminus" The node facts terminus\. . .IP "\(bu" 4 \fIDefault\fR: facter . .IP "" 0 . .SS "factsignore" What files to ignore when pulling down facts\. . .IP "\(bu" 4 \fIDefault\fR: \.svn CVS . .IP "" 0 . .SS "factsource" From where to retrieve facts\. The standard Puppet \fBfile\fR type is used for retrieval, so anything that is a valid file source can be used here\. . .IP "\(bu" 4 \fIDefault\fR: puppet://$server/facts/ . .IP "" 0 . .SS "factsync" Whether facts should be synced with the central server\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "fileserverconfig" Where the fileserver configuration is stored\. . .IP "\(bu" 4 \fIDefault\fR: $confdir/fileserver\.conf . .IP "" 0 . .SS "filetimeout" The minimum time to wait (in seconds) between checking for updates in configuration files\. This timeout determines how quickly Puppet checks whether a file (such as manifests or templates) has changed on disk\. . .IP "\(bu" 4 \fIDefault\fR: 15 . .IP "" 0 . .SS "freeze_main" Freezes the \'main\' class, disallowing any code to be added to it\. This essentially means that you can\'t have any code outside of a node, class, or definition other than in the site manifest\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "genconfig" Whether to just print a configuration to stdout and exit\. Only makes sense when used interactively\. Takes into account arguments specified on the CLI\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "genmanifest" Whether to just print a manifest to stdout and exit\. Only makes sense when used interactively\. Takes into account arguments specified on the CLI\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "graph" Whether to create dot graph files for the different configuration graphs\. These dot files can be interpreted by tools like OmniGraffle or dot (which is part of ImageMagick)\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "graphdir" Where to store dot\-outputted graphs\. . .IP "\(bu" 4 \fIDefault\fR: $statedir/graphs . .IP "" 0 . .SS "group" The group puppet master should run as\. . .IP "\(bu" 4 \fIDefault\fR: puppet . .IP "" 0 . .SS "hostcert" Where individual hosts store and look for their certificates\. . .IP "\(bu" 4 \fIDefault\fR: $certdir/$certname\.pem . .IP "" 0 . .SS "hostcrl" Where the host\'s certificate revocation list can be found\. This is distinct from the certificate authority\'s CRL\. . .IP "\(bu" 4 \fIDefault\fR: $ssldir/crl\.pem . .IP "" 0 . .SS "hostcsr" Where individual hosts store and look for their certificate requests\. . .IP "\(bu" 4 \fIDefault\fR: $ssldir/csr_$certname\.pem . .IP "" 0 . .SS "hostprivkey" Where individual hosts store and look for their private key\. . .IP "\(bu" 4 \fIDefault\fR: $privatekeydir/$certname\.pem . .IP "" 0 . .SS "hostpubkey" Where individual hosts store and look for their public key\. . .IP "\(bu" 4 \fIDefault\fR: $publickeydir/$certname\.pem . .IP "" 0 . .SS "http_compression" Allow http compression in REST communication with the master\. This setting might improve performance for agent \-> master communications over slow WANs\. Your puppetmaster needs to support compression (usually by activating some settings in a reverse\-proxy in front of the puppetmaster, which rules out webrick)\. It is harmless to activate this settings if your master doesn\'t support compression, but if it supports it, this setting might reduce performance on high\-speed LANs\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "http_proxy_host" The HTTP proxy host to use for outgoing connections\. Note: You may need to use a FQDN for the server hostname when using a proxy\. . .IP "\(bu" 4 \fIDefault\fR: none . .IP "" 0 . .SS "http_proxy_port" The HTTP proxy port to use for outgoing connections . .IP "\(bu" 4 \fIDefault\fR: 3128 . .IP "" 0 . .SS "httplog" Where the puppet agent web server logs\. . .IP "\(bu" 4 \fIDefault\fR: $logdir/http\.log . .IP "" 0 . .SS "ignorecache" Ignore cache and always recompile the configuration\. This is useful for testing new configurations, where the local cache may in fact be stale even if the timestamps are up to date \- if the facts change or if the server changes\. . .IP "\(bu" 4 \fIDefault\fR: false . .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\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "inventory_port" The port to communicate with the inventory_server\. . .IP "\(bu" 4 \fIDefault\fR: $masterport . .IP "" 0 . .SS "inventory_server" The server to send facts to\. . .IP "\(bu" 4 \fIDefault\fR: $server . .IP "" 0 . .SS "inventory_terminus" Should usually be the same as the facts terminus . .IP "\(bu" 4 \fIDefault\fR: $facts_terminus . .IP "" 0 . .SS "keylength" The bit length of keys\. . .IP "\(bu" 4 \fIDefault\fR: 1024 . .IP "" 0 . .SS "lastrunfile" Where puppet agent stores the last run report summary in yaml format\. . .IP "\(bu" 4 \fIDefault\fR: $statedir/last_run_summary\.yaml . .IP "" 0 . .SS "lastrunreport" Where puppet agent stores the last run report in yaml format\. . .IP "\(bu" 4 \fIDefault\fR: $statedir/last_run_report\.yaml . .IP "" 0 . .SS "ldapattrs" The LDAP attributes to include when querying LDAP for nodes\. All returned attributes are set as variables in the top\-level scope\. Multiple values should be comma\-separated\. The value \'all\' returns all attributes\. . .IP "\(bu" 4 \fIDefault\fR: all . .IP "" 0 . .SS "ldapbase" The search base for LDAP searches\. It\'s impossible to provide a meaningful default here, although the LDAP libraries might have one already set\. Generally, it should be the \'ou=Hosts\' branch under your main directory\. . .SS "ldapclassattrs" The LDAP attributes to use to define Puppet classes\. Values should be comma\-separated\. . .IP "\(bu" 4 \fIDefault\fR: puppetclass . .IP "" 0 . .SS "ldapnodes" Whether to search for node configurations in LDAP\. See http://projects\.puppetlabs\.com/projects/puppet/wiki/LDAP_Nodes for more information\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "ldapparentattr" The attribute to use to define the parent node\. . .IP "\(bu" 4 \fIDefault\fR: parentnode . .IP "" 0 . .SS "ldappassword" The password to use to connect to LDAP\. . .SS "ldapport" The LDAP port\. Only used if \fBldapnodes\fR is enabled\. . .IP "\(bu" 4 \fIDefault\fR: 389 . .IP "" 0 . .SS "ldapserver" The LDAP server\. Only used if \fBldapnodes\fR is enabled\. . .IP "\(bu" 4 \fIDefault\fR: ldap . .IP "" 0 . .SS "ldapssl" Whether SSL should be used when searching for nodes\. Defaults to false because SSL usually requires certificates to be set up on the client side\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "ldapstackedattrs" The LDAP attributes that should be stacked to arrays by adding the values in all hierarchy elements of the tree\. Values should be comma\-separated\. . .IP "\(bu" 4 \fIDefault\fR: puppetvar . .IP "" 0 . .SS "ldapstring" The search string used to find an LDAP node\. . .IP "\(bu" 4 \fIDefault\fR: (&(objectclass=puppetClient)(cn=%s)) . .IP "" 0 . .SS "ldaptls" Whether TLS should be used when searching for nodes\. Defaults to false because TLS usually requires certificates to be set up on the client side\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "ldapuser" The user to use to connect to LDAP\. Must be specified as a full DN\. . .SS "lexical" Whether to use lexical scoping (vs\. dynamic)\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "libdir" An extra search path for Puppet\. This is only useful for those files that Puppet will load on demand, and is only guaranteed to work for those cases\. In fact, the autoload mechanism is responsible for making sure this directory is in Ruby\'s search path . .IP "\(bu" 4 \fIDefault\fR: $vardir/lib . .IP "" 0 . .SS "listen" Whether puppet agent should listen for connections\. If this is true, then by default only the \fBrunner\fR server is started, which allows remote authorized and authenticated nodes to connect and trigger \fBpuppet agent\fR runs\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "localcacert" Where each client stores the CA certificate\. . .IP "\(bu" 4 \fIDefault\fR: $certdir/ca\.pem . .IP "" 0 . .SS "localconfig" Where puppet agent caches the local configuration\. An extension indicating the cache format is added automatically\. . .IP "\(bu" 4 \fIDefault\fR: $statedir/localconfig . .IP "" 0 . .SS "logdir" The Puppet log directory\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/log . .IP "" 0 . .SS "manage_internal_file_permissions" Whether Puppet should manage the owner, group, and mode of files it uses internally . .IP "\(bu" 4 \fIDefault\fR: true . .IP "" 0 . .SS "manifest" The entry\-point manifest for puppet master\. . .IP "\(bu" 4 \fIDefault\fR: $manifestdir/site\.pp . .IP "" 0 . .SS "manifestdir" Where puppet master looks for its manifests\. . .IP "\(bu" 4 \fIDefault\fR: $confdir/manifests . .IP "" 0 . .SS "masterhttplog" Where the puppet master web server logs\. . .IP "\(bu" 4 \fIDefault\fR: $logdir/masterhttp\.log . .IP "" 0 . .SS "masterlog" Where puppet master logs\. This is generally not used, since syslog is the default log destination\. . .IP "\(bu" 4 \fIDefault\fR: $logdir/puppetmaster\.log . .IP "" 0 . .SS "masterport" Which port puppet master listens on\. . .IP "\(bu" 4 \fIDefault\fR: 8140 . .IP "" 0 . .SS "maximum_uid" The maximum allowed UID\. Some platforms use negative UIDs but then ship with tools that do not know how to handle signed ints, so the UIDs show up as huge numbers that can then not be fed back into the system\. This is a hackish way to fail in a slightly more useful way when that happens\. . .IP "\(bu" 4 \fIDefault\fR: 4294967290 . .IP "" 0 . .SS "mkusers" Whether to create the necessary user and group that puppet agent will run as\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "modulepath" The search path for modules as a colon\-separated list of directories\. . .IP "\(bu" 4 \fIDefault\fR: $confdir/modules:/usr/share/puppet/modules . .IP "" 0 . .SS "name" The name of the application, if we are running as one\. The default is essentially $0 without the path or \fB\.rb\fR\. . .IP "\(bu" 4 \fIDefault\fR: doc . .IP "" 0 . .SS "node_name" 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\. Possible values are \'cert\' (use the subject\'s CN in the client\'s certificate) and \'facter\' (use the hostname that the client reported in its facts) . .IP "\(bu" 4 \fIDefault\fR: cert . .IP "" 0 . .SS "node_terminus" Where to find information about nodes\. . .IP "\(bu" 4 \fIDefault\fR: plain . .IP "" 0 . .SS "noop" Whether puppet agent should be run in noop mode\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "onetime" Run the configuration once, rather than as a long\-running daemon\. This is useful for interactively running puppetd\. . .IP "\(bu" 4 \fIDefault\fR: false . .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\. . .IP "\(bu" 4 \fIDefault\fR: $privatedir/password . .IP "" 0 . .SS "path" The shell search path\. Defaults to whatever is inherited from the parent process\. . .IP "\(bu" 4 \fIDefault\fR: none . .IP "" 0 . .SS "pidfile" The pid file . .IP "\(bu" 4 \fIDefault\fR: $rundir/$name\.pid . .IP "" 0 . .SS "plugindest" Where Puppet should store plugins that it pulls down from the central server\. . .IP "\(bu" 4 \fIDefault\fR: $libdir . .IP "" 0 . .SS "pluginsignore" What files to ignore when pulling down plugins\. . .IP "\(bu" 4 \fIDefault\fR: \.svn CVS \.git . .IP "" 0 . .SS "pluginsource" From where to retrieve plugins\. The standard Puppet \fBfile\fR type is used for retrieval, so anything that is a valid file source can be used here\. . .IP "\(bu" 4 \fIDefault\fR: puppet://$server/plugins . .IP "" 0 . .SS "pluginsync" Whether plugins should be synced with the central server\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "postrun_command" A command to run after every agent run\. If this command returns a non\-zero return code, the entire Puppet run will be considered to have failed, even though it might have performed work during the normal run\. . .SS "preferred_serialization_format" The preferred means of serializing ruby instances for passing over the wire\. This won\'t guarantee that all instances will be serialized using this method, since not all classes can be guaranteed to support this format, but it will be used for all classes that support it\. . .IP "\(bu" 4 \fIDefault\fR: pson . .IP "" 0 . .SS "prerun_command" A command to run before every agent run\. If this command returns a non\-zero return code, the entire Puppet run will fail\. . .SS "privatedir" Where the client stores private certificate information\. . .IP "\(bu" 4 \fIDefault\fR: $ssldir/private . .IP "" 0 . .SS "privatekeydir" The private key directory\. . .IP "\(bu" 4 \fIDefault\fR: $ssldir/private_keys . .IP "" 0 . .SS "publickeydir" The public key directory\. . .IP "\(bu" 4 \fIDefault\fR: $ssldir/public_keys . .IP "" 0 . .SS "puppetdlockfile" A lock file to temporarily stop puppet agent from doing anything\. . .IP "\(bu" 4 \fIDefault\fR: $statedir/puppetdlock . .IP "" 0 . .SS "puppetdlog" The log file for puppet agent\. This is generally not used\. . .IP "\(bu" 4 \fIDefault\fR: $logdir/puppetd\.log . .IP "" 0 . .SS "puppetport" Which port puppet agent listens on\. . .IP "\(bu" 4 \fIDefault\fR: 8139 . .IP "" 0 . .SS "queue_source" Which type of queue to use for asynchronous processing\. If your stomp server requires authentication, you can include it in the URI as long as your stomp client library is at least 1\.1\.1 . .IP "\(bu" 4 \fIDefault\fR: stomp://localhost:61613/ . .IP "" 0 . .SS "queue_type" Which type of queue to use for asynchronous processing\. . .IP "\(bu" 4 \fIDefault\fR: stomp . .IP "" 0 . .SS "rails_loglevel" The log level for Rails connections\. The value must be a valid log level within Rails\. Production environments normally use \fBinfo\fR and other environments normally use \fBdebug\fR\. . .IP "\(bu" 4 \fIDefault\fR: info . .IP "" 0 . .SS "railslog" Where Rails\-specific logs are sent . .IP "\(bu" 4 \fIDefault\fR: $logdir/rails\.log . .IP "" 0 . .SS "report" Whether to send reports after every transaction\. . .IP "\(bu" 4 \fIDefault\fR: true . .IP "" 0 . .SS "report_port" The port to communicate with the report_server\. . .IP "\(bu" 4 \fIDefault\fR: $masterport . .IP "" 0 . .SS "report_server" The server to send transaction reports to\. . .IP "\(bu" 4 \fIDefault\fR: $server . .IP "" 0 . .SS "reportdir" The directory in which to store reports received from the client\. Each client gets a separate subdirectory\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/reports . .IP "" 0 . .SS "reportfrom" 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 . .SS "reports" The list of reports to generate\. All reports are looked for in \fBpuppet/reports/name\.rb\fR, and multiple report names should be comma\-separated (whitespace is okay)\. . .IP "\(bu" 4 \fIDefault\fR: store . .IP "" 0 . .SS "reportserver" (Deprecated for \'report_server\') The server to which to send transaction reports\. . .IP "\(bu" 4 \fIDefault\fR: $server . .IP "" 0 . .SS "reporturl" The URL used by the http reports processor to send reports . .IP "\(bu" 4 \fIDefault\fR: http://localhost:3000/reports . .IP "" 0 . .SS "req_bits" The bit length of the certificates\. . .IP "\(bu" 4 \fIDefault\fR: 2048 . .IP "" 0 . .SS "requestdir" Where host certificate requests are stored\. . .IP "\(bu" 4 \fIDefault\fR: $ssldir/certificate_requests . .IP "" 0 . .SS "rest_authconfig" The configuration file that defines the rights to the different rest indirections\. This can be used as a fine\-grained authorization system for \fBpuppet master\fR\. . .IP "\(bu" 4 \fIDefault\fR: $confdir/auth\.conf . .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\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/rrd . .IP "" 0 . .SS "rrdinterval" How often RRD should expect data\. This should match how often the hosts report back to the server\. . .IP "\(bu" 4 \fIDefault\fR: $runinterval . .IP "" 0 . .SS "run_mode" The effective \'run mode\' of the application: master, agent, or user\. . .IP "\(bu" 4 \fIDefault\fR: master . .IP "" 0 . .SS "rundir" Where Puppet PID files are kept\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/run . .IP "" 0 . .SS "runinterval" How often puppet agent applies the client configuration; in seconds\. . .IP "\(bu" 4 \fIDefault\fR: 1800 . .IP "" 0 . .SS "sendmail" Where to find the sendmail binary with which to send email\. . .IP "\(bu" 4 \fIDefault\fR: /usr/sbin/sendmail . .IP "" 0 . .SS "serial" Where the serial number for certificates is stored\. . .IP "\(bu" 4 \fIDefault\fR: $cadir/serial . .IP "" 0 . .SS "server" The server to which server puppet agent should connect . .IP "\(bu" 4 \fIDefault\fR: puppet . .IP "" 0 . .SS "server_datadir" The directory in which serialized data is stored, usually in a subdirectory\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/server_data . .IP "" 0 . .SS "servertype" The type of server to use\. Currently supported options are webrick and mongrel\. If you use mongrel, you will need a proxy in front of the process or processes, since Mongrel cannot speak SSL\. . .IP "\(bu" 4 \fIDefault\fR: webrick . .IP "" 0 . .SS "show_diff" Whether to print a contextual diff when files are being replaced\. The diff is printed on stdout, so this option is meaningless unless you are running Puppet interactively\. This feature currently requires the \fBdiff/lcs\fR Ruby library\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "signeddir" Where the CA stores signed certificates\. . .IP "\(bu" 4 \fIDefault\fR: $cadir/signed . .IP "" 0 . .SS "smtpserver" The server through which to send email reports\. . .IP "\(bu" 4 \fIDefault\fR: none . .IP "" 0 . .SS "splay" Whether to sleep for a pseudo\-random (but consistent) amount of time before a run\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "splaylimit" The maximum time to delay before runs\. Defaults to being the same as the run interval\. . .IP "\(bu" 4 \fIDefault\fR: $runinterval . .IP "" 0 . .SS "ssl_client_header" The header containing an authenticated client\'s SSL DN\. Only used with Mongrel\. This header must be set by the proxy to the authenticated client\'s SSL DN (e\.g\., \fB/CN=puppet\.puppetlabs\.com\fR)\. See http://projects\.puppetlabs\.com/projects/puppet/wiki/Using_Mongrel for more information\. . .IP "\(bu" 4 \fIDefault\fR: HTTP_X_CLIENT_DN . .IP "" 0 . .SS "ssl_client_verify_header" The header containing the status message of the client verification\. Only used with Mongrel\. This header must be set by the proxy to \'SUCCESS\' if the client successfully authenticated, and anything else otherwise\. See http://projects\.puppetlabs\.com/projects/puppet/wiki/Using_Mongrel for more information\. . .IP "\(bu" 4 \fIDefault\fR: HTTP_X_CLIENT_VERIFY . .IP "" 0 . .SS "ssldir" Where SSL certificates are kept\. . .IP "\(bu" 4 \fIDefault\fR: $confdir/ssl . .IP "" 0 . .SS "statedir" The directory where Puppet state is stored\. Generally, this directory can be removed without causing harm (although it might result in spurious service restarts)\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/state . .IP "" 0 . .SS "statefile" Where puppet agent and puppet master store state associated with the running configuration\. In the case of puppet master, this file reflects the state discovered through interacting with clients\. . .IP "\(bu" 4 \fIDefault\fR: $statedir/state\.yaml . .IP "" 0 . .SS "storeconfigs" Whether to store each client\'s configuration\. This requires ActiveRecord from Ruby on Rails\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "strict_hostname_checking" Whether to only search for the complete hostname as it is in the certificate when searching for node information in the catalogs\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "summarize" Whether to print a transaction summary\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "syslogfacility" What syslog facility to use when logging to syslog\. Syslog has a fixed list of valid facilities, and you must choose one of those; you cannot just make one up\. . .IP "\(bu" 4 \fIDefault\fR: daemon . .IP "" 0 . .SS "tagmap" The mapping between reporting tags and email addresses\. . .IP "\(bu" 4 \fIDefault\fR: $confdir/tagmail\.conf . .IP "" 0 . .SS "tags" Tags to use to find resources\. If this is set, then only resources tagged with the specified tags will be applied\. Values must be comma\-separated\. . .SS "templatedir" Where Puppet looks for template files\. Can be a list of colon\-seperated directories\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/templates . .IP "" 0 . .SS "thin_storeconfigs" Boolean; wether storeconfigs store in the database only the facts and exported resources\. If true, then storeconfigs performance will be higher and still allow exported/collected resources, but other usage external to Puppet might not work . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "trace" Whether to print stack traces on some errors . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "use_cached_catalog" Whether to only use the cached catalog rather than compiling a new catalog on every run\. Puppet can be run with this enabled by default and then selectively disabled when a recompile is desired\. . .IP "\(bu" 4 \fIDefault\fR: false . .IP "" 0 . .SS "usecacheonfailure" Whether to use the cached configuration when the remote configuration will not compile\. This option is useful for testing new configurations, where you want to fix the broken configuration rather than reverting to a known\-good one\. . .IP "\(bu" 4 \fIDefault\fR: true . .IP "" 0 . .SS "user" The user puppet master should run as\. . .IP "\(bu" 4 \fIDefault\fR: puppet . .IP "" 0 . .SS "vardir" Where Puppet stores dynamic and growing data\. The default for this parameter is calculated specially, like \fBconfdir\fR_\. . .IP "\(bu" 4 \fIDefault\fR: /var/lib/puppet . .IP "" 0 . .SS "yamldir" The directory in which YAML data is stored, usually in a subdirectory\. . .IP "\(bu" 4 \fIDefault\fR: $vardir/yaml . .IP "" 0 . .SS "zlib" Boolean; whether to use the zlib library . .IP "\(bu" 4 \fIDefault\fR: true . .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 @@ -1,433 +1,390 @@ #!/usr/bin/env rspec require 'spec_helper' require 'puppet/application/apply' require 'puppet/file_bucket/dipper' require 'puppet/configurer' describe Puppet::Application::Apply do before :each do @apply = Puppet::Application[:apply] Puppet::Util::Log.stubs(:newdestination) Puppet::Util::Log.stubs(:level=) end [:debug,:loadclasses,:verbose,:use_nodes,:detailed_exitcodes].each do |option| it "should declare handle_#{option} method" do @apply.should respond_to("handle_#{option}".to_sym) end it "should store argument value when calling handle_#{option}" do @apply.options.expects(:[]=).with(option, 'arg') @apply.send("handle_#{option}".to_sym, 'arg') end end it "should set the code to the provided code when :execute is used" do @apply.options.expects(:[]=).with(:code, 'arg') @apply.send("handle_execute".to_sym, 'arg') end it "should ask Puppet::Application to parse Puppet configuration file" do @apply.should_parse_config?.should be_true end describe "when applying options" do it "should set the log destination with --logdest" do Puppet::Log.expects(:newdestination).with("console") @apply.handle_logdest("console") end it "should put the logset options to true" do @apply.options.expects(:[]=).with(:logset,true) @apply.handle_logdest("console") end end describe "during setup" do before :each do Puppet::Log.stubs(:newdestination) Puppet::Log.stubs(:level=) Puppet.stubs(:parse_config) Puppet::FileBucket::Dipper.stubs(:new) STDIN.stubs(:read) Puppet::Transaction::Report.indirection.stubs(:cache_class=) @apply.options.stubs(:[]).with(any_parameters) end it "should set show_diff on --noop" do Puppet.stubs(:[]=) Puppet.stubs(:[]).with(:config) Puppet.stubs(:[]).with(:noop).returns(true) Puppet.expects(:[]=).with(:show_diff, true) @apply.setup end it "should set console as the log destination if logdest option wasn't provided" do Puppet::Log.expects(:newdestination).with(:console) @apply.setup end it "should set INT trap" do Signal.expects(:trap).with(:INT) @apply.setup end it "should set log level to debug if --debug was passed" do @apply.options.stubs(:[]).with(:debug).returns(true) Puppet::Log.expects(:level=).with(:debug) @apply.setup end it "should set log level to info if --verbose was passed" do @apply.options.stubs(:[]).with(:verbose).returns(true) Puppet::Log.expects(:level=).with(:info) @apply.setup end it "should print puppet config if asked to in Puppet config" do @apply.stubs(:exit) Puppet.settings.stubs(:print_configs?).returns(true) Puppet.settings.expects(:print_configs) @apply.setup end it "should exit after printing puppet config if asked to in Puppet config" do Puppet.settings.stubs(:print_configs?).returns(true) lambda { @apply.setup }.should raise_error(SystemExit) end it "should tell the report handler to cache locally as yaml" do Puppet::Transaction::Report.indirection.expects(:cache_class=).with(:yaml) @apply.setup end end 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" @apply.expects(:apply) @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(:[]) Puppet.settings.stubs(:use) Puppet.stubs(:[]).with(:prerun_command).returns "" Puppet.stubs(:[]).with(:postrun_command).returns "" Puppet.stubs(:[]).with(:trace).returns(true) @apply.options.stubs(:[]) @facts = stub_everything 'facts' Puppet::Node::Facts.indirection.stubs(:find).returns(@facts) @node = stub_everything 'node' Puppet::Node.indirection.stubs(:find).returns(@node) @catalog = stub_everything 'catalog' @catalog.stubs(:to_ral).returns(@catalog) Puppet::Resource::Catalog.indirection.stubs(:find).returns(@catalog) STDIN.stubs(:read) @transaction = stub_everything 'transaction' @catalog.stubs(:apply).returns(@transaction) @apply.stubs(:exit) Puppet::Util::Storage.stubs(:load) Puppet::Configurer.any_instance.stubs(:save_last_run_summary) # to prevent it from trying to write files end it "should set the code to run from --code" do @apply.options.stubs(:[]).with(:code).returns("code to run") Puppet.expects(:[]=).with(:code,"code to run") @apply.main end it "should set the code to run from STDIN if no arguments" do @apply.command_line.stubs(:args).returns([]) STDIN.stubs(:read).returns("code to run") Puppet.expects(:[]=).with(:code,"code to run") @apply.main end 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") @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.indirection.expects(:find).returns(@facts) @apply.main end it "should raise an error if we can't find the node" do Puppet::Node::Facts.indirection.expects(:find).returns(nil) lambda { @apply.main }.should raise_error end it "should look for the node" do Puppet::Node.indirection.expects(:find).returns(@node) @apply.main end it "should raise an error if we can't find the node" do Puppet::Node.indirection.expects(:find).returns(nil) lambda { @apply.main }.should raise_error end it "should merge in our node the loaded facts" do @facts.stubs(:values).returns("values") @node.expects(:merge).with("values") @apply.main end it "should load custom classes if loadclasses" do @apply.options.stubs(:[]).with(:loadclasses).returns(true) Puppet.stubs(:[]).with(:classfile).returns("/etc/puppet/classes.txt") FileTest.stubs(:exists?).with("/etc/puppet/classes.txt").returns(true) FileTest.stubs(:readable?).with("/etc/puppet/classes.txt").returns(true) File.stubs(:read).with("/etc/puppet/classes.txt").returns("class") @node.expects(:classes=) @apply.main end it "should compile the catalog" do Puppet::Resource::Catalog.indirection.expects(:find).returns(@catalog) @apply.main end it "should transform the catalog to ral" do @catalog.expects(:to_ral).returns(@catalog) @apply.main end it "should finalize the catalog" do @catalog.expects(:finalize) @apply.main end it "should call the prerun and postrun commands on a Configurer instance" do Puppet::Configurer.any_instance.expects(:execute_prerun_command) Puppet::Configurer.any_instance.expects(:execute_postrun_command) @apply.main end it "should apply the catalog" do @catalog.expects(:apply).returns(stub_everything('transaction')) @apply.main end it "should save the last run summary" do Puppet.stubs(:[]).with(:noop).returns(false) report = Puppet::Transaction::Report.new("apply") Puppet::Transaction::Report.stubs(:new).returns(report) Puppet::Configurer.any_instance.expects(:save_last_run_summary).with(report) @apply.main end describe "with detailed_exitcodes" do it "should exit with report's computed exit status" do Puppet.stubs(:[]).with(:noop).returns(false) @apply.options.stubs(:[]).with(:detailed_exitcodes).returns(true) Puppet::Transaction::Report.any_instance.stubs(:exit_status).returns(666) @apply.expects(:exit).with(666) @apply.main end it "should exit with report's computed exit status, even if --noop is set" do Puppet.stubs(:[]).with(:noop).returns(true) @apply.options.stubs(:[]).with(:detailed_exitcodes).returns(true) Puppet::Transaction::Report.any_instance.stubs(:exit_status).returns(666) @apply.expects(:exit).with(666) @apply.main end it "should always exit with 0 if option is disabled" do Puppet.stubs(:[]).with(:noop).returns(false) @apply.options.stubs(:[]).with(:detailed_exitcodes).returns(false) report = stub 'report', :exit_status => 666 @transaction.stubs(:report).returns(report) @apply.expects(:exit).with(0) @apply.main end it "should always exit with 0 if --noop" do Puppet.stubs(:[]).with(:noop).returns(true) @apply.options.stubs(:[]).with(:detailed_exitcodes).returns(true) report = stub 'report', :exit_status => 666 @transaction.stubs(:report).returns(report) @apply.expects(:exit).with(0) @apply.main end end end describe "the 'apply' command" do it "should read the catalog in from disk if a file name is provided" do @apply.options[:catalog] = "/my/catalog.pson" File.expects(:read).with("/my/catalog.pson").returns "something" Puppet::Resource::Catalog.stubs(:convert_from).with(:pson,'something').returns Puppet::Resource::Catalog.new @apply.apply end it "should read the catalog in from stdin if '-' is provided" do @apply.options[:catalog] = "-" $stdin.expects(:read).returns "something" Puppet::Resource::Catalog.stubs(:convert_from).with(:pson,'something').returns Puppet::Resource::Catalog.new @apply.apply end it "should deserialize the catalog from the default format" do @apply.options[:catalog] = "/my/catalog.pson" File.stubs(:read).with("/my/catalog.pson").returns "something" Puppet::Resource::Catalog.stubs(:default_format).returns :rot13_piglatin Puppet::Resource::Catalog.stubs(:convert_from).with(:rot13_piglatin,'something').returns Puppet::Resource::Catalog.new @apply.apply end it "should fail helpfully if deserializing fails" do @apply.options[:catalog] = "/my/catalog.pson" File.stubs(:read).with("/my/catalog.pson").returns "something syntacically invalid" lambda { @apply.apply }.should raise_error(Puppet::Error) end it "should convert plain data structures into a catalog if deserialization does not do so" do @apply.options[:catalog] = "/my/catalog.pson" File.stubs(:read).with("/my/catalog.pson").returns "something" Puppet::Resource::Catalog.stubs(:convert_from).with(:pson,"something").returns({:foo => "bar"}) Puppet::Resource::Catalog.expects(:pson_create).with({:foo => "bar"}).returns(Puppet::Resource::Catalog.new) @apply.apply end it "should convert the catalog to a RAL catalog and use a Configurer instance to apply it" do @apply.options[:catalog] = "/my/catalog.pson" File.stubs(:read).with("/my/catalog.pson").returns "something" catalog = Puppet::Resource::Catalog.new Puppet::Resource::Catalog.stubs(:convert_from).with(:pson,'something').returns catalog catalog.expects(:to_ral).returns "mycatalog" configurer = stub 'configurer' Puppet::Configurer.expects(:new).returns configurer configurer.expects(:run).with(:catalog => "mycatalog") @apply.apply end end end end 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 @@ -1,450 +1,410 @@ #!/usr/bin/env rspec require 'spec_helper' require 'puppet/application/master' require 'puppet/daemon' require 'puppet/network/server' describe Puppet::Application::Master do before :each do @master = Puppet::Application[:master] @daemon = stub_everything 'daemon' Puppet::Daemon.stubs(:new).returns(@daemon) Puppet::Util::Log.stubs(:newdestination) Puppet::Util::Log.stubs(:level=) Puppet::Node.indirection.stubs(:terminus_class=) Puppet::Node.indirection.stubs(:cache_class=) Puppet::Node::Facts.indirection.stubs(:terminus_class=) Puppet::Node::Facts.indirection.stubs(:cache_class=) Puppet::Transaction::Report.indirection.stubs(:terminus_class=) Puppet::Resource::Catalog.indirection.stubs(:terminus_class=) Puppet::SSL::Host.stubs(:ca_location=) end it "should operate in master run_mode" do @master.class.run_mode.name.should equal(:master) end it "should ask Puppet::Application to parse Puppet configuration file" do @master.should_parse_config?.should be_true end it "should declare a main command" 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 it "should declare a preinit block" do @master.should respond_to(:preinit) end describe "during preinit" do before :each do @master.stubs(:trap) end it "should catch INT" do @master.stubs(:trap).with { |arg,block| arg == :INT } @master.preinit end it "should create a Puppet Daemon" do Puppet::Daemon.expects(:new).returns(@daemon) @master.preinit end it "should give ARGV to the Daemon" do argv = stub 'argv' ARGV.stubs(:dup).returns(argv) @daemon.expects(:argv=).with(argv) @master.preinit end end [:debug,:verbose].each do |option| it "should declare handle_#{option} method" do @master.should respond_to("handle_#{option}".to_sym) end it "should store argument value when calling handle_#{option}" do @master.options.expects(:[]=).with(option, 'arg') @master.send("handle_#{option}".to_sym, 'arg') end end describe "when applying options" do before do @master.command_line.stubs(:args).returns([]) end it "should set the log destination with --logdest" do Puppet::Log.expects(:newdestination).with("console") @master.handle_logdest("console") end it "should put the setdest options to true" do @master.options.expects(:[]=).with(:setdest,true) @master.handle_logdest("console") end it "should parse the log destination from ARGV" do @master.command_line.stubs(:args).returns(%w{--logdest /my/file}) Puppet::Util::Log.expects(:newdestination).with("/my/file") @master.parse_options end end describe "during setup" do before :each do Puppet::Log.stubs(:newdestination) Puppet.stubs(:settraps) Puppet::Log.stubs(:level=) Puppet::SSL::CertificateAuthority.stubs(:instance) Puppet::SSL::CertificateAuthority.stubs(:ca?) Puppet.settings.stubs(:use) @master.options.stubs(:[]).with(any_parameters) end it "should set log level to debug if --debug was passed" do @master.options.stubs(:[]).with(:debug).returns(true) Puppet::Log.expects(:level=).with(:debug) @master.setup end it "should set log level to info if --verbose was passed" do @master.options.stubs(:[]).with(:verbose).returns(true) Puppet::Log.expects(:level=).with(:info) @master.setup end it "should set console as the log destination if no --logdest and --daemonize" do @master.stubs(:[]).with(:daemonize).returns(:false) Puppet::Log.expects(:newdestination).with(:syslog) @master.setup end it "should set syslog as the log destination if no --logdest and not --daemonize" do Puppet::Log.expects(:newdestination).with(:syslog) @master.setup end it "should set syslog as the log destination if --rack" do @master.options.stubs(:[]).with(:rack).returns(:true) Puppet::Log.expects(:newdestination).with(:syslog) @master.setup end it "should print puppet config if asked to in Puppet config" do @master.stubs(:exit) Puppet.settings.stubs(:print_configs?).returns(true) Puppet.settings.expects(:print_configs) @master.setup end it "should exit after printing puppet config if asked to in Puppet config" do Puppet.settings.stubs(:print_configs?).returns(true) lambda { @master.setup }.should raise_error(SystemExit) end it "should tell Puppet.settings to use :main,:ssl,:master and :metrics category" do Puppet.settings.expects(:use).with(:main,:master,:ssl,:metrics) @master.setup end it "should cache class in yaml" do Puppet::Node.indirection.expects(:cache_class=).with(:yaml) @master.setup end describe "with no ca" do it "should set the ca_location to none" do Puppet::SSL::Host.expects(:ca_location=).with(:none) @master.setup end end describe "with a ca configured" do before :each do Puppet::SSL::CertificateAuthority.stubs(:ca?).returns(true) end it "should set the ca_location to local" do Puppet::SSL::Host.expects(:ca_location=).with(:local) @master.setup end it "should tell Puppet.settings to use :ca category" do Puppet.settings.expects(:use).with(:ca) @master.setup end it "should instantiate the CertificateAuthority singleton" do Puppet::SSL::CertificateAuthority.expects(:instance) @master.setup end end end describe "when running" do before 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) Puppet.stubs(:[]).with(:manifest).returns("site.pp") Puppet.stubs(:err) @master.stubs(:jj) @master.stubs(:exit) Puppet.features.stubs(:pson?).returns true end it "should fail if pson isn't available" do Puppet.features.expects(:pson?).returns false lambda { @master.compile }.should raise_error end it "should compile a catalog for the specified node" do @master.options[:node] = "foo" Puppet::Resource::Catalog.indirection.expects(:find).with("foo").returns Puppet::Resource::Catalog.new $stdout.stubs(:puts) @master.compile end it "should convert the catalog to a pure-resource catalog and use 'jj' to pretty-print the catalog" do catalog = Puppet::Resource::Catalog.new Puppet::Resource::Catalog.indirection.expects(:find).returns catalog catalog.expects(:to_resource).returns("rescat") @master.options[:node] = "foo" @master.expects(:jj).with("rescat") @master.compile end it "should exit with error code 30 if no catalog can be found" do @master.options[:node] = "foo" Puppet::Resource::Catalog.indirection.expects(:find).returns nil @master.expects(:exit).with(30) $stderr.expects(:puts) @master.compile end it "should exit with error code 30 if there's a failure" do @master.options[:node] = "foo" Puppet::Resource::Catalog.indirection.expects(:find).raises ArgumentError @master.expects(:exit).with(30) $stderr.expects(:puts) @master.compile end end describe "the main command" do before :each do @master.preinit @server = stub_everything 'server' Puppet::Network::Server.stubs(:new).returns(@server) @app = stub_everything 'app' Puppet::SSL::Host.stubs(:localhost) Puppet::SSL::CertificateAuthority.stubs(:ca?) Process.stubs(:uid).returns(1000) Puppet.stubs(:service) Puppet.stubs(:[]) Puppet.stubs(:notice) Puppet.stubs(:start) end it "should create a Server" do Puppet::Network::Server.expects(:new) @master.main end it "should give the server to the daemon" do @daemon.expects(:server=).with(@server) @master.main end it "should create the server with the right XMLRPC handlers" do Puppet::Network::Server.expects(:new).with { |args| args[:xmlrpc_handlers] == [:Status, :FileServer, :Master, :Report, :Filebucket]} @master.main end it "should create the server with a :ca xmlrpc handler if needed" do Puppet.stubs(:[]).with(:ca).returns(true) Puppet::Network::Server.expects(:new).with { |args| args[:xmlrpc_handlers].include?(:CA) } @master.main end it "should generate a SSL cert for localhost" do Puppet::SSL::Host.expects(:localhost) @master.main end it "should make sure to *only* hit the CA for data" do Puppet::SSL::CertificateAuthority.stubs(:ca?).returns(true) Puppet::SSL::Host.expects(:ca_location=).with(:only) @master.main end it "should drop privileges if running as root" do Puppet.features.stubs(:root?).returns true Puppet::Util.expects(:chuser) @master.main end it "should daemonize if needed" do Puppet.stubs(:[]).with(:daemonize).returns(true) @daemon.expects(:daemonize) @master.main end it "should start the service" do @daemon.expects(:start) @master.main end describe "with --rack", :if => Puppet.features.rack? do before do require 'puppet/network/http/rack' Puppet::Network::HTTP::Rack.stubs(:new).returns(@app) end it "it should create the app with REST and XMLRPC support" do @master.options.stubs(:[]).with(:rack).returns(:true) Puppet::Network::HTTP::Rack.expects(:new).with { |args| args[:xmlrpc_handlers] == [:Status, :FileServer, :Master, :Report, :Filebucket] and args[:protocols] == [:rest, :xmlrpc] } @master.main end it "it should not start a daemon" do @master.options.stubs(:[]).with(:rack).returns(:true) @daemon.expects(:start).never @master.main end it "it should return the app" do @master.options.stubs(:[]).with(:rack).returns(:true) app = @master.main app.should equal(@app) end end end end end 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 @@ -1,739 +1,738 @@ #!/usr/bin/env ruby require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'mocha' require 'puppet' require 'puppet/parser/parser' require 'puppettest' require 'puppettest/support/utils' class TestParser < Test::Unit::TestCase include PuppetTest include PuppetTest::ParserTesting include PuppetTest::Support::Utils def setup super - Puppet[:parseonly] = true #@lexer = Puppet::Parser::Lexer.new end def teardown super Puppet::Node::Environment.clear end def test_each_file textfiles { |file| Puppet::Node::Environment.clear parser = mkparser Puppet.debug("parsing #{file}") if __FILE__ == $0 assert_nothing_raised { parser.file = file parser.parse } } end def test_failers failers { |file| parser = mkparser Puppet.debug("parsing failer #{file}") if __FILE__ == $0 assert_raise(Puppet::ParseError, Puppet::Error, "Did not fail while parsing #{file}") { Puppet[:manifest] = file config = mkcompiler(parser) config.compile #ast.hostclass("").evaluate config.topscope } } end def test_arrayrvalues parser = mkparser ret = nil file = tempfile assert_nothing_raised { parser.string = "file { \"#{file}\": mode => [755, 640] }" } assert_nothing_raised { ret = parser.parse } end def test_arrayrvalueswithtrailingcomma parser = mkparser ret = nil file = tempfile assert_nothing_raised { parser.string = "file { \"#{file}\": mode => [755, 640,] }" } assert_nothing_raised { ret = parser.parse } end def mkmanifest(file) name = File.join(tmpdir, "file#{rand(100)}") @@tmpfiles << name File.open(file, "w") { |f| f.puts "file { \"%s\": ensure => file, mode => 755 }\n" % name } end def test_importglobbing basedir = File.join(tmpdir, "importesting") @@tmpfiles << basedir Dir.mkdir(basedir) subdir = "subdir" Dir.mkdir(File.join(basedir, subdir)) manifest = File.join(basedir, "manifest") File.open(manifest, "w") { |f| f.puts "import \"%s/*\"" % subdir } 4.times { |i| path = File.join(basedir, subdir, "subfile#{i}.pp") mkmanifest(path) } assert_nothing_raised("Could not parse multiple files") { parser = mkparser parser.file = manifest parser.parse } end def test_nonexistent_import basedir = File.join(tmpdir, "importesting") @@tmpfiles << basedir Dir.mkdir(basedir) manifest = File.join(basedir, "manifest") File.open(manifest, "w") do |f| f.puts "import \" no such file \"" end assert_raise(Puppet::ParseError) { parser = mkparser parser.file = manifest parser.parse } end def test_trailingcomma path = tempfile str = %{file { "#{path}": ensure => file, } } parser = mkparser parser.string = str assert_nothing_raised("Could not parse trailing comma") { parser.parse } end def test_importedclasses imported = tempfile '.pp' importer = tempfile '.pp' made = tempfile File.open(imported, "w") do |f| f.puts %{class foo { file { "#{made}": ensure => file }}} end File.open(importer, "w") do |f| f.puts %{import "#{imported}"\ninclude foo} end parser = mkparser parser.file = importer # Make sure it parses fine assert_nothing_raised { parser.parse } # Now make sure it actually does the work assert_creates(importer, made) end # Make sure fully qualified and unqualified files can be imported def test_fqfilesandlocalfiles dir = tempfile Dir.mkdir(dir) importer = File.join(dir, "site.pp") fullfile = File.join(dir, "full.pp") localfile = File.join(dir, "local.pp") files = [] File.open(importer, "w") do |f| f.puts %{import "#{fullfile}"\ninclude full\nimport "local.pp"\ninclude local} end fullmaker = tempfile files << fullmaker File.open(fullfile, "w") do |f| f.puts %{class full { file { "#{fullmaker}": ensure => file }}} end localmaker = tempfile files << localmaker File.open(localfile, "w") do |f| f.puts %{class local { file { "#{localmaker}": ensure => file }}} end parser = mkparser parser.file = importer # Make sure it parses assert_nothing_raised { parser.parse } # Now make sure it actually does the work assert_creates(importer, *files) end # Make sure the parser adds '.pp' when necessary def test_addingpp dir = tempfile Dir.mkdir(dir) importer = File.join(dir, "site.pp") localfile = File.join(dir, "local.pp") files = [] File.open(importer, "w") do |f| f.puts %{import "local"\ninclude local} end file = tempfile files << file File.open(localfile, "w") do |f| f.puts %{class local { file { "#{file}": ensure => file }}} end parser = mkparser parser.file = importer assert_nothing_raised { parser.parse } end # Make sure that file importing changes file relative names. def test_changingrelativenames dir = tempfile Dir.mkdir(dir) Dir.mkdir(File.join(dir, "subdir")) top = File.join(dir, "site.pp") subone = File.join(dir, "subdir/subone") subtwo = File.join(dir, "subdir/subtwo") files = [] file = tempfile files << file File.open(subone + ".pp", "w") do |f| f.puts %{class one { file { "#{file}": ensure => file }}} end otherfile = tempfile files << otherfile File.open(subtwo + ".pp", "w") do |f| f.puts %{import "subone"\n class two inherits one { file { "#{otherfile}": ensure => file } }} end File.open(top, "w") do |f| f.puts %{import "subdir/subtwo"} end parser = mkparser parser.file = top assert_nothing_raised { parser.parse } end # Defaults are purely syntactical, so it doesn't make sense to be able to # collect them. def test_uncollectabledefaults string = "@Port { protocols => tcp }" assert_raise(Puppet::ParseError) { mkparser.parse(string) } end # Verify that we can parse collections def test_collecting text = "Port <| |>" parser = mkparser parser.string = text ret = nil assert_nothing_raised { ret = parser.parse } ret.code.each do |obj| assert_instance_of(AST::Collection, obj) end end def test_emptyfile file = tempfile File.open(file, "w") do |f| f.puts %{} end parser = mkparser parser.file = file assert_nothing_raised { parser.parse } end def test_multiple_nodes_named file = tempfile other = tempfile File.open(file, "w") do |f| f.puts %{ node nodeA, nodeB { file { "#{other}": ensure => file } } } end parser = mkparser parser.file = file ast = nil assert_nothing_raised { ast = parser.parse } end def test_emptyarrays str = %{$var = []\n} parser = mkparser parser.string = str # Make sure it parses fine assert_nothing_raised { parser.parse } end # Make sure function names aren't reserved words. def test_functionnamecollision str = %{tag yayness tag(rahness) file { "/tmp/yayness": tag => "rahness", ensure => exists } } parser = mkparser parser.string = str # Make sure it parses fine assert_nothing_raised { parser.parse } end def test_metaparams_in_definition_prototypes parser = mkparser assert_raise(Puppet::ParseError) { parser.known_resource_types.import_ast(parser.parse(%{define mydef($schedule) {}}), '') } assert_nothing_raised { parser.known_resource_types.import_ast(parser.parse(%{define adef($schedule = false) {}}), '') parser.known_resource_types.import_ast(parser.parse(%{define mydef($schedule = daily) {}}), '') } end def test_parsingif parser = mkparser exec = proc do |val| %{exec { "/bin/echo #{val}": logoutput => true }} end str1 = %{if true { #{exec.call("true")} }} ret = nil assert_nothing_raised { ret = parser.parse(str1).code[0] } assert_instance_of(Puppet::Parser::AST::IfStatement, ret) parser = mkparser str2 = %{if true { #{exec.call("true")} } else { #{exec.call("false")} }} ret = parser.parse(str2).code[0] assert_instance_of(Puppet::Parser::AST::IfStatement, ret) assert_instance_of(Puppet::Parser::AST::Else, ret.else) end def test_hostclass parser = mkparser assert_nothing_raised { parser.known_resource_types.import_ast(parser.parse(%{class myclass { class other {} }}), '') } assert(parser.hostclass("myclass"), "Could not find myclass") assert(parser.hostclass("myclass::other"), "Could not find myclass::other") assert_nothing_raised { parser.known_resource_types.import_ast(parser.parse("class base {} class container { class deep::sub inherits base {} }"), '') } sub = parser.hostclass("container::deep::sub") assert(sub, "Could not find sub") # Now try it with a parent class being a fq class assert_nothing_raised { parser.known_resource_types.import_ast(parser.parse("class container::one inherits container::deep::sub {}"), '') } sub = parser.hostclass("container::one") assert(sub, "Could not find one") assert_equal("container::deep::sub", sub.parent) # Finally, try including a qualified class assert_nothing_raised("Could not include fully qualified class") { parser.known_resource_types.import_ast(parser.parse("include container::deep::sub"), '') } end def test_topnamespace parser = mkparser # Make sure we put the top-level code into a class called "" in # the "" namespace parser.initvars assert_nothing_raised do parser.known_resource_types.import_ast(parser.parse("Exec { path => '/usr/bin:/usr/sbin' }"), '') assert_equal("", parser.known_resource_types.hostclass("").name) assert_equal("", parser.known_resource_types.hostclass("").namespace) end end # Make sure virtual and exported resources work appropriately. def test_virtualresources tests = [:virtual] if Puppet.features.rails? catalog_cache_class = Puppet::Resource::Catalog.indirection.cache_class facts_cache_class = Puppet::Node::Facts.indirection.cache_class node_cache_class = Puppet::Node.indirection.cache_class Puppet[:storeconfigs] = true tests << :exported end tests.each do |form| parser = mkparser if form == :virtual at = "@" else at = "@@" end check = proc do |res, msg| if res.is_a?(Puppet::Parser::Resource) txt = res.ref else txt = res.class end # Real resources get marked virtual when exported if form == :virtual or res.is_a?(Puppet::Parser::Resource) assert(res.virtual, "#{msg} #{at}#{txt} is not virtual") end if form == :virtual assert(! res.exported, "#{msg} #{at}#{txt} is exported") else assert(res.exported, "#{msg} #{at}#{txt} is not exported") end end ret = nil assert_nothing_raised do parser.known_resource_types.import_ast(parser.parse("#{at}file { '/tmp/testing': owner => root }"), '') ret = parser.known_resource_types end assert_instance_of(AST::ASTArray, ret.hostclass("").code) resdef = ret.hostclass("").code[0] assert_instance_of(AST::Resource, resdef) assert_instance_of(AST::ASTArray, resdef.instances) assert_equal(1, resdef.instances.children.length) assert_equal("/tmp/testing", resdef.instances[0].title.value) # We always get an astarray back, so... check.call(resdef, "simple resource") # Now let's try it with multiple resources in the same spec assert_nothing_raised do parser.known_resource_types.import_ast(parser.parse("#{at}file { ['/tmp/1', '/tmp/2']: owner => root }"), '') ret = parser.known_resource_types end ret.hostclass("").code[0].each do |res| assert_instance_of(AST::Resource, res) check.call(res, "multiresource") end end ensure if Puppet.features.rails? Puppet[:storeconfigs] = false Puppet::Resource::Catalog.indirection.cache_class = catalog_cache_class Puppet::Node::Facts.indirection.cache_class = facts_cache_class Puppet::Node.indirection.cache_class = node_cache_class end end def test_collections tests = [:virtual] if Puppet.features.rails? catalog_cache_class = Puppet::Resource::Catalog.indirection.cache_class facts_cache_class = Puppet::Node::Facts.indirection.cache_class node_cache_class = Puppet::Node.indirection.cache_class Puppet[:storeconfigs] = true tests << :exported end tests.each do |form| Puppet::Node::Environment.clear parser = mkparser if form == :virtual arrow = "<||>" else arrow = "<<||>>" end ret = nil assert_nothing_raised do ret = parser.parse("File #{arrow}") end coll = ret.code[0] assert_instance_of(AST::Collection, coll) assert_equal(form, coll.form) end ensure if Puppet.features.rails? Puppet[:storeconfigs] = false Puppet::Resource::Catalog.indirection.cache_class = catalog_cache_class Puppet::Node::Facts.indirection.cache_class = facts_cache_class Puppet::Node.indirection.cache_class = node_cache_class end end def test_collectionexpressions %w{== !=}.each do |oper| Puppet::Node::Environment.clear str = "File <| title #{oper} '/tmp/testing' |>" parser = mkparser res = nil assert_nothing_raised do res = parser.parse(str).code[0] end assert_instance_of(AST::Collection, res) query = res.query assert_instance_of(AST::CollExpr, query) assert_equal(:virtual, query.form) assert_equal("title", query.test1.value) assert_equal("/tmp/testing", query.test2.value) assert_equal(oper, query.oper) end end def test_collectionstatements %w{and or}.each do |joiner| str = "File <| title == '/tmp/testing' #{joiner} owner == root |>" parser = mkparser res = nil assert_nothing_raised do res = parser.parse(str).code[0] end assert_instance_of(AST::Collection, res) query = res.query assert_instance_of(AST::CollExpr, query) assert_equal(joiner, query.oper) assert_instance_of(AST::CollExpr, query.test1) assert_instance_of(AST::CollExpr, query.test2) end end def test_collectionstatements_with_parens [ "(title == '/tmp/testing' and owner == root) or owner == wheel", "(title == '/tmp/testing')" ].each do |test| str = "File <| #{test} |>" parser = mkparser res = nil assert_nothing_raised("Could not parse '#{test}'") do res = parser.parse(str).code[0] end assert_instance_of(AST::Collection, res) query = res.query assert_instance_of(AST::CollExpr, query) #assert_equal(joiner, query.oper) #assert_instance_of(AST::CollExpr, query.test1) #assert_instance_of(AST::CollExpr, query.test2) end end def test_fully_qualified_definitions parser = mkparser types = parser.known_resource_types assert_nothing_raised("Could not parse fully-qualified definition") { types.import_ast(parser.parse(%{define one::two { }}), '') } assert(parser.definition("one::two"), "Could not find one::two with no namespace") end # #524 def test_functions_with_no_arguments parser = mkparser assert_nothing_raised("Could not parse statement function with no args") { parser.parse %{tag()} } assert_nothing_raised("Could not parse rvalue function with no args") { parser.parse %{$testing = template()} } end # #774 def test_fully_qualified_collection_statement parser = mkparser assert_nothing_raised("Could not parse fully qualified collection statement") { parser.parse %{Foo::Bar <||>} } end def test_multiple_imports_on_one_line one = tempfile '.pp' two = tempfile '.pp' base = tempfile '.pp' File.open(one, "w") { |f| f.puts "$var = value" } File.open(two, "w") { |f| f.puts "$var = value" } File.open(base, "w") { |f| f.puts "import '#{one}', '#{two}'" } parser = mkparser parser.file = base # Importing is logged at debug time. Puppet::Util::Log.level = :debug assert_nothing_raised("Parser could not import multiple files at once") do parser.parse end [one, two].each do |file| assert(@logs.detect { |l| l.message =~ /importing '#{file}'/}, "did not import #{file}") end end def test_cannot_assign_qualified_variables parser = mkparser assert_raise(Puppet::ParseError, "successfully assigned a qualified variable") do parser.parse("$one::two = yay") end end # #629 - undef keyword def test_undef parser = mkparser result = nil assert_nothing_raised("Could not parse assignment to undef") { result = parser.parse %{$variable = undef} } main = result.code children = main.children assert_instance_of(AST::VarDef, main.children[0]) assert_instance_of(AST::Undef, main.children[0].value) end # Prompted by #729 -- parsing should not modify the interpreter. def test_parse parser = mkparser str = "file { '/tmp/yay': ensure => file }\nclass yay {}\nnode foo {}\ndefine bar {}\n" result = nil assert_nothing_raised("Could not parse") do parser.known_resource_types.import_ast(parser.parse(str), '') result = parser.known_resource_types end assert_instance_of(Puppet::Resource::TypeCollection, result, "Did not get a ASTSet back from parsing") assert_instance_of(Puppet::Resource::Type, result.hostclass("yay"), "Did not create 'yay' class") assert_instance_of(Puppet::Resource::Type, result.hostclass(""), "Did not create main class") assert_instance_of(Puppet::Resource::Type, result.definition("bar"), "Did not create 'bar' definition") assert_instance_of(Puppet::Resource::Type, result.node("foo"), "Did not create 'foo' node") end def test_namesplit parser = mkparser assert_nothing_raised do {"base::sub" => %w{base sub}, "main" => ["", "main"], "one::two::three::four" => ["one::two::three", "four"], }.each do |name, ary| result = parser.namesplit(name) assert_equal(ary, result, "#{name} split to #{result}") end end end # Make sure class, node, and define methods are case-insensitive def test_structure_case_insensitivity parser = mkparser result = nil assert_nothing_raised do parser.known_resource_types.import_ast(parser.parse("class yayness { }"), '') result = parser.known_resource_types.hostclass('yayness') end assert_equal(result, parser.find_hostclass("", "yayNess")) assert_nothing_raised do parser.known_resource_types.import_ast(parser.parse("define funtest { }"), '') result = parser.known_resource_types.definition('funtest') end assert_equal(result, parser.find_definition("", "fUntEst"), "#{"fUntEst"} was not matched") end end