From aed4b5fd674107d6c1e3a2e2e5c2f8c42f7a5c35 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Sat, 18 Dec 2010 12:31:52 +0100 Subject: Process name instrumentation infrastructure This is special feature that changes the process name of the running puppet entity to display its current activity. It is disabled by default, and can be enabled by sending the QUIT signal to the process in question (or calling enable through the code). This system can work only if some "probes" are integrated in the core puppet codebase. Since tools to visualize process names have a large refresh time (ie more than 1s) it only makes sense to track long activities (like compilation, transaction or file serving). Those probes are the subject of a subsequent patch. This system tracks every thread activity and form a strings which will be used as the process name. Due to the way it is implemented it is possible that it doesn't work on all platforms (I tested successfully on osx and linux). On some systems the space available is dependent on the original size of the full command. That's why if this string is longer than a 50 characters, the string is scrolled (like stock market tickers). Note: This is not intended to be a generic instrumentation system. Also, being block based means that it can reduce performance if the instrumentation probes are used in tight inner loops. Signed-off-by: Brice Figureau --- lib/puppet/util/instrumentation.rb | 12 ++ lib/puppet/util/instrumentation/process_name.rb | 129 +++++++++++++ .../unit/util/instrumentation/process_name_spec.rb | 207 +++++++++++++++++++++ 3 files changed, 348 insertions(+) create mode 100644 lib/puppet/util/instrumentation.rb create mode 100644 lib/puppet/util/instrumentation/process_name.rb create mode 100644 spec/unit/util/instrumentation/process_name_spec.rb diff --git a/lib/puppet/util/instrumentation.rb b/lib/puppet/util/instrumentation.rb new file mode 100644 index 000000000..5981bea59 --- /dev/null +++ b/lib/puppet/util/instrumentation.rb @@ -0,0 +1,12 @@ +require 'puppet/util/instrumentation/process_name' + +module Puppet::Util::Instrumentation + + def instrument(title) + Puppet::Util::Instrumentation::ProcessName.instrument(title) do + yield + end + end + module_function :instrument + +end \ No newline at end of file diff --git a/lib/puppet/util/instrumentation/process_name.rb b/lib/puppet/util/instrumentation/process_name.rb new file mode 100644 index 000000000..370d29e2e --- /dev/null +++ b/lib/puppet/util/instrumentation/process_name.rb @@ -0,0 +1,129 @@ +require 'puppet' +require 'puppet/util/instrumentation' + +module Puppet::Util::Instrumentation + class ProcessName + + # start scrolling when process name is longer than + SCROLL_LENGTH = 50 + + @active = false + class << self + attr_accessor :active, :reason + end + + trap(:QUIT) do + active? ? disable : enable + end + + def self.active? + !! @active + end + + def self.enable + mutex.synchronize do + Puppet.info("Process Name instrumentation is enabled") + @active = true + @x = 0 + setproctitle + end + end + + def self.disable + mutex.synchronize do + Puppet.info("Process Name instrumentation is disabled") + @active = false + $0 = @oldname + end + end + + def self.instrument(activity) + # inconditionnally start the scroller thread here + # because it doesn't seem possible to start a new thrad + # from the USR2 signal handler + @scroller ||= Thread.new do + loop do + scroll if active? + sleep 1 + end + end + + push_activity(Thread.current, activity) + yield + ensure + pop_activity(Thread.current) + end + + def self.setproctitle + @oldname ||= $0 + $0 = "#{base}: " + rotate(process_name,@x) if active? + end + + def self.push_activity(thread, activity) + mutex.synchronize do + @reason ||= {} + @reason[thread] ||= [] + @reason[thread].push(activity) + setproctitle + end + end + + def self.pop_activity(thread) + mutex.synchronize do + @reason[thread].pop + if @reason[thread].empty? + @reason.delete(thread) + end + setproctitle + end + end + + def self.process_name + out = (@reason || {}).inject([]) do |out, reason| + out << "#{thread_id(reason[0])} #{reason[1].join(',')}" + end + out.join(' | ') + end + + # certainly non-portable + def self.thread_id(thread) + thread.inspect.gsub(/^#<.*:0x([a-f0-9]+) .*>$/, '\1') + end + + def self.rotate(string, steps) + steps ||= 0 + if string.length > 0 && steps > 0 + steps = steps % string.length + return string[steps..string.length].concat " -- #{string[0..(steps-1)]}" + end + string + end + + def self.base + basename = case Puppet.run_mode.name + when :master + "master" + when :agent + "agent" + else + "puppet" + end + end + + def self.mutex + #Thread.exclusive { + @mutex ||= Sync.new + #} + @mutex + end + + def self.scroll + return if process_name.length < SCROLL_LENGTH + mutex.synchronize do + setproctitle + @x += 1 + end + end + + end +end \ No newline at end of file diff --git a/spec/unit/util/instrumentation/process_name_spec.rb b/spec/unit/util/instrumentation/process_name_spec.rb new file mode 100644 index 000000000..9cbedf2d2 --- /dev/null +++ b/spec/unit/util/instrumentation/process_name_spec.rb @@ -0,0 +1,207 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' + +describe Puppet::Util::Instrumentation::ProcessName do + + ProcessName = Puppet::Util::Instrumentation::ProcessName + + after(:each) do + ProcessName.reason = {} + end + + it "should be disabled by default" do + ProcessName.should_not be_active + end + + describe "when managing thread activity" do + before(:each) do + ProcessName.stubs(:setproctitle) + ProcessName.stubs(:base).returns("base") + end + + it "should be able to append activity" do + thread1 = stub 'thread1' + ProcessName.push_activity(:thread1,"activity1") + ProcessName.push_activity(:thread1,"activity2") + + ProcessName.reason[:thread1].should == ["activity1", "activity2"] + end + + it "should be able to remove activity" do + ProcessName.push_activity(:thread1,"activity1") + ProcessName.push_activity(:thread1,"activity1") + ProcessName.pop_activity(:thread1) + + ProcessName.reason[:thread1].should == ["activity1"] + end + + it "should maintain activity thread by thread" do + ProcessName.push_activity(:thread1,"activity1") + ProcessName.push_activity(:thread2,"activity2") + + ProcessName.reason[:thread1].should == ["activity1"] + ProcessName.reason[:thread2].should == ["activity2"] + end + + it "should set process title" do + ProcessName.expects(:setproctitle) + + ProcessName.push_activity("thread1","activity1") + end + end + + describe "when computing the current process name" do + before(:each) do + ProcessName.stubs(:setproctitle) + ProcessName.stubs(:base).returns("base") + end + + it "should include every running thread activity" do + thread1 = stub 'thread1', :inspect => "\#", :hash => 1 + thread2 = stub 'thread2', :inspect => "\#", :hash => 0 + + ProcessName.push_activity(thread1,"Compiling node1.domain.com") + ProcessName.push_activity(thread2,"Compiling node4.domain.com") + ProcessName.push_activity(thread1,"Parsing file site.pp") + ProcessName.push_activity(thread2,"Parsing file node.pp") + + ProcessName.process_name.should == "12344321 Compiling node4.domain.com,Parsing file node.pp | deadbeef Compiling node1.domain.com,Parsing file site.pp" + end + end + + describe "when finding base process name" do + {:master => "master", :agent => "agent", :user => "puppet"}.each do |program,base| + it "should return #{base} for #{program}" do + Puppet.run_mode.stubs(:name).returns(program) + ProcessName.base.should == base + end + end + end + + describe "when finding a thread id" do + it "should return the id from the thread inspect string" do + thread = stub 'thread', :inspect => "\#" + ProcessName.thread_id(thread).should == "1234abdc" + end + end + + describe "when scrolling the instrumentation string" do + it "should rotate the string of various step" do + ProcessName.rotate("this is a rotation", 10).should == "rotation -- this is a " + end + + it "should not rotate the string for the 0 offset" do + ProcessName.rotate("this is a rotation", 0).should == "this is a rotation" + end + end + + describe "when setting process name" do + before(:each) do + ProcessName.stubs(:process_name).returns("12345 activity") + ProcessName.stubs(:base).returns("base") + @oldname = $0 + end + + after(:each) do + $0 = @oldname + end + + it "should not do it if the feature is disabled" do + ProcessName.setproctitle + + $0.should_not == "base: 12345 activity" + end + + it "should do it if the feature is enabled" do + ProcessName.active = true + ProcessName.setproctitle + + $0.should == "base: 12345 activity" + end + end + + describe "when setting a probe" do + before(:each) do + thread = stub 'thread', :inspect => "\#" + Thread.stubs(:current).returns(thread) + Thread.stubs(:new) + ProcessName.active = true + end + + it "should start the scroller thread" do + Thread.expects(:new) + ProcessName.instrument("doing something") do + end + end + + it "should push current thread activity and execute the block" do + ProcessName.instrument("doing something") do + $0.should == "puppet: 1234abdc doing something" + end + end + + it "should finally pop the activity" do + ProcessName.instrument("doing something") do + end + $0.should == "puppet: " + end + end + + describe "when enabling" do + before do + Thread.stubs(:new) + ProcessName.stubs(:setproctitle) + end + + it "should be active" do + ProcessName.enable + ProcessName.should be_active + end + + it "should set the new process name" do + ProcessName.expects(:setproctitle) + ProcessName.enable + end + end + + describe "when disabling" do + it "should set active to false" do + ProcessName.active = true + ProcessName.disable + ProcessName.should_not be_active + end + + it "should restore the old process name" do + oldname = $0 + ProcessName.active = true + ProcessName.setproctitle + ProcessName.disable + $0.should == oldname + end + end + + describe "when scrolling" do + it "should do nothing for shorter process names" do + ProcessName.expects(:setproctitle).never + ProcessName.scroll + end + + it "should call setproctitle" do + ProcessName.stubs(:process_name).returns("x" * 60) + ProcessName.expects(:setproctitle) + ProcessName.scroll + end + + it "should increment rotation offset" do + name = "x" * 60 + ProcessName.active = true + ProcessName.stubs(:process_name).returns(name) + ProcessName.expects(:rotate).once.with(name,1).returns("") + ProcessName.expects(:rotate).once.with(name,2).returns("") + ProcessName.scroll + ProcessName.scroll + end + end + +end \ No newline at end of file -- cgit From e27d208db86ae0825afbc6fb34d39e7c047a1bf4 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Sat, 18 Dec 2010 15:25:02 +0100 Subject: Some high-level process name probes Here is an attempt to cover with process name probes some of the longest parts of a puppet agent or master. Currently: * node compilation * individual resource evaluation * some configurer parts * individual network requests Signed-off-by: Brice Figureau --- lib/puppet/configurer.rb | 24 ++++++++++++++++++------ lib/puppet/network/http/handler.rb | 6 +++++- lib/puppet/parser/compiler.rb | 6 +++++- lib/puppet/transaction.rb | 9 +++++++-- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index 31d31c2d2..4320aa9bd 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -3,6 +3,7 @@ require 'sync' require 'timeout' require 'puppet/network/http_pool' require 'puppet/util' +require 'puppet/util/instrumentation' class Puppet::Configurer class CommandHookError < RuntimeError; end @@ -12,6 +13,7 @@ class Puppet::Configurer include Puppet::Configurer::FactHandler include Puppet::Configurer::PluginHandler + include Puppet::Util::Instrumentation # For benchmarking include Puppet::Util @@ -80,11 +82,17 @@ class Puppet::Configurer def prepare dostorage - download_plugins + instrument("downloading plugins") do + download_plugins + end - download_fact_plugins + instrument("downloading facts plugins") do + download_fact_plugins + end - execute_prerun_command + instrument("executing prerun command") do + execute_prerun_command + end end # Get the remote catalog, yo. Returns nil if no catalog can be found. @@ -148,8 +156,10 @@ class Puppet::Configurer transaction = nil begin - benchmark(:notice, "Finished catalog run") do - transaction = catalog.apply(options) + instrument("applying catalog") do + benchmark(:notice, "Finished catalog run") do + transaction = catalog.apply(options) + end end report rescue => detail @@ -169,7 +179,9 @@ class Puppet::Configurer Puppet::Util::Log.close(report) - send_report(report, transaction) + instrument("sending report") do + send_report(report, transaction) + end end def send_report(report, trans = nil) diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb index 82238aa0a..855a9b78d 100644 --- a/lib/puppet/network/http/handler.rb +++ b/lib/puppet/network/http/handler.rb @@ -5,10 +5,12 @@ require 'puppet/network/http/api/v1' require 'puppet/network/rest_authorization' require 'puppet/network/rights' require 'resolv' +require 'puppet/util/instrumentation' module Puppet::Network::HTTP::Handler include Puppet::Network::HTTP::API::V1 include Puppet::Network::RestAuthorization + include Puppet::Util::Instrumentation attr_reader :server, :handler @@ -65,7 +67,9 @@ module Puppet::Network::HTTP::Handler check_authorization(indirection, method, key, params) - send("do_#{method}", indirection, key, params, request, response) + instrument("processing #{indirection} #{key}") do + send("do_#{method}", indirection, key, params, request, response) + end rescue SystemExit,NoMemoryError raise rescue Exception => e diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index c60e1d4fb..7da50c227 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -4,6 +4,7 @@ require 'puppet/node' require 'puppet/resource/catalog' require 'puppet/util/errors' +require 'puppet/util/instrumentation' require 'puppet/resource/type_collection_helper' @@ -13,9 +14,12 @@ class Puppet::Parser::Compiler include Puppet::Util include Puppet::Util::Errors include Puppet::Resource::TypeCollectionHelper + extend Puppet::Util::Instrumentation def self.compile(node) - new(node).compile.to_resource + instrument("compiling #{node.name}") do + new(node).compile.to_resource + end rescue => detail puts detail.backtrace if Puppet[:trace] raise Puppet::Error, "#{detail} on node #{node.name}" diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index dcd9aad0a..0a3bfc3dd 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -4,8 +4,11 @@ require 'puppet' require 'puppet/util/tagging' require 'puppet/application' +require 'puppet/util/instrumentation' class Puppet::Transaction + include Puppet::Util::Instrumentation + require 'puppet/transaction/change' require 'puppet/transaction/event' require 'puppet/transaction/event_manager' @@ -139,8 +142,10 @@ class Puppet::Transaction next end ret = nil - seconds = thinmark do - ret = eval_resource(resource) + instrument("evaluating #{resource}") do + seconds = thinmark do + ret = eval_resource(resource) + end end resource.info "Evaluated in %0.2f seconds" % seconds if Puppet[:evaltrace] and @catalog.host_config? -- cgit From 35dd0702e9619706b6365a98da2826a612a4047a Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Sun, 5 Dec 2010 11:30:42 +0100 Subject: (#5661) Creating types dont work with >1 namevar The methods [] and []= of type.rb are handling :name in a special way. When someone wants to access resource[:name] puppet tries to replace :name with the name_var. If the type has more than one key_attribute name_var is always returning false so we'll get the error Resource type does not support parameter false This patch doesnt try to substitute :name if we dont have a single namevar, aka. we have more than one key_attribute --- lib/puppet/type.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 1b6e7dcd7..cb1022ddf 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -382,8 +382,8 @@ class Type fail("Invalid parameter #{name}(#{name.inspect})") unless self.class.validattr?(name) - if name == :name - name = name_var + if name == :name && nv = name_var + name = nv end if obj = @parameters[name] @@ -403,8 +403,8 @@ class Type fail("Invalid parameter #{name}") unless self.class.validattr?(name) - if name == :name - name = name_var + if name == :name && nv = name_var + name = nv end raise Puppet::Error.new("Got nil value for #{name}") if value.nil? -- cgit From 2a0c970b8f91c9687d3f2a1dea5adac44b5f96fb Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Sun, 5 Dec 2010 16:25:06 +0100 Subject: (#5662) Parsedfile doesnt work with mult keyattr When one wants to use the parsedfile provider for a type with more than one key_attribute (e.g. a type for entries in /etc/services with name and protocol as key_attributes) the provider will not store all key_attributes in property_hash and not all keyattributes will be visible in the to_line function. The create method of parsedfile will only put validproperties into the propertyhash. As result :name and all the other key_attributes will not be set. In the flush method however the :name parameter is put in the property_hash but the method does not handle other keyattributes. This patch modifies flush to put all key_attributes into the property hash (Note: @resource.name is basically just an alias for @resource[:name]) --- lib/puppet/provider/parsedfile.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/puppet/provider/parsedfile.rb b/lib/puppet/provider/parsedfile.rb index ffd36e59f..75a215f4b 100755 --- a/lib/puppet/provider/parsedfile.rb +++ b/lib/puppet/provider/parsedfile.rb @@ -334,7 +334,9 @@ class Puppet::Provider::ParsedFile < Puppet::Provider @property_hash[:target] = @resource.should(:target) || self.class.default_target self.class.modified(@property_hash[:target]) end - @property_hash[:name] ||= @resource.name + @resource.class.key_attributes.each do |attr| + @property_hash[attr] ||= @resource[attr] + end self.class.flush(@property_hash) -- cgit From 02b311113df84646406737ccfad961c5b6df4ae8 Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Thu, 23 Dec 2010 18:08:37 +0100 Subject: (#5605) Prefetch doesnt work with composite keys The uniqueness_key method of a type or resource object should return a key that can be used to identify this resource. In fact puppet seldomly uses this method and instead uses resource[:name] as an identifier. While this is totally fine for resourcetypes with a single key_attribute (and resource[:name] returning the namevar), it breaks things as soon as one creates a type with a composite key (prefetching for example is broken). To ease the process of replacing calls to resource[:name] to resource.uniqueness_key, the method uniqueness_key now just returns name_var if there is only one key_attribute (immitating self[:name]) and only returns an array of all the values of all the key_attributes if we have more than one key_attribute. The resourcehash which is passed to providers in their prefetch method is now build with uniqueness_key as the hashkey. Because of the new behaviour of uniqueness_key we hopefully wont break existing providers while allowing new providers for types with composite keys to implement correct prefetch methods. --- lib/puppet/resource.rb | 9 +++++++-- lib/puppet/transaction.rb | 2 +- lib/puppet/type.rb | 8 +++++++- spec/unit/resource_spec.rb | 11 +++++++++-- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index 4f0d50750..a52796800 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -237,11 +237,16 @@ class Puppet::Resource h = self.to_hash h[namevar] ||= h[:name] h[:name] ||= h[namevar] - h.values_at(*key_attributes.sort_by { |k| k.to_s }) + # Simulate the same behaviour like Type#uniqueness_key + if key_attributes.size == 1 + h[namevar] + else + h.values_at(*key_attributes) + end end def key_attributes - return(resource_type.respond_to? :key_attributes) ? resource_type.key_attributes : [:name] + resource_type.respond_to?(:key_attributes) ? resource_type.key_attributes : [:name] end # Convert our resource to Puppet code. diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index dcd9aad0a..0bb98f827 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -252,7 +252,7 @@ class Puppet::Transaction @catalog.vertices.each do |resource| if provider = resource.provider and provider.class.respond_to?(:prefetch) prefetchers[provider.class] ||= {} - prefetchers[provider.class][resource.name] = resource + prefetchers[provider.class][resource.uniqueness_key] = resource end end diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 1b6e7dcd7..c50f8de50 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -200,7 +200,13 @@ class Type end def uniqueness_key - to_resource.uniqueness_key + # If we have only one namevar use that one (res.uniqueness_key behaves + # like res[:name] in that case). Otherwise use an array of all keyattributes + if name_var + self[:name] + else + @parameters.values_at(*self.class.key_attributes).collect {|p| p.value } + end end # Create a new parameter. Requires a block and a name, stores it in the diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index e65e8a13a..092ae8ce0 100755 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -268,7 +268,7 @@ describe Puppet::Resource do describe "when referring to a resource with name canonicalization" do it "should canonicalize its own name" do res = Puppet::Resource.new("file", "/path/") - res.uniqueness_key.should == ["/path"] + res.uniqueness_key.should == "/path" res.ref.should == "File[/path/]" end end @@ -770,7 +770,14 @@ describe Puppet::Resource do end describe "when generating the uniqueness key" do - it "should include all of the key_attributes in alphabetical order by attribute name" do + + it "should use namevar if there is only one key_attribute" do + Puppet::Type.type(:file).stubs(:key_attributes).returns [:path] + res = Puppet::Resource.new("file", "/my/file", :parameters => {:owner => 'root', :content => 'hello'}) + res.uniqueness_key.should == '/my/file' + end + + it "should include all of the key_attributes" do Puppet::Type.type(:file).stubs(:key_attributes).returns [:myvar, :owner, :path] Puppet::Type.type(:file).stubs(:title_patterns).returns( [ [ /(.*)/, [ [:path, lambda{|x| x} ] ] ] ] -- cgit From 8b98526b0f81d559fdf85fc8aaf370f75baa5919 Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Thu, 23 Dec 2010 22:11:49 +0100 Subject: (#5662) Fixed tests that didnt stub key_attributes The parsedfile provider calls the method key_attributes of the resource class to decide what resourceparameters must be put in the property_hash. Tests that uses fake resources and only stub resource[:name] must also stub resource.class.key_attributes --- spec/unit/provider/mount/parsed_spec.rb | 1 + spec/unit/provider/ssh_authorized_key/parsed_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index 7d2e8a84c..3d37fc72e 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -51,6 +51,7 @@ module ParsedMountTesting #hash[:provider] = @provider_class.name fakeresource = stub :type => :mount, :name => hash[:name] + fakeresource.class.stubs(:key_attributes).returns([:name]) fakeresource.stubs(:[]).with(:name).returns(hash[:name]) fakeresource.stubs(:should).with(:target).returns(nil) diff --git a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb index 11e9233e0..2e5be165a 100755 --- a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +++ b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb @@ -104,6 +104,7 @@ describe provider_class do before :each do @resource = stub("resource", :name => "foo") @resource.stubs(:[]).returns "foo" + @resource.class.stubs(:key_attributes).returns( [:name] ) @provider = provider_class.new(@resource) provider_class.stubs(:filetype).returns(Puppet::Util::FileType::FileTypeRam) -- cgit From 7b3b56ef7bfd32d7afb47fd71c2d9f606856d2e0 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Fri, 14 Jan 2011 18:21:57 -0600 Subject: (5977) Puppet::Applications can be loaded from multiple paths. - previously, Puppet would search $LOAD_PATH and just load applications in the first $LOAD_PATH to have the directory puppet/application. Now multiple paths can contain applications. --- lib/puppet/util/command_line.rb | 8 ++++++-- spec/unit/util/command_line_spec.rb | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb index 3562a3dc0..4aff0a8cb 100644 --- a/lib/puppet/util/command_line.rb +++ b/lib/puppet/util/command_line.rb @@ -33,8 +33,12 @@ module Puppet end def available_subcommands - absolute_appdir = $LOAD_PATH.collect { |x| File.join(x,'puppet','application') }.detect{ |x| File.directory?(x) } - Dir[File.join(absolute_appdir, '*.rb')].map{|fn| File.basename(fn, '.rb')} + absolute_appdirs = $LOAD_PATH.collect do |x| + File.join(x,'puppet','application') + end.select{ |x| File.directory?(x) } + absolute_appdirs.inject([]) do |commands, dir| + commands + Dir[File.join(dir, '*.rb')].map{|fn| File.basename(fn, '.rb')} + end.uniq end def usage_message diff --git a/spec/unit/util/command_line_spec.rb b/spec/unit/util/command_line_spec.rb index 7ba965249..a648eb4a1 100644 --- a/spec/unit/util/command_line_spec.rb +++ b/spec/unit/util/command_line_spec.rb @@ -6,6 +6,7 @@ Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f require 'puppet/util/command_line' describe Puppet::Util::CommandLine do + include PuppetSpec::Files before do @tty = stub("tty", :tty? => true ) @pipe = stub("pipe", :tty? => false) @@ -105,4 +106,27 @@ describe Puppet::Util::CommandLine do end end end + describe 'when loading commands' do + before do + @core_apps = ["describe", "filebucket", "kick", "queue", "resource", "agent", "cert", "apply", "doc", "master"] + @command_line = Puppet::Util::CommandLine.new("foo", %w{ client --help w hatever.pp }, @tty ) + end + it 'should be able to find all existing commands' do + @core_apps.each do |command| + @command_line.available_subcommands.should include command + end + end + describe 'when multiple paths have applications' do + before do + @dir=tmpdir('command_line_plugin_test') + @appdir="#{@dir}/puppet/application" + FileUtils.mkdir_p(@appdir) + FileUtils.touch("#{@appdir}/foo.rb") + $LOAD_PATH.unshift(@dir) + end + it 'should be able to find commands from both paths' do + @command_line.available_subcommands.should == ['foo'] + @core_apps + end + end + end end -- cgit From ade951aa9d0017743059f282cbc1611a8b0b02f0 Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Sun, 23 Jan 2011 12:47:38 +0100 Subject: (#4914) Join lines for better readability --- lib/puppet/provider/mount/parsed.rb | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/puppet/provider/mount/parsed.rb b/lib/puppet/provider/mount/parsed.rb index 82d1628bd..a8c8bc118 100755 --- a/lib/puppet/provider/mount/parsed.rb +++ b/lib/puppet/provider/mount/parsed.rb @@ -9,20 +9,13 @@ else end - Puppet::Type.type(:mount).provide( - :parsed, - :parent => Puppet::Provider::ParsedFile, - :default_target => fstab, - - :filetype => :flat -) do +Puppet::Type.type(:mount).provide(:parsed,:parent => Puppet::Provider::ParsedFile,:default_target => fstab,:filetype => :flat) do include Puppet::Provider::Mount #confine :exists => fstab commands :mountcmd => "mount", :umount => "umount" - @platform = Facter["operatingsystem"].value - case @platform + case Facter["operatingsystem"] when "Solaris" @fields = [:device, :blockdevice, :name, :fstype, :pass, :atboot, :options] else -- cgit From 2884660768fbea22a91e3c5bab9595ce075e67a5 Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Sun, 23 Jan 2011 13:03:15 +0100 Subject: (#4914) Prefetch mountstate Add a method mountinstances that returns a list of currently mounted filesystems and overwrite prefetch to update the :ensure state of a mount resource to either - :absent => not in fstab and not mounted - :unmounted => in fstab but not mounted - :mounted => in fstab and mounted - :ghost => not in fstab but mounted This is just one step towards 4914. Next will be query the property_hash when asking mounted? and update the insync? methods to handle the different states. --- lib/puppet/provider/mount/parsed.rb | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/lib/puppet/provider/mount/parsed.rb b/lib/puppet/provider/mount/parsed.rb index a8c8bc118..9422ca6bb 100755 --- a/lib/puppet/provider/mount/parsed.rb +++ b/lib/puppet/provider/mount/parsed.rb @@ -36,5 +36,55 @@ Puppet::Type.type(:mount).provide(:parsed,:parent => Puppet::Provider::ParsedFil record_line self.name, :fields => @fields, :separator => /\s+/, :joiner => "\t", :optional => optional_fields + # Every entry in fstab is :unmounted until we can prove different + def self.prefetch_hook(target_records) + target_records.collect do |record| + record[:ensure] = :unmounted if record[:record_type] == :parsed + record + end + end + + def self.prefetch(resources = nil) + # Get providers for all resources the user defined and that match + # a record in /etc/fstab. + super + # We need to do two things now: + # - Update ensure from :unmounted to :mounted if the resource is mounted + # - Check for mounted devices that are not in fstab and + # set ensure to :ghost (if the user wants to add an entry + # to fstab we need to know if the device was mounted before) + mountinstances.each do |hash| + if mount = resources[hash[:name]] + case mount.provider.get(:ensure) + when :absent # Mount not in fstab + mount.provider.set(:ensure => :ghost) + when :unmounted # Mount in fstab + mount.provider.set(:ensure => :mounted) + end + end + end + end + + def self.mountinstances + # XXX: Will not work for mount points that have spaces in path (does fstab support this anyways?) + regex = case Facter.value("operatingsystem") + when "Darwin" + / on (?:\/private\/var\/automount)?(\S*)/ + when "Solaris", "HP-UX" + /^(\S*) on / + else + / on (\S*)/ + end + instances = [] + mountcmd.split("\n").each do |line| + if match = regex.match(line) and name = match.captures.first + instances << {:name => name, :mounted => :yes} # Only :name is important here + else + raise Puppet::Error, "Could not understand line #{line} from mount output" + end + end + instances + end + end -- cgit From fd111f26f17b3dbdd0de310d0a4b43877eef7e14 Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Sun, 23 Jan 2011 13:10:17 +0100 Subject: (#4914) Query property_hash for mountstate Change mounted? to query the property_hash so we don't have to run the mountcommand for every specified mount but rely on the prefetched state Also update the prefetched property_hash[:ensure] after mount or umount. This is important if we query mounted? later (most obvious when refresh is called. We dont want to remount a resource that was umounted before) --- lib/puppet/provider/mount.rb | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/lib/puppet/provider/mount.rb b/lib/puppet/provider/mount.rb index 8c7b24bd4..65296eed2 100644 --- a/lib/puppet/provider/mount.rb +++ b/lib/puppet/provider/mount.rb @@ -14,8 +14,11 @@ module Puppet::Provider::Mount args << "-o" << self.options if self.options and self.options != :absent args << resource[:name] - flush if respond_to?(:flush) mountcmd(*args) + case get(:ensure) + when :absent; set(:ensure => :ghost) + when :unmounted; set(:ensure => :mounted) + end end def remount @@ -30,22 +33,17 @@ module Puppet::Provider::Mount # This only works when the mount point is synced to the fstab. def unmount - umount resource[:name] + umount(resource[:name]) + + # Update property hash for future queries (e.g. refresh is called) + case get(:ensure) + when :mounted; set(:ensure => :unmounted) + when :ghost; set(:ensure => :absent) + end end # Is the mount currently mounted? def mounted? - platform = Facter.value("operatingsystem") - name = resource[:name] - mounts = mountcmd.split("\n").find do |line| - case platform - when "Darwin" - line =~ / on #{name} / or line =~ %r{ on /private/var/automount#{name}} - when "Solaris", "HP-UX" - line =~ /^#{name} on / - else - line =~ / on #{name} / - end - end + [:mounted, :ghost].include?(get(:ensure)) end end -- cgit From 9f4060860a3e8247d95696ffb9e0aaf4acdd539d Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Sun, 23 Jan 2011 14:21:45 +0100 Subject: (#4914) Update property blocks The action for a specific ensure state depends on the actual state so we cannot use the default behaviour. The following transitions are now supported (with ghost = mounted but not present in fstab): * 4 Is-states : absent, mounted, unmounted, ghost * 4 Should-states: absent, mounted, present, unmounted * from ghost to present -> create * from absent to present -> create * from ghost to unmounted -> create, umount * from mounted to unmounted -> umount * from absent to unmounted -> create * from ghost to absent -> umount (may fail on certain OS) * from mounted to absent -> umount, destroy * from unmounted to absent -> destroy * from ghost to mounted -> create * from absent to mounted -> create, mount * from unmounted to mounted -> mount Every other combination is treatet insync --- lib/puppet/type/mount.rb | 55 ++++++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/lib/puppet/type/mount.rb b/lib/puppet/type/mount.rb index d048c90f1..bcd24a1db 100755 --- a/lib/puppet/type/mount.rb +++ b/lib/puppet/type/mount.rb @@ -21,6 +21,11 @@ module Puppet fstab and mount it. Set to `present` to add to fstab but not change mount/unmount status" + # IS -> SHOULD In Sync Action + # ghost -> present NO create + # absent -> present NO create + # (mounted -> present YES) + # (unmounted -> present YES) newvalue(:defined) do provider.create return :mount_created @@ -28,27 +33,48 @@ module Puppet aliasvalue :present, :defined + # IS -> SHOULD In Sync Action + # ghost -> unmounted NO create, unmount + # absent -> unmounted NO create + # mounted -> unmounted NO unmount newvalue(:unmounted) do - if provider.mounted? - syncothers + case self.retrieve + when :ghost # (not in fstab but mounted) + provider.create + @resource.flush provider.unmount return :mount_unmounted - else + when nil, :absent # (not in fstab and not mounted) provider.create return :mount_created + when :mounted # (in fstab and mounted) + provider.unmount + syncothers # I guess it's more likely that the mount was originally mounted with + # the wrong attributes so I sync AFTER the umount + return :mount_unmounted + else + raise Puppet::Error, "Unexpected change from #{current_value} to unmounted}" end end + # IS -> SHOULD In Sync Action + # ghost -> absent NO unmount + # mounted -> absent NO provider.destroy AND unmount + # unmounted -> absent NO provider.destroy newvalue(:absent, :event => :mount_deleted) do + current_value = self.retrieve provider.unmount if provider.mounted? - - provider.destroy + provider.destroy unless current_value == :ghost end + # IS -> SHOULD In Sync Action + # ghost -> mounted NO provider.create + # absent -> mounted NO provider.create AND mount + # unmounted -> mounted NO mount newvalue(:mounted, :event => :mount_mounted) do # Create the mount point if it does not already exist. current_value = self.retrieve - provider.create if current_value.nil? or current_value == :absent + provider.create if [nil, :absent, :ghost].include?(current_value) syncothers @@ -56,27 +82,16 @@ module Puppet provider.mount unless provider.mounted? end + # insync: mounted -> present + # unmounted -> present def insync?(is) - if should == :defined and is != :absent + if should == :defined and [:mounted,:unmounted].include?(is) true else super end end - def retrieve - # We need to special case :mounted; if we're absent, we still - # want - curval = super() - if curval == :absent - return :absent - elsif provider.mounted? - return :mounted - else - return :unmounted - end - end - def syncothers # We have to flush any changes to disk. currentvalues = @resource.retrieve_resource -- cgit From b7530389788effce9705e34c75aab5aad1ad5ee6 Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Sun, 23 Jan 2011 16:55:19 +0100 Subject: (#4914) Add specs for modified mount type --- spec/unit/type/mount_spec.rb | 292 +++++++++++++++++++++++++++---------------- 1 file changed, 182 insertions(+), 110 deletions(-) diff --git a/spec/unit/type/mount_spec.rb b/spec/unit/type/mount_spec.rb index ce82cb516..45a6b6f5c 100755 --- a/spec/unit/type/mount_spec.rb +++ b/spec/unit/type/mount_spec.rb @@ -11,10 +11,14 @@ describe Puppet::Type.type(:mount) do mount = Puppet::Type.type(:mount).new(:name => "yay") mount.should(:ensure).should be_nil end + + it "should have :name as the only keyattribut" do + Puppet::Type.type(:mount).key_attributes.should == [:name] + end end describe Puppet::Type.type(:mount), "when validating attributes" do - [:name, :remounts].each do |param| + [:name, :remounts, :provider].each do |param| it "should have a #{param} parameter" do Puppet::Type.type(:mount).attrtype(param).should == :param end @@ -38,9 +42,16 @@ describe Puppet::Type.type(:mount)::Ensure, "when validating values" do mount.should(:ensure).should == :defined end + it "should support :present as a value to :ensure" do + Puppet::Type.type(:mount).new(:name => "yay", :ensure => :present) + end + + it "should support :defined as a value to :ensure" do + Puppet::Type.type(:mount).new(:name => "yay", :ensure => :defined) + end + it "should support :unmounted as a value to :ensure" do - mount = Puppet::Type.type(:mount).new(:name => "yay", :ensure => :unmounted) - mount.should(:ensure).should == :unmounted + Puppet::Type.type(:mount).new(:name => "yay", :ensure => :unmounted) end it "should support :absent as a value to :ensure" do @@ -74,134 +85,150 @@ describe Puppet::Type.type(:mount)::Ensure do end end - describe Puppet::Type.type(:mount)::Ensure, "when retrieving its current state" do + describe Puppet::Type.type(:mount)::Ensure, "when changing the host" do - it "should return the provider's value if it is :absent" do - @provider.expects(:ensure).returns(:absent) - @ensure.retrieve.should == :absent - end + def test_ensure_change(options) + @provider.stubs(:get).with(:ensure).returns options[:from] + @provider.stubs(:ensure).returns options[:from] + @provider.stubs(:mounted?).returns([:mounted,:ghost].include? options[:from]) + @provider.expects(:create).times(options[:create] || 0) + @provider.expects(:destroy).times(options[:destroy] || 0) + @provider.expects(:mount).times(options[:mount] || 0) + @provider.expects(:unmount).times(options[:unmount] || 0) + @ensure.stubs(:syncothers) + @ensure.should = options[:to] + @ensure.sync + end - it "should return :mounted if the provider indicates it is mounted and the value is not :absent" do - @provider.expects(:ensure).returns(:present) - @provider.expects(:mounted?).returns(true) - @ensure.retrieve.should == :mounted - end + it "should create itself when changing from :ghost to :present" do + test_ensure_change(:from => :ghost, :to => :present, :create => 1) + end - it "should return :unmounted if the provider indicates it is not mounted and the value is not :absent" do - @provider.expects(:ensure).returns(:present) - @provider.expects(:mounted?).returns(false) - @ensure.retrieve.should == :unmounted - end - end + it "should create itself when changing from :absent to :present" do + test_ensure_change(:from => :absent, :to => :present, :create => 1) + end - describe Puppet::Type.type(:mount)::Ensure, "when changing the host" do + it "should create itself and unmount when changing from :ghost to :unmounted" do + test_ensure_change(:from => :ghost, :to => :unmounted, :create => 1, :unmount => 1) + end - it "should destroy itself if it should be absent" do - @provider.stubs(:mounted?).returns(false) - @provider.expects(:destroy) - @ensure.should = :absent - @ensure.sync - end + it "should unmount resource when changing from :mounted to :unmounted" do + test_ensure_change(:from => :mounted, :to => :unmounted, :unmount => 1) + end - it "should unmount itself before destroying if it is mounted and should be absent" do - @provider.expects(:mounted?).returns(true) - @provider.expects(:unmount) - @provider.expects(:destroy) - @ensure.should = :absent - @ensure.sync - end + it "should create itself when changing from :absent to :unmounted" do + test_ensure_change(:from => :absent, :to => :unmounted, :create => 1) + end - it "should create itself if it is absent and should be defined" do - @provider.stubs(:ensure).returns(:absent) - @provider.stubs(:mounted?).returns(true) + it "should unmount resource when changing from :ghost to :absent" do + test_ensure_change(:from => :ghost, :to => :absent, :unmount => 1) + end - @provider.stubs(:mounted?).returns(false) - @provider.expects(:create) - @ensure.should = :defined - @ensure.sync - end + it "should unmount and destroy itself when changing from :mounted to :absent" do + test_ensure_change(:from => :mounted, :to => :absent, :destroy => 1, :unmount => 1) + end - it "should not unmount itself if it is mounted and should be defined" do - @provider.stubs(:ensure).returns(:mounted) - @provider.stubs(:mounted?).returns(true) + it "should destroy itself when changing from :unmounted to :absent" do + test_ensure_change(:from => :unmounted, :to => :absent, :destroy => 1) + end - @provider.stubs(:create) - @provider.expects(:mount).never - @provider.expects(:unmount).never - @ensure.should = :defined - @ensure.sync - end + it "should create itself when changing from :ghost to :mounted" do + test_ensure_change(:from => :ghost, :to => :mounted, :create => 1) + end - it "should not mount itself if it is unmounted and should be defined" do - @provider.stubs(:ensure).returns(:unmounted) - @provider.stubs(:mounted?).returns(false) + it "should create itself and mount when changing from :absent to :mounted" do + test_ensure_change(:from => :absent, :to => :mounted, :create => 1, :mount => 1) + end - @ensure.stubs(:syncothers) - @provider.stubs(:create) - @provider.expects(:mount).never - @provider.expects(:unmount).never - @ensure.should = :present - @ensure.sync - end + it "should mount resource when changing from :unmounted to :mounted" do + test_ensure_change(:from => :unmounted, :to => :mounted, :mount => 1) + end - it "should unmount itself if it is mounted and should be unmounted" do - @provider.stubs(:ensure).returns(:present) - @provider.stubs(:mounted?).returns(true) - @ensure.stubs(:syncothers) - @provider.expects(:unmount) - @ensure.should = :unmounted - @ensure.sync - end + it "should be in sync if it is :absent and should be :absent" do + @ensure.should = :absent + @ensure.insync?(:absent).should == true + end - it "should create and mount itself if it does not exist and should be mounted" do - @provider.stubs(:ensure).returns(:absent) - @provider.stubs(:mounted?).returns(false) - @provider.expects(:create) - @ensure.stubs(:syncothers) - @provider.expects(:mount) - @ensure.should = :mounted - @ensure.sync - end + it "should be out of sync if it is :absent and should be :defined" do + @ensure.should = :defined + @ensure.insync?(:absent).should == false + end - it "should mount itself if it is present and should be mounted" do - @provider.stubs(:ensure).returns(:present) - @provider.stubs(:mounted?).returns(false) - @ensure.stubs(:syncothers) - @provider.expects(:mount) - @ensure.should = :mounted - @ensure.sync - end + it "should be out of sync if it is :absent and should be :mounted" do + @ensure.should = :mounted + @ensure.insync?(:absent).should == false + end - it "should create but not mount itself if it is absent and mounted and should be mounted" do - @provider.stubs(:ensure).returns(:absent) - @provider.stubs(:mounted?).returns(true) - @ensure.stubs(:syncothers) - @provider.expects(:create) - @ensure.should = :mounted - @ensure.sync - end + it "should be out of sync if it is :absent and should be :unmounted" do + @ensure.should = :unmounted + @ensure.insync?(:absent).should == false + end - it "should be insync if it is mounted and should be defined" do - @ensure.should = :defined - @ensure.insync?(:mounted).should == true - end - it "should be insync if it is unmounted and should be defined" do - @ensure.should = :defined - @ensure.insync?(:unmounted).should == true - end + it "should be out of sync if it is :mounted and should be :absent" do + @ensure.should = :absent + @ensure.insync?(:mounted).should == false + end - it "should be insync if it is mounted and should be present" do - @ensure.should = :present - @ensure.insync?(:mounted).should == true - end + it "should be in sync if it is :mounted and should be :defined" do + @ensure.should = :defined + @ensure.insync?(:mounted).should == true + end - it "should be insync if it is unmounted and should be present" do - @ensure.should = :present - @ensure.insync?(:unmounted).should == true - end - end + it "should be in sync if it is :mounted and should be :mounted" do + @ensure.should = :mounted + @ensure.insync?(:mounted).should == true + end + + it "should be out in sync if it is :mounted and should be :unmounted" do + @ensure.should = :unmounted + @ensure.insync?(:mounted).should == false + end + + + it "should be out of sync if it is :unmounted and should be :absent" do + @ensure.should = :absent + @ensure.insync?(:unmounted).should == false + end + + it "should be in sync if it is :unmounted and should be :defined" do + @ensure.should = :defined + @ensure.insync?(:unmounted).should == true + end + + it "should be out of sync if it is :unmounted and should be :mounted" do + @ensure.should = :mounted + @ensure.insync?(:unmounted).should == false + end + + it "should be in sync if it is :unmounted and should be :unmounted" do + @ensure.should = :unmounted + @ensure.insync?(:unmounted).should == true + end + + + it "should be out of sync if it is :ghost and should be :absent" do + @ensure.should = :absent + @ensure.insync?(:ghost).should == false + end + + it "should be out of sync if it is :ghost and should be :defined" do + @ensure.should = :defined + @ensure.insync?(:ghost).should == false + end + + it "should be out of sync if it is :ghost and should be :mounted" do + @ensure.should = :mounted + @ensure.insync?(:ghost).should == false + end + + it "should be out of sync if it is :ghost and should be :unmounted" do + @ensure.should = :unmounted + @ensure.insync?(:ghost).should == false + end + + end describe Puppet::Type.type(:mount), "when responding to events" do @@ -258,4 +285,49 @@ describe Puppet::Type.type(:mount), "when modifying an existing mount entry" do @catalog.apply end + + it "should flush changes before mounting" do + syncorder = sequence('syncorder') + @mount.provider.expects(:options).returns 'soft' + @mount.provider.expects(:ensure).returns :unmounted + @mount.provider.expects(:mounted?).returns false + + @mount.provider.expects(:options=).in_sequence(syncorder).with 'hard' + @mount.expects(:flush).in_sequence(syncorder) # Have to write with no options + @mount.provider.expects(:mount).in_sequence(syncorder) + @mount.expects(:flush).in_sequence(syncorder) # Call flush again cause we changed everything + + @mount[:ensure] = :mounted + @mount[:options] = 'hard' + + @catalog.apply + end + + it "should not flush before mounting if there are no other changes" do + syncorder = sequence('syncorder') + @mount.provider.expects(:ensure).returns :unmounted + @mount.provider.expects(:mounted?).returns false + @mount.provider.expects(:mount).in_sequence(syncorder) + @mount.expects(:flush).in_sequence(syncorder) # Call flush cause we changed everything + + @mount[:ensure] = :mounted + @catalog.apply + end + + it "should umount before flushing changes to disk" do + syncorder = sequence('syncorder') + @mount.provider.expects(:options).returns 'soft' + @mount.provider.expects(:ensure).returns :mounted + + @mount.provider.expects(:unmount).in_sequence(syncorder) + @mount.provider.expects(:options=).in_sequence(syncorder).with 'hard' + @mount.expects(:flush).in_sequence(syncorder) # Call inside syncothers + @mount.expects(:flush).in_sequence(syncorder) # I guess transaction or anything calls flush again + + @mount[:ensure] = :unmounted + @mount[:options] = 'hard' + + @catalog.apply + end + end -- cgit From f534470221fb97f2d25700f01c3f8c43aef73c26 Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Tue, 25 Jan 2011 20:45:54 +0100 Subject: (#4914) Add specs for modified mount provider Change specs - No need to call flush before mounting (explicitly), because the type and syncothers will to that for us - Add tests regarding the prefetched mount status --- spec/unit/provider/mount_spec.rb | 59 +++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb index b034214ee..232c559f4 100755 --- a/spec/unit/provider/mount_spec.rb +++ b/spec/unit/provider/mount_spec.rb @@ -19,18 +19,13 @@ describe Puppet::Provider::Mount do describe Puppet::Provider::Mount, " when mounting" do - it "should use the 'mountcmd' method to mount" do - @mounter.stubs(:options).returns(nil) - @mounter.expects(:mountcmd) - - @mounter.mount + before :each do + @mounter.stubs(:get).with(:ensure).returns(:mounted) end - it "should flush before mounting if a flush method exists" do - @mounter.meta_def(:flush) { } - @mounter.expects(:flush) - @mounter.stubs(:mountcmd) + it "should use the 'mountcmd' method to mount" do @mounter.stubs(:options).returns(nil) + @mounter.expects(:mountcmd) @mounter.mount end @@ -48,6 +43,23 @@ describe Puppet::Provider::Mount do @mounter.mount end + + it "should update the :ensure state to :mounted if it was :unmounted before" do + @mounter.expects(:mountcmd) + @mounter.stubs(:options).returns(nil) + @mounter.expects(:get).with(:ensure).returns(:unmounted) + @mounter.expects(:set).with(:ensure => :mounted) + @mounter.mount + end + + it "should update the :ensure state to :ghost if it was :absent before" do + @mounter.expects(:mountcmd) + @mounter.stubs(:options).returns(nil) + @mounter.expects(:get).with(:ensure).returns(:absent) + @mounter.expects(:set).with(:ensure => :ghost) + @mounter.mount + end + end describe Puppet::Provider::Mount, " when remounting" do @@ -77,21 +89,42 @@ describe Puppet::Provider::Mount do describe Puppet::Provider::Mount, " when unmounting" do + before :each do + @mounter.stubs(:get).with(:ensure).returns(:unmounted) + end + it "should call the :umount command with the resource name" do @mounter.expects(:umount).with(@name) @mounter.unmount end + + it "should update the :ensure state to :absent if it was :ghost before" do + @mounter.expects(:umount).with(@name).returns true + @mounter.expects(:get).with(:ensure).returns(:ghost) + @mounter.expects(:set).with(:ensure => :absent) + @mounter.unmount + end + + it "should update the :ensure state to :unmounted if it was :mounted before" do + @mounter.expects(:umount).with(@name).returns true + @mounter.expects(:get).with(:ensure).returns(:mounted) + @mounter.expects(:set).with(:ensure => :unmounted) + @mounter.unmount + end + end describe Puppet::Provider::Mount, " when determining if it is mounted" do - it "should parse the results of running the mount command with no arguments" do - Facter.stubs(:value).returns("whatever") - @mounter.expects(:mountcmd).returns("") - + it "should query the property_hash" do + @mounter.expects(:get).with(:ensure).returns(:mounted) @mounter.mounted? end + end + + describe Puppet::Provider::Mount, " when prefetching resources" do + it "should match ' on /private/var/automount' if the operating system is Darwin" do Facter.stubs(:value).with("operatingsystem").returns("Darwin") @mounter.expects(:mountcmd).returns("/dev/whatever on /private/var/automount/\ndevfs on /dev") -- cgit From d6e4ffeb069686050b0ad1db544389be40e39b57 Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Sun, 30 Jan 2011 20:34:27 +0100 Subject: (#4914) Specs for mounted? match new behaviour The question if a filesystem is mounted or not can be answered without calling mount and the specs have to reflect that. --- spec/unit/provider/mount_spec.rb | 50 +++++++++++----------------------------- 1 file changed, 13 insertions(+), 37 deletions(-) diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb index 232c559f4..3fc8a8664 100755 --- a/spec/unit/provider/mount_spec.rb +++ b/spec/unit/provider/mount_spec.rb @@ -121,50 +121,26 @@ describe Puppet::Provider::Mount do @mounter.mounted? end - end - - describe Puppet::Provider::Mount, " when prefetching resources" do - - it "should match ' on /private/var/automount' if the operating system is Darwin" do - Facter.stubs(:value).with("operatingsystem").returns("Darwin") - @mounter.expects(:mountcmd).returns("/dev/whatever on /private/var/automount/\ndevfs on /dev") - - @mounter.should be_mounted + it "should return true if prefetched value is :mounted" do + @mounter.stubs(:get).with(:ensure).returns(:mounted) + @mounter.mounted? == true end - it "should match ' on ' if the operating system is Darwin" do - Facter.stubs(:value).with("operatingsystem").returns("Darwin") - @mounter.expects(:mountcmd).returns("/dev/disk03 on / (local, journaled)\ndevfs on /dev") - - @mounter.should be_mounted + it "should return true if prefetched value is :ghost" do + @mounter.stubs(:get).with(:ensure).returns(:ghost) + @mounter.mounted? == true end - it "should match '^ on' if the operating system is Solaris" do - Facter.stubs(:value).with("operatingsystem").returns("Solaris") - @mounter.expects(:mountcmd).returns("/ on /dev/dsk/whatever\n/var on /dev/dsk/other") - - @mounter.should be_mounted + it "should return false if prefetched value is :absent" do + @mounter.stubs(:get).with(:ensure).returns(:absent) + @mounter.mounted? == false end - it "should match '^ on' if the operating system is HP-UX" do - Facter.stubs(:value).with("operatingsystem").returns("HP-UX") - @mounter.expects(:mountcmd).returns("/ on /dev/dsk/whatever\n/var on /dev/dsk/other") - - @mounter.should be_mounted - end - - it "should match ' on ' if the operating system is not Darwin, Solaris, or HP-UX" do - Facter.stubs(:value).with("operatingsystem").returns("Debian") - @mounter.expects(:mountcmd).returns("/dev/dsk/whatever on / and stuff\n/dev/other/disk on /var and stuff") - - @mounter.should be_mounted + it "should return false if prefetched value is :unmounted" do + @mounter.stubs(:get).with(:ensure).returns(:unmounted) + @mounter.mounted? == false end - it "should not be considered mounted if it did not match the mount output" do - Facter.stubs(:value).with("operatingsystem").returns("Debian") - @mounter.expects(:mountcmd).returns("/dev/dsk/whatever on /something/else and stuff\n/dev/other/disk on /var and stuff") - - @mounter.should_not be_mounted - end end + end -- cgit From c912a2af2f63f505a493137d4ff0b88bc3754cda Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 3 Feb 2011 13:46:08 -0800 Subject: (#4139) hook log autoflush into global defaults We previously had an ordering dependency in the autoflush option, which was statically read from defaults when the log destination was configured. We add a hook in the defaults to update the log subsystem, which in turn updates log destinations, when autoflush is changed. This would work as desired: puppet agent --autoflush --logdest=file This would not work, as autoflush would be false: puppet agent --logdest=file --autoflush Now those changes propagate correctly. Paired-with: matt@puppetlabs.com --- lib/puppet/defaults.rb | 6 +++++- lib/puppet/util/log.rb | 6 ++++++ lib/puppet/util/log/destinations.rb | 2 ++ spec/unit/util/log/destinations_spec.rb | 13 +++++++++++++ spec/unit/util/log_spec.rb | 5 +++++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 764cbbe2b..687ac4eb0 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -14,7 +14,11 @@ module Puppet setdefaults(:main, :trace => [false, "Whether to print stack traces on some errors"], - :autoflush => [false, "Whether log files should always flush to disk."], + :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."], diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb index 3fdac3f69..ba1690078 100644 --- a/lib/puppet/util/log.rb +++ b/lib/puppet/util/log.rb @@ -67,6 +67,12 @@ class Puppet::Util::Log } end + def Log.autoflush=(v) + @destinations.each do |type, dest| + dest.autoflush = v if dest.respond_to?(:autoflush=) + end + end + # Create a new log message. The primary role of this method is to # avoid creating log messages below the loglevel. def Log.create(hash) diff --git a/lib/puppet/util/log/destinations.rb b/lib/puppet/util/log/destinations.rb index 22b3dedb2..c70edeb02 100644 --- a/lib/puppet/util/log/destinations.rb +++ b/lib/puppet/util/log/destinations.rb @@ -50,6 +50,8 @@ Puppet::Util::Log.newdesttype :file do @file.flush if defined?(@file) end + attr_accessor :autoflush + def initialize(path) @name = path # first make sure the directory exists diff --git a/spec/unit/util/log/destinations_spec.rb b/spec/unit/util/log/destinations_spec.rb index 6596c0664..710a51725 100755 --- a/spec/unit/util/log/destinations_spec.rb +++ b/spec/unit/util/log/destinations_spec.rb @@ -22,3 +22,16 @@ describe Puppet::Util::Log.desttypes[:report] do dest.handle "my log" end end + + +describe Puppet::Util::Log.desttypes[:file] do + before do + File.stubs(:open) # prevent actually creating the file + @class = Puppet::Util::Log.desttypes[:file] + end + + it "should default to autoflush false" do + @class.new('/tmp/log').autoflush.should == false + end +end + diff --git a/spec/unit/util/log_spec.rb b/spec/unit/util/log_spec.rb index f3fd1b051..4a30d5086 100755 --- a/spec/unit/util/log_spec.rb +++ b/spec/unit/util/log_spec.rb @@ -136,6 +136,11 @@ describe Puppet::Util::Log do Puppet::Util::Log.new(:level => "notice", :message => :foo) end + it "should update Log autoflush when Puppet[:autoflush] is set" do + Puppet::Util::Log.expects(:autoflush=).once.with(true) + Puppet[:autoflush] = true + end + it "should have a method for determining if a tag is present" do Puppet::Util::Log.new(:level => "notice", :message => :foo).should respond_to(:tagged?) end -- cgit From ac8d316a08cffd951a883936a9966388ca3e54ee Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Wed, 2 Feb 2011 14:12:45 -0800 Subject: Fix for #5755 -- making zaml serialization robust over projected objects The core problem arose when the fix for #5048 in 31118fe85aca4 introduced a hook to replace objects dynamically durring serialization so that they could be projected / rewritten to a different form for backward compatability. The serialization code assumed that all objects being serialized would remain valid until the serialization was complete, but nothing retained a copy of the temporary objects created in the hook. To resolve this, the serialization layer now maintains a ref to each such object and clears them (to allow GC) after serialization is complete. Paired-with: Jesse Wolfe Paired-with: Paul Berry --- lib/puppet/util/zaml.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/puppet/util/zaml.rb b/lib/puppet/util/zaml.rb index 14aa90e5f..b22dfc199 100644 --- a/lib/puppet/util/zaml.rb +++ b/lib/puppet/util/zaml.rb @@ -20,6 +20,7 @@ class ZAML def self.dump(stuff, where='') z = new stuff.to_zaml(z) + Label.counter_reset where << z.to_s end # @@ -61,6 +62,7 @@ class ZAML end def initialize(obj) @this_label_number = nil + @obj = obj # prevent garbage collection so that object id isn't reused @@previously_emitted_object[obj.object_id] = self end def to_s -- cgit From bddfa1e22d8db53a16f71759a2d9c690bfc00417 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Thu, 3 Feb 2011 13:42:46 -0800 Subject: (6114) Update the audit metaparameter for 2.6.5. The audit metaparameter has some new behavior, its old behavior has changed, and the previous description was incomplete at any rate. This patch replaces its description string. --- lib/puppet/type.rb | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index e03650b54..f70a3ec0b 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -957,12 +957,25 @@ class Type end newmetaparam(:audit) do - desc "Audit specified attributes of resources over time, and report if any have changed. - This attribute can be used to track changes to any resource over time, and can - provide an audit trail of every change that happens on any given machine. - - Note that you cannot both audit and manage an attribute - managing it guarantees - the value, and any changes already get logged." + desc "Marks a subset of this resource's unmanaged attributes for auditing. Accepts an + attribute name or a list of attribute names. + + Auditing a resource attribute has two effects: First, whenever a catalog + is applied with puppet apply or puppet agent, Puppet will check whether + that attribute of the resource has been modified, comparing its current + value to the previous run; any change will be logged alongside any actions + performed by Puppet while applying the catalog. + + Secondly, marking a resource attribute for auditing will include that + attribute in inspection reports generated by puppet inspect; see the + puppet inspect documentation for more details. + + Managed attributes for a resource can also be audited, but note that + changes made by Puppet will be logged as additional modifications. (I.e. + if a user manually edits a file whose contents are audited and managed, + puppet agent's next two runs will both log an audit notice: the first run + will log the user's edit and then revert the file to the desired state, + and the second run will log the edit made by Puppet.)" validate do |list| list = Array(list).collect {|p| p.to_sym} -- cgit From 4ff5769119aefafa33e05449ebcfac78ba0c0fe0 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 3 Feb 2011 15:36:50 -0800 Subject: (#5823) run mode can now be set dynamically... Third party scripts, and complex command line tools, depend on being able to configure the run_mode value at runtime, not just when they fire up. For better or worse we used to allow this sort of thing to work, but stopped, and we have no sane, safe and consensual alternative, so we broke a bunch of client code. This enables the feature again, but does not add any safety catch; you can now happily slice off your own feet with this, if you really want to. --- lib/puppet/application.rb | 9 ++++++--- spec/unit/application_spec.rb | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb index 17ad69cee..b944a554e 100644 --- a/lib/puppet/application.rb +++ b/lib/puppet/application.rb @@ -264,9 +264,14 @@ class Application def initialize(command_line = nil) require 'puppet/util/command_line' @command_line = command_line || Puppet::Util::CommandLine.new - @run_mode = self.class.run_mode + set_run_mode self.class.run_mode @options = {} + require 'puppet' + end + + def set_run_mode(mode) + @run_mode = mode $puppet_application_mode = @run_mode $puppet_application_name = name @@ -281,8 +286,6 @@ class Application Puppet.settings.set_value(:rundir, Puppet.run_mode.run_dir, :mutable_defaults) Puppet.settings.set_value(:run_mode, Puppet.run_mode.name.to_s, :mutable_defaults) end - - require 'puppet' end # This is the main application entry point diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index c0f97336c..5a52c2d54 100755 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -46,6 +46,48 @@ describe Puppet::Application do end end + it "should sadly and frighteningly allow run_mode to change at runtime" do + class TestApp < Puppet::Application + run_mode :master + def run_command + # This is equivalent to calling these methods externally to the + # instance, but since this is what "real world" code is likely to do + # (and we need the class anyway) we may as well test that. --daniel 2011-02-03 + set_run_mode self.class.run_mode "agent" + end + end + + Puppet[:run_mode].should == "user" + + expect { + app = TestApp.new + + Puppet[:run_mode].should == "master" + + app.run + + app.class.run_mode.name.should == :agent + $puppet_application_mode.name.should == :agent + }.should_not raise_error + + Puppet[:run_mode].should == "agent" + end + + it "it should not allow run mode to be set multiple times" do + pending "great floods of tears, you can do this right now" # --daniel 2011-02-03 + app = Puppet::Application.new + expect { + app.set_run_mode app.class.run_mode "master" + $puppet_application_mode.name.should == :master + app.set_run_mode app.class.run_mode "agent" + $puppet_application_mode.name.should == :agent + }.should raise_error + end + + it "should explode when an invalid run mode is set at runtime, for great victory" + # ...but you can, and while it will explode, that only happens too late for + # us to easily test. --daniel 2011-02-03 + it "should have a run entry-point" do @app.should respond_to(:run) end -- cgit From 04ea8269e70e9c1f81394ac6da2b48dcfb49b1d5 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 3 Feb 2011 16:19:03 -0800 Subject: (#5823) document the not-an-API status of set_run_mode Since this is totally not API, document that in big, threatening letters so that folks actually know what is going on. Include promises so they don't feel too unhappy with us. Paired-with: matt@puppetlabs.com --- lib/puppet/application.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb index b944a554e..c3d7355f6 100644 --- a/lib/puppet/application.rb +++ b/lib/puppet/application.rb @@ -270,6 +270,13 @@ class Application require 'puppet' end + # WARNING: This is a totally scary, frightening, and nasty internal API. We + # strongly advise that you do not use this, and if you insist, we will + # politely allow you to keep both pieces of your broken code. + # + # We plan to provide a supported, long-term API to deliver this in a way + # that you can use. Please make sure that you let us know if you do require + # this, and this message is still present in the code. --daniel 2011-02-03 def set_run_mode(mode) @run_mode = mode $puppet_application_mode = @run_mode -- cgit From f108f0330623f643343709b29921608b6c76874a Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 3 Feb 2011 14:48:54 -0800 Subject: (#6018) Nick F's --help text for puppet inspect. --- lib/puppet/application/inspect.rb | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb index 77e8476a2..52ef97530 100644 --- a/lib/puppet/application/inspect.rb +++ b/lib/puppet/application/inspect.rb @@ -19,6 +19,59 @@ class Puppet::Application::Inspect < Puppet::Application end end + def help + puts <<-HELP ; exit # XXX + +SYNOPSIS +======== + +Prepare and submit an inspection report to the puppet master. + + +USAGE +===== + + puppet inspect + + +DESCRIPTION +=========== + +This command uses the cached catalog from the previous run of 'puppet +agent' to determine which attributes of which resources have been +marked as auditable with the 'audit' metaparameter. It then examines +the current state of the system, writes the state of the specified +resource attributes to a report, and submits the report to the puppet +master. + +Puppet inspect does not run as a daemon, and must be run manually or from cron. + + +OPTIONS +======= + +Any configuration setting which is valid in the configuration file is +also a valid long argument, e.g. '--server=master.domain.com'. See the +configuration file documentation at +http://docs.puppetlabs.com/references/latest/configuration.html for +the full list of acceptable settings. + + +AUTHOR +====== + +Puppet Labs + + +COPYRIGHT +========= + +Copyright (c) 2011 Puppet Labs, LLC +Licensed under the GNU General Public License version 2 + + HELP + end + def setup exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs? -- cgit From e1191f33defcaffec5900c7122a89ca75d3a9673 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 3 Feb 2011 16:10:49 -0800 Subject: Maint: remove rdoc/usage dependency --- lib/puppet/application.rb | 21 +++------------------ spec/unit/application_spec.rb | 5 ++--- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb index c3d7355f6..7ef71bc81 100644 --- a/lib/puppet/application.rb +++ b/lib/puppet/application.rb @@ -250,7 +250,8 @@ class Application # Every app responds to --help option("--help", "-h") do |v| - help + puts help + exit end def should_parse_config? @@ -385,23 +386,7 @@ class Application end def help - if Puppet.features.usage? - # RH:FIXME: My goodness, this is ugly. - ::RDoc.const_set("PuppetSourceFile", name) - #:stopdoc: # Issue #4161 - def (::RDoc).caller - docfile = `grep -l 'Puppet::Application\\[:#{::RDoc::PuppetSourceFile}\\]' #{DOCPATTERN}`.chomp - super << "#{docfile}:0" - end - #:startdoc: - ::RDoc::usage && exit - else - puts "No help available unless you have RDoc::usage installed" - exit - end - rescue Errno::ENOENT - puts "No help available for puppet #{name}" - exit + "No help available for puppet #{name}" end private diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index 5a52c2d54..1446535e1 100755 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -283,11 +283,10 @@ describe Puppet::Application do @app.parse_options end - describe "when using --help", :if => Puppet.features.usage? do + describe "when using --help" do - it "should call RDoc::usage and exit" do + it "should call exit" do @app.expects(:exit) - RDoc.expects(:usage).returns(true) @app.handle_help(nil) end -- cgit From 8d569b36ec9ba30043b394a02e3f9fecf08068ce Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 3 Feb 2011 14:48:54 -0800 Subject: Maint: remove puts and exit from inspect --help --- lib/puppet/application/inspect.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb index 52ef97530..cee66dec2 100644 --- a/lib/puppet/application/inspect.rb +++ b/lib/puppet/application/inspect.rb @@ -20,7 +20,7 @@ class Puppet::Application::Inspect < Puppet::Application end def help - puts <<-HELP ; exit # XXX + <<-HELP SYNOPSIS ======== -- cgit From 9b521d70695b32e251fa636a73dfbc9ce6942f7a Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 3 Feb 2011 14:58:38 -0800 Subject: Maint: move puppet agent --help --- lib/puppet/application/agent.rb | 206 +++++++++++++++++++++++++++++++++++ lib/puppet/util/command_line/puppetd | 188 -------------------------------- 2 files changed, 206 insertions(+), 188 deletions(-) delete mode 100755 lib/puppet/util/command_line/puppetd diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb index 2b75505fd..5dc425556 100644 --- a/lib/puppet/application/agent.rb +++ b/lib/puppet/application/agent.rb @@ -83,6 +83,212 @@ class Puppet::Application::Agent < Puppet::Application @args[:Port] = arg end + def help + <<-HELP + +SYNOPSIS +======== +Retrieve the client configuration from the puppet master and apply it to +the local host. + +Currently must be run out periodically, using cron or something similar. + + +USAGE +===== + puppet agent [-D|--daemonize|--no-daemonize] [-d|--debug] + [--detailed-exitcodes] [--disable] [--enable] + [-h|--help] [--certname ] [-l|--logdest syslog||console] + [-o|--onetime] [--serve ] [-t|--test] [--noop] + [--digest ] [--fingerprint] [-V|--version] + [-v|--verbose] [-w|--waitforcert ] + + +DESCRIPTION +=========== +This is the main puppet client. Its job is to retrieve the local +machine's configuration from a remote server and apply it. In order to +successfully communicate with the remote server, the client must have a +certificate signed by a certificate authority that the server trusts; +the recommended method for this, at the moment, is to run a certificate +authority as part of the puppet server (which is the default). The +client will connect and request a signed certificate, and will continue +connecting until it receives one. + +Once the client has a signed certificate, it will retrieve its +configuration and apply it. + + +USAGE NOTES +=========== +'puppet agent' does its best to find a compromise between interactive +use and daemon use. Run with no arguments and no configuration, it will +go into the backgroun, attempt to get a signed certificate, and retrieve +and apply its configuration every 30 minutes. + +Some flags are meant specifically for interactive use -- in particular, +'test', 'tags' or 'fingerprint' are useful. 'test' enables verbose +logging, causes the daemon to stay in the foreground, exits if the +server's configuration is invalid (this happens if, for instance, you've +left a syntax error on the server), and exits after running the +configuration once (rather than hanging around as a long-running +process). + +'tags' allows you to specify what portions of a configuration you want +to apply. Puppet elements are tagged with all of the class or definition +names that contain them, and you can use the 'tags' flag to specify one +of these names, causing only configuration elements contained within +that class or definition to be applied. This is very useful when you are +testing new configurations -- for instance, if you are just starting to +manage 'ntpd', you would put all of the new elements into an 'ntpd' +class, and call puppet with '--tags ntpd', which would only apply that +small portion of the configuration during your testing, rather than +applying the whole thing. + +'fingerprint' is a one-time flag. In this mode 'puppet agent' will run +once and display on the console (and in the log) the current certificate +(or certificate request) fingerprint. Providing the '--digest' option +allows to use a different digest algorithm to generate the fingerprint. +The main use is to verify that before signing a certificate request on +the master, the certificate request the master received is the same as +the one the client sent (to prevent against man-in-the-middle attacks +when signing certificates). + + +OPTIONS +======= +Note that any configuration parameter that's valid in the configuration +file is also a valid long argument. For example, 'server' is a valid +configuration parameter, so you can specify '--server ' 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 agent 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. + +digest: Change the certificate fingerprinting digest + algorithm. The default is MD5. Valid values depends + on the version of OpenSSL installed, but should + always at least contain MD5, MD2, SHA1 and SHA256. + +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. This + option only makes sense in conjunction with + --onetime. + +disable: Disable working on the local system. This puts a + lock file in place, causing 'puppet agent' not to + work on the system until the lock file is removed. + This is useful if you are testing a configuration + and do not want the central configuration to + override the local state until everything is tested + and committed. + +'puppet agent' uses the same lock file while it is running, so no more +than one 'puppet agent' process is working at a time. + +'puppet agent' exits after executing this. + +enable: Enable working on the local system. This removes any + lock file, causing 'puppet agent' to start managing + the local system again (although it will continue to + use its normal scheduling, so it might not start for + another half hour). + +'puppet agent' exits after executing this. + +certname: Set the certname (unique ID) of the client. The + master reads this unique identifying string, which + is usually set to the node's fully-qualified domain + name, to determine which configurations the node + will receive. Use this option to debug setup + problems or implement unusual node identification + schemes. + +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. + +no-client: Do not create a config client. This will cause the + daemon to run without ever checking for its + configuration automatically, and only makes sense + +onetime: Run the configuration once. Runs a single (normally + daemonized) Puppet run. Useful for interactively + running puppet agent when used in conjunction with + the --no-daemonize option. + +fingerprint: Display the current certificate or certificate + signing request fingerprint and then exit. Use the + '--digest' option to change the digest algorithm + used. + +serve: Start another type of server. By default, 'puppet + agent' will start a service handler that allows + authenticated and authorized remote nodes to trigger + the configuration to be pulled down and applied. You + can specify any handler here that does not require + configuration, e.g., filebucket, ca, or resource. + The handlers are in 'lib/puppet/network/handler', + and the names must match exactly, both in the call + to 'serve' and in 'namespaceauth.conf'. + +test: Enable the most common options used for testing. + These are 'onetime', 'verbose', 'ignorecache', + 'no-daemonize', 'no-usecacheonfailure', + 'detailed-exit-codes', 'no-splay', and 'show_diff'. + +noop: Use 'noop' mode where the daemon runs in a no-op or + dry-run mode. This is useful for seeing what changes + Puppet will make without actually executing the + changes. + +verbose: Turn on verbose reporting. + +version: Print the puppet version number and exit. + +waitforcert: This option only matters for daemons that do not yet + have certificates and it is enabled by default, with + a value of 120 (seconds). This causes 'puppet agent' + to connect to the server every 2 minutes and ask it + to sign a certificate request. This is useful for + the initial setup of a puppet client. You can turn + off waiting for certificates by specifying a time of + 0. + + +EXAMPLE +======= + puppet agent --server puppet.domain.com + + +AUTHOR +====== +Luke Kanies + + +COPYRIGHT +========= +Copyright (c) 2005, 2006 Puppet Labs, LLC Licensed under the GNU Public +License + + HELP + end + def run_command return fingerprint if options[:fingerprint] return onetime if Puppet[:onetime] diff --git a/lib/puppet/util/command_line/puppetd b/lib/puppet/util/command_line/puppetd deleted file mode 100755 index 71b28429b..000000000 --- a/lib/puppet/util/command_line/puppetd +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/env ruby - -# == Synopsis -# -# Retrieve the client configuration from the puppet master and apply -# it to the local host. -# -# Currently must be run out periodically, using cron or something similar. -# -# = Usage -# -# puppet agent [-D|--daemonize|--no-daemonize] [-d|--debug] -# [--detailed-exitcodes] [--disable] [--enable] -# [-h|--help] [--certname ] [-l|--logdest syslog||console] -# [-o|--onetime] [--serve ] [-t|--test] [--noop] -# [--digest ] [--fingerprint] [-V|--version] -# [-v|--verbose] [-w|--waitforcert ] -# -# = Description -# -# This is the main puppet client. Its job is to retrieve the local machine's -# configuration from a remote server and apply it. In order to successfully -# communicate with the remote server, the client must have a certificate signed -# by a certificate authority that the server trusts; the recommended method -# for this, at the moment, is to run a certificate authority as part of the -# puppet server (which is the default). The client will connect and request -# a signed certificate, and will continue connecting until it receives one. -# -# Once the client has a signed certificate, it will retrieve its configuration -# and apply it. -# -# = Usage Notes -# -# +puppet agent+ does its best to find a compromise between interactive use and -# daemon use. Run with no arguments and no configuration, it will go into the -# backgroun, attempt to get a signed certificate, and retrieve and apply its -# configuration every 30 minutes. -# -# Some flags are meant specifically for interactive use -- in particular, -# +test+, +tags+ or +fingerprint+ are useful. +test+ enables verbose logging, causes -# the daemon to stay in the foreground, exits if the server's configuration is -# invalid (this happens if, for instance, you've left a syntax error on the -# server), and exits after running the configuration once (rather than hanging -# around as a long-running process). -# -# +tags+ allows you to specify what portions of a configuration you want to apply. -# Puppet elements are tagged with all of the class or definition names that -# contain them, and you can use the +tags+ flag to specify one of these names, -# causing only configuration elements contained within that class or definition -# to be applied. This is very useful when you are testing new configurations -- -# for instance, if you are just starting to manage +ntpd+, you would put all of -# the new elements into an +ntpd+ class, and call puppet with +--tags ntpd+, -# which would only apply that small portion of the configuration during your -# testing, rather than applying the whole thing. -# -# +fingerprint+ is a one-time flag. In this mode +puppet agent+ will run once and -# display on the console (and in the log) the current certificate (or certificate -# request) fingerprint. Providing the +--digest+ option allows to use a different -# digest algorithm to generate the fingerprint. The main use is to verify that -# before signing a certificate request on the master, the certificate request the -# master received is the same as the one the client sent (to prevent against -# man-in-the-middle attacks when signing certificates). -# -# -# = Options -# -# Note that any configuration parameter that's valid in the configuration file -# is also a valid long argument. For example, 'server' is a valid configuration -# parameter, so you can specify '--server ' 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 agent 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. -# -# digest:: -# Change the certificate fingerprinting digest algorithm. The default is MD5. -# Valid values depends on the version of OpenSSL installed, but should always -# at least contain MD5, MD2, SHA1 and SHA256. -# -# 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. This option only makes -# sense in conjunction with --onetime. -# -# disable:: -# Disable working on the local system. This puts a lock file in place, -# causing +puppet agent+ not to work on the system until the lock file is removed. -# This is useful if you are testing a configuration and do not want the central -# configuration to override the local state until everything is tested and -# committed. -# -# +puppet agent+ uses the same lock file while it is running, so no more than one -# +puppet agent+ process is working at a time. -# -# +puppet agent+ exits after executing this. -# -# enable:: -# Enable working on the local system. This removes any lock file, causing -# +puppet agent+ to start managing the local system again (although it will continue -# to use its normal scheduling, so it might not start for another half hour). -# -# +puppet agent+ exits after executing this. -# -# certname:: -# Set the certname (unique ID) of the client. The master reads this unique -# identifying string, which is usually set to the node's fully-qualified domain -# name, to determine which configurations the node will receive. Use this option -# to debug setup problems or implement unusual node identification schemes. -# -# 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. -# -# no-client:: -# Do not create a config client. This will cause the daemon to run -# without ever checking for its configuration automatically, and only -# makes sense when used in conjunction with --listen. -# -# onetime:: -# Run the configuration once. Runs a single (normally daemonized) Puppet run. -# Useful for interactively running puppet agent when used in conjunction with -# the --no-daemonize option. -# -# fingerprint:: -# Display the current certificate or certificate signing request fingerprint -# and then exit. Use the +--digest+ option to change the digest algorithm used. -# -# serve:: -# Start another type of server. By default, +puppet agent+ will start -# a service handler that allows authenticated and authorized remote nodes to -# trigger the configuration to be pulled down and applied. You can specify -# any handler here that does not require configuration, e.g., filebucket, ca, -# or resource. The handlers are in +lib/puppet/network/handler+, and the names -# must match exactly, both in the call to +serve+ and in +namespaceauth.conf+. -# -# test:: -# Enable the most common options used for testing. These are +onetime+, -# +verbose+, +ignorecache, +no-daemonize+, +no-usecacheonfailure+, -# +detailed-exit-codes+, +no-splay+, and +show_diff+. -# -# noop:: -# Use +noop+ mode where the daemon runs in a no-op or dry-run mode. This is useful -# for seeing what changes Puppet will make without actually executing the changes. -# -# verbose:: -# Turn on verbose reporting. -# -# version:: -# Print the puppet version number and exit. -# -# waitforcert:: -# This option only matters for daemons that do not yet have certificates -# and it is enabled by default, with a value of 120 (seconds). This causes -# +puppet agent+ to connect to the server every 2 minutes and ask it to sign a -# certificate request. This is useful for the initial setup of a puppet -# client. You can turn off waiting for certificates by specifying a time -# of 0. -# -# = Example -# -# puppet agent --server puppet.domain.com -# -# = Author -# -# Luke Kanies -# -# = Copyright -# -# Copyright (c) 2005, 2006 Puppet Labs, LLC -# Licensed under the GNU Public License - -#Puppet::Application[:agent].run -- cgit From fc66e576b7bfc08ad9460d05702ad8750045fa07 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 3 Feb 2011 15:00:46 -0800 Subject: Maint: move puppet master --help --- lib/puppet/application/master.rb | 77 ++++++++++++++++++++++++++++++ lib/puppet/util/command_line/puppetmasterd | 74 ---------------------------- 2 files changed, 77 insertions(+), 74 deletions(-) delete mode 100755 lib/puppet/util/command_line/puppetmasterd diff --git a/lib/puppet/application/master.rb b/lib/puppet/application/master.rb index fde474907..398c0694e 100644 --- a/lib/puppet/application/master.rb +++ b/lib/puppet/application/master.rb @@ -25,6 +25,83 @@ class Puppet::Application::Master < Puppet::Application end end + def help + <<-HELP + +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 ] [--apply ] + +DESCRIPTION +=========== +This is the puppet central daemon. + + +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 puppetmasterdd +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: Capability to compile a catalogue and output it in JSON + from the Puppet master. Uses facts contained in the + $vardir/yaml/ directory to compile the catalog. + +apply: Capability to apply JSON catalog (such as one generated + with --compile). You can either specify a JSON file or + pipe in JSON from standard input. + + +EXAMPLE +======= + puppet master + + +AUTHOR +====== +Luke Kanies + + +COPYRIGHT +========= +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public +License + + HELP + end + def preinit trap(:INT) do $stderr.puts "Cancelling startup" diff --git a/lib/puppet/util/command_line/puppetmasterd b/lib/puppet/util/command_line/puppetmasterd deleted file mode 100755 index 445169820..000000000 --- a/lib/puppet/util/command_line/puppetmasterd +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env ruby - -# -# = 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 ] [--apply ] -# -# = Description -# -# This is the puppet central daemon. -# -# = 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 puppetmasterdd 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:: -# Capability to compile a catalogue and output it in JSON from the Puppet master. Uses -# facts contained in the $vardir/yaml/ directory to compile the catalog. -# -# apply:: -# Capability to apply JSON catalog (such as one generated with --compile). You can either specify -# a JSON file or pipe in JSON from standard input. -# -# = Example -# -# puppet master -# -# = Author -# -# Luke Kanies -# -# = Copyright -# -# Copyright (c) 2005 Puppet Labs, LLC -# Licensed under the GNU Public License - -#Puppet::Application[:master].run -- cgit From ae78264c8c3cd8ec38128b13c265a07faa0eaa84 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 3 Feb 2011 15:12:55 -0800 Subject: Maint: move puppet filebucket --help --- lib/puppet/application/filebucket.rb | 98 +++++++++++++++++++++++++++++++++ lib/puppet/util/command_line/filebucket | 97 -------------------------------- 2 files changed, 98 insertions(+), 97 deletions(-) delete mode 100755 lib/puppet/util/command_line/filebucket diff --git a/lib/puppet/application/filebucket.rb b/lib/puppet/application/filebucket.rb index 9c3c79bc3..77ebbb843 100644 --- a/lib/puppet/application/filebucket.rb +++ b/lib/puppet/application/filebucket.rb @@ -12,6 +12,104 @@ class Puppet::Application::Filebucket < Puppet::Application attr :args + def help + <<-HELP + +SYNOPSIS +======== +A stand-alone Puppet filebucket client. + + +USAGE +===== + puppet filebucket [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] + [-l|--local] [-r|--remote] + [-s|--server ] [-b|--bucket ] ... + + +DESCRIPTION +=========== +This is a stand-alone filebucket client for sending files to a local or +central filebucket. + + +USAGE +===== +This client can operate in three modes, with only one mode per call: + +backup: Send one or more files to the specified file bucket. Each sent + file is printed with its resulting md5 sum. + +get: Return the text associated with an md5 sum. The text is printed + to stdout, and only one file can be retrieved at a time. + +restore: Given a file path and an md5 sum, store the content associated + with the sum into the specified file path. You can specify an + entirely new path to this argument; you are not restricted to + +Note that 'filebucket' defaults to using a network-based filebucket +available on the server named 'puppet'. To use this, you'll have to be +running as a user with valid Puppet certificates. Alternatively, you can +use your local file bucket by specifying '--local'. + + +EXAMPLE +======= + $ puppet filebucket backup /etc/passwd + /etc/passwd: 429b225650b912a2ee067b0a4cf1e949 + $ puppet filebucket restore /tmp/passwd 429b225650b912a2ee067b0a4cf1e949 + $ + + +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 with +'--genconfig'. + +debug: Enable full debugging. + +help: Print this help message + +local: Use the local filebucket. This will use the default + configuration information. + +remote: Use a remote filebucket. This will use the default + configuration information. + +server: The server to send the file to, instead of locally. + +verbose: Print extra information. + +version: Print version information. + + +EXAMPLE +======= + puppet filebucket -b /tmp/filebucket /my/file + + +AUTHOR +====== +Luke Kanies + + +COPYRIGHT +========= +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public +License + + HELP + end + + def run_command @args = command_line.args command = args.shift diff --git a/lib/puppet/util/command_line/filebucket b/lib/puppet/util/command_line/filebucket deleted file mode 100755 index 34b01508e..000000000 --- a/lib/puppet/util/command_line/filebucket +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env ruby - -# -# = Synopsis -# -# A stand-alone Puppet filebucket client. -# -# = Usage -# -# puppet filebucket [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] -# [-l|--local] [-r|--remote] -# [-s|--server ] [-b|--bucket ] ... -# -# = Description -# -# This is a stand-alone filebucket client for sending files to a local -# or central filebucket. -# -# = Usage -# -# This client can operate in three modes, with only one mode per call: -# -# backup:: -# Send one or more files to the specified file bucket. Each sent file -# is printed with its resulting md5 sum. -# -# get:: -# Return the text associated with an md5 sum. The text is printed to -# stdout, and only one file can be retrieved at a time. -# -# restore:: -# Given a file path and an md5 sum, store the content associated with the -# sum into the specified file path. You can specify an entirely new path -# to this argument; you are not restricted to restoring the content to its -# original location. -# -# Note that +filebucket+ defaults to using a network-based filebucket available on -# the server named +puppet+. To use this, you'll have to be running as a user -# with valid Puppet certificates. Alternatively, you can use your local file bucket -# by specifying +--local+. -# -# = Example -# -# $ puppet filebucket backup /etc/passwd -# /etc/passwd: 429b225650b912a2ee067b0a4cf1e949 -# $ puppet filebucket restore /tmp/passwd 429b225650b912a2ee067b0a4cf1e949 -# $ -# -# = 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 with -# '--genconfig'. -# -# debug:: -# Enable full debugging. -# -# help:: -# Print this help message -# -# local:: -# Use the local filebucket. This will use the default configuration -# information. -# -# remote:: -# Use a remote filebucket. This will use the default configuration -# information. -# -# server:: -# The server to send the file to, instead of locally. -# -# verbose:: -# Print extra information. -# -# version:: -# Print version information. -# -# = Example -# -# puppet filebucket -b /tmp/filebucket /my/file -# -# = Author -# -# Luke Kanies -# -# = Copyright -# -# Copyright (c) 2005 Puppet Labs, LLC -# Licensed under the GNU Public License - -#Puppet::Application[:filebucket].run -- cgit From c61d6d0c133ba185bf63884b9e513df5234211cf Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 3 Feb 2011 15:14:51 -0800 Subject: Maint: move puppet describe --help --- lib/puppet/application/describe.rb | 53 ++++++++++++++++++++++++++++++++++++++ lib/puppet/util/command_line/pi | 48 ---------------------------------- 2 files changed, 53 insertions(+), 48 deletions(-) delete mode 100755 lib/puppet/util/command_line/pi diff --git a/lib/puppet/application/describe.rb b/lib/puppet/application/describe.rb index e76b347f6..0c7bea96d 100644 --- a/lib/puppet/application/describe.rb +++ b/lib/puppet/application/describe.rb @@ -180,6 +180,59 @@ class Puppet::Application::Describe < Puppet::Application option("--list", "-l") option("--meta","-m") + def help + <<-HELP + +SYNOPSIS +======== +Print help about puppet types on the console. Run with '-h' to get +detailed help. + + +USAGE +===== + puppet describe [-h|--help] [-s|--short] [-p|--providers] [-l|--list] [-m|--meta] + + +DESCRIPTION +=========== +Prints details of Puppet types, providers and metaparameters on the +console. + + +OPTIONS +======= +help: Print this help text + +providers: Describe providers in detail for each type + +list: List all types + +meta: List all metaparameters + +short: List only parameters without detail + + +EXAMPLE +======= + puppet describe --list + puppet describe file --providers + puppet describe user -s -m + + +AUTHOR +====== +David Lutterkort + + +COPYRIGHT +========= +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public +License + + HELP + end + def preinit options[:parameters] = true end diff --git a/lib/puppet/util/command_line/pi b/lib/puppet/util/command_line/pi deleted file mode 100755 index 3d80eea8f..000000000 --- a/lib/puppet/util/command_line/pi +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env ruby - -# -# = Synopsis -# -# Print help about puppet types on the console. Run with '-h' to get detailed -# help. -# = Usage -# -# puppet describe [-h|--help] [-s|--short] [-p|--providers] [-l|--list] [-m|--meta] -# -# = Description -# -# Prints details of Puppet types, providers and metaparameters on the console. -# -# = Options -# -# help:: -# Print this help text -# -# providers:: -# Describe providers in detail for each type -# -# list:: -# List all types -# -# meta:: -# List all metaparameters -# -# short:: -# List only parameters without detail -# -# = Example -# -# puppet describe --list -# puppet describe file --providers -# puppet describe user -s -m -# -# = Author -# -# David Lutterkort -# -# = Copyright -# -# Copyright (c) 2005 Puppet Labs, LLC -# Licensed under the GNU Public License - -#Puppet::Application[:describe].run -- cgit From 9fdd66b3b481e658c8951530b90ca4dd4707fcf0 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 3 Feb 2011 15:17:13 -0800 Subject: Maint: move puppet apply --help --- lib/puppet/application/apply.rb | 76 +++++++++++++++++++++++++++++++++++++ lib/puppet/util/command_line/puppet | 69 --------------------------------- 2 files changed, 76 insertions(+), 69 deletions(-) delete mode 100755 lib/puppet/util/command_line/puppet diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index 33a70ce8a..63a51f253 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -26,6 +26,82 @@ class Puppet::Application::Apply < Puppet::Application end end + def help + <<-HELP + +SYNOPSIS +======== +Run a stand-alone 'puppet' manifest. + + +USAGE +===== + puppet apply [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] [-e|--execute] + [--detailed-exitcodes] [-l|--logdest ] + + +DESCRIPTION +=========== +This is the standalone puppet execution tool; use it to execute +individual manifests that you write. If you need to execute site-wide +manifests, use 'puppet agent' and 'puppet master'. + + +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 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. + + +EXAMPLE +======= + puppet -l /tmp/manifest.log manifest.pp + + +AUTHOR +====== +Luke Kanies + + +COPYRIGHT +========= +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public +License + + HELP + end + def run_command if options[:catalog] apply diff --git a/lib/puppet/util/command_line/puppet b/lib/puppet/util/command_line/puppet deleted file mode 100755 index e75b92af8..000000000 --- a/lib/puppet/util/command_line/puppet +++ /dev/null @@ -1,69 +0,0 @@ - -# -# = Synopsis -# -# Run a stand-alone +puppet+ manifest. -# -# = Usage -# -# puppet apply [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] [-e|--execute] -# [--detailed-exitcodes] [-l|--logdest ] -# -# = Description -# -# This is the standalone puppet execution tool; use it to execute -# individual manifests that you write. If you need to execute site-wide -# manifests, use 'puppet agent' and 'puppet master'. -# -# = 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 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. -# -# = Example -# -# puppet -l /tmp/manifest.log manifest.pp -# -# = Author -# -# Luke Kanies -# -# = Copyright -# -# Copyright (c) 2005 Puppet Labs, LLC -# Licensed under the GNU Public License - -#Puppet::Application[:apply].run -- cgit From 7568b780702d53beabc3fba3017c4c70179aafd7 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 3 Feb 2011 15:43:54 -0800 Subject: Maint: move puppet cert --help --- lib/puppet/application/cert.rb | 111 ++++++++++++++++++++++++++++++++++ lib/puppet/util/command_line/puppetca | 110 --------------------------------- 2 files changed, 111 insertions(+), 110 deletions(-) delete mode 100755 lib/puppet/util/command_line/puppetca diff --git a/lib/puppet/application/cert.rb b/lib/puppet/application/cert.rb index 467b0c859..0db968e9e 100644 --- a/lib/puppet/application/cert.rb +++ b/lib/puppet/application/cert.rb @@ -45,6 +45,117 @@ class Puppet::Application::Cert < Puppet::Application Puppet::Util::Log.level = :info end + def help + <<-HELP + +SYNOPSIS +======== +Stand-alone certificate authority. Capable of generating certificates +but mostly meant for signing certificate requests from puppet clients. + + +USAGE +===== + puppet cert [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] + [-g|--generate] [-l|--list] [-s|--sign] [-r|--revoke] + [-p|--print] [-c|--clean] [--verify] [--digest DIGEST] + [--fingerprint] [host] + + +DESCRIPTION +=========== +Because the puppetmasterd daemon defaults to not signing client +certificate requests, this script is available for signing outstanding +requests. It can be used to list outstanding requests and then either +sign them individually or sign all of them. + + +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 cert with +'--genconfig'. + +all: Operate on all items. Currently only makes sense with + '--sign', '--clean', or '--list'. + +digest: Set the digest for fingerprinting (defaults to md5). Valid + values depends on your openssl and openssl ruby extension + version, but should contain at least md5, sha1, md2, + sha256. + +clean: Remove all files related to a host from puppet cert's + storage. This is useful when rebuilding hosts, since new + certificate signing requests will only be honored if puppet + cert does not have a copy of a signed certificate for that + host. The certificate of the host is also revoked. If + '--all' is specified then all host certificates, both + signed and unsigned, will be removed. + +debug: Enable full debugging. + +generate: Generate a certificate for a named client. A + certificate/keypair will be generated for each client named + on the command line. + +help: Print this help message + +list: List outstanding certificate requests. If '--all' is + specified, signed certificates are also listed, prefixed by + '+', and revoked or invalid certificates are prefixed by + '-' (the verification outcome is printed in parenthesis). + +print: Print the full-text version of a host's certificate. + +fingerprint: Print the DIGEST (defaults to md5) fingerprint of a host's + certificate. + +revoke: Revoke the certificate of a client. The certificate can be + specified either by its serial number, given as a decimal + number or a hexadecimal number prefixed by '0x', or by its + hostname. The certificate is revoked by adding it to the + Certificate Revocation List given by the 'cacrl' config + parameter. Note that the puppetmasterd needs to be + restarted after revoking certificates. + +sign: Sign an outstanding certificate request. Unless '--all' is + specified, hosts must be listed after all flags. + +verbose: Enable verbosity. + +version: Print the puppet version number and exit. + +verify: Verify the named certificate against the local CA + certificate. + + +EXAMPLE +======= + $ puppet cert -l + culain.madstop.com + $ puppet cert -s culain.madstop.com + + +AUTHOR +====== +Luke Kanies + + +COPYRIGHT +========= +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public +License + + HELP + end + def main if @all hosts = :all diff --git a/lib/puppet/util/command_line/puppetca b/lib/puppet/util/command_line/puppetca deleted file mode 100755 index 317d99881..000000000 --- a/lib/puppet/util/command_line/puppetca +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env ruby - -# -# = Synopsis -# -# Stand-alone certificate authority. Capable of generating certificates -# but mostly meant for signing certificate requests from puppet clients. -# -# = Usage -# -# puppet cert [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] -# [-g|--generate] [-l|--list] [-s|--sign] [-r|--revoke] -# [-p|--print] [-c|--clean] [--verify] [--digest DIGEST] -# [--fingerprint] [host] -# -# = Description -# -# Because the puppetmasterd daemon defaults to not signing client certificate -# requests, this script is available for signing outstanding requests. It -# can be used to list outstanding requests and then either sign them individually -# or sign all of them. -# -# = 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 cert with -# '--genconfig'. -# -# all:: -# Operate on all items. Currently only makes sense with '--sign', -# '--clean', or '--list'. -# -# digest:: -# Set the digest for fingerprinting (defaults to md5). Valid values depends -# on your openssl and openssl ruby extension version, but should contain at -# least md5, sha1, md2, sha256. -# -# clean:: -# Remove all files related to a host from puppet cert's storage. This is -# useful when rebuilding hosts, since new certificate signing requests -# will only be honored if puppet cert does not have a copy of a signed -# certificate for that host. The certificate of the host is also revoked. -# If '--all' is specified then all host certificates, both signed and -# unsigned, will be removed. -# -# debug:: -# Enable full debugging. -# -# generate:: -# Generate a certificate for a named client. A certificate/keypair will be -# generated for each client named on the command line. -# -# help:: -# Print this help message -# -# list:: -# List outstanding certificate requests. If '--all' is specified, -# signed certificates are also listed, prefixed by '+', and revoked -# or invalid certificates are prefixed by '-' (the verification outcome -# is printed in parenthesis). -# -# print:: -# Print the full-text version of a host's certificate. -# -# fingerprint:: -# Print the DIGEST (defaults to md5) fingerprint of a host's certificate. -# -# revoke:: -# Revoke the certificate of a client. The certificate can be specified -# either by its serial number, given as a decimal number or a hexadecimal -# number prefixed by '0x', or by its hostname. The certificate is revoked -# by adding it to the Certificate Revocation List given by the 'cacrl' -# config parameter. Note that the puppetmasterd needs to be restarted -# after revoking certificates. -# -# sign:: -# Sign an outstanding certificate request. Unless '--all' is specified, -# hosts must be listed after all flags. -# -# verbose:: -# Enable verbosity. -# -# version:: -# Print the puppet version number and exit. -# -# verify:: -# Verify the named certificate against the local CA certificate. -# -# = Example -# -# $ puppet cert -l -# culain.madstop.com -# $ puppet cert -s culain.madstop.com -# -# = Author -# -# Luke Kanies -# -# = Copyright -# -# Copyright (c) 2005 Puppet Labs, LLC -# Licensed under the GNU Public License - -#Puppet::Application[:cert].run -- cgit From a041e194c41febe752ee39ba5d26291a775ecb5f Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 3 Feb 2011 15:45:53 -0800 Subject: Maint: move puppet doc --help --- lib/puppet/application/doc.rb | 84 ++++++++++++++++++++++++++++++++++ lib/puppet/util/command_line/puppetdoc | 67 --------------------------- 2 files changed, 84 insertions(+), 67 deletions(-) delete mode 100755 lib/puppet/util/command_line/puppetdoc diff --git a/lib/puppet/application/doc.rb b/lib/puppet/application/doc.rb index aaefd6e75..c7f270c8d 100644 --- a/lib/puppet/application/doc.rb +++ b/lib/puppet/application/doc.rb @@ -50,6 +50,90 @@ class Puppet::Application::Doc < Puppet::Application options[:references] << arg.intern end + def help + <<-HELP + +SYNOPSIS +======== +Generate a reference for all Puppet types. Largely meant for internal +Puppet Labs use. + + +USAGE +===== + puppet doc [-a|--all] [-h|--help] [-o|--outputdir ] [-m|--mode ] + [-r|--reference <[type]|configuration|..>] [--charset CHARSET] [manifest-file] + + +DESCRIPTION +=========== +If mode is not 'rdoc', then this command generates a Markdown document +describing all installed Puppet types or all allowable arguments to +puppet executables. It is largely meant for internal use and is used to +generate the reference document available on the Puppet Labs web site. + +In 'rdoc' mode, this command generates an html RDoc hierarchy describing +the manifests that are in 'manifestdir' and 'modulepath' configuration +directives. The generated documentation directory is doc by default but +can be changed with the 'outputdir' option. + +If the command is started with 'manifest-file' command-line arguments, +puppet doc generate a single manifest documentation that is output on +stdout. + + +OPTIONS +======= +all: Output the docs for all of the reference types. In 'rdoc' + modes, this also outputs documentation for all resources + +help: Print this help message + +outputdir: Specifies the directory where to output the rdoc + documentation in 'rdoc' mode. + +mode: Determine the output mode. Valid modes are 'text', 'pdf' and + 'rdoc'. The 'pdf' mode creates PDF formatted files in the + /tmp directory. The default mode is 'text'. In 'rdoc' mode + you must provide 'manifests-path' + +reference: Build a particular reference. Get a list of references by + running 'puppet doc --list'. + +charset: Used only in 'rdoc' mode. It sets the charset used in the + html files produced. + + +EXAMPLE +======= + $ puppet doc -r type > /tmp/type_reference.markdown + +or + + $ puppet doc --outputdir /tmp/rdoc --mode rdoc /path/to/manifests + +or + + $ puppet doc /etc/puppet/manifests/site.pp + +or + + $ puppet doc -m pdf -r configuration + + +AUTHOR +====== +Luke Kanies + + +COPYRIGHT +========= +Copyright (c) 2005-2007 Puppet Labs, LLC Licensed under the GNU Public +License + + HELP + end + def handle_unknown( opt, arg ) @unknown_args << {:opt => opt, :arg => arg } true diff --git a/lib/puppet/util/command_line/puppetdoc b/lib/puppet/util/command_line/puppetdoc deleted file mode 100755 index 45a9c6518..000000000 --- a/lib/puppet/util/command_line/puppetdoc +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env ruby - -# -# = Synopsis -# -# Generate a reference for all Puppet types. Largely meant for internal Puppet -# Labs use. -# -# = Usage -# -# puppet doc [-a|--all] [-h|--help] [-o|--outputdir ] [-m|--mode ] -# [-r|--reference <[type]|configuration|..>] [--charset CHARSET] [manifest-file] -# -# = Description -# -# If mode is not 'rdoc', then this command generates a Markdown document describing all installed -# Puppet types or all allowable arguments to puppet executables. It is largely -# meant for internal use and is used to generate the reference document -# available on the Puppet Labs web site. -# -# In 'rdoc' mode, this command generates an html RDoc hierarchy describing the manifests that -# are in 'manifestdir' and 'modulepath' configuration directives. -# The generated documentation directory is doc by default but can be changed with the 'outputdir' option. -# -# If the command is started with 'manifest-file' command-line arguments, puppet doc generate a single -# manifest documentation that is output on stdout. -# -# = Options -# -# all:: -# Output the docs for all of the reference types. In 'rdoc' modes, this also outputs documentation for all resources -# -# help:: -# Print this help message -# -# outputdir:: -# Specifies the directory where to output the rdoc documentation in 'rdoc' mode. -# -# mode:: -# Determine the output mode. Valid modes are 'text', 'pdf' and 'rdoc'. The 'pdf' mode creates PDF formatted files in the /tmp directory. The default mode is 'text'. In 'rdoc' mode you must provide 'manifests-path' -# -# reference:: -# Build a particular reference. Get a list of references by running +puppet doc --list+. -# -# charset:: -# Used only in 'rdoc' mode. It sets the charset used in the html files produced. -# -# = Example -# -# $ puppet doc -r type > /tmp/type_reference.markdown -# or -# $ puppet doc --outputdir /tmp/rdoc --mode rdoc /path/to/manifests -# or -# $ puppet doc /etc/puppet/manifests/site.pp -# or -# $ puppet doc -m pdf -r configuration -# -# = Author -# -# Luke Kanies -# -# = Copyright -# -# Copyright (c) 2005-2007 Puppet Labs, LLC -# Licensed under the GNU Public License - -#Puppet::Application[:doc].run -- cgit From 95fc38c1a06cddbc8de9e308b6abc4ada65671c6 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 3 Feb 2011 15:50:06 -0800 Subject: Maint: move puppet queue --help --- lib/puppet/application/queue.rb | 59 +++++++++++++++++++++++++++++++++++ lib/puppet/util/command_line/puppetqd | 53 ------------------------------- 2 files changed, 59 insertions(+), 53 deletions(-) delete mode 100755 lib/puppet/util/command_line/puppetqd diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb index 239f6b2ad..651177109 100644 --- a/lib/puppet/application/queue.rb +++ b/lib/puppet/application/queue.rb @@ -37,6 +37,65 @@ class Puppet::Application::Queue < Puppet::Application option("--debug","-d") option("--verbose","-v") + def help + <<-HELP + +SYNOPSIS +======== +Retrieve serialized records from a queue and process them in order. + + +USAGE +===== + puppet queue [-d|--debug] [-v|--verbose] + + +DESCRIPTION +=========== +This is a simple application that just processes entities in a queue as +they are recieved. + + +OPTIONS +======= +Note that any configuration parameter that's valid in the configuration +file is also a valid long argument. For example, 'server' is a valid +configuration parameter, so you can specify '--server ' 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 puppetd with +'--genconfig'. + +debug: Enable full debugging. + +help: Print this help message + +verbose: Turn on verbose reporting. + +version: Print the puppet version number and exit. + + +EXAMPLE +======= + puppet queue + + +AUTHOR +====== +Luke Kanies + + +COPYRIGHT +========= +Copyright (c) 2009 Puppet Labs, LLC Licensed under the GNU Public +License + + HELP + end + def main require 'puppet/indirector/catalog/queue' # provides Puppet::Indirector::Queue.subscribe Puppet.notice "Starting puppetqd #{Puppet.version}" diff --git a/lib/puppet/util/command_line/puppetqd b/lib/puppet/util/command_line/puppetqd deleted file mode 100755 index 81963d537..000000000 --- a/lib/puppet/util/command_line/puppetqd +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env ruby - -# == Synopsis -# -# Retrieve serialized records from a queue and process them in order. -# -# = Usage -# -# puppet queue [-d|--debug] [-v|--verbose] -# -# = Description -# -# This is a simple application that just processes entities in a queue as they -# are recieved. -# -# = Options -# -# Note that any configuration parameter that's valid in the configuration file -# is also a valid long argument. For example, 'server' is a valid configuration -# parameter, so you can specify '--server ' 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 puppetd with -# '--genconfig'. -# -# debug:: -# Enable full debugging. -# -# help:: -# Print this help message -# -# verbose:: -# Turn on verbose reporting. -# -# version:: -# Print the puppet version number and exit. -# -# = Example -# -# puppet queue -# -# = Author -# -# Luke Kanies -# -# = Copyright -# -# Copyright (c) 2009 Puppet Labs, LLC -# Licensed under the GNU Public License - -#Puppet::Application[:queue].run -- cgit From 82e004f810b0e578c39c605237e9a99fd7d2d3d1 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 3 Feb 2011 15:52:16 -0800 Subject: Maint: move puppet kick --help --- lib/puppet/application/kick.rb | 131 +++++++++++++++++++++++++++++++++ lib/puppet/util/command_line/puppetrun | 126 ------------------------------- 2 files changed, 131 insertions(+), 126 deletions(-) delete mode 100755 lib/puppet/util/command_line/puppetrun diff --git a/lib/puppet/application/kick.rb b/lib/puppet/application/kick.rb index 37aeb1ef2..c05f09783 100644 --- a/lib/puppet/application/kick.rb +++ b/lib/puppet/application/kick.rb @@ -37,6 +37,137 @@ class Puppet::Application::Kick < Puppet::Application end end + def help + <<-HELP + +SYNOPSIS +======== +Trigger a puppet agent run on a set of hosts. + + +USAGE +===== + puppet kick [-a|--all] [-c|--class ] [-d|--debug] [-f|--foreground] + [-h|--help] [--host ] [--no-fqdn] [--ignoreschedules] + [-t|--tag ] [--test] [-p|--ping] [ [...]] + + +DESCRIPTION +=========== +This script can be used to connect to a set of machines running 'puppet +agent' and trigger them to run their configurations. The most common +usage would be to specify a class of hosts and a set of tags, and +'puppet kick' would look up in LDAP all of the hosts matching that +class, then connect to each host and trigger a run of all of the objects +with the specified tags. + +If you are not storing your host configurations in LDAP, you can specify +hosts manually. + +You will most likely have to run 'puppet kick' as root to get access to +the SSL certificates. + +'puppet kick' reads 'puppet master''s configuration file, so that it can +copy things like LDAP settings. + + +USAGE NOTES +=========== +'puppet kick' is useless unless 'puppet agent' is listening. See its +documentation for more information, but the gist is that you must enable +'listen' on the 'puppet agent' daemon, either using '--listen' on the +command line or adding 'listen: true' in its config file. In addition, +you need to set the daemons up to specifically allow connections by +creating the 'namespaceauth' file, normally at +'/etc/puppet/namespaceauth.conf'. This file specifies who has access to +each namespace; if you create the file you must add every namespace you +want any Puppet daemon to allow -- it is currently global to all Puppet +daemons. + +An example file looks like this:: + + [fileserver] + allow *.madstop.com + + [puppetmaster] + allow *.madstop.com + + [puppetrunner] + allow culain.madstop.com + +This is what you would install on your Puppet master; non-master hosts +could leave off the 'fileserver' and 'puppetmaster' namespaces. + + +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://reductivelabs.com/projects/puppet/reference/configref.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'. + +all: Connect to all available hosts. Requires LDAP support + at this point. + +class: Specify a class of machines to which to connect. This + only works if you have LDAP configured, at the moment. + +debug: Enable full debugging. + +foreground: Run each configuration in the foreground; that is, when + connecting to a host, do not return until the host has + finished its run. The default is false. + +help: Print this help message + +host: A specific host to which to connect. This flag can be + specified more than once. + +ignoreschedules: Whether the client should ignore schedules when running + its configuration. This can be used to force the client + to perform work it would not normally perform so soon. + The default is false. + +parallel: How parallel to make the connections. Parallelization + is provided by forking for each client to which to + connect. The default is 1, meaning serial execution. + +tag: Specify a tag for selecting the objects to apply. Does + not work with the --test option. + +test: Print the hosts you would connect to but do not + actually connect. This option requires LDAP support at + this point. + +ping:: + + Do a ICMP echo against the target host. Skip hosts that don't respond to ping. + + +EXAMPLE +======= + sudo puppet kick -p 10 -t remotefile -t webserver host1 host2 + + +AUTHOR +====== +Luke Kanies + + +COPYRIGHT +========= +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public +License + + HELP + end + def run_command @hosts += command_line.args options[:test] ? test : main diff --git a/lib/puppet/util/command_line/puppetrun b/lib/puppet/util/command_line/puppetrun deleted file mode 100755 index 7eba3b2c4..000000000 --- a/lib/puppet/util/command_line/puppetrun +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env ruby - -# -# = Synopsis -# -# Trigger a puppet agent run on a set of hosts. -# -# = Usage -# -# puppet kick [-a|--all] [-c|--class ] [-d|--debug] [-f|--foreground] -# [-h|--help] [--host ] [--no-fqdn] [--ignoreschedules] -# [-t|--tag ] [--test] [-p|--ping] [ [...]] -# -# = Description -# -# This script can be used to connect to a set of machines running +puppet agent+ -# and trigger them to run their configurations. The most common usage would -# be to specify a class of hosts and a set of tags, and +puppet kick+ would -# look up in LDAP all of the hosts matching that class, then connect to -# each host and trigger a run of all of the objects with the specified tags. -# -# If you are not storing your host configurations in LDAP, you can specify -# hosts manually. -# -# You will most likely have to run +puppet kick+ as root to get access to -# the SSL certificates. -# -# +puppet kick+ reads +puppet master+'s configuration file, so that it can copy -# things like LDAP settings. -# -# = Usage Notes -# -# +puppet kick+ is useless unless +puppet agent+ is listening. See its documentation -# for more information, but the gist is that you must enable +listen+ on the -# +puppet agent+ daemon, either using +--listen+ on the command line or adding -# 'listen: true' in its config file. In addition, you need to set the daemons -# up to specifically allow connections by creating the +namespaceauth+ file, -# normally at '/etc/puppet/namespaceauth.conf'. This file specifies who has -# access to each namespace; if you create the file you must add every namespace -# you want any Puppet daemon to allow -- it is currently global to all Puppet -# daemons. -# -# An example file looks like this:: -# -# [fileserver] -# allow *.madstop.com -# -# [puppetmaster] -# allow *.madstop.com -# -# [puppetrunner] -# allow culain.madstop.com -# -# This is what you would install on your Puppet master; non-master hosts could -# leave off the 'fileserver' and 'puppetmaster' namespaces. -# -# = 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://reductivelabs.com/projects/puppet/reference/configref.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'. -# -# -# all:: -# Connect to all available hosts. Requires LDAP support at this point. -# -# class:: -# Specify a class of machines to which to connect. This only works if you -# have LDAP configured, at the moment. -# -# debug:: -# Enable full debugging. -# -# foreground:: -# Run each configuration in the foreground; that is, when connecting to a host, -# do not return until the host has finished its run. The default is false. -# -# help:: -# Print this help message -# -# host:: -# A specific host to which to connect. This flag can be specified more -# than once. -# -# ignoreschedules:: -# Whether the client should ignore schedules when running its configuration. -# This can be used to force the client to perform work it would not normally -# perform so soon. The default is false. -# -# parallel:: -# How parallel to make the connections. Parallelization is provided by forking -# for each client to which to connect. The default is 1, meaning serial execution. -# -# tag:: -# Specify a tag for selecting the objects to apply. Does not work with the -# --test option. -# -# -# test:: -# Print the hosts you would connect to but do not actually connect. This -# option requires LDAP support at this point. -# -# ping:: -# -# Do a ICMP echo against the target host. Skip hosts that don't respond to ping. -# -# = Example -# -# sudo puppet kick -p 10 -t remotefile -t webserver host1 host2 -# -# = Author -# -# Luke Kanies -# -# = Copyright -# -# Copyright (c) 2005 Puppet Labs, LLC -# Licensed under the GNU Public License - -#Puppet::Application[:kick].run -- cgit From 3f2f1c2456cf5f08bd67ab5730ab970be5285711 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 3 Feb 2011 16:02:46 -0800 Subject: Maint: move puppet resource --help --- lib/puppet/application/resource.rb | 104 +++++++++++++++++++++++++++++++++++++ lib/puppet/util/command_line/ralsh | 89 ------------------------------- 2 files changed, 104 insertions(+), 89 deletions(-) delete mode 100755 lib/puppet/util/command_line/ralsh diff --git a/lib/puppet/application/resource.rb b/lib/puppet/application/resource.rb index f55caa58a..55b190a76 100644 --- a/lib/puppet/application/resource.rb +++ b/lib/puppet/application/resource.rb @@ -35,6 +35,110 @@ class Puppet::Application::Resource < Puppet::Application @extra_params << arg.to_sym end + def help + <<-HELP + +SYNOPSIS +======== +Use the Puppet RAL to directly interact with the system. + + +USAGE +===== + puppet resource [-h|--help] [-d|--debug] [-v|--verbose] [-e|--edit] + [-H|--host ] [-p|--param ] [-t|--types] + type + + +DESCRIPTION +=========== +This command provides simple facilities for converting current system +state into Puppet code, along with some ability to use Puppet to affect +the current state. + +By default, you must at least provide a type to list, which case puppet +resource will tell you everything it knows about all instances of that +type. You can optionally specify an instance name, and puppet resource +will only describe that single instance. + +You can also add '--edit' as an argument, and puppet resource will write +its output to a file, open that file in an editor, and then apply the +file as a Puppet transaction. You can easily use this to use Puppet to +make simple changes to a system. + + +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 with +'--genconfig'. + +debug: Enable full debugging. + +edit: + + Write the results of the query to a file, open the file in an editor, + and read the file back in as an executable Puppet manifest. + +host: + + When specified, connect to the resource server on the named host + and retrieve the list of resouces of the type specified. + +help: + + Print this help message. + +param: + + Add more parameters to be outputted from queries. + +types: + + List all available types. + +verbose: + + Print extra information. + + +EXAMPLE +======= +This example uses `puppet resource` to return Puppet configuration for +the user `luke`: + + $ puppet resource user luke + user { 'luke': + home => '/home/luke', + uid => '100', + ensure => 'present', + comment => 'Luke Kanies,,,', + gid => '1000', + shell => '/bin/bash', + groups => ['sysadmin','audio','video','puppet'] + } + + +AUTHOR +====== +Luke Kanies + + +COPYRIGHT +========= +Copyright (c) 2005-2007 Puppet Labs, LLC Licensed under the GNU Public +License + + HELP + end + def main args = command_line.args type = args.shift or raise "You must specify the type to display" diff --git a/lib/puppet/util/command_line/ralsh b/lib/puppet/util/command_line/ralsh deleted file mode 100755 index 5c1f719e2..000000000 --- a/lib/puppet/util/command_line/ralsh +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env ruby - -# -# = Synopsis -# -# Use the Puppet RAL to directly interact with the system. -# -# = Usage -# -# puppet resource [-h|--help] [-d|--debug] [-v|--verbose] [-e|--edit] -# [-H|--host ] [-p|--param ] [-t|--types] -# type -# -# = Description -# -# This command provides simple facilities for converting current system state -# into Puppet code, along with some ability to use Puppet to affect the current -# state. -# -# By default, you must at least provide a type to list, which case puppet resource -# will tell you everything it knows about all instances of that type. You can -# optionally specify an instance name, and puppet resource will only describe that single -# instance. -# -# You can also add +--edit+ as an argument, and puppet resource will write its output -# to a file, open that file in an editor, and then apply the file as a Puppet -# transaction. You can easily use this to use Puppet to make simple changes to -# a system. -# -# = 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 with -# '--genconfig'. -# -# debug:: -# Enable full debugging. -# -# edit: -# Write the results of the query to a file, open the file in an editor, -# and read the file back in as an executable Puppet manifest. -# -# host: -# When specified, connect to the resource server on the named host -# and retrieve the list of resouces of the type specified. -# -# help: -# Print this help message. -# -# param: -# Add more parameters to be outputted from queries. -# -# types: -# List all available types. -# -# verbose: -# Print extra information. -# -# = Example -# -# This example uses `puppet resource` to return Puppet configuration for the user `luke`: -# -# $ puppet resource user luke -# user { 'luke': -# home => '/home/luke', -# uid => '100', -# ensure => 'present', -# comment => 'Luke Kanies,,,', -# gid => '1000', -# shell => '/bin/bash', -# groups => ['sysadmin','audio','video','puppet'] -# } -# -# = Author -# -# Luke Kanies -# -# = Copyright -# -# Copyright (c) 2005-2007 Puppet Labs, LLC -# Licensed under the GNU Public License - -#Puppet::Application[:resource].run -- cgit From 1ad6470e3df59caf67c484ef4e43274314c0bc40 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Fri, 21 Jan 2011 23:32:40 -0800 Subject: Feature #2597 -- fix cycle relationship notification format. The SimpleGraph class was reporting duplicate data when printing cycles: Notify[c]Notify[c] => Notify[d] Notify[a]Notify[a] => Notify[b] This was caused by throwing the array representation of the edge into a string, rather than just the relationship data; we only care about the later, so now we only emit that later and have the correct text in the error. --- lib/puppet/simple_graph.rb | 8 +++++--- spec/unit/simple_graph_spec.rb | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index 9d7f218a6..29e46c9bd 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -109,7 +109,7 @@ class Puppet::SimpleGraph # each of its out-edges. while v = zeros.pop result << v - @out_from[v].each { |v2,es| + @out_from[v].each { |v2,es| degree[v2].delete(v) zeros << v2 if degree[v2].empty? } @@ -117,7 +117,9 @@ class Puppet::SimpleGraph # If we have any vertices left with non-zero in-degrees, then we've found a cycle. if cycles = degree.values.reject { |ns| ns.empty? } and cycles.length > 0 - message = cycles.collect { |edges| '('+edges.collect { |e| e.to_s }.join(", ")+')' }.join(", ") + message = cycles.collect { |edges| + '(' + edges.collect { |e| e[1].to_s }.join(", ") + ')' + }.join(", ") raise Puppet::Error, "Found dependency cycles in the following relationships: #{message}; try using the '--graph' option and open the '.dot' files in OmniGraffle or GraphViz" end @@ -141,7 +143,7 @@ class Puppet::SimpleGraph # each of its out-edges. while v = zeros.pop result << v - @out_from[v].each { |v2,es| + @out_from[v].each { |v2,es| zeros << v2 if (degree[v2] -= 1) == 0 } end diff --git a/spec/unit/simple_graph_spec.rb b/spec/unit/simple_graph_spec.rb index e49811ea7..0d1a3b4a7 100755 --- a/spec/unit/simple_graph_spec.rb +++ b/spec/unit/simple_graph_spec.rb @@ -303,6 +303,12 @@ describe Puppet::SimpleGraph do proc { @graph.topsort }.should_not raise_error end + it "should produce the correct relationship text" do + add_edges :a => :b, :b => :a + want = %r{following relationships: \(b => a\), \(a => b\)} + expect { @graph.topsort }.to raise_error(Puppet::Error, want) + end + # Our graph's add_edge method is smart enough not to add # duplicate edges, so we use the objects, which it doesn't # check. -- cgit From 403adb8af42cc79701b5ff47b377e7dc1e192a34 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Fri, 21 Jan 2011 23:53:56 -0800 Subject: Feature #2597 -- nicer reporting of relationships. Split out the reporting from a single line (often with literally hundreds or thousands of items) into a multi-line report. This is still nasty, but at least it is easier to use as input to other systems. This will also auto-join to a single line when sent to targets such as syslog that do not approve of newlines in messages; this preserves the utility of the message without needing to lose console utility. --- lib/puppet/simple_graph.rb | 6 ++++-- spec/unit/simple_graph_spec.rb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index 29e46c9bd..f9a665d3c 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -119,8 +119,10 @@ class Puppet::SimpleGraph if cycles = degree.values.reject { |ns| ns.empty? } and cycles.length > 0 message = cycles.collect { |edges| '(' + edges.collect { |e| e[1].to_s }.join(", ") + ')' - }.join(", ") - raise Puppet::Error, "Found dependency cycles in the following relationships: #{message}; try using the '--graph' option and open the '.dot' files in OmniGraffle or GraphViz" + }.join("\n") + raise Puppet::Error, "Found dependency cycles in the following relationships:\n" + + message + "\n" + + "Try the '--graph' option and opening the '.dot' file in OmniGraffle or GraphViz" end result diff --git a/spec/unit/simple_graph_spec.rb b/spec/unit/simple_graph_spec.rb index 0d1a3b4a7..58978f2ba 100755 --- a/spec/unit/simple_graph_spec.rb +++ b/spec/unit/simple_graph_spec.rb @@ -305,7 +305,7 @@ describe Puppet::SimpleGraph do it "should produce the correct relationship text" do add_edges :a => :b, :b => :a - want = %r{following relationships: \(b => a\), \(a => b\)} + want = %r{following relationships:\n\(b => a\)\n\(a => b\)} expect { @graph.topsort }.to raise_error(Puppet::Error, want) end -- cgit From 34a57b846319f2962f78b161cd80b15f491e1086 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Sat, 22 Jan 2011 21:41:52 -0800 Subject: Feature #2597 -- really find and report cycles. This implements Tarjan's algorithm for finding strongly connected components in a directed graph, and leverages that to find cycles. This allows us to report the minimum set of nodes in each cycle, as well as reporting each cycle discretely if there are multiple of them. While this can still produce overwhelming and/or unhelpful output, it represents a large step forward in delivering useful information when a cycle is detected. This presently reports the set of nodes that contain the cycle, in no particular order, rather than the set of edges connecting those nodes. Sadly, it also suffers a limitation: the implementation of Tarjan's algorithm used to find strongly connected components is recursive, so is limited by the maximum Ruby stack depth to dependency chains less than 1,000 nodes deep. While this is probably not a limit in practice, it is a nasty limitation, and other considerations (like Ruby stack consumption across versions) could trigger this much sooner than is desirable. --- lib/puppet/simple_graph.rb | 103 ++++++++++++++++++++++++++++------------- spec/unit/simple_graph_spec.rb | 51 +++++++++++++++++++- 2 files changed, 122 insertions(+), 32 deletions(-) diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index f9a665d3c..b90079329 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -1,9 +1,11 @@ -# Created by Luke A. Kanies on 2007-11-07. -# Copyright (c) 2007. All rights reserved. +# Created by Luke A. Kanies on 2007-11-07. +# Cycle detection and reporting by Daniel Pittman 2011-01-22 +# Copyright (c) 2007, 2010. All rights reserved. require 'puppet/external/dot' require 'puppet/relationship' require 'set' +require 'ostruct' # A hopefully-faster graph class to replace the use of GRATR. class Puppet::SimpleGraph @@ -92,40 +94,79 @@ class Puppet::SimpleGraph vertices end - # Provide a topological sort with cycle reporting - def topsort_with_cycles - degree = {} - zeros = [] - result = [] - - # Collect each of our vertices, with the number of in-edges each has. - vertices.each do |v| - edges = @in_to[v].dup - zeros << v if edges.empty? - degree[v] = edges + # This is a simple implementation of Tarjan's algorithm to find strongly + # connected components in the graph; this is a fairly ugly implementation, + # because I can't just decorate the vertices themselves. + # + # This method has an unhealthy relationship with the find_cycles_in_graph + # method below, which contains the knowledge of how the state object is + # maintained. + def tarjan(v, s) + s.index[v] = s.n + s.lowlink[v] = s.n + s.n = s.n + 1 + + s.s.push v + + @out_from[v].each do |edge| + to = edge[0] + + if ! s.index[to] then + tarjan(to, s) + s.lowlink[v] = [s.lowlink[v], s.lowlink[to]].min + elsif s.s.member? to then + # Performance note: the stack membership test *should* be done with a + # constant time check, but I was lazy and used something that is + # likely to be O(N) where N is the stack depth; this will bite us + # eventually, and should be improved before the change lands. + # + # OTOH, this is only invoked on a very cold path, when things have + # gone wrong anyhow, right now. I feel that getting the code out is + # worth more than that final performance boost. --daniel 2011-01-22 + s.lowlink[v] = [s.lowlink[v], s.index[to]].min + end end - # Iterate over each 0-degree vertex, decrementing the degree of - # each of its out-edges. - while v = zeros.pop - result << v - @out_from[v].each { |v2,es| - degree[v2].delete(v) - zeros << v2 if degree[v2].empty? - } + if s.lowlink[v] == s.index[v] then + # REVISIT: Surely there must be a nicer way to partition this around an + # index, but I don't know what it is. This works. :/ --daniel 2011-01-22 + # + # Performance note: this might also suffer an O(stack depth) performance + # hit, better replaced with something that is O(1) for splitting the + # stack into parts. + tmp = s.s.slice!(0, s.s.index(v)) + s.scc.push s.s + s.s = tmp end + end - # If we have any vertices left with non-zero in-degrees, then we've found a cycle. - if cycles = degree.values.reject { |ns| ns.empty? } and cycles.length > 0 - message = cycles.collect { |edges| - '(' + edges.collect { |e| e[1].to_s }.join(", ") + ')' - }.join("\n") - raise Puppet::Error, "Found dependency cycles in the following relationships:\n" + - message + "\n" + - "Try the '--graph' option and opening the '.dot' file in OmniGraffle or GraphViz" + # Find all cycles in the graph by detecting all the strongly connected + # components, then eliminating everything with a size of one as + # uninteresting - which it is, because it can't be a cycle. :) + # + # This has an unhealthy relationship with the 'tarjan' method above, which + # it uses to implement the detection of strongly connected components. + def find_cycles_in_graph + state = OpenStruct.new :n => 0, :index => {}, :lowlink => {}, :s => [], :scc => [] + + # we usually have a disconnected graph, must walk all possible roots + vertices.each do |vertex| + if ! state.index[vertex] then + tarjan vertex, state + end end - result + return state.scc.select { |c| c.length > 1 } + end + + def report_cycles_in_graph + cycles = find_cycles_in_graph + n = cycles.length # where is "pluralize"? --daniel 2011-01-22 + s = n == 1 ? '' : 's' + + raise Puppet::Error, "Found #{n} dependency cycle#{s}:\n" + + cycles.collect { |c| '(' + c.join(", ") + ')' }.join("\n") + "\n" + + "Try the '--graph' option and opening the '.dot' file in OmniGraffle or GraphViz" end # Provide a topological sort. @@ -152,7 +193,7 @@ class Puppet::SimpleGraph # If we have any vertices left with non-zero in-degrees, then we've found a cycle. if cycles = degree.values.reject { |ns| ns == 0 } and cycles.length > 0 - topsort_with_cycles + report_cycles_in_graph end result diff --git a/spec/unit/simple_graph_spec.rb b/spec/unit/simple_graph_spec.rb index 58978f2ba..a8e0c4434 100755 --- a/spec/unit/simple_graph_spec.rb +++ b/spec/unit/simple_graph_spec.rb @@ -305,10 +305,59 @@ describe Puppet::SimpleGraph do it "should produce the correct relationship text" do add_edges :a => :b, :b => :a - want = %r{following relationships:\n\(b => a\)\n\(a => b\)} + want = %r{Found 1 dependency cycle:\n\(a, b\)\nTry} expect { @graph.topsort }.to raise_error(Puppet::Error, want) end + it "cycle discovery should be the minimum cycle for a simple graph" do + add_edges "a" => "b" + add_edges "b" => "a" + add_edges "b" => "c" + + cycles = nil + expect { cycles = @graph.find_cycles_in_graph.sort }.should_not raise_error + cycles.should be == [["a", "b"]] + end + + it "cycle discovery should handle two distinct cycles" do + add_edges "a" => "a1", "a1" => "a" + add_edges "b" => "b1", "b1" => "b" + + cycles = nil + expect { cycles = @graph.find_cycles_in_graph.sort }.should_not raise_error + cycles.should be == [["a", "a1"], ["b", "b1"]] + end + + it "cycle discovery should handle two cycles in a connected graph" do + add_edges "a" => "b", "b" => "c", "c" => "d" + add_edges "a" => "a1", "a1" => "a" + add_edges "c" => "c1", "c1" => "c2", "c2" => "c3", "c3" => "c" + + cycles = nil + expect { cycles = @graph.find_cycles_in_graph.sort }.should_not raise_error + cycles.should be == [%w{a a1}, %w{c c1 c2 c3}] + end + + it "cycle discovery should handle a complicated cycle" do + add_edges "a" => "b", "b" => "c" + add_edges "a" => "c" + add_edges "c" => "c1", "c1" => "a" + add_edges "c" => "c2", "c2" => "b" + + cycles = nil + expect { cycles = @graph.find_cycles_in_graph.sort }.should_not raise_error + cycles.should be == [%w{a b c c1 c2}] + end + + it "cycle discovery should not fail with large data sets" do + limit = 1000 + (1..(limit - 1)).each do |n| add_edges n.to_s => (n+1).to_s end + + cycles = nil + expect { cycles = @graph.find_cycles_in_graph.sort }.should_not raise_error + cycles.should be == [] + end + # Our graph's add_edge method is smart enough not to add # duplicate edges, so we use the objects, which it doesn't # check. -- cgit From f547118462cac124dc826ad96d00574711f1d3cd Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Sun, 23 Jan 2011 00:05:11 -0800 Subject: Feature #2597 -- use iterative DFS in Tarjan clustering. In order to bypass the limitations of the C stack, which is also the Ruby stack, we replace the simple and clear recursive Trajan implementation with an iterative version that uses the heap as the stack. This is somewhat harder to read, but can now run a 10,000 vertex deep linear dependency relationship where, previously, 1,250 was about the limit on my machine. This should now be bounded by the size of the heap rather than the stack on all platforms -- though it would be nice to get rid of the magic and return to the recursive version if Ruby ever follows Perl down the sensible path of essentially unlimited recursion by writing that code for us in the interpreter... --- lib/puppet/simple_graph.rb | 94 ++++++++++++++++++++++++++---------------- spec/unit/simple_graph_spec.rb | 2 +- 2 files changed, 60 insertions(+), 36 deletions(-) diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index b90079329..064f6bebb 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -101,42 +101,66 @@ class Puppet::SimpleGraph # This method has an unhealthy relationship with the find_cycles_in_graph # method below, which contains the knowledge of how the state object is # maintained. - def tarjan(v, s) - s.index[v] = s.n - s.lowlink[v] = s.n - s.n = s.n + 1 - - s.s.push v - - @out_from[v].each do |edge| - to = edge[0] - - if ! s.index[to] then - tarjan(to, s) - s.lowlink[v] = [s.lowlink[v], s.lowlink[to]].min - elsif s.s.member? to then - # Performance note: the stack membership test *should* be done with a - # constant time check, but I was lazy and used something that is - # likely to be O(N) where N is the stack depth; this will bite us - # eventually, and should be improved before the change lands. - # - # OTOH, this is only invoked on a very cold path, when things have - # gone wrong anyhow, right now. I feel that getting the code out is - # worth more than that final performance boost. --daniel 2011-01-22 - s.lowlink[v] = [s.lowlink[v], s.index[to]].min - end - end + def tarjan(root, s) + # initialize the recursion stack we use to work around the nasty lack of a + # decent Ruby stack. + recur = [OpenStruct.new :node => root] + + while not recur.empty? do + frame = recur.last + v = frame.node + case frame.step + when nil then + s.index[v] = s.n + s.lowlink[v] = s.n + s.n = s.n + 1 + + s.s.push v + + frame.children = adjacent(v) + frame.step = :children + + when :children then + if frame.children.length > 0 then + child = frame.children.shift + if ! s.index[child] then + # Never seen, need to recurse. + frame.step = :after_recursion + frame.child = child + recur.push OpenStruct.new :node => child + elsif s.s.member? child then + # Performance note: the stack membership test *should* be done with a + # constant time check, but I was lazy and used something that is + # likely to be O(N) where N is the stack depth; this will bite us + # eventually, and should be improved before the change lands. + # + # OTOH, this is only invoked on a very cold path, when things have + # gone wrong anyhow, right now. I feel that getting the code out is + # worth more than that final performance boost. --daniel 2011-01-22 + s.lowlink[v] = [s.lowlink[v], s.index[child]].min + end + else + if s.lowlink[v] == s.index[v] then + # REVISIT: Surely there must be a nicer way to partition this around an + # index, but I don't know what it is. This works. :/ --daniel 2011-01-22 + # + # Performance note: this might also suffer an O(stack depth) performance + # hit, better replaced with something that is O(1) for splitting the + # stack into parts. + tmp = s.s.slice!(0, s.s.index(v)) + s.scc.push s.s + s.s = tmp + end + recur.pop # done with this node, finally. + end + + when :after_recursion then + s.lowlink[v] = [s.lowlink[v], s.lowlink[frame.child]].min + frame.step = :children - if s.lowlink[v] == s.index[v] then - # REVISIT: Surely there must be a nicer way to partition this around an - # index, but I don't know what it is. This works. :/ --daniel 2011-01-22 - # - # Performance note: this might also suffer an O(stack depth) performance - # hit, better replaced with something that is O(1) for splitting the - # stack into parts. - tmp = s.s.slice!(0, s.s.index(v)) - s.scc.push s.s - s.s = tmp + else + fail "#{frame.step} is an unknown step" + end end end diff --git a/spec/unit/simple_graph_spec.rb b/spec/unit/simple_graph_spec.rb index a8e0c4434..3b0fe9ace 100755 --- a/spec/unit/simple_graph_spec.rb +++ b/spec/unit/simple_graph_spec.rb @@ -350,7 +350,7 @@ describe Puppet::SimpleGraph do end it "cycle discovery should not fail with large data sets" do - limit = 1000 + limit = 3000 (1..(limit - 1)).each do |n| add_edges n.to_s => (n+1).to_s end cycles = nil -- cgit From e30fd8f3a4179551abbd11456d937eaa7f816545 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Sun, 23 Jan 2011 09:51:48 -0800 Subject: Feature #2597 -- remove obsolete licensing comment... The header at the top of the file is long obsolete; simple_graph.rb is licensed under the GPLv2 like the rest of puppet. Removed. --- lib/puppet/simple_graph.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index 064f6bebb..c91d87885 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -1,7 +1,3 @@ -# Created by Luke A. Kanies on 2007-11-07. -# Cycle detection and reporting by Daniel Pittman 2011-01-22 -# Copyright (c) 2007, 2010. All rights reserved. - require 'puppet/external/dot' require 'puppet/relationship' require 'set' -- cgit From 9ea74ccd8c875f0d222874746f6b904883faf1d1 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Sun, 23 Jan 2011 23:31:44 -0800 Subject: Feature #2597 -- report all paths in each cycle found. Rather than reporting the cluster of vertexes in the dependency graph, which is interesting but not entirely informative, we now calculate and report the paths through the graph that form cycles. This returns the most useful information, which is the exact path that the dependency cycle has, allowing the user to (hopefully) immediately target it and start to work out why the cycle has formed there. We strongly prefer short paths through the dependency graph within the cycle, which should report the most useful loops to target first; extended loops involving more items will show up later if they are independently created. We also limit the number of paths reported (default: 10) to avoid overwhelming the error report with the combinatorial explosion that can easily result from a large scale cycle. (eg: Package => User => Package or something.) --- lib/puppet/simple_graph.rb | 48 +++++++++++++++++++++++++++++++++++++++--- spec/unit/simple_graph_spec.rb | 48 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 92 insertions(+), 4 deletions(-) diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index c91d87885..d081b4cf3 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -179,14 +179,56 @@ class Puppet::SimpleGraph return state.scc.select { |c| c.length > 1 } end + # Perform a BFS on the sub graph representing the cycle, with a view to + # generating a sufficient set of paths to report the cycle meaningfully, and + # ideally usefully, for the end user. + # + # BFS is preferred because it will generally report the shortest paths + # through the graph first, which are more likely to be interesting to the + # user. I think; it would be interesting to verify that. --daniel 2011-01-23 + def all_paths_in_cycle(cycle, max_paths = 10) + raise ArgumentError, "negative or zero max_paths" if max_paths < 1 + + # Calculate our filtered outbound vertex lists... + adj = {} + cycle.each do |vertex| + adj[vertex] = adjacent(vertex).select{|s| cycle.member? s} + end + + found = [] + + stack = [OpenStruct.new :vertex => cycle.first, :path => []] + while frame = stack.shift do + if frame.path.member? frame.vertex then + found << frame.path + [frame.vertex] + + # REVISIT: This should be an O(1) test, but I have no idea if Ruby + # specifies Array#length to be O(1), O(n), or allows the implementer + # to pick either option. Should answer that. --daniel 2011-01-23 + break if found.length >= max_paths + else + adj[frame.vertex].each do |to| + stack.push OpenStruct.new :vertex => to, :path => frame.path + [frame.vertex] + end + end + end + + return found + end + def report_cycles_in_graph cycles = find_cycles_in_graph n = cycles.length # where is "pluralize"? --daniel 2011-01-22 s = n == 1 ? '' : 's' - raise Puppet::Error, "Found #{n} dependency cycle#{s}:\n" + - cycles.collect { |c| '(' + c.join(", ") + ')' }.join("\n") + "\n" + - "Try the '--graph' option and opening the '.dot' file in OmniGraffle or GraphViz" + message = "Found #{n} dependency cycle#{s}:\n" + cycles.each do |cycle| + paths = all_paths_in_cycle(cycle) + message += paths.map{ |path| '(' + path.join(" => ") + ')'}.join("\n") + "\n" + end + message += "Try the '--graph' option and opening the '.dot' file in OmniGraffle or GraphViz" + + raise Puppet::Error, message end # Provide a topological sort. diff --git a/spec/unit/simple_graph_spec.rb b/spec/unit/simple_graph_spec.rb index 3b0fe9ace..e7c875f50 100755 --- a/spec/unit/simple_graph_spec.rb +++ b/spec/unit/simple_graph_spec.rb @@ -305,7 +305,7 @@ describe Puppet::SimpleGraph do it "should produce the correct relationship text" do add_edges :a => :b, :b => :a - want = %r{Found 1 dependency cycle:\n\(a, b\)\nTry} + want = %r{Found 1 dependency cycle:\n\(a => b => a\)\nTry} expect { @graph.topsort }.to raise_error(Puppet::Error, want) end @@ -358,6 +358,52 @@ describe Puppet::SimpleGraph do cycles.should be == [] end + it "path finding should work with a simple cycle" do + add_edges "a" => "b", "b" => "c", "c" => "a" + + cycles = @graph.find_cycles_in_graph.sort + paths = @graph.all_paths_in_cycle(cycles.first) + paths.should be == [%w{a b c a}] + end + + it "path finding should work with two independent cycles" do + add_edges "a" => "b1" + add_edges "a" => "b2" + add_edges "b1" => "a", "b2" => "a" + + cycles = @graph.find_cycles_in_graph.sort + cycles.length.should be == 1 + + paths = @graph.all_paths_in_cycle(cycles.first) + paths.sort.should be == [%w{a b1 a}, %w{a b2 a}] + end + + it "path finding should prefer shorter paths in cycles" do + add_edges "a" => "b", "b" => "c", "c" => "a" + add_edges "b" => "a" + + cycles = @graph.find_cycles_in_graph.sort + cycles.length.should be == 1 + + paths = @graph.all_paths_in_cycle(cycles.first) + paths.should be == [%w{a b a}, %w{a b c a}] + end + + it "path finding should respect the max_path value" do + (1..20).each do |n| add_edges "a" => "b#{n}", "b#{n}" => "a" end + + cycles = @graph.find_cycles_in_graph.sort + cycles.length.should be == 1 + + (1..20).each do |n| + paths = @graph.all_paths_in_cycle(cycles.first, n) + paths.length.should be == n + end + + paths = @graph.all_paths_in_cycle(cycles.first, 21) + paths.length.should be == 20 + end + # Our graph's add_edge method is smart enough not to add # duplicate edges, so we use the objects, which it doesn't # check. -- cgit From d302628f9dc5a5406acabb272ba13ad1b1efe7ff Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Mon, 24 Jan 2011 21:40:49 -0800 Subject: Feature #2597 -- improve names and whitespace in the code. This renames a few cryptic variables to have more human-friendly names, and aligns a bit of whitespace; there are no functional changes in the code. --- lib/puppet/simple_graph.rb | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index d081b4cf3..793e598e0 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -104,17 +104,18 @@ class Puppet::SimpleGraph while not recur.empty? do frame = recur.last - v = frame.node + vertex = frame.node + case frame.step when nil then - s.index[v] = s.n - s.lowlink[v] = s.n - s.n = s.n + 1 + s.index[vertex] = s.number + s.lowlink[vertex] = s.number + s.number = s.number + 1 - s.s.push v + s.stack.push(vertex) - frame.children = adjacent(v) - frame.step = :children + frame.children = adjacent(vertex) + frame.step = :children when :children then if frame.children.length > 0 then @@ -124,7 +125,7 @@ class Puppet::SimpleGraph frame.step = :after_recursion frame.child = child recur.push OpenStruct.new :node => child - elsif s.s.member? child then + elsif s.stack.member? child then # Performance note: the stack membership test *should* be done with a # constant time check, but I was lazy and used something that is # likely to be O(N) where N is the stack depth; this will bite us @@ -133,25 +134,25 @@ class Puppet::SimpleGraph # OTOH, this is only invoked on a very cold path, when things have # gone wrong anyhow, right now. I feel that getting the code out is # worth more than that final performance boost. --daniel 2011-01-22 - s.lowlink[v] = [s.lowlink[v], s.index[child]].min + s.lowlink[vertex] = [s.lowlink[vertex], s.index[child]].min end else - if s.lowlink[v] == s.index[v] then + if s.lowlink[vertex] == s.index[vertex] then # REVISIT: Surely there must be a nicer way to partition this around an # index, but I don't know what it is. This works. :/ --daniel 2011-01-22 # # Performance note: this might also suffer an O(stack depth) performance # hit, better replaced with something that is O(1) for splitting the # stack into parts. - tmp = s.s.slice!(0, s.s.index(v)) - s.scc.push s.s - s.s = tmp + tmp = s.stack.slice!(0, s.stack.index(vertex)) + s.scc.push(s.stack) + s.stack = tmp end recur.pop # done with this node, finally. end when :after_recursion then - s.lowlink[v] = [s.lowlink[v], s.lowlink[frame.child]].min + s.lowlink[vertex] = [s.lowlink[vertex], s.lowlink[frame.child]].min frame.step = :children else @@ -167,7 +168,7 @@ class Puppet::SimpleGraph # This has an unhealthy relationship with the 'tarjan' method above, which # it uses to implement the detection of strongly connected components. def find_cycles_in_graph - state = OpenStruct.new :n => 0, :index => {}, :lowlink => {}, :s => [], :scc => [] + state = OpenStruct.new :number => 0, :index => {}, :lowlink => {}, :stack => [], :scc => [] # we usually have a disconnected graph, must walk all possible roots vertices.each do |vertex| -- cgit From 9584cda2a529cdcf06d766692f5749c775ad7d14 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Mon, 24 Jan 2011 21:56:18 -0800 Subject: Feature #2597 -- use O(1) methods as often as possible. This uses a separate hash and array to track the visited path and the seen vertex data; while that is less efficient than using a single data structure, it avoids on O(n) operation on the stack to determine if we have previously visited a vertex. --- lib/puppet/simple_graph.rb | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index 793e598e0..5833cf7ce 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -113,6 +113,7 @@ class Puppet::SimpleGraph s.number = s.number + 1 s.stack.push(vertex) + s.seen[vertex] = true frame.children = adjacent(vertex) frame.step = :children @@ -125,28 +126,29 @@ class Puppet::SimpleGraph frame.step = :after_recursion frame.child = child recur.push OpenStruct.new :node => child - elsif s.stack.member? child then - # Performance note: the stack membership test *should* be done with a - # constant time check, but I was lazy and used something that is - # likely to be O(N) where N is the stack depth; this will bite us - # eventually, and should be improved before the change lands. - # - # OTOH, this is only invoked on a very cold path, when things have - # gone wrong anyhow, right now. I feel that getting the code out is - # worth more than that final performance boost. --daniel 2011-01-22 + elsif s.seen[child] then s.lowlink[vertex] = [s.lowlink[vertex], s.index[child]].min end else if s.lowlink[vertex] == s.index[vertex] then - # REVISIT: Surely there must be a nicer way to partition this around an - # index, but I don't know what it is. This works. :/ --daniel 2011-01-22 + this_scc = [] + begin + top = s.stack.pop + s.seen[top] = false + this_scc << top + end until top == vertex + # NOTE: if we don't reverse we get the components in the opposite + # order to what a human being would expect; reverse should be an + # O(1) operation, without even copying, because we know the length + # of the source, but I worry that an implementation will get this + # wrong. Still, the worst case is O(n) for n vertices as we can't + # possibly put a vertex into two SCCs. # - # Performance note: this might also suffer an O(stack depth) performance - # hit, better replaced with something that is O(1) for splitting the - # stack into parts. - tmp = s.stack.slice!(0, s.stack.index(vertex)) - s.scc.push(s.stack) - s.stack = tmp + # Also, my feeling is that most implementations are going to do + # better with a reverse operation than a string of 'unshift' + # insertions at the head of the array; if they were going to mess + # up the performance of one, it would be unshift. + s.scc << this_scc.reverse end recur.pop # done with this node, finally. end @@ -168,7 +170,8 @@ class Puppet::SimpleGraph # This has an unhealthy relationship with the 'tarjan' method above, which # it uses to implement the detection of strongly connected components. def find_cycles_in_graph - state = OpenStruct.new :number => 0, :index => {}, :lowlink => {}, :stack => [], :scc => [] + state = OpenStruct.new :number => 0, :index => {}, :lowlink => {}, :scc => [], + :stack => [], :seen => {} # we usually have a disconnected graph, must walk all possible roots vertices.each do |vertex| @@ -177,7 +180,8 @@ class Puppet::SimpleGraph end end - return state.scc.select { |c| c.length > 1 } + result = state.scc.select { |c| c.length > 1 } + return result end # Perform a BFS on the sub graph representing the cycle, with a view to -- cgit From 2cf45283d7eea90461f1c9606af710bf5645076a Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Mon, 24 Jan 2011 22:23:41 -0800 Subject: Feature #2597 -- eliminate OpenStruct for performance... A bit of profiling shows that most of the time spent in clustering is spent trolling around through OpenStruct. Replacing this with a hash or, where sane, an array for the stack frame in our non-recursive implementations makes performance significantly faster. (3 seconds to .65 seconds faster.) I guess those developer niceties do have some cost after all. Better to take the hit on readability and prefer performance here. --- lib/puppet/simple_graph.rb | 77 ++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index 5833cf7ce..1b5ffdc52 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -1,7 +1,6 @@ require 'puppet/external/dot' require 'puppet/relationship' require 'set' -require 'ostruct' # A hopefully-faster graph class to replace the use of GRATR. class Puppet::SimpleGraph @@ -100,41 +99,41 @@ class Puppet::SimpleGraph def tarjan(root, s) # initialize the recursion stack we use to work around the nasty lack of a # decent Ruby stack. - recur = [OpenStruct.new :node => root] + recur = [{ :node => root }] while not recur.empty? do frame = recur.last - vertex = frame.node + vertex = frame[:node] - case frame.step + case frame[:step] when nil then - s.index[vertex] = s.number - s.lowlink[vertex] = s.number - s.number = s.number + 1 + s[:index][vertex] = s[:number] + s[:lowlink][vertex] = s[:number] + s[:number] = s[:number] + 1 - s.stack.push(vertex) - s.seen[vertex] = true + s[:stack].push(vertex) + s[:seen][vertex] = true - frame.children = adjacent(vertex) - frame.step = :children + frame[:children] = adjacent(vertex) + frame[:step] = :children when :children then - if frame.children.length > 0 then - child = frame.children.shift - if ! s.index[child] then + if frame[:children].length > 0 then + child = frame[:children].shift + if ! s[:index][child] then # Never seen, need to recurse. - frame.step = :after_recursion - frame.child = child - recur.push OpenStruct.new :node => child - elsif s.seen[child] then - s.lowlink[vertex] = [s.lowlink[vertex], s.index[child]].min + frame[:step] = :after_recursion + frame[:child] = child + recur.push({ :node => child }) + elsif s[:seen][child] then + s[:lowlink][vertex] = [s[:lowlink][vertex], s[:index][child]].min end else - if s.lowlink[vertex] == s.index[vertex] then + if s[:lowlink][vertex] == s[:index][vertex] then this_scc = [] begin - top = s.stack.pop - s.seen[top] = false + top = s[:stack].pop + s[:seen][top] = false this_scc << top end until top == vertex # NOTE: if we don't reverse we get the components in the opposite @@ -148,17 +147,17 @@ class Puppet::SimpleGraph # better with a reverse operation than a string of 'unshift' # insertions at the head of the array; if they were going to mess # up the performance of one, it would be unshift. - s.scc << this_scc.reverse + s[:scc] << this_scc.reverse end recur.pop # done with this node, finally. end when :after_recursion then - s.lowlink[vertex] = [s.lowlink[vertex], s.lowlink[frame.child]].min - frame.step = :children + s[:lowlink][vertex] = [s[:lowlink][vertex], s[:lowlink][frame[:child]]].min + frame[:step] = :children else - fail "#{frame.step} is an unknown step" + fail "#{frame[:step]} is an unknown step" end end end @@ -170,18 +169,19 @@ class Puppet::SimpleGraph # This has an unhealthy relationship with the 'tarjan' method above, which # it uses to implement the detection of strongly connected components. def find_cycles_in_graph - state = OpenStruct.new :number => 0, :index => {}, :lowlink => {}, :scc => [], - :stack => [], :seen => {} + state = { + :number => 0, :index => {}, :lowlink => {}, :scc => [], + :stack => [], :seen => {} + } # we usually have a disconnected graph, must walk all possible roots vertices.each do |vertex| - if ! state.index[vertex] then + if ! state[:index][vertex] then tarjan vertex, state end end - result = state.scc.select { |c| c.length > 1 } - return result + state[:scc].select { |c| c.length > 1 } end # Perform a BFS on the sub graph representing the cycle, with a view to @@ -202,18 +202,15 @@ class Puppet::SimpleGraph found = [] - stack = [OpenStruct.new :vertex => cycle.first, :path => []] + # frame struct is vertex, [path] + stack = [[cycle.first, []]] while frame = stack.shift do - if frame.path.member? frame.vertex then - found << frame.path + [frame.vertex] - - # REVISIT: This should be an O(1) test, but I have no idea if Ruby - # specifies Array#length to be O(1), O(n), or allows the implementer - # to pick either option. Should answer that. --daniel 2011-01-23 + if frame[1].member?(frame[0]) then + found << frame[1] + [frame[0]] break if found.length >= max_paths else - adj[frame.vertex].each do |to| - stack.push OpenStruct.new :vertex => to, :path => frame.path + [frame.vertex] + adj[frame[0]].each do |to| + stack.push [to, frame[1] + [frame[0]]] end end end -- cgit From adc9244ecf4bfb59a98a2dd5472b03f685b6303e Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 27 Jan 2011 00:02:52 -0800 Subject: Feature #2597 -- generate a DOT graph of cycles on request. When the '--graph' option is specified, generate a new 'cycles.dot' file and report the location of that to the user. This contains only the cycles, in dot format, allowing a visual representation of the cycle to be obtained quickly. This will include up to 10 paths through the cycle in the graph, and only one in the display to the user, to reduce information overload. --- lib/puppet/simple_graph.rb | 35 ++++++++++++++++++++++++++++++++--- spec/unit/simple_graph_spec.rb | 10 +++++----- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index 1b5ffdc52..e39aa8770 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -191,7 +191,7 @@ class Puppet::SimpleGraph # BFS is preferred because it will generally report the shortest paths # through the graph first, which are more likely to be interesting to the # user. I think; it would be interesting to verify that. --daniel 2011-01-23 - def all_paths_in_cycle(cycle, max_paths = 10) + def paths_in_cycle(cycle, max_paths = 1) raise ArgumentError, "negative or zero max_paths" if max_paths < 1 # Calculate our filtered outbound vertex lists... @@ -225,14 +225,43 @@ class Puppet::SimpleGraph message = "Found #{n} dependency cycle#{s}:\n" cycles.each do |cycle| - paths = all_paths_in_cycle(cycle) + paths = paths_in_cycle(cycle) message += paths.map{ |path| '(' + path.join(" => ") + ')'}.join("\n") + "\n" end - message += "Try the '--graph' option and opening the '.dot' file in OmniGraffle or GraphViz" + + if Puppet[:graph] then + filename = write_cycles_to_graph(cycles) + message += "Cycle graph written to #{filename}." + else + message += "Try the '--graph' option and opening the " + message += "resulting '.dot' file in OmniGraffle or GraphViz" + end raise Puppet::Error, message end + def write_cycles_to_graph(cycles) + # This does not use the DOT graph library, just writes the content + # directly. Given the complexity of this, there didn't seem much point + # using a heavy library to generate exactly the same content. --daniel 2011-01-27 + Puppet.settings.use(:graphing) + + graph = ["digraph Resource_Cycles {"] + graph << ' label = "Resource Cycles"' + + cycles.each do |cycle| + paths_in_cycle(cycle, 10).each do |path| + graph << path.map { |v| '"' + v.to_s.gsub(/"/, '\\"') + '"' }.join(" -> ") + end + end + + graph << '}' + + filename = File.join(Puppet[:graphdir], "cycles.dot") + File.open(filename, "w") { |f| f.puts graph } + return filename + end + # Provide a topological sort. def topsort degree = {} diff --git a/spec/unit/simple_graph_spec.rb b/spec/unit/simple_graph_spec.rb index e7c875f50..2c6af063b 100755 --- a/spec/unit/simple_graph_spec.rb +++ b/spec/unit/simple_graph_spec.rb @@ -362,7 +362,7 @@ describe Puppet::SimpleGraph do add_edges "a" => "b", "b" => "c", "c" => "a" cycles = @graph.find_cycles_in_graph.sort - paths = @graph.all_paths_in_cycle(cycles.first) + paths = @graph.paths_in_cycle(cycles.first, 100) paths.should be == [%w{a b c a}] end @@ -374,7 +374,7 @@ describe Puppet::SimpleGraph do cycles = @graph.find_cycles_in_graph.sort cycles.length.should be == 1 - paths = @graph.all_paths_in_cycle(cycles.first) + paths = @graph.paths_in_cycle(cycles.first, 100) paths.sort.should be == [%w{a b1 a}, %w{a b2 a}] end @@ -385,7 +385,7 @@ describe Puppet::SimpleGraph do cycles = @graph.find_cycles_in_graph.sort cycles.length.should be == 1 - paths = @graph.all_paths_in_cycle(cycles.first) + paths = @graph.paths_in_cycle(cycles.first, 100) paths.should be == [%w{a b a}, %w{a b c a}] end @@ -396,11 +396,11 @@ describe Puppet::SimpleGraph do cycles.length.should be == 1 (1..20).each do |n| - paths = @graph.all_paths_in_cycle(cycles.first, n) + paths = @graph.paths_in_cycle(cycles.first, n) paths.length.should be == n end - paths = @graph.all_paths_in_cycle(cycles.first, 21) + paths = @graph.paths_in_cycle(cycles.first, 21) paths.length.should be == 20 end -- cgit From 70a43c4b0d3018a39e29c50b1caf7dec38694323 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Thu, 3 Feb 2011 18:44:13 -0800 Subject: Updated CHANGELOG and version for 2.6.5rc1 --- CHANGELOG | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/puppet.rb | 2 +- 2 files changed, 128 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index c3135031b..cd503a1c3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,130 @@ +2.6.5rc1 +======== +f9e2e2b Augmentation of tests for prior commit +392504a Fix to fix for #5755 -- backref serialization issues in zaml +a732a15 Fixed #5564 - Added some more fqdn_rand documentation +f279f2c Fixed #4968 - Updated list of options turned on by --test in documentation +ce5a2bf (#5061) - allow special hostclass/define variables to be evaluated as defaults. +fd73874 (#6107) Fix an error when auditing a file with empty content +530496b Remove already initialized constant warning from file_spec.rb tests +76788f8 (#5566) Treat source only File checksums as syntax errors when used with content +d657292 Rename variable used in File type validation to be more clear +3398139 Remove invalid "timestamp" and "time", and add missing "ctime" File checksum types. +6c93eb2 Remove order dependency when specifying source and checksum on File type +3a125d4 Bug #5755 -- ZAML generates extra newline in some hash backreferences. +50c12e5 bug #5681 -- code fix to handle AIX mount output +139760b Bug #5681 -- parse AIX mount command output. +2f74d83 Spec for #5681 to allow parsing of AIX mount output in mount provider +878f266 Fixed #6091 - Changed POSIX path matching to allow multiple leading slashes +eb97aa5 Bug #6091 -- test leading double-slash in filenames are allowed. +1bfc9a0 Fixed #6071 - Fixed typo and improved exec path error message +c50a48e Fixed #6061 - Allowed -1 as password min/max age +bf44e72 Bug #6061 -- verify that negative {min,max}_password_age are accepted. +af1c1fe Feature #5855 -- fix withenv call in freebsd package provider +d871641 Feature #5855 -- undefined method 'withenv' in FreeBSD package provider. +f1ab588 Fixed #6009 - nested member list vs directory service group provider +86a2a00 (#5944) Remove documentation of define() when used on nodes, as it is not a supported use of this function. +2b9f653 (#5944) Further edits of inline defined() documentation. +5d108e8 (#5944) Improve documentation of defined() function +7d38ab2 (#5594) Update documentation of exec resource type. +67e1bba (#5931) Prevent errors when calling insync? on audited properties +0f9d236 Maint: Removed dead code from resource harness. +0765afb Maint: Rename misleading insync? method in file provider +0084b08 (#5548) Specify return values of manual status commands in service type description. +dd332f6 Fixed #6002 - Added note about function execution +3cfbd07 (#5045) Cleaning up some tests and code +a2036ea (#5045) External node classifiers should be able to specify params for classes +18ca97b (#5045) Adds support to resource/type to also accept a param hash +70630b9 Fix #3165 Ralsh (bin/puppet resource) can't manage files +1fd3600 Fixed #3646 - Added documentation for compile and apply to man page +ae48634 Fixed #5914 Removed genconfig = true from genconfig output +7e7f342 Fixed #1657 - Added note about target file +069f29b Fixed #2096 - clarified option modification and tested it is working +66b442b Fixes #5916 - Cleanup of unused doc methods and documentation +9b74968 Modified rubydoc in lib/puppet/util/command_line/puppetca to fix inaccurate description of --clean. +e58f5dc Fixed #5742 - Removed legacy fqdn option from documentation +4d1b51f Fixed #5167 - misleading documentation in the defaults of [main] +c1b5c7f (#5913) Fix Puppet::Application.find constant lookup behavior +f9bfb96 (#5900) Include ResourceStatus#failed in serialized reports +79b6332 (#5882) Added error-handling for bucketing files in puppet inspect +17843d5 (#5882) Added error-handling to puppet inspect when auditing +1a6fab2 (#5171) Made "puppet inspect" upload audited files to a file bucket +a7cd185 Prep for #5171: Added a missing require to inspect application. +71ac9cf Locked Puppet license to GPLv2 +abc6256 (#5838) Support paths as part of file bucket requests. +002f9f1 (#5838) Improve the quality of file bucket specs. +94d7179 (#5838) Make file bucket dipper efficient when saving a file that already exists +89f5692 (#5838) Implemented the "head" method for FileBucketFile::File terminus. +9cfd3d5 (#5838) Reworked file dipper spec to perform less stubbing. +c514c64 (#5838) Added support for HEAD requests to the indirector. +2b9b7a5 (#5838) Refactored error handling logic into find_in_cache. +08561b2 (#5838) Refactored Puppet::Network::Rights#fail_on_deny +87c5c30 (#5910) Improved logging when declared classes cannot be found: +4efc98a maint: Remove unused Rakefile in spec directory +a002231 (#5171) Made filebucket able to perform diffs +8f314f2 (#5710) Removed unnecessary calls to insync? +e270086 Prep for fixing #5710: Refactor stub provider in resource harness spec +c57a677 Maint: test partial resource failure +8aa8b9d (#5799) Simplify report dir creation +2d88844 maint: Add vim swap files to .gitignore +3d3baec maint: Remove rspec options from the Rakefile +df65304 maint: Inspect reports should have audited = true on events +4c9eca1 Maint: Added "skipped" to the YAML output for Puppet::Resource::Status +717670f (#5771): Fix spec failures associated with rspec upgrade +52760a4 (#5771) Upgrade rspec to version 2 +7603b05 maint: remove stray debug statement. +7661ba8 maint: Prune #inspect methods on various objects +80bfb54 (#5758) Verify that report events are correctly created +de85f8d Prep work for #5758: set audited=true on all audit events +e162da9 Prep work for #5758: clean up initializer for Puppet::Transaction::Event +06a8d1e Fix #5698 puppet inspect shouldn't report of attributes of deleted files +1f72c31 (#5715) Added attributes resource_type and title to Puppet::Resource::Status. +a6cd736 (#5715) Removed attribute source_description from the YAML representation of Puppet::Resource::Status. +98db2da (#5715) Removed unnecessary attributes from YAML of Puppet::Transaction::Event. +bd4a8a1 (#5715) Make certain report attributes always present. +716ee1c (#5715) Changed the type of metric names to always be strings. +037eac4 (#5715) Add status attribute to reports. +e4a2e04 (#5715) Made the report "calculate" methods strictly functional. +71db5be (#5715) Made the changes/total and events/total metrics always present +a4e40f4 (#5715) Refactor in preparation for adding a status attribute to reports. +15dda94 (#5715) Added total time to inspect reports and made inspect metrics more consistent. +d1bcdec (#5715) Removed Puppet::Transaction::Report#external_times from YAML output. +1550bbb (#5715) Added total time metric to apply reports. +4cc42cd (#5715) Removed redundant attribute Transaction::Event#version +1907650 (#5715) Removed redundant attribute Resource::Status#version +e596a57 (#5715) Removed Puppet::Util::Log#version. +908e0e0 (#5715) Removed the unused attribute Puppet::Transaction::Event#node +0e39ec5 (#5715) Removed Resource::Status#skipped_reason. It was never used. +b765f0e (#5715) Prep work: Fixed add_statuses in report_spec. +8631709 (#5723) Fix failing type/package specs +76fe2b3 Implement #5168 and #5169 ctime and mtime are properties +d11ae78 [3782] Test isolation problem in test/ral/providers/cron/crontab.rb +4d3030c Modified the behavior of Puppet::Resource::Status as follows: +7fff780 (#5408) Reworked ResourceHarness so that code is clearer and all behaviors are tested +d516f63 (#5493) Add report_format, puppet_version, and configuration_version to Reports +093c45f (#5375) Rework puppet apply to use configurer.run +e99a3ea Fix #5566 none, mtime, and ctime checksum types can write file contents +d74e8e1 maint: Fix ActiveRecord confine issue +6daeb16 maint: Fix a test that was missing a require +5db696b maint: Fix tests that don't run on their own +7f4e058 (#4487) Fix environment column in hosts table +3ac50fa maint: restore plugin handler safety +f38c36c (#5408) Attributes can be both audited and managed +54a1025 maint: missing stub +1d3192e maint: missing stub +1aa8157 maint: missing line and filename stubs +5e5ee97 maint: Fully stub partially stubbed test. +3d7c8d0 maint: remove Puppet.settings stubs +52fba89 maint: test was expecting Catalog.find too few times +8c134b6 maint: broken test not failing due to over-eager exception catching +3e59277 Fix #1757 Change file mode representation to octal +84bf02e Bug #5423: This moves the home directory property before the uid property, thus minimizing room for damage when usermod is in use. +1131ad7 (#4943) Add puppet inspect application +e005cc7 maint: Remove bogus mongrel test +c908fdb (#5261) Fix #5261 Don't escape Unicode characters in PSON +b27e9b4 [#5081] Revert "Fix #4349 - Parsing with ignoreimport=true was always loading site.pp" +af6e08c (#5304) Use internal_name rather than real_name for maillist provider + 2.6.4 ===== 76890a5 Revert "(#5304) Use internal_name rather than real_name for maillist provider" diff --git a/lib/puppet.rb b/lib/puppet.rb index a58d3c801..5c3e7f18b 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -24,7 +24,7 @@ require 'puppet/util/run_mode' # it's also a place to find top-level commands like 'debug' module Puppet - PUPPETVERSION = '2.6.4' + PUPPETVERSION = '2.6.5' def Puppet.version PUPPETVERSION -- cgit From 1f89906fcb87690a688b4d7facf6af0e4c554d6d Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Tue, 8 Feb 2011 12:02:06 -0800 Subject: (#6257) Speed up PUT and POST requests under rack This patch significantly speeds up reading the body of HTTP requests from Rack. Reviewed-by: Markus Roberts --- lib/puppet/network/http/rack/rest.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/puppet/network/http/rack/rest.rb b/lib/puppet/network/http/rack/rest.rb index b7e1d9709..602927a78 100644 --- a/lib/puppet/network/http/rack/rest.rb +++ b/lib/puppet/network/http/rack/rest.rb @@ -76,9 +76,7 @@ class Puppet::Network::HTTP::RackREST < Puppet::Network::HTTP::RackHttpHandler # request.body has some limitiations, so we need to concat it back # into a regular string, which is something puppet can use. def body(request) - body = '' - request.body.each { |part| body += part } - body + request.body.read end def extract_client_info(request) -- cgit From c08fc1bd31431012f20d2e2033debc2c409bb620 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Tue, 8 Feb 2011 12:28:55 -0800 Subject: Updated CHANGELOG for 2.6.5rc2 --- CHANGELOG | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index cd503a1c3..feba175cc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +2.6.5rc2 +======== +1f89906 (#6257) Speed up PUT and POST requests under rack +7b3b56e (5977) Puppet::Applications can be loaded from multiple paths. + 2.6.5rc1 ======== f9e2e2b Augmentation of tests for prior commit -- cgit From e9ee621e1f32a984ca4b18e814e7f3549612dcc5 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Thu, 3 Feb 2011 11:12:44 -0800 Subject: (6130) Change header level on metaparameter reference Individual metaparameters under the main H2 on the page should be H3s, not H4s. --- lib/puppet/reference/metaparameter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/reference/metaparameter.rb b/lib/puppet/reference/metaparameter.rb index c16a1d33a..3c4c08701 100644 --- a/lib/puppet/reference/metaparameter.rb +++ b/lib/puppet/reference/metaparameter.rb @@ -29,7 +29,7 @@ in your manifest, including defined components. params.sort { |a,b| a.to_s <=> b.to_s }.each { |param| - str += paramwrap(param.to_s, scrub(Puppet::Type.metaparamdoc(param)), :level => 4) + str += paramwrap(param.to_s, scrub(Puppet::Type.metaparamdoc(param)), :level => 3) } rescue => detail puts detail.backtrace -- cgit From 637e139556d7a0fa37d9e7626cfedb23430177d6 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 9 Feb 2011 10:12:48 -0800 Subject: (#6270) Fix formatting in regsubst function's doc string * Fixed ULs being interpreted as code blocks * Changed an example for variety. * Turned set of paragraphs inside a LI into a nested list. --- lib/puppet/parser/functions/regsubst.rb | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/lib/puppet/parser/functions/regsubst.rb b/lib/puppet/parser/functions/regsubst.rb index f655db7b3..b6bb5afcf 100644 --- a/lib/puppet/parser/functions/regsubst.rb +++ b/lib/puppet/parser/functions/regsubst.rb @@ -4,25 +4,18 @@ module Puppet::Parser::Functions :regsubst, :type => :rvalue, :doc => " - Perform regexp replacement on a string or array of strings. +Perform regexp replacement on a string or array of strings. * *Parameters* (in order): - - _target_ The string or array of strings to operate on. If an array, the replacement will be performed on each of the elements in the array, and the return value will be an array. - - _regexp_ The regular expression matching the target string. If you want it anchored at the start and or end of the string, you must do that with ^ and $ yourself. - - _replacement_ Replacement string. Can contain back references to what was matched using \\0, \\1, and so on. - - _flags_ Optional. String of single letter flags for how the regexp is interpreted: - + * _target_ The string or array of strings to operate on. If an array, the replacement will be performed on each of the elements in the array, and the return value will be an array. + * _regexp_ The regular expression matching the target string. If you want it anchored at the start and or end of the string, you must do that with ^ and $ yourself. + * _replacement_ Replacement string. Can contain backreferences to what was matched using \\0 (whole match), \\1 (first set of parentheses), and so on. + * _flags_ Optional. String of single letter flags for how the regexp is interpreted: - *E* Extended regexps - *I* Ignore case in regexps - *M* Multiline regexps - *G* Global replacement; all occurrences of the regexp in each target string will be replaced. Without this, only the first occurrence will be replaced. - - _lang_ Optional. How to handle multibyte characters. A single-character string with the following values: - + * _encoding_ Optional. How to handle multibyte characters. A single-character string with the following values: - *N* None - *E* EUC - *S* SJIS @@ -32,7 +25,7 @@ module Puppet::Parser::Functions Get the third octet from the node's IP address: - $i3 = regsubst($ipaddress,'^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)$','\\3') + $i3 = regsubst($ipaddress,'^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$','\\3') Put angle brackets around each octet in the node's IP address: -- cgit From 0b7faa6c95dbb734019a6e659b838ef24103571a Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 9 Feb 2011 10:41:32 -0800 Subject: (#6270) Fix formatting in split function's doc string * Repaired a 2-indent/4-indent issue that kept a code block from being recognized * Wrapped literal strings in backticks to format as code and protect from Markdown * Added note about backslashes for escaping metacharacters. --- lib/puppet/parser/functions/split.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/puppet/parser/functions/split.rb b/lib/puppet/parser/functions/split.rb index 52394095a..ad027865b 100644 --- a/lib/puppet/parser/functions/split.rb +++ b/lib/puppet/parser/functions/split.rb @@ -6,21 +6,21 @@ module Puppet::Parser::Functions :doc => "\ Split a string variable into an array using the specified split regexp. - Usage: +*Example:* $string = 'v1.v2:v3.v4' $array_var1 = split($string, ':') $array_var2 = split($string, '[.]') $array_var3 = split($string, '[.:]') -$array_var1 now holds the result ['v1.v2', 'v3.v4'], -while $array_var2 holds ['v1', 'v2:v3', 'v4'], and -$array_var3 holds ['v1', 'v2', 'v3', 'v4']. +`$array_var1` now holds the result `['v1.v2', 'v3.v4']`, +while `$array_var2` holds `['v1', 'v2:v3', 'v4']`, and +`$array_var3` holds `['v1', 'v2', 'v3', 'v4']`. -Note that in the second example, we split on a string that contains -a regexp meta-character (.), and that needs protection. A simple +Note that in the second example, we split on a literal string that contains +a regexp meta-character (.), which must be escaped. A simple way to do that for a single character is to enclose it in square -brackets.") do |args| +brackets; a backslash will also escape a single character.") do |args| raise Puppet::ParseError, ("split(): wrong number of arguments (#{args.length}; must be 2)") if args.length != 2 -- cgit From 48bc7d00ca87fa92cdde0b993529bba3827fa47e Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Fri, 11 Feb 2011 20:18:14 +0100 Subject: Fix #6280 - puppetdoc crashing on string interpolation The following manifest was crashing puppetdoc: class test { include "test::$operatingsystem" } Because the quoted string is "rendered" as a concat AST, which in turn ended being an array when entering RDoc. Signed-off-by: Brice Figureau --- lib/puppet/parser/ast/leaf.rb | 2 +- lib/puppet/util/rdoc/parser.rb | 4 ++-- spec/unit/util/rdoc/parser_spec.rb | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb index fcdd219d7..77617e992 100644 --- a/lib/puppet/parser/ast/leaf.rb +++ b/lib/puppet/parser/ast/leaf.rb @@ -67,7 +67,7 @@ class Puppet::Parser::AST end def to_s - "concat(#{@value.join(',')})" + "#{@value.map { |s| s.to_s.gsub(/^"(.*)"$/, '\1') }.join}" end end diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb index f9becede1..f59af64f9 100644 --- a/lib/puppet/util/rdoc/parser.rb +++ b/lib/puppet/util/rdoc/parser.rb @@ -157,8 +157,8 @@ class Parser if stmt.is_a?(Puppet::Parser::AST::Function) and ['include','require'].include?(stmt.name) stmt.arguments.each do |included| - Puppet.debug "found #{stmt.name}: #{included.value}" - container.send("add_#{stmt.name}",Include.new(included.value, stmt.doc)) + Puppet.debug "found #{stmt.name}: #{included}" + container.send("add_#{stmt.name}",Include.new(included.to_s, stmt.doc)) end end end diff --git a/spec/unit/util/rdoc/parser_spec.rb b/spec/unit/util/rdoc/parser_spec.rb index 28c33c295..3295e9031 100755 --- a/spec/unit/util/rdoc/parser_spec.rb +++ b/spec/unit/util/rdoc/parser_spec.rb @@ -339,7 +339,7 @@ describe RDoc::Parser do describe "when scanning for includes and requires" do def create_stmt(name) - stmt_value = stub "#{name}_value", :value => "myclass" + stmt_value = stub "#{name}_value", :to_s => "myclass" Puppet::Parser::AST::Function.new( :name => name, @@ -357,13 +357,13 @@ describe RDoc::Parser do it "should also scan mono-instruction code" do @class.expects(:add_include).with { |i| i.is_a?(RDoc::Include) and i.name == "myclass" and i.comment == "mydoc" } - @parser.scan_for_include_or_require(@class,create_stmt("include")) + @parser.scan_for_include_or_require(@class, create_stmt("include")) end it "should register recursively includes to the current container" do @code.stubs(:children).returns([ create_stmt("include") ]) - @class.expects(:add_include).with { |i| i.is_a?(RDoc::Include) and i.name == "myclass" and i.comment == "mydoc" } + @class.expects(:add_include)#.with { |i| i.is_a?(RDoc::Include) and i.name == "myclass" and i.comment == "mydoc" } @parser.scan_for_include_or_require(@class, [@code]) end -- cgit From cfa0c32fc5149464af97235a7bb458950d19cc82 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Fri, 11 Feb 2011 20:34:22 +0100 Subject: Fix #6281 - Make sure puppetdoc analyzes all files It can happen that when parsing a file puppet parses other manifests if they get imported (this is at least true for site.pp, even in ignoreimport=true). Thus those files are now "watched". But puppetdoc needs to analyze all files, and since 99c101 we are now checking if the file was already parsed to not reparse it again. If that was the case, though, we weren't analyzing the produced code. Thus it was possible to not produce documentation for the site.pp content. Signed-off-by: Brice Figureau --- lib/puppet/util/rdoc/parser.rb | 4 +++- spec/unit/util/rdoc/parser_spec.rb | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb index f59af64f9..ea7439ad7 100644 --- a/lib/puppet/util/rdoc/parser.rb +++ b/lib/puppet/util/rdoc/parser.rb @@ -41,8 +41,10 @@ class Parser @parser.file = @input_file_name @ast = @parser.parse end - scan_top_level(@top_level) + else + @ast = env.known_resource_types end + scan_top_level(@top_level) @top_level end diff --git a/spec/unit/util/rdoc/parser_spec.rb b/spec/unit/util/rdoc/parser_spec.rb index 3295e9031..b4453ae86 100755 --- a/spec/unit/util/rdoc/parser_spec.rb +++ b/spec/unit/util/rdoc/parser_spec.rb @@ -43,6 +43,18 @@ describe RDoc::Parser do @parser.scan.should be_a(RDoc::PuppetTopLevel) end + + it "should scan the top level even if the file has already parsed" do + known_type = stub 'known_types' + env = stub 'env' + Puppet::Node::Environment.stubs(:new).returns(env) + env.stubs(:known_resource_types).returns(known_type) + known_type.expects(:watching_file?).with("module/manifests/init.pp").returns(true) + + @parser.expects(:scan_top_level) + + @parser.scan + end end describe "when scanning top level entities" do -- cgit From b4a171e78c501208798220910352943331ceb9e0 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Fri, 11 Feb 2011 22:46:15 +0100 Subject: Fix #5720 - puppetdoc misses some class comments It appears that the fix for #5252 wasn't complete, and class, nodes and definition were still using the current lexer line number instead of the line number of the class/define/node token. This combined with some missing comments stack pushing/pop on parenthesis prevented puppetdoc to correctly get the documentation of some class (including parametrized ones). Signed-off-by: Brice Figureau --- lib/puppet/parser/lexer.rb | 5 ++++- lib/puppet/parser/parser_support.rb | 6 +++--- spec/unit/parser/lexer_spec.rb | 16 ++++++++++++++++ spec/unit/parser/parser_spec.rb | 27 +++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb index 31d39ae2f..9a25263f6 100644 --- a/lib/puppet/parser/lexer.rb +++ b/lib/puppet/parser/lexer.rb @@ -476,9 +476,12 @@ class Puppet::Parser::Lexer @expected.pop end - if final_token.name == :LBRACE + if final_token.name == :LBRACE or final_token.name == :LPAREN commentpush end + if final_token.name == :RPAREN + commentpop + end yield [final_token.name, token_value] diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb index 7bbebb124..7a0aa2601 100644 --- a/lib/puppet/parser/parser_support.rb +++ b/lib/puppet/parser/parser_support.rb @@ -135,19 +135,19 @@ class Puppet::Parser::Parser # Create a new class, or merge with an existing class. def newclass(name, options = {}) - known_resource_types.add Puppet::Resource::Type.new(:hostclass, name, ast_context(true).merge(options)) + known_resource_types.add Puppet::Resource::Type.new(:hostclass, name, ast_context(true, options[:line]).merge(options)) end # Create a new definition. def newdefine(name, options = {}) - known_resource_types.add Puppet::Resource::Type.new(:definition, name, ast_context(true).merge(options)) + known_resource_types.add Puppet::Resource::Type.new(:definition, name, ast_context(true, options[:line]).merge(options)) end # Create a new node. Nodes are special, because they're stored in a global # table, not according to namespaces. def newnode(names, options = {}) names = [names] unless names.instance_of?(Array) - context = ast_context(true) + context = ast_context(true, options[:line]) names.collect do |name| known_resource_types.add(Puppet::Resource::Type.new(:node, name, context.merge(options))) end diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb index 860326973..4ef242cf5 100755 --- a/spec/unit/parser/lexer_spec.rb +++ b/spec/unit/parser/lexer_spec.rb @@ -529,6 +529,22 @@ describe Puppet::Parser::Lexer, "when lexing comments" do @lexer.fullscan end + it "should add a new comment stack level on LPAREN" do + @lexer.string = "(" + + @lexer.expects(:commentpush) + + @lexer.fullscan + end + + it "should pop the current comment on RPAREN" do + @lexer.string = ")" + + @lexer.expects(:commentpop) + + @lexer.fullscan + end + it "should return the current comments on getcomment" do @lexer.string = "# comment" @lexer.fullscan diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb index 07e2d220b..9aab6a716 100755 --- a/spec/unit/parser/parser_spec.rb +++ b/spec/unit/parser/parser_spec.rb @@ -304,6 +304,33 @@ describe Puppet::Parser do it "should return an array of nodes" do @parser.newnode(@nodename).should be_instance_of(Array) end + + it "should initialize the ast context with the correct line number" do + @parser.expects(:ast_context).with { |a,b| b == 123 }.returns({}) + @parser.newnode(@nodename, { :line => 123 }) + end + end + + %w{class define}.each do |entity| + describe "when creating a #{entity}" do + before :each do + @parser.stubs(:ast_context).returns({}) + + @name = stub "#{entity}name", :is_a? => false, :value => "foo" + end + + it "should create and add the correct resource type" do + instance = stub 'instance' + Puppet::Resource::Type.expects(:new).returns(instance) + @parser.known_resource_types.expects(:add).with(instance) + @parser.send("new#{entity}", @name) + end + + it "should initialize the ast context with the correct line number" do + @parser.expects(:ast_context).with { |a,b| b == 123 }.returns({}) + @parser.send("new#{entity}", @name, { :line => 123 }) + end + end end describe "when retrieving a specific node" do -- cgit From 90905073a6e1136c80cd59dca1a9594f4a859126 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Sat, 12 Feb 2011 13:32:24 +0100 Subject: Fix #6267 - puppetdoc embedded links to puppet entities are not hyperlinked Puppetdoc was relying on RDoc to provide the puppet entity (class, definition node, etc...) hyperlinking in comments. Unfortunately, RDoc was assuming namespaces are capitalized like Ruby namespaces and that definition would use the # or . separator. This change adds on top of RDoc puppet namespace format for classes and definition. This will make sure the comment hyperlinking will work as intented. Signed-off-by: Brice Figureau --- lib/puppet/util/rdoc/code_objects.rb | 39 ++++++++++++++++++++++ .../util/rdoc/generators/puppet_generator.rb | 18 ++++++++++ 2 files changed, 57 insertions(+) diff --git a/lib/puppet/util/rdoc/code_objects.rb b/lib/puppet/util/rdoc/code_objects.rb index 3854fbc01..3c789a0c5 100644 --- a/lib/puppet/util/rdoc/code_objects.rb +++ b/lib/puppet/util/rdoc/code_objects.rb @@ -124,6 +124,45 @@ module RDoc def add_child(child) @childs << child end + + # Look up the given symbol. RDoc only looks for class1::class2.method + # or class1::class2#method. Since our definitions are mapped to RDoc methods + # but are written class1::class2::define we need to perform the lookup by + # ourselves. + def find_symbol(symbol, method=nil) + result = super + if not result and symbol =~ /::/ + modules = symbol.split(/::/) + unless modules.empty? + module_name = modules.shift + result = find_module_named(module_name) + if result + last_name = "" + previous = nil + modules.each do |module_name| + previous = result + last_name = module_name + result = result.find_module_named(module_name) + break unless result + end + unless result + result = previous + method = last_name + end + end + end + if result && method + if !result.respond_to?(:find_local_symbol) + p result.name + p method + fail + end + result = result.find_local_symbol(method) + end + end + result + end + end # PuppetNode holds a puppet node diff --git a/lib/puppet/util/rdoc/generators/puppet_generator.rb b/lib/puppet/util/rdoc/generators/puppet_generator.rb index e6bbb2e1e..249c9a8ba 100644 --- a/lib/puppet/util/rdoc/generators/puppet_generator.rb +++ b/lib/puppet/util/rdoc/generators/puppet_generator.rb @@ -31,6 +31,24 @@ module Generators NODE_DIR = "nodes" PLUGIN_DIR = "plugins" + # We're monkey patching RDoc markup to allow + # lowercase class1::class2::class3 crossref hyperlinking + module MarkUp + alias :old_markup :markup + + def new_markup(str, remove_para=false) + first = @markup.nil? + res = old_markup(str, remove_para) + if first and not @markup.nil? + @markup.add_special(/\b([a-z]\w+(::\w+)*)/,:CROSSREF) + # we need to call it again, since we added a rule + res = old_markup(str, remove_para) + end + res + end + alias :markup :new_markup + end + # This is a specialized HTMLGenerator tailored to Puppet manifests class PuppetGenerator < HTMLGenerator -- cgit From c373b6272ddd4daabf15d1b459ef3e86072e3f26 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Sat, 12 Feb 2011 16:58:20 +0100 Subject: Fix #6269 - Hashes only work with two levels of access The following manifest was failing: $hash = { 'a' => { 'b' => { 'c' => 'it works' } } } $out = $hash['a']['b']['c'] because of a typo in the grammar. Signed-off-by: Brice Figureau --- lib/puppet/parser/grammar.ra | 2 +- lib/puppet/parser/parser.rb | 1591 ++++++++++++++++---------------- spec/integration/parser/parser_spec.rb | 7 + 3 files changed, 800 insertions(+), 800 deletions(-) diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index 7a316d4d7..b7e527251 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -844,7 +844,7 @@ hasharrayaccess: VARIABLE LBRACK rvalue RBRACK { } hasharrayaccesses: hasharrayaccess - | hasharrayaccess LBRACK rvalue RBRACK { + | hasharrayaccesses LBRACK rvalue RBRACK { result = ast AST::HashOrArrayAccess, :variable => val[0], :key => val[2] } diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index 5be9e5a3f..3c0910d98 100644 --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -13,9 +13,9 @@ require 'puppet/parser/lexer' require 'puppet/parser/ast' module Puppet - class ParseError < Puppet::Error; end - class ImportError < Racc::ParseError; end - class AlreadyImportedError < ImportError; end + class ParseError < Puppet::Error; end + class ImportError < Racc::ParseError; end + class AlreadyImportedError < ImportError; end end @@ -25,7 +25,7 @@ module Puppet class Parser < Racc::Parser -module_eval <<'..end grammar.ra modeval..id7145220b1b', 'grammar.ra', 876 +module_eval <<'..end grammar.ra modeval..id6e24f09658', 'grammar.ra', 865 # It got too annoying having code in a file that needs to be compiled. require 'puppet/parser/parser_support' @@ -37,7 +37,7 @@ require 'puppet/parser/parser_support' # $Id$ -..end grammar.ra modeval..id7145220b1b +..end grammar.ra modeval..id6e24f09658 ##### racc 1.4.5 generates ### @@ -281,77 +281,53 @@ racc_reduce_n = 233 racc_shift_n = 384 racc_action_table = [ - 256, 257, 228, 82, 54, 72, 75, 181, 251, 48, + 256, 257, 228, 82, 54, 72, 75, 308, 251, 48, 72, 75, 194, 205, 210, 163, 156, 348, 46, 47, - 344, 184, 201, 203, 206, 209, 162, 352, 54, 182, - 351, 169, 54, -168, 72, 75, 241, 242, 102, 305, - 106, 158, 58, 193, 230, 60, 204, 208, 193, 306, + 309, 184, 201, 203, 206, 209, 162, 352, 54, 182, + 351, 169, 54, -168, 72, 75, 241, 242, 102, 117, + 106, 158, 58, 193, 230, 60, 204, 208, 193, -170, 213, 196, 197, 198, 200, 202, 97, 207, 211, 72, - 75, 72, 75, 163, 199, 59, 58, 71, 245, 60, - 58, 83, 86, 60, 162, 92, 244, 72, 75, 169, + 75, 72, 75, 163, 199, 59, 58, 71, 355, 60, + 58, 83, 86, 60, 162, 92, 356, 72, 75, 169, 78, 100, 352, 269, 89, 351, 63, 94, 64, 59, - 228, 326, 71, 59, 162, 59, 83, 86, 83, 268, - 92, 65, 92, 184, 76, 78, 307, 137, 163, 89, + 181, 326, 71, 59, 162, 59, 83, 86, 83, 268, + 92, 65, 92, 344, 76, 78, 305, 137, 163, 89, 162, 89, 72, 75, 83, 268, 241, 242, 92, 162, - 59, 163, 59, 137, 169, 62, 254, 89, 207, 211, - 72, 75, 162, 308, 102, 199, 106, 169, 59, 255, - 213, 196, 197, 198, -166, 162, 309, 207, 211, 83, - 268, 310, 97, 92, 199, 72, 75, 355, 137, 102, - -170, 106, 89, 71, 218, 356, 173, 83, 86, 220, - 313, 92, -171, 59, 72, 75, 78, 100, 37, 218, - 89, 249, 38, 94, 220, 246, 247, 173, 71, 11, - 210, 59, 83, 86, 246, 367, 92, 271, 201, 37, - -167, 78, 37, 38, 270, 89, 38, 71, 246, 247, - 11, 83, 86, 11, 14, 92, 59, 72, 75, 76, - 78, 102, 278, 106, 89, 277, 213, 196, 197, 198, - 200, 202, 275, 207, 211, 59, 246, 274, 152, 97, - 199, 37, 318, 72, 75, 127, 319, 102, -169, 106, - 71, 63, 11, 14, 83, 86, -167, 37, 92, 207, - 211, 127, -169, 78, 100, 97, 199, 89, 11, 14, - 94, -166, 117, 72, 75, -185, 71, 82, 59, 336, - 83, 86, 197, 198, 92, 231, 338, 207, 211, 78, - 100, 181, 48, 89, 199, 74, 94, 240, -168, 72, - 75, 241, 242, 102, 59, 106, 71, 184, 176, 37, - 83, 86, 59, 38, 92, 345, 322, 175, 76, 78, - 11, 97, -172, 89, -171, 72, 75, -170, 59, 102, - 214, 106, 71, 64, 59, 215, 83, 86, 173, 217, - 92, -23, -23, -23, -23, 78, 100, 97, 155, 89, - 72, 75, 94, 122, 102, 152, 106, 82, 71, 223, - 59, 122, 83, 86, 72, 75, 92, -168, 102, 225, - 106, 78, 100, -166, 276, 89, 226, 117, 94, 44, - 45, 41, 42, 71, -169, -167, 59, 83, 86, 72, - 75, 92, 226, 102, 229, 106, 78, 71, 52, -168, - 89, 83, 86, 72, 75, 92, -166, 102, -169, 106, - 78, 59, 197, 198, 89, -167, -171, 207, 211, 365, - 231, 152, 71, 234, 199, 59, 83, 86, 50, 210, - 92, -21, -21, -21, -21, 78, 71, 201, 372, 89, - 83, 86, 49, 374, 92, 72, 75, 228, -220, 78, - 59, 226, 354, 89, 377, 72, 75, 40, 39, 102, - 237, 106, 341, nil, 59, 213, 196, 197, 198, 200, - 202, nil, 207, 211, nil, nil, nil, 97, 162, 199, - nil, nil, 83, 268, nil, nil, 92, nil, 71, nil, - nil, 137, 83, 86, nil, 89, 92, 44, 45, 41, - 42, 78, 100, 72, 75, 89, 59, 102, 94, 106, - 213, 196, 197, 198, 200, 202, 59, 207, 211, nil, - 213, 196, 197, 198, 199, 97, nil, 207, 211, 72, - 75, nil, nil, 102, 199, 106, 71, nil, nil, nil, - 83, 86, nil, nil, 92, nil, nil, nil, nil, 78, - 100, 97, nil, 89, nil, nil, 94, nil, nil, 72, - 75, nil, 71, 102, 59, 106, 83, 86, nil, nil, - 92, nil, nil, nil, nil, 78, 100, nil, nil, 89, - nil, 97, 94, nil, nil, 72, 75, nil, nil, 102, - 59, 106, 71, nil, nil, nil, 83, 86, nil, nil, - 92, nil, nil, nil, nil, 78, 100, 97, nil, 89, - 72, 75, 94, nil, 102, nil, 106, nil, 71, nil, - 59, nil, 83, 86, 72, 75, 92, nil, 102, nil, - nil, 78, 100, nil, nil, 89, nil, nil, 94, nil, - nil, nil, nil, 71, nil, nil, 59, 83, 86, 72, - 75, 92, nil, 102, nil, 106, 78, 71, nil, nil, - 89, 83, 143, nil, nil, 92, nil, nil, nil, nil, - 137, 59, nil, nil, 89, 72, 75, nil, nil, 102, - nil, 106, 71, nil, nil, 59, 83, 86, nil, nil, - 92, nil, nil, nil, nil, 78, nil, 97, nil, 89, - nil, 72, 75, nil, nil, 102, nil, 106, 71, nil, + 59, 163, 59, 137, 169, 62, 228, 89, 207, 211, + 72, 75, 162, 254, 102, 199, 106, 169, 59, 184, + 213, 196, 197, 198, 306, 162, 255, 207, 211, 83, + 268, 307, 97, 92, 199, 72, 75, 245, 137, 102, + -166, 106, 89, 71, 218, 244, 310, 83, 86, 220, + -171, 92, 173, 59, 72, 75, 78, 100, 37, 218, + 89, 275, 127, 94, 220, 246, 274, 313, 71, 11, + 14, 59, 83, 86, 246, 367, 92, 271, 37, 72, + 75, 78, 127, -167, 173, 89, 354, 71, 63, 11, + 14, 83, 86, 152, 318, 92, 59, 72, 75, 76, + 78, 102, 37, 106, 89, 270, 38, 37, 319, 246, + 247, 38, 162, 11, 14, 59, 83, 268, 11, 97, + 92, 59, 37, 72, 75, 137, 38, 82, 278, 89, + 71, 277, 240, 11, 83, 86, 241, 242, 92, -169, + 59, -169, -166, 78, 100, 74, 176, 89, 72, 75, + 94, -185, 102, 181, 106, 37, 71, 336, 59, 38, + 83, 86, 322, 231, 92, 338, 11, 48, 76, 78, + 97, 197, 198, 89, 72, 75, 207, 211, 102, 176, + 106, 71, 341, 199, 59, 83, 86, 184, 249, 92, + 207, 211, 246, 247, 78, 100, 97, 199, 89, 72, + 75, 94, -168, 102, -167, 106, 345, 71, 175, 59, + -172, 83, 86, 72, 75, 92, 59, 102, -171, 106, + 78, 100, -170, 214, 89, 64, 215, 94, -21, -21, + -21, -21, 71, 173, 217, 59, 83, 86, 72, 75, + 92, 155, 102, 122, 106, 78, 71, 152, 82, 89, + 83, 86, 223, 122, 92, 44, 45, 41, 42, 78, + 59, 197, 198, 89, 72, 75, 207, 211, 102, -168, + 106, 71, 276, 199, 59, 83, 86, 176, 225, 92, + 44, 45, 41, 42, 78, -166, 97, 117, 89, 72, + 75, 226, -169, 102, 226, 106, -167, 71, 52, 59, + -168, 83, 86, -166, -169, 92, -23, -23, -23, -23, + 78, 100, -167, -171, 89, 72, 75, 94, 365, 102, + 152, 106, 71, 229, 228, 59, 83, 86, 50, 372, + 92, 49, 374, 226, -220, 78, 231, 97, 377, 89, + 40, 72, 75, 39, 237, 102, 234, 106, 71, nil, 59, nil, 83, 86, nil, nil, 92, nil, nil, nil, nil, 78, 100, 97, nil, 89, nil, nil, 94, nil, nil, 72, 75, nil, 71, 102, 59, 106, 83, 86, @@ -360,60 +336,88 @@ racc_action_table = [ nil, 102, 59, 106, 71, nil, nil, nil, 83, 86, nil, nil, 92, nil, nil, nil, nil, 78, 100, 97, nil, 89, 72, 75, 94, nil, 102, nil, 106, nil, + 71, nil, 59, nil, 83, 86, 72, 75, 92, nil, + 102, nil, nil, 78, 100, nil, nil, 89, nil, nil, + 94, nil, nil, nil, nil, 71, nil, nil, 59, 83, + 86, 72, 75, 92, nil, 102, nil, 106, 78, 71, + nil, nil, 89, 83, 143, nil, nil, 92, nil, nil, + nil, nil, 137, 59, nil, nil, 89, 72, 75, nil, + nil, 102, nil, 106, 71, nil, nil, 59, 83, 86, + nil, nil, 92, nil, nil, nil, nil, 78, nil, 97, + nil, 89, nil, 72, 75, nil, nil, 102, nil, 106, 71, nil, 59, nil, 83, 86, nil, nil, 92, nil, - nil, nil, nil, 78, 100, nil, nil, 89, 72, 75, - 94, nil, 102, nil, 106, 71, nil, nil, 59, 83, - 86, nil, nil, 92, nil, nil, nil, nil, 78, nil, - 97, nil, 89, nil, 72, 75, nil, nil, 102, nil, - 106, 71, nil, 59, nil, 83, 86, nil, nil, 92, - nil, nil, 72, 75, 78, 100, 97, nil, 89, 72, - 75, 94, nil, 102, nil, 106, nil, 71, nil, 59, - nil, 83, 86, nil, nil, 92, nil, nil, nil, nil, - 78, 100, nil, nil, 89, 162, nil, 94, nil, 83, - 268, nil, 71, 92, nil, 59, 83, 86, 137, nil, - 92, nil, 89, nil, nil, 78, 72, 75, nil, 89, - 102, nil, 106, 59, nil, nil, nil, nil, nil, nil, - 59, nil, nil, nil, nil, 72, 75, nil, 97, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 71, - nil, nil, nil, 83, 86, nil, nil, 92, 177, nil, - 72, 75, 78, 100, nil, nil, 89, nil, 71, 94, - nil, nil, 83, 86, nil, nil, 92, 59, 72, 75, - 76, 78, 102, 339, 106, 89, nil, nil, nil, nil, - nil, nil, nil, 71, nil, nil, 59, 83, 86, nil, - 97, 92, nil, 72, 75, 76, 78, 102, nil, 106, - 89, 71, nil, 72, 75, 83, 86, nil, nil, 92, - nil, 59, nil, nil, 78, 100, nil, nil, 89, 72, - 75, 94, nil, nil, nil, nil, 71, nil, nil, 59, - 83, 86, nil, nil, 92, nil, 162, nil, nil, 78, - 83, 268, nil, 89, 92, nil, 72, 75, nil, 137, - 102, nil, 162, 89, 59, nil, 83, 268, nil, nil, - 92, nil, 72, 75, 59, 137, 102, nil, 106, 89, - nil, nil, 72, 75, nil, nil, 102, nil, 106, 71, - 59, nil, nil, 83, 268, nil, nil, 92, nil, nil, - nil, nil, 137, nil, 97, 71, 89, nil, nil, 83, - 86, nil, nil, 92, nil, 71, nil, 59, 78, 83, - 86, nil, 89, 92, nil, nil, nil, nil, 78, 100, - 72, 75, 89, 59, 102, 94, 106, 213, 196, 197, - 198, 200, 202, 59, 207, 211, nil, nil, nil, 72, - 75, 199, 97, 102, 189, 106, 72, 75, nil, nil, - 102, nil, 106, 71, nil, nil, nil, 83, 86, nil, - nil, 92, nil, nil, nil, nil, 78, 100, 72, 75, - 89, nil, 71, 94, nil, nil, 83, 86, nil, 71, - 92, 59, nil, 83, 86, 78, nil, 92, nil, 89, - nil, nil, 78, 72, 75, nil, 89, 102, nil, 106, - 59, 162, nil, nil, nil, 83, 268, 59, nil, 92, - nil, 72, 75, nil, 137, 102, nil, 106, 89, nil, - nil, nil, nil, nil, nil, nil, 71, nil, nil, 59, - 83, 86, nil, 97, 92, nil, nil, nil, nil, 78, - nil, 72, 75, 89, 71, 102, nil, 106, 83, 86, - nil, nil, 92, nil, 59, nil, nil, 78, 100, nil, - nil, 89, nil, 97, 94, nil, nil, 72, 75, nil, - nil, 102, 59, 106, 71, nil, nil, nil, 83, 86, + nil, nil, nil, 78, 100, 97, nil, 89, nil, nil, + 94, nil, nil, 72, 75, nil, 71, 102, 59, 106, + 83, 86, nil, nil, 92, nil, nil, nil, nil, 78, + 100, nil, nil, 89, nil, 97, 94, nil, nil, 72, + 75, nil, nil, 102, 59, 106, 71, nil, nil, nil, + 83, 86, nil, nil, 92, nil, nil, nil, nil, 78, + 100, 97, nil, 89, 72, 75, 94, nil, 102, nil, + 106, nil, 71, nil, 59, nil, 83, 86, nil, nil, + 92, nil, nil, nil, nil, 78, 100, nil, nil, 89, + 72, 75, 94, nil, 102, nil, 106, 71, nil, nil, + 59, 83, 86, nil, nil, 92, nil, nil, nil, nil, + 78, nil, 97, nil, 89, nil, 72, 75, nil, nil, + 102, nil, 106, 71, nil, 59, nil, 83, 86, nil, + nil, 92, nil, nil, 72, 75, 78, 100, 97, nil, + 89, 72, 75, 94, nil, 102, nil, 106, nil, 71, + nil, 59, nil, 83, 86, nil, nil, 92, nil, nil, + nil, nil, 78, 100, nil, nil, 89, 162, nil, 94, + nil, 83, 268, nil, 71, 92, nil, 59, 83, 86, + 137, nil, 92, nil, 89, nil, nil, 78, 72, 75, + nil, 89, 102, nil, 106, 59, nil, 213, 196, 197, + 198, nil, 59, nil, 207, 211, nil, 72, 75, nil, + 97, 199, nil, 72, 75, nil, nil, nil, nil, nil, + nil, 71, nil, nil, nil, 83, 86, nil, nil, 92, + 339, nil, nil, nil, 78, 100, 177, nil, 89, nil, + 71, 94, nil, nil, 83, 86, 71, nil, 92, 59, + 83, 86, 76, 78, 92, nil, nil, 89, 76, 78, + 72, 75, nil, 89, 102, nil, 106, nil, 59, nil, + nil, nil, nil, nil, 59, nil, nil, nil, nil, 72, + 75, nil, 97, 102, nil, 106, 72, 75, nil, nil, + nil, nil, nil, 71, nil, nil, nil, 83, 86, nil, + nil, 92, nil, nil, 72, 75, 78, 100, nil, nil, + 89, nil, 71, 94, nil, nil, 83, 86, nil, 162, + 92, 59, nil, 83, 268, 78, nil, 92, nil, 89, + nil, nil, 137, nil, nil, nil, 89, 162, nil, nil, + 59, 83, 268, nil, nil, 92, nil, 59, nil, nil, + 137, 72, 75, nil, 89, 102, nil, 106, nil, nil, + nil, nil, nil, nil, nil, 59, nil, nil, nil, nil, + 72, 75, nil, 97, 102, nil, 106, 72, 75, nil, + nil, 102, nil, 106, 71, nil, nil, nil, 83, 86, nil, nil, 92, nil, nil, nil, nil, 78, 100, 97, - nil, 89, nil, nil, 94, nil, nil, nil, nil, nil, - 71, nil, 59, nil, 83, 86, 212, nil, 92, nil, - nil, nil, nil, 78, 100, 205, 210, 89, nil, nil, - 94, nil, nil, nil, 201, 203, 206, 209, 59, nil, + nil, 89, nil, 71, 94, nil, nil, 83, 86, nil, + 71, 92, 59, nil, 83, 86, 78, nil, 92, nil, + 89, 72, 75, 78, 100, 102, nil, 89, 72, 75, + 94, 59, 102, nil, 106, 72, 75, nil, 59, 102, + 189, 106, 72, 75, nil, nil, 102, nil, 106, nil, + nil, nil, nil, nil, 71, nil, nil, nil, 83, 268, + nil, 71, 92, nil, nil, 83, 86, 137, 71, 92, + nil, 89, 83, 86, 78, 71, 92, nil, 89, 83, + 86, 78, 59, 92, nil, 89, nil, nil, 78, 59, + nil, nil, 89, 72, 75, nil, 59, 102, nil, 106, + nil, nil, nil, 59, nil, nil, nil, nil, nil, nil, + nil, nil, 72, 75, nil, 97, nil, nil, nil, 72, + 75, nil, nil, 102, nil, 106, 71, nil, nil, nil, + 83, 86, nil, nil, 92, nil, nil, nil, nil, 78, + 100, 97, nil, 89, nil, 162, 94, nil, nil, 83, + 268, nil, 71, 92, 59, nil, 83, 86, 137, nil, + 92, nil, 89, nil, nil, 78, 100, nil, nil, 89, + 72, 75, 94, 59, 102, nil, 106, nil, nil, nil, + 59, 26, nil, 33, 1, nil, 7, 12, nil, 17, + nil, 23, 97, 29, nil, 3, 72, 75, 11, 14, + 102, nil, 106, 71, nil, nil, nil, 83, 86, nil, + nil, 92, nil, nil, nil, nil, 78, 100, 97, nil, + 89, nil, nil, 94, nil, nil, nil, nil, nil, 71, + nil, 59, nil, 83, 86, 212, nil, 92, nil, nil, + nil, nil, 78, 100, 205, 210, 89, nil, nil, 94, + nil, nil, nil, 201, 203, 206, 209, 59, nil, 205, + 210, nil, nil, nil, nil, nil, nil, nil, 201, 203, + 206, 209, nil, nil, nil, nil, nil, 204, 208, nil, + nil, 213, 196, 197, 198, 200, 202, nil, 207, 211, + nil, nil, 204, 208, nil, 199, 213, 196, 197, 198, + 200, 202, nil, 207, 211, 205, 210, nil, nil, nil, + 199, nil, nil, 273, 201, 203, 206, 209, nil, nil, 205, 210, nil, nil, nil, nil, nil, nil, nil, 201, 203, 206, 209, nil, nil, nil, nil, nil, 204, 208, nil, nil, 213, 196, 197, 198, 200, 202, nil, 207, @@ -423,277 +427,277 @@ racc_action_table = [ nil, 205, 210, nil, nil, nil, nil, nil, nil, nil, 201, 203, 206, 209, nil, nil, nil, nil, nil, 204, 208, nil, nil, 213, 196, 197, 198, 200, 202, nil, - 207, 211, nil, nil, 204, 208, nil, 199, 213, 196, + 207, 211, nil, nil, nil, 208, nil, 199, 213, 196, 197, 198, 200, 202, nil, 207, 211, 205, 210, nil, nil, nil, 199, nil, nil, nil, 201, 203, 206, 209, - nil, nil, 205, 210, nil, nil, nil, nil, nil, nil, - 273, 201, 203, 206, 209, nil, nil, nil, nil, nil, - nil, 208, nil, nil, 213, 196, 197, 198, 200, 202, - nil, 207, 211, nil, nil, 204, 208, nil, 199, 213, - 196, 197, 198, 200, 202, nil, 207, 211, 205, 210, - nil, nil, nil, 199, nil, nil, nil, 201, 203, 206, - 209, nil, nil, 26, 210, 33, 1, nil, 7, 12, - nil, 17, 201, 23, nil, 29, nil, 3, nil, nil, - 11, 14, nil, 210, nil, 213, 196, 197, 198, 200, - 202, 201, 207, 211, nil, nil, nil, nil, nil, 199, - 213, 196, 197, 198, 200, 202, nil, 207, 211, nil, - nil, 324, nil, nil, 199, nil, nil, nil, nil, 213, - 196, 197, 198, 200, 202, nil, 207, 211, nil, nil, - 379, nil, 26, 199, 33, 1, nil, 7, 12, nil, - 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, - 14, 26, 382, 33, 1, nil, 7, 12, nil, 17, - nil, 23, nil, 29, nil, 3, nil, nil, 11, 14, - nil, 296, nil, 26, nil, 33, 1, nil, 7, 12, - nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, - 11, 14, 26, 364, 33, 1, nil, 7, 12, nil, - 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, - 14, nil, 381, nil, 26, nil, 33, 1, nil, 7, - 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, - nil, 11, 14, 26, 383, 33, 1, nil, 7, 12, - nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, - 11, 14, nil, 357, nil, 26, nil, 33, 1, nil, + nil, nil, 26, 210, 33, 1, nil, 7, 12, nil, + 17, 201, 23, nil, 29, nil, 3, nil, nil, 11, + 14, nil, 210, nil, 213, 196, 197, 198, 200, 202, + 201, 207, 211, nil, nil, nil, nil, 210, 199, 213, + 196, 197, 198, 200, 202, 201, 207, 211, nil, nil, + nil, nil, nil, 199, nil, nil, 210, nil, 213, 196, + 197, 198, 200, 202, 201, 207, 211, nil, nil, nil, + nil, nil, 199, 213, 196, 197, 198, 200, 202, nil, + 207, 211, nil, nil, 304, nil, nil, 199, nil, nil, + nil, nil, 213, 196, 197, 198, 200, 202, nil, 207, + 211, nil, nil, 383, nil, 26, 199, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, - nil, nil, 11, 14, 26, 363, 33, 1, nil, 7, + nil, nil, 11, 14, 26, 375, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, - nil, 11, 14, nil, 375, nil, 26, nil, 33, 1, + nil, 11, 14, nil, 349, nil, 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, - 3, nil, nil, 11, 14, 26, 304, 33, 1, nil, + 3, nil, nil, 11, 14, 26, 296, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, - nil, nil, 11, 14, nil, 349, nil, 26, nil, 33, + nil, nil, 11, 14, nil, 357, nil, 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, - nil, 3, nil, nil, 11, 14, 26, nil, 33, 1, + nil, 3, nil, nil, 11, 14, 26, 382, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, - 3, nil, nil, 11, 14, 26, nil, 33, 1, nil, - 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, - nil, nil, 11, 14 ] + 3, nil, nil, 11, 14, nil, 364, nil, 26, nil, + 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, + 29, nil, 3, nil, nil, 11, 14, 26, 363, 33, + 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, + nil, 3, nil, nil, 11, 14, nil, 379, nil, 26, + nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, + nil, 29, nil, 3, nil, nil, 11, 14, 26, 381, + 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, + 29, nil, 3, nil, nil, 11, 14, nil, 324, nil, + 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, + 23, nil, 29, nil, 3, nil, nil, 11, 14, 26, + nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, + nil, 29, nil, 3, nil, nil, 11, 14, 213, 196, + 197, 198, 200, 202, nil, 207, 211, nil, nil, nil, + nil, nil, 199, 213, 196, 197, 198, 200, 202, nil, + 207, 211, nil, nil, nil, nil, nil, 199 ] racc_action_check = [ - 180, 180, 152, 86, 156, 106, 106, 272, 174, 7, - 277, 277, 106, 180, 180, 65, 55, 277, 7, 7, - 272, 86, 180, 180, 180, 180, 65, 296, 17, 80, - 296, 65, 158, 95, 202, 202, 174, 174, 202, 218, - 202, 55, 156, 106, 152, 156, 180, 180, 277, 219, - 180, 180, 180, 180, 180, 180, 202, 180, 180, 181, - 181, 368, 368, 239, 180, 156, 17, 202, 165, 17, - 158, 202, 202, 158, 239, 202, 165, 182, 182, 239, - 202, 202, 349, 182, 202, 349, 22, 202, 22, 17, - 143, 243, 181, 158, 368, 202, 181, 181, 368, 368, - 181, 22, 368, 143, 181, 181, 220, 368, 163, 181, - 182, 368, 355, 355, 182, 182, 243, 243, 182, 163, - 181, 62, 368, 182, 163, 22, 178, 182, 281, 281, - 351, 351, 62, 221, 351, 281, 351, 62, 182, 178, - 285, 285, 285, 285, 101, 355, 221, 285, 285, 355, - 355, 224, 351, 355, 285, 341, 341, 300, 355, 341, - 91, 341, 355, 351, 308, 300, 226, 351, 351, 308, - 227, 351, 90, 355, 184, 184, 351, 351, 12, 122, - 351, 171, 12, 351, 122, 171, 171, 229, 341, 12, - 286, 351, 341, 341, 343, 343, 341, 184, 286, 1, - 87, 341, 30, 1, 183, 341, 30, 184, 183, 183, - 1, 184, 184, 30, 30, 184, 341, 196, 196, 184, - 184, 196, 195, 196, 184, 195, 286, 286, 286, 286, - 286, 286, 188, 286, 286, 184, 188, 188, 231, 196, - 286, 120, 232, 197, 197, 120, 233, 197, 103, 197, - 196, 85, 120, 120, 196, 196, 105, 43, 196, 280, - 280, 43, 84, 196, 196, 197, 280, 196, 43, 43, - 196, 81, 215, 23, 23, 78, 197, 23, 196, 250, - 197, 197, 279, 279, 197, 252, 253, 279, 279, 197, - 197, 77, 71, 197, 279, 23, 197, 160, 68, 26, - 26, 160, 160, 26, 197, 26, 23, 268, 67, 234, - 23, 23, 211, 234, 23, 274, 234, 66, 23, 23, - 234, 26, 107, 23, 108, 198, 198, 109, 207, 198, - 114, 198, 26, 115, 23, 119, 26, 26, 64, 121, - 26, 35, 35, 35, 35, 26, 26, 198, 52, 26, - 29, 29, 26, 51, 29, 50, 29, 127, 198, 132, - 26, 36, 198, 198, 307, 307, 198, 133, 307, 136, - 307, 198, 198, 138, 192, 198, 139, 33, 198, 34, - 34, 34, 34, 29, 140, 142, 198, 29, 29, 305, - 305, 29, 315, 305, 144, 305, 29, 307, 16, 327, - 29, 307, 307, 199, 199, 307, 328, 199, 330, 199, - 307, 29, 297, 297, 307, 331, 332, 297, 297, 337, - 153, 175, 305, 154, 297, 307, 305, 305, 9, 288, - 305, 28, 28, 28, 28, 305, 199, 288, 352, 305, - 199, 199, 8, 356, 199, 298, 298, 173, 367, 199, - 305, 172, 298, 199, 369, 200, 200, 3, 2, 200, - 157, 200, 263, nil, 199, 288, 288, 288, 288, 288, - 288, nil, 288, 288, nil, nil, nil, 200, 298, 288, - nil, nil, 298, 298, nil, nil, 298, nil, 200, nil, - nil, 298, 200, 200, nil, 298, 200, 4, 4, 4, - 4, 200, 200, 39, 39, 200, 298, 39, 200, 39, - 293, 293, 293, 293, 293, 293, 200, 293, 293, nil, - 283, 283, 283, 283, 293, 39, nil, 283, 283, 201, - 201, nil, nil, 201, 283, 201, 39, nil, nil, nil, - 39, 39, nil, nil, 39, nil, nil, nil, nil, 39, - 39, 201, nil, 39, nil, nil, 39, nil, nil, 46, - 46, nil, 201, 46, 39, 46, 201, 201, nil, nil, - 201, nil, nil, nil, nil, 201, 201, nil, nil, 201, - nil, 46, 201, nil, nil, 47, 47, nil, nil, 47, - 201, 47, 46, nil, nil, nil, 46, 46, nil, nil, - 46, nil, nil, nil, nil, 46, 46, 47, nil, 46, - 48, 48, 46, nil, 48, nil, 48, nil, 47, nil, - 46, nil, 47, 47, 49, 49, 47, nil, 49, nil, - nil, 47, 47, nil, nil, 47, nil, nil, 47, nil, - nil, nil, nil, 48, nil, nil, 47, 48, 48, 176, - 176, 48, nil, 176, nil, 176, 48, 49, nil, nil, - 48, 49, 49, nil, nil, 49, nil, nil, nil, nil, - 49, 48, nil, nil, 49, 203, 203, nil, nil, 203, - nil, 203, 176, nil, nil, 49, 176, 176, nil, nil, - 176, nil, nil, nil, nil, 176, nil, 203, nil, 176, - nil, 204, 204, nil, nil, 204, nil, 204, 203, nil, - 176, nil, 203, 203, nil, nil, 203, nil, nil, nil, - nil, 203, 203, 204, nil, 203, nil, nil, 203, nil, - nil, 205, 205, nil, 204, 205, 203, 205, 204, 204, - nil, nil, 204, nil, nil, nil, nil, 204, 204, nil, - nil, 204, nil, 205, 204, nil, nil, 100, 100, nil, - nil, 100, 204, 100, 205, nil, nil, nil, 205, 205, - nil, nil, 205, nil, nil, nil, nil, 205, 205, 100, - nil, 205, 63, 63, 205, nil, 63, nil, 63, nil, - 100, nil, 205, nil, 100, 100, nil, nil, 100, nil, - nil, nil, nil, 100, 100, nil, nil, 100, 208, 208, - 100, nil, 208, nil, 208, 63, nil, nil, 100, 63, - 63, nil, nil, 63, nil, nil, nil, nil, 63, nil, - 208, nil, 63, nil, 209, 209, nil, nil, 209, nil, - 209, 208, nil, 63, nil, 208, 208, nil, nil, 208, - nil, nil, 269, 269, 208, 208, 209, nil, 208, 276, - 276, 208, nil, 276, nil, 276, nil, 209, nil, 208, - nil, 209, 209, nil, nil, 209, nil, nil, nil, nil, - 209, 209, nil, nil, 209, 269, nil, 209, nil, 269, - 269, nil, 276, 269, nil, 209, 276, 276, 269, nil, - 276, nil, 269, nil, nil, 276, 256, 256, nil, 276, - 256, nil, 256, 269, nil, nil, nil, nil, nil, nil, - 276, nil, nil, nil, nil, 74, 74, nil, 256, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 256, - nil, nil, nil, 256, 256, nil, nil, 256, 74, nil, - 254, 254, 256, 256, nil, nil, 256, nil, 74, 256, - nil, nil, 74, 74, nil, nil, 74, 256, 75, 75, - 74, 74, 75, 254, 75, 74, nil, nil, nil, nil, - nil, nil, nil, 254, nil, nil, 74, 254, 254, nil, - 75, 254, nil, 248, 248, 254, 254, 248, nil, 248, - 254, 75, nil, 245, 245, 75, 75, nil, nil, 75, - nil, 254, nil, nil, 75, 75, nil, nil, 75, 244, - 244, 75, nil, nil, nil, nil, 248, nil, nil, 75, - 248, 248, nil, nil, 248, nil, 245, nil, nil, 248, - 245, 245, nil, 248, 245, nil, 225, 225, nil, 245, - 225, nil, 244, 245, 248, nil, 244, 244, nil, nil, - 244, nil, 82, 82, 245, 244, 82, nil, 82, 244, - nil, nil, 210, 210, nil, nil, 210, nil, 210, 225, - 244, nil, nil, 225, 225, nil, nil, 225, nil, nil, - nil, nil, 225, nil, 210, 82, 225, nil, nil, 82, - 82, nil, nil, 82, nil, 210, nil, 225, 82, 210, - 210, nil, 82, 210, nil, nil, nil, nil, 210, 210, - 213, 213, 210, 82, 213, 210, 213, 284, 284, 284, - 284, 284, 284, 210, 284, 284, nil, nil, nil, 102, - 102, 284, 213, 102, 102, 102, 230, 230, nil, nil, - 230, nil, 230, 213, nil, nil, nil, 213, 213, nil, - nil, 213, nil, nil, nil, nil, 213, 213, 214, 214, - 213, nil, 102, 213, nil, nil, 102, 102, nil, 230, - 102, 213, nil, 230, 230, 102, nil, 230, nil, 102, - nil, nil, 230, 228, 228, nil, 230, 228, nil, 228, - 102, 214, nil, nil, nil, 214, 214, 230, nil, 214, - nil, 94, 94, nil, 214, 94, nil, 94, 214, nil, - nil, nil, nil, nil, nil, nil, 228, nil, nil, 214, - 228, 228, nil, 94, 228, nil, nil, nil, nil, 228, - nil, 97, 97, 228, 94, 97, nil, 97, 94, 94, - nil, nil, 94, nil, 228, nil, nil, 94, 94, nil, - nil, 94, nil, 97, 94, nil, nil, 206, 206, nil, - nil, 206, 94, 206, 97, nil, nil, nil, 97, 97, - nil, nil, 97, nil, nil, nil, nil, 97, 97, 206, - nil, 97, nil, nil, 97, nil, nil, nil, nil, nil, - 206, nil, 97, nil, 206, 206, 111, nil, 206, nil, - nil, nil, nil, 206, 206, 111, 111, 206, nil, nil, - 206, nil, nil, nil, 111, 111, 111, 111, 206, nil, + 180, 180, 152, 86, 158, 106, 106, 221, 174, 7, + 277, 277, 106, 180, 180, 163, 55, 277, 7, 7, + 221, 86, 180, 180, 180, 180, 163, 296, 156, 80, + 296, 163, 17, 95, 201, 201, 174, 174, 201, 215, + 201, 55, 158, 106, 152, 158, 180, 180, 277, 91, + 180, 180, 180, 180, 180, 180, 201, 180, 180, 181, + 181, 368, 368, 65, 180, 158, 156, 201, 300, 156, + 17, 201, 201, 17, 65, 201, 300, 182, 182, 65, + 201, 201, 349, 182, 201, 349, 22, 201, 22, 156, + 272, 243, 181, 17, 368, 201, 181, 181, 368, 368, + 181, 22, 368, 272, 181, 181, 218, 368, 62, 181, + 182, 368, 355, 355, 182, 182, 243, 243, 182, 62, + 181, 239, 368, 182, 62, 22, 143, 182, 280, 280, + 351, 351, 239, 178, 351, 280, 351, 239, 182, 143, + 285, 285, 285, 285, 219, 355, 178, 285, 285, 355, + 355, 220, 351, 355, 285, 341, 341, 165, 355, 341, + 101, 341, 355, 351, 122, 165, 224, 351, 351, 122, + 90, 351, 226, 355, 184, 184, 351, 351, 43, 308, + 351, 188, 43, 351, 308, 188, 188, 227, 341, 43, + 43, 351, 341, 341, 343, 343, 341, 184, 120, 298, + 298, 341, 120, 87, 229, 341, 298, 184, 85, 120, + 120, 184, 184, 231, 232, 184, 341, 196, 196, 184, + 184, 196, 30, 196, 184, 183, 30, 1, 233, 183, + 183, 1, 298, 30, 30, 184, 298, 298, 1, 196, + 298, 211, 12, 23, 23, 298, 12, 23, 195, 298, + 196, 195, 160, 12, 196, 196, 160, 160, 196, 84, + 298, 103, 81, 196, 196, 23, 96, 196, 26, 26, + 196, 78, 26, 77, 26, 234, 23, 250, 196, 234, + 23, 23, 234, 252, 23, 253, 234, 71, 23, 23, + 26, 297, 297, 23, 197, 197, 297, 297, 197, 70, + 197, 26, 263, 297, 23, 26, 26, 268, 171, 26, + 281, 281, 171, 171, 26, 26, 197, 281, 26, 29, + 29, 26, 68, 29, 105, 29, 274, 197, 66, 26, + 107, 197, 197, 307, 307, 197, 207, 307, 108, 307, + 197, 197, 109, 114, 197, 115, 119, 197, 28, 28, + 28, 28, 29, 64, 121, 197, 29, 29, 305, 305, + 29, 52, 305, 51, 305, 29, 307, 50, 127, 29, + 307, 307, 132, 36, 307, 34, 34, 34, 34, 307, + 29, 279, 279, 307, 198, 198, 279, 279, 198, 133, + 198, 305, 192, 279, 307, 305, 305, 135, 136, 305, + 4, 4, 4, 4, 305, 138, 198, 33, 305, 199, + 199, 139, 140, 199, 315, 199, 142, 198, 16, 305, + 327, 198, 198, 328, 330, 198, 35, 35, 35, 35, + 198, 198, 331, 332, 198, 97, 97, 198, 337, 97, + 175, 97, 199, 144, 173, 198, 199, 199, 9, 352, + 199, 8, 356, 172, 367, 199, 153, 97, 369, 199, + 3, 200, 200, 2, 157, 200, 154, 200, 97, nil, + 199, nil, 97, 97, nil, nil, 97, nil, nil, nil, + nil, 97, 97, 200, nil, 97, nil, nil, 97, nil, + nil, 46, 46, nil, 200, 46, 97, 46, 200, 200, + nil, nil, 200, nil, nil, nil, nil, 200, 200, nil, + nil, 200, nil, 46, 200, nil, nil, 47, 47, nil, + nil, 47, 200, 47, 46, nil, nil, nil, 46, 46, + nil, nil, 46, nil, nil, nil, nil, 46, 46, 47, + nil, 46, 48, 48, 46, nil, 48, nil, 48, nil, + 47, nil, 46, nil, 47, 47, 49, 49, 47, nil, + 49, nil, nil, 47, 47, nil, nil, 47, nil, nil, + 47, nil, nil, nil, nil, 48, nil, nil, 47, 48, + 48, 176, 176, 48, nil, 176, nil, 176, 48, 49, + nil, nil, 48, 49, 49, nil, nil, 49, nil, nil, + nil, nil, 49, 48, nil, nil, 49, 202, 202, nil, + nil, 202, nil, 202, 176, nil, nil, 49, 176, 176, + nil, nil, 176, nil, nil, nil, nil, 176, nil, 202, + nil, 176, nil, 203, 203, nil, nil, 203, nil, 203, + 202, nil, 176, nil, 202, 202, nil, nil, 202, nil, + nil, nil, nil, 202, 202, 203, nil, 202, nil, nil, + 202, nil, nil, 204, 204, nil, 203, 204, 202, 204, + 203, 203, nil, nil, 203, nil, nil, nil, nil, 203, + 203, nil, nil, 203, nil, 204, 203, nil, nil, 205, + 205, nil, nil, 205, 203, 205, 204, nil, nil, nil, + 204, 204, nil, nil, 204, nil, nil, nil, nil, 204, + 204, 205, nil, 204, 63, 63, 204, nil, 63, nil, + 63, nil, 205, nil, 204, nil, 205, 205, nil, nil, + 205, nil, nil, nil, nil, 205, 205, nil, nil, 205, + 206, 206, 205, nil, 206, nil, 206, 63, nil, nil, + 205, 63, 63, nil, nil, 63, nil, nil, nil, nil, + 63, nil, 206, nil, 63, nil, 208, 208, nil, nil, + 208, nil, 208, 206, nil, 63, nil, 206, 206, nil, + nil, 206, nil, nil, 269, 269, 206, 206, 208, nil, + 206, 276, 276, 206, nil, 276, nil, 276, nil, 208, + nil, 206, nil, 208, 208, nil, nil, 208, nil, nil, + nil, nil, 208, 208, nil, nil, 208, 269, nil, 208, + nil, 269, 269, nil, 276, 269, nil, 208, 276, 276, + 269, nil, 276, nil, 269, nil, nil, 276, 256, 256, + nil, 276, 256, nil, 256, 269, nil, 283, 283, 283, + 283, nil, 276, nil, 283, 283, nil, 254, 254, nil, + 256, 283, nil, 74, 74, nil, nil, nil, nil, nil, + nil, 256, nil, nil, nil, 256, 256, nil, nil, 256, + 254, nil, nil, nil, 256, 256, 74, nil, 256, nil, + 254, 256, nil, nil, 254, 254, 74, nil, 254, 256, + 74, 74, 254, 254, 74, nil, nil, 254, 74, 74, + 75, 75, nil, 74, 75, nil, 75, nil, 254, nil, + nil, nil, nil, nil, 74, nil, nil, nil, nil, 248, + 248, nil, 75, 248, nil, 248, 245, 245, nil, nil, + nil, nil, nil, 75, nil, nil, nil, 75, 75, nil, + nil, 75, nil, nil, 244, 244, 75, 75, nil, nil, + 75, nil, 248, 75, nil, nil, 248, 248, nil, 245, + 248, 75, nil, 245, 245, 248, nil, 245, nil, 248, + nil, nil, 245, nil, nil, nil, 245, 244, nil, nil, + 248, 244, 244, nil, nil, 244, nil, 245, nil, nil, + 244, 209, 209, nil, 244, 209, nil, 209, nil, nil, + nil, nil, nil, nil, nil, 244, nil, nil, nil, nil, + 82, 82, nil, 209, 82, nil, 82, 210, 210, nil, + nil, 210, nil, 210, 209, nil, nil, nil, 209, 209, + nil, nil, 209, nil, nil, nil, nil, 209, 209, 210, + nil, 209, nil, 82, 209, nil, nil, 82, 82, nil, + 210, 82, 209, nil, 210, 210, 82, nil, 210, nil, + 82, 225, 225, 210, 210, 225, nil, 210, 230, 230, + 210, 82, 230, nil, 230, 102, 102, nil, 210, 102, + 102, 102, 228, 228, nil, nil, 228, nil, 228, nil, + nil, nil, nil, nil, 225, nil, nil, nil, 225, 225, + nil, 230, 225, nil, nil, 230, 230, 225, 102, 230, + nil, 225, 102, 102, 230, 228, 102, nil, 230, 228, + 228, 102, 225, 228, nil, 102, nil, nil, 228, 230, + nil, nil, 228, 100, 100, nil, 102, 100, nil, 100, + nil, nil, nil, 228, nil, nil, nil, nil, nil, nil, + nil, nil, 214, 214, nil, 100, nil, nil, nil, 94, + 94, nil, nil, 94, nil, 94, 100, nil, nil, nil, + 100, 100, nil, nil, 100, nil, nil, nil, nil, 100, + 100, 94, nil, 100, nil, 214, 100, nil, nil, 214, + 214, nil, 94, 214, 100, nil, 94, 94, 214, nil, + 94, nil, 214, nil, nil, 94, 94, nil, nil, 94, + 213, 213, 94, 214, 213, nil, 213, nil, nil, nil, + 94, 19, nil, 19, 19, nil, 19, 19, nil, 19, + nil, 19, 213, 19, nil, 19, 39, 39, 19, 19, + 39, nil, 39, 213, nil, nil, nil, 213, 213, nil, + nil, 213, nil, nil, nil, nil, 213, 213, 39, nil, + 213, nil, nil, 213, nil, nil, nil, nil, nil, 39, + nil, 213, nil, 39, 39, 111, nil, 39, nil, nil, + nil, nil, 39, 39, 111, 111, 39, nil, nil, 39, + nil, nil, nil, 111, 111, 111, 111, 39, nil, 131, + 131, nil, nil, nil, nil, nil, nil, nil, 131, 131, + 131, 131, nil, nil, nil, nil, nil, 111, 111, nil, + nil, 111, 111, 111, 111, 111, 111, nil, 111, 111, + nil, nil, 131, 131, nil, 111, 131, 131, 131, 131, + 131, 131, nil, 131, 131, 186, 186, nil, nil, nil, + 131, nil, nil, 186, 186, 186, 186, 186, nil, nil, 124, 124, nil, nil, nil, nil, nil, nil, nil, 124, - 124, 124, 124, nil, nil, nil, nil, nil, 111, 111, - nil, nil, 111, 111, 111, 111, 111, 111, nil, 111, - 111, nil, nil, 124, 124, nil, 111, 124, 124, 124, + 124, 124, 124, nil, nil, nil, nil, nil, 186, 186, + nil, nil, 186, 186, 186, 186, 186, 186, nil, 186, + 186, nil, nil, 124, 124, nil, 186, 124, 124, 124, 124, 124, 124, nil, 124, 124, 130, 130, nil, nil, nil, 124, nil, nil, nil, 130, 130, 130, 130, nil, - nil, 131, 131, nil, nil, nil, nil, nil, nil, nil, - 131, 131, 131, 131, nil, nil, nil, nil, nil, 130, + nil, 287, 287, nil, nil, nil, nil, nil, nil, nil, + 287, 287, 287, 287, nil, nil, nil, nil, nil, 130, 130, nil, nil, 130, 130, 130, 130, 130, 130, nil, - 130, 130, nil, nil, 131, 131, nil, 130, 131, 131, - 131, 131, 131, 131, nil, 131, 131, 287, 287, nil, - nil, nil, 131, nil, nil, nil, 287, 287, 287, 287, - nil, nil, 186, 186, nil, nil, nil, nil, nil, nil, - 186, 186, 186, 186, 186, nil, nil, nil, nil, nil, - nil, 287, nil, nil, 287, 287, 287, 287, 287, 287, - nil, 287, 287, nil, nil, 186, 186, nil, 287, 186, - 186, 186, 186, 186, 186, nil, 186, 186, 291, 291, - nil, nil, nil, 186, nil, nil, nil, 291, 291, 291, - 291, nil, nil, 19, 292, 19, 19, nil, 19, 19, - nil, 19, 292, 19, nil, 19, nil, 19, nil, nil, - 19, 19, nil, 289, nil, 291, 291, 291, 291, 291, - 291, 289, 291, 291, nil, nil, nil, nil, nil, 291, - 292, 292, 292, 292, 292, 292, nil, 292, 292, nil, - nil, 237, nil, nil, 292, nil, nil, nil, nil, 289, - 289, 289, 289, 289, 289, nil, 289, 289, nil, nil, - 372, nil, 237, 289, 237, 237, nil, 237, 237, nil, - 237, nil, 237, nil, 237, nil, 237, nil, nil, 237, - 237, 372, 378, 372, 372, nil, 372, 372, nil, 372, - nil, 372, nil, 372, nil, 372, nil, nil, 372, 372, - nil, 212, nil, 378, nil, 378, 378, nil, 378, 378, - nil, 378, nil, 378, nil, 378, nil, 378, nil, nil, - 378, 378, 212, 323, 212, 212, nil, 212, 212, nil, - 212, nil, 212, nil, 212, nil, 212, nil, nil, 212, - 212, nil, 374, nil, 323, nil, 323, 323, nil, 323, - 323, nil, 323, nil, 323, nil, 323, nil, 323, nil, - nil, 323, 323, 374, 380, 374, 374, nil, 374, 374, - nil, 374, nil, 374, nil, 374, nil, 374, nil, nil, - 374, 374, nil, 303, nil, 380, nil, 380, 380, nil, - 380, 380, nil, 380, nil, 380, nil, 380, nil, 380, - nil, nil, 380, 380, 303, 319, 303, 303, nil, 303, - 303, nil, 303, nil, 303, nil, 303, nil, 303, nil, - nil, 303, 303, nil, 362, nil, 319, nil, 319, 319, - nil, 319, 319, nil, 319, nil, 319, nil, 319, nil, - 319, nil, nil, 319, 319, 362, 217, 362, 362, nil, - 362, 362, nil, 362, nil, 362, nil, 362, nil, 362, - nil, nil, 362, 362, nil, 295, nil, 217, nil, 217, - 217, nil, 217, 217, nil, 217, nil, 217, nil, 217, - nil, 217, nil, nil, 217, 217, 295, nil, 295, 295, - nil, 295, 295, nil, 295, nil, 295, nil, 295, nil, - 295, nil, nil, 295, 295, 0, nil, 0, 0, nil, - 0, 0, nil, 0, nil, 0, nil, 0, nil, 0, - nil, nil, 0, 0 ] + 130, 130, nil, nil, nil, 287, nil, 130, 287, 287, + 287, 287, 287, 287, nil, 287, 287, 291, 291, nil, + nil, nil, 287, nil, nil, nil, 291, 291, 291, 291, + nil, nil, 0, 286, 0, 0, nil, 0, 0, nil, + 0, 286, 0, nil, 0, nil, 0, nil, nil, 0, + 0, nil, 292, nil, 291, 291, 291, 291, 291, 291, + 292, 291, 291, nil, nil, nil, nil, 289, 291, 286, + 286, 286, 286, 286, 286, 289, 286, 286, nil, nil, + nil, nil, nil, 286, nil, nil, 288, nil, 292, 292, + 292, 292, 292, 292, 288, 292, 292, nil, nil, nil, + nil, nil, 292, 289, 289, 289, 289, 289, 289, nil, + 289, 289, nil, nil, 217, nil, nil, 289, nil, nil, + nil, nil, 288, 288, 288, 288, 288, 288, nil, 288, + 288, nil, nil, 380, nil, 217, 288, 217, 217, nil, + 217, 217, nil, 217, nil, 217, nil, 217, nil, 217, + nil, nil, 217, 217, 380, 362, 380, 380, nil, 380, + 380, nil, 380, nil, 380, nil, 380, nil, 380, nil, + nil, 380, 380, nil, 295, nil, 362, nil, 362, 362, + nil, 362, 362, nil, 362, nil, 362, nil, 362, nil, + 362, nil, nil, 362, 362, 295, 212, 295, 295, nil, + 295, 295, nil, 295, nil, 295, nil, 295, nil, 295, + nil, nil, 295, 295, nil, 303, nil, 212, nil, 212, + 212, nil, 212, 212, nil, 212, nil, 212, nil, 212, + nil, 212, nil, nil, 212, 212, 303, 378, 303, 303, + nil, 303, 303, nil, 303, nil, 303, nil, 303, nil, + 303, nil, nil, 303, 303, nil, 323, nil, 378, nil, + 378, 378, nil, 378, 378, nil, 378, nil, 378, nil, + 378, nil, 378, nil, nil, 378, 378, 323, 319, 323, + 323, nil, 323, 323, nil, 323, nil, 323, nil, 323, + nil, 323, nil, nil, 323, 323, nil, 372, nil, 319, + nil, 319, 319, nil, 319, 319, nil, 319, nil, 319, + nil, 319, nil, 319, nil, nil, 319, 319, 372, 374, + 372, 372, nil, 372, 372, nil, 372, nil, 372, nil, + 372, nil, 372, nil, nil, 372, 372, nil, 237, nil, + 374, nil, 374, 374, nil, 374, 374, nil, 374, nil, + 374, nil, 374, nil, 374, nil, nil, 374, 374, 237, + nil, 237, 237, nil, 237, 237, nil, 237, nil, 237, + nil, 237, nil, 237, nil, nil, 237, 237, 293, 293, + 293, 293, 293, 293, nil, 293, 293, nil, nil, nil, + nil, nil, 293, 284, 284, 284, 284, 284, 284, nil, + 284, 284, nil, nil, nil, nil, nil, 284 ] racc_action_pointer = [ - 1795, 163, 443, 413, 433, nil, nil, 3, 434, 420, - nil, nil, 142, nil, nil, nil, 398, 26, nil, 1483, - nil, nil, 80, 271, nil, nil, 297, nil, 367, 348, - 166, nil, nil, 375, 315, 277, 337, nil, nil, 501, - nil, nil, nil, 221, nil, nil, 557, 583, 608, 622, - 315, 329, 348, nil, nil, 4, nil, nil, nil, nil, - nil, nil, 97, 780, 298, -9, 309, 302, 275, nil, - nil, 286, nil, nil, 923, 966, nil, 279, 269, nil, - 6, 248, 1060, nil, 239, 245, -3, 177, nil, nil, - 149, 137, nil, nil, 1209, 10, nil, 1239, nil, nil, - 755, 121, 1137, 225, nil, 233, 3, 299, 301, 304, - nil, 1298, nil, nil, 322, 325, nil, nil, nil, 323, - 205, 331, 144, nil, 1313, nil, nil, 351, nil, nil, - 1359, 1374, 352, 344, nil, nil, 328, nil, 350, 364, - 361, nil, 362, 79, 374, nil, nil, nil, nil, nil, - nil, nil, -9, 408, 386, nil, 2, 452, 30, nil, - 251, nil, nil, 84, nil, 50, nil, nil, nil, nil, - nil, 174, 439, 436, -14, 381, 647, nil, 114, nil, - -4, 57, 75, 197, 172, nil, 1435, nil, 225, nil, - nil, nil, 363, nil, nil, 213, 215, 241, 323, 401, - 453, 527, 32, 673, 699, 729, 1265, 265, 806, 832, - 1070, 249, 1612, 1118, 1166, 270, nil, 1757, 24, 24, - 91, 121, nil, nil, 142, 1044, 126, 161, 1191, 147, - 1144, 198, 233, 238, 273, nil, nil, 1552, nil, 39, - nil, nil, nil, 66, 1017, 1001, nil, nil, 991, nil, - 270, nil, 273, 279, 948, nil, 904, nil, nil, nil, - nil, nil, nil, 451, nil, nil, nil, nil, 283, 850, - nil, nil, -5, nil, 308, nil, 857, 8, nil, 226, - 198, 67, nil, 466, 1073, 86, 172, 1420, 411, 1515, - nil, 1481, 1496, 456, nil, 1776, -4, 356, 443, nil, - 145, nil, nil, 1694, nil, 387, nil, 362, 129, nil, - nil, nil, nil, nil, nil, 380, nil, nil, nil, 1716, - nil, nil, nil, 1634, nil, nil, nil, 376, 383, nil, - 385, 392, 393, nil, nil, nil, nil, 410, nil, nil, + 1462, 191, 448, 416, 336, nil, nil, 3, 443, 440, + nil, nil, 206, nil, nil, nil, 418, 30, nil, 1201, + nil, nil, 80, 241, nil, nil, 266, nil, 284, 317, + 186, nil, nil, 405, 311, 362, 349, nil, nil, 1244, + nil, nil, nil, 142, nil, nil, 489, 515, 540, 554, + 327, 339, 361, nil, nil, 4, nil, nil, nil, nil, + nil, nil, 84, 712, 313, 39, 320, nil, 299, nil, + 293, 281, nil, nil, 861, 908, nil, 261, 265, nil, + 6, 239, 1018, nil, 236, 202, -3, 180, nil, nil, + 147, 26, nil, nil, 1167, 10, 260, 433, nil, nil, + 1141, 137, 1083, 238, nil, 301, 3, 307, 315, 319, + nil, 1277, nil, nil, 335, 337, nil, nil, nil, 334, + 162, 346, 129, nil, 1353, nil, nil, 362, nil, nil, + 1399, 1292, 365, 366, nil, 391, 357, nil, 382, 399, + 389, nil, 393, 115, 423, nil, nil, nil, nil, nil, + nil, nil, -9, 444, 429, nil, 26, 456, 2, nil, + 206, nil, nil, -9, nil, 139, nil, nil, nil, nil, + nil, 301, 441, 433, -14, 400, 579, nil, 121, nil, + -4, 57, 75, 218, 172, nil, 1338, nil, 174, nil, + nil, nil, 381, nil, nil, 239, 215, 292, 382, 407, + 459, 32, 605, 631, 661, 687, 738, 273, 764, 999, + 1025, 178, 1647, 1218, 1160, 37, nil, 1565, 91, 119, + 136, -5, nil, nil, 157, 1069, 132, 178, 1090, 164, + 1076, 173, 205, 220, 239, nil, nil, 1789, nil, 97, + nil, nil, nil, 66, 952, 934, nil, nil, 927, nil, + 268, nil, 271, 278, 855, nil, 836, nil, nil, nil, + nil, nil, nil, 291, nil, nil, nil, nil, 283, 782, + nil, nil, 78, nil, 319, nil, 789, 8, nil, 325, + 67, 249, nil, 793, 1799, 86, 1475, 1414, 1528, 1509, + nil, 1460, 1494, 1784, nil, 1625, -4, 235, 197, nil, + 56, nil, nil, 1666, nil, 356, nil, 331, 144, nil, + nil, nil, nil, nil, nil, 402, nil, nil, nil, 1729, + nil, nil, nil, 1707, nil, nil, nil, 397, 400, nil, + 401, 409, 410, nil, nil, nil, nil, 429, nil, nil, nil, 153, nil, 183, nil, nil, nil, nil, nil, 51, - nil, 128, 430, nil, nil, 110, 435, nil, nil, nil, - nil, nil, 1735, nil, nil, nil, nil, 439, 59, 445, - nil, nil, 1571, nil, 1653, nil, nil, nil, 1593, nil, - 1675, nil, nil, nil ] + nil, 128, 441, nil, nil, 110, 444, nil, nil, nil, + nil, nil, 1606, nil, nil, nil, nil, 445, 59, 449, + nil, nil, 1748, nil, 1770, nil, nil, nil, 1688, nil, + 1584, nil, nil, nil ] racc_action_default = [ -196, -233, -233, -50, -233, -8, -9, -233, -233, -22, @@ -1177,20 +1181,20 @@ Racc_debug_parser = false module_eval <<'.,.,', 'grammar.ra', 46 def _reduce_1( val, _values, result ) - if val[0] - # Make sure we always return an array. - if val[0].is_a?(AST::ASTArray) - if val[0].children.empty? - result = nil - else - result = val[0] - end - else - result = aryfy(val[0]) - end - else + if val[0] + # Make sure we always return an array. + if val[0].is_a?(AST::ASTArray) + if val[0].children.empty? result = nil + else + result = val[0] + end + else + result = aryfy(val[0]) end + else + result = nil + end result end .,., @@ -1202,16 +1206,16 @@ module_eval <<'.,.,', 'grammar.ra', 46 module_eval <<'.,.,', 'grammar.ra', 62 def _reduce_4( val, _values, result ) if val[0] and val[1] - if val[0].instance_of?(AST::ASTArray) - val[0].push(val[1]) - result = val[0] - else - result = ast AST::ASTArray, :children => [val[0],val[1]] - end - elsif obj = (val[0] || val[1]) - result = obj - else result = nil + if val[0].instance_of?(AST::ASTArray) + val[0].push(val[1]) + result = val[0] + else + result = ast AST::ASTArray, :children => [val[0],val[1]] end + elsif obj = (val[0] || val[1]) + result = obj + else result = nil + end result end .,., @@ -1246,7 +1250,7 @@ module_eval <<'.,.,', 'grammar.ra', 62 module_eval <<'.,.,', 'grammar.ra', 82 def _reduce_19( val, _values, result ) - result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context) + result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context) result end .,., @@ -1274,35 +1278,35 @@ module_eval <<'.,.,', 'grammar.ra', 85 module_eval <<'.,.,', 'grammar.ra', 98 def _reduce_28( val, _values, result ) - args = aryfy(val[2]) - result = ast AST::Function, - :name => val[0][:value], - :line => val[0][:line], - :arguments => args, - :ftype => :statement + args = aryfy(val[2]) + result = ast AST::Function, + :name => val[0][:value], + :line => val[0][:line], + :arguments => args, + :ftype => :statement result end .,., module_eval <<'.,.,', 'grammar.ra', 106 def _reduce_29( val, _values, result ) - args = aryfy(val[2]) - result = ast AST::Function, - :name => val[0][:value], - :line => val[0][:line], - :arguments => args, - :ftype => :statement + args = aryfy(val[2]) + result = ast AST::Function, + :name => val[0][:value], + :line => val[0][:line], + :arguments => args, + :ftype => :statement result end .,., module_eval <<'.,.,', 'grammar.ra', 112 def _reduce_30( val, _values, result ) - result = ast AST::Function, - :name => val[0][:value], - :line => val[0][:line], - :arguments => AST::ASTArray.new({}), - :ftype => :statement + result = ast AST::Function, + :name => val[0][:value], + :line => val[0][:line], + :arguments => AST::ASTArray.new({}), + :ftype => :statement result end .,., @@ -1311,10 +1315,10 @@ module_eval <<'.,.,', 'grammar.ra', 120 def _reduce_31( val, _values, result ) args = aryfy(val[1]) result = ast AST::Function, - :name => val[0][:value], - :line => val[0][:line], - :arguments => args, - :ftype => :statement + :name => val[0][:value], + :line => val[0][:line], + :arguments => args, + :ftype => :statement result end .,., @@ -1335,12 +1339,12 @@ module_eval <<'.,.,', 'grammar.ra', 128 module_eval <<'.,.,', 'grammar.ra', 137 def _reduce_35( val, _values, result ) unless val[0].is_a?(AST::ASTArray) - val[0] = aryfy(val[0]) - end + val[0] = aryfy(val[0]) + end - val[0].push(val[2]) + val[0].push(val[2]) - result = val[0] + result = val[0] result end .,., @@ -1363,171 +1367,166 @@ module_eval <<'.,.,', 'grammar.ra', 137 module_eval <<'.,.,', 'grammar.ra', 151 def _reduce_44( val, _values, result ) - result = ast AST::Name, :value => val[0][:value] + result = ast AST::Name, :value => val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 173 +module_eval <<'.,.,', 'grammar.ra', 172 def _reduce_45( val, _values, result ) - @lexer.commentpop - array = val[2] - if array.instance_of?(AST::ResourceInstance) - array = [array] - end - result = ast AST::ASTArray + @lexer.commentpop + array = val[2] + array = [array] if array.instance_of?(AST::ResourceInstance) + result = ast AST::ASTArray - # this iterates across each specified resourceinstance - array.each { |instance| - unless instance.instance_of?(AST::ResourceInstance) - raise Puppet::Dev, "Got something that isn't an instance" - end - # now, i need to somehow differentiate between those things with - # arrays in their names, and normal things - result.push ast(AST::Resource, - :type => val[0], - :title => instance[0], - :parameters => instance[1]) - } + # this iterates across each specified resourceinstance + array.each { |instance| + raise Puppet::Dev, "Got something that isn't an instance" unless instance.instance_of?(AST::ResourceInstance) + # now, i need to somehow differentiate between those things with + # arrays in their names, and normal things + + result.push ast( + AST::Resource, + :type => val[0], + :title => instance[0], + + :parameters => instance[1]) + } result end .,., -module_eval <<'.,.,', 'grammar.ra', 176 +module_eval <<'.,.,', 'grammar.ra', 175 def _reduce_46( val, _values, result ) - # This is a deprecated syntax. - error "All resource specifications require names" + # This is a deprecated syntax. + error "All resource specifications require names" result end .,., -module_eval <<'.,.,', 'grammar.ra', 180 +module_eval <<'.,.,', 'grammar.ra', 179 def _reduce_47( val, _values, result ) - # a defaults setting for a type - @lexer.commentpop - result = ast(AST::ResourceDefaults, :type => val[0], :parameters => val[2]) + # a defaults setting for a type + @lexer.commentpop + result = ast(AST::ResourceDefaults, :type => val[0], :parameters => val[2]) result end .,., -module_eval <<'.,.,', 'grammar.ra', 186 +module_eval <<'.,.,', 'grammar.ra', 185 def _reduce_48( val, _values, result ) - @lexer.commentpop - result = ast AST::ResourceOverride, :object => val[0], :parameters => val[2] + @lexer.commentpop + result = ast AST::ResourceOverride, :object => val[0], :parameters => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 213 +module_eval <<'.,.,', 'grammar.ra', 210 def _reduce_49( val, _values, result ) - type = val[0] + type = val[0] - if (type == :exported and ! Puppet[:storeconfigs]) and ! Puppet[:parseonly] - Puppet.warning addcontext("You cannot collect without storeconfigs being set") - end + if (type == :exported and ! Puppet[:storeconfigs]) and ! Puppet[:parseonly] + Puppet.warning addcontext("You cannot collect without storeconfigs being set") + end - if val[1].is_a? AST::ResourceDefaults - error "Defaults are not virtualizable" - end + error "Defaults are not virtualizable" if val[1].is_a? AST::ResourceDefaults - method = type.to_s + "=" + method = type.to_s + "=" - # Just mark our resources as exported and pass them through. - if val[1].instance_of?(AST::ASTArray) - val[1].each do |obj| - obj.send(method, true) - end - else - val[1].send(method, true) + # Just mark our resources as exported and pass them through. + if val[1].instance_of?(AST::ASTArray) + val[1].each do |obj| + obj.send(method, true) end + else + val[1].send(method, true) + end - result = val[1] + result = val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 214 +module_eval <<'.,.,', 'grammar.ra', 211 def _reduce_50( val, _values, result ) result = :virtual result end .,., -module_eval <<'.,.,', 'grammar.ra', 215 +module_eval <<'.,.,', 'grammar.ra', 212 def _reduce_51( val, _values, result ) result = :exported result end .,., -module_eval <<'.,.,', 'grammar.ra', 240 +module_eval <<'.,.,', 'grammar.ra', 235 def _reduce_52( val, _values, result ) - @lexer.commentpop - if val[0] =~ /^[a-z]/ - Puppet.warning addcontext("Collection names must now be capitalized") - end - type = val[0].downcase - args = {:type => type} + @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] - 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 + 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] + 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', 259 +module_eval <<'.,.,', 'grammar.ra', 254 def _reduce_53( 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 } + 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] - Puppet.warning addcontext("You cannot collect exported resources without storeconfigs being set; the collection will be ignored") - end - result = ast AST::Collection, args + 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] + 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', 269 +module_eval <<'.,.,', 'grammar.ra', 264 def _reduce_54( val, _values, result ) - if val[1] - result = val[1] - result.form = :virtual - else - result = :virtual - end + if val[1] + result = val[1] + result.form = :virtual + else + result = :virtual + end result end .,., -module_eval <<'.,.,', 'grammar.ra', 277 +module_eval <<'.,.,', 'grammar.ra', 272 def _reduce_55( val, _values, result ) if val[1] - result = val[1] - result.form = :exported - else - result = :exported - end + result = val[1] + result.form = :exported + else + result = :exported + end result end .,., @@ -1536,7 +1535,7 @@ module_eval <<'.,.,', 'grammar.ra', 277 # reduce 57 omitted -module_eval <<'.,.,', 'grammar.ra', 285 +module_eval <<'.,.,', 'grammar.ra', 280 def _reduce_58( val, _values, result ) result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2] result @@ -1545,7 +1544,7 @@ module_eval <<'.,.,', 'grammar.ra', 285 # reduce 59 omitted -module_eval <<'.,.,', 'grammar.ra', 291 +module_eval <<'.,.,', 'grammar.ra', 286 def _reduce_60( val, _values, result ) result = val[1] result.parens = true @@ -1553,30 +1552,30 @@ module_eval <<'.,.,', 'grammar.ra', 291 end .,., -module_eval <<'.,.,', 'grammar.ra', 292 +module_eval <<'.,.,', 'grammar.ra', 287 def _reduce_61( val, _values, result ) result=val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 293 +module_eval <<'.,.,', 'grammar.ra', 288 def _reduce_62( val, _values, result ) result=val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 300 +module_eval <<'.,.,', 'grammar.ra', 295 def _reduce_63( 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 = 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', 305 +module_eval <<'.,.,', 'grammar.ra', 300 def _reduce_64( val, _values, result ) result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2] #result = ast AST::CollExpr @@ -1589,23 +1588,23 @@ module_eval <<'.,.,', 'grammar.ra', 305 # reduce 66 omitted -module_eval <<'.,.,', 'grammar.ra', 312 +module_eval <<'.,.,', 'grammar.ra', 307 def _reduce_67( val, _values, result ) - result = ast AST::ResourceInstance, :children => [val[0],val[2]] + result = ast AST::ResourceInstance, :children => [val[0],val[2]] result end .,., # reduce 68 omitted -module_eval <<'.,.,', 'grammar.ra', 322 +module_eval <<'.,.,', 'grammar.ra', 317 def _reduce_69( val, _values, result ) if val[0].instance_of?(AST::ResourceInstance) - result = ast AST::ASTArray, :children => [val[0],val[2]] - else - val[0].push val[2] - result = val[0] - end + result = ast AST::ASTArray, :children => [val[0],val[2]] + else + val[0].push val[2] + result = val[0] + end result end .,., @@ -1614,23 +1613,23 @@ module_eval <<'.,.,', 'grammar.ra', 322 # reduce 71 omitted -module_eval <<'.,.,', 'grammar.ra', 329 +module_eval <<'.,.,', 'grammar.ra', 324 def _reduce_72( val, _values, result ) - result = ast AST::Undef, :value => :undef + result = ast AST::Undef, :value => :undef result end .,., -module_eval <<'.,.,', 'grammar.ra', 333 +module_eval <<'.,.,', 'grammar.ra', 328 def _reduce_73( val, _values, result ) - result = ast AST::Name, :value => val[0][:value], :line => val[0][:line] + result = ast AST::Name, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 337 +module_eval <<'.,.,', 'grammar.ra', 332 def _reduce_74( val, _values, result ) - result = ast AST::Type, :value => val[0][:value], :line => val[0][:line] + result = ast AST::Type, :value => val[0][:value], :line => val[0][:line] result end .,., @@ -1649,70 +1648,68 @@ module_eval <<'.,.,', 'grammar.ra', 337 # reduce 81 omitted -module_eval <<'.,.,', 'grammar.ra', 354 +module_eval <<'.,.,', 'grammar.ra', 347 def _reduce_82( val, _values, result ) - if val[0][:value] =~ /::/ - raise Puppet::ParseError, "Cannot assign to variables in other namespaces" - end - # 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] + 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', 357 +module_eval <<'.,.,', 'grammar.ra', 350 def _reduce_83( val, _values, result ) result = ast AST::VarDef, :name => val[0], :value => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 362 +module_eval <<'.,.,', 'grammar.ra', 355 def _reduce_84( 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] + 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', 367 +module_eval <<'.,.,', 'grammar.ra', 360 def _reduce_85( val, _values, result ) - result = ast AST::ASTArray + result = ast AST::ASTArray result end .,., -module_eval <<'.,.,', 'grammar.ra', 367 +module_eval <<'.,.,', 'grammar.ra', 360 def _reduce_86( val, _values, result ) result = val[0] result end .,., -module_eval <<'.,.,', 'grammar.ra', 376 +module_eval <<'.,.,', 'grammar.ra', 369 def _reduce_87( 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 + 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', 380 +module_eval <<'.,.,', 'grammar.ra', 373 def _reduce_88( val, _values, result ) - result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2] + result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 385 +module_eval <<'.,.,', 'grammar.ra', 378 def _reduce_89( val, _values, result ) - result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2], - :add => true + result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2], + :add => true result end .,., @@ -1721,41 +1718,41 @@ module_eval <<'.,.,', 'grammar.ra', 385 # reduce 91 omitted -module_eval <<'.,.,', 'grammar.ra', 393 +module_eval <<'.,.,', 'grammar.ra', 386 def _reduce_92( val, _values, result ) - result = ast AST::ASTArray + result = ast AST::ASTArray result end .,., -module_eval <<'.,.,', 'grammar.ra', 393 +module_eval <<'.,.,', 'grammar.ra', 386 def _reduce_93( val, _values, result ) result = val[0] result end .,., -module_eval <<'.,.,', 'grammar.ra', 402 +module_eval <<'.,.,', 'grammar.ra', 395 def _reduce_94( 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 + val[0].push(val[2]) + result = val[0] + else + result = ast AST::ASTArray, :children => [val[0],val[2]] + end result end .,., # reduce 95 omitted -module_eval <<'.,.,', 'grammar.ra', 411 +module_eval <<'.,.,', 'grammar.ra', 404 def _reduce_96( val, _values, result ) if val[0].instance_of?(AST::ASTArray) - result = val[0].push(val[2]) - else - result = ast AST::ASTArray, :children => [val[0],val[2]] - end + result = val[0].push(val[2]) + else + result = ast AST::ASTArray, :children => [val[0],val[2]] + end result end .,., @@ -1796,136 +1793,131 @@ module_eval <<'.,.,', 'grammar.ra', 411 # reduce 114 omitted -module_eval <<'.,.,', 'grammar.ra', 440 +module_eval <<'.,.,', 'grammar.ra', 433 def _reduce_115( val, _values, result ) - args = aryfy(val[2]) - result = ast AST::Function, - :name => val[0][:value], :line => val[0][:line], - :arguments => args, - :ftype => :rvalue + args = aryfy(val[2]) + result = ast AST::Function, + :name => val[0][:value], :line => val[0][:line], + :arguments => args, + :ftype => :rvalue result end .,., -module_eval <<'.,.,', 'grammar.ra', 445 +module_eval <<'.,.,', 'grammar.ra', 438 def _reduce_116( val, _values, result ) - result = ast AST::Function, - :name => val[0][:value], :line => val[0][:line], - :arguments => AST::ASTArray.new({}), - :ftype => :rvalue + result = ast AST::Function, + :name => val[0][:value], :line => val[0][:line], + :arguments => AST::ASTArray.new({}), + :ftype => :rvalue result end .,., -module_eval <<'.,.,', 'grammar.ra', 446 +module_eval <<'.,.,', 'grammar.ra', 439 def _reduce_117( val, _values, result ) result = ast AST::String, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 447 +module_eval <<'.,.,', 'grammar.ra', 440 def _reduce_118( 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', 449 +module_eval <<'.,.,', 'grammar.ra', 442 def _reduce_119( val, _values, result ) result = [val[0]] + val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 451 +module_eval <<'.,.,', 'grammar.ra', 444 def _reduce_120( val, _values, result ) result = [ast(AST::String,val[0])] result end .,., -module_eval <<'.,.,', 'grammar.ra', 452 +module_eval <<'.,.,', 'grammar.ra', 445 def _reduce_121( val, _values, result ) result = [ast(AST::String,val[0])] + val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 457 +module_eval <<'.,.,', 'grammar.ra', 450 def _reduce_122( val, _values, result ) - result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line] + result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 462 +module_eval <<'.,.,', 'grammar.ra', 455 def _reduce_123( 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] + 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', 464 +module_eval <<'.,.,', 'grammar.ra', 457 def _reduce_124( val, _values, result ) - result = ast AST::ResourceReference, :type => val[0], :title => val[2] + result = ast AST::ResourceReference, :type => val[0], :title => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 468 +module_eval <<'.,.,', 'grammar.ra', 461 def _reduce_125( val, _values, result ) - result = val[1] + result = val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 482 +module_eval <<'.,.,', 'grammar.ra', 473 def _reduce_126( val, _values, result ) - @lexer.commentpop - args = { - :test => val[0], - :statements => val[2] - } + @lexer.commentpop + args = { + :test => val[0], + :statements => val[2] + } - if val[4] - args[:else] = val[4] - end + args[:else] = val[4] if val[4] - result = ast AST::IfStatement, args + result = ast AST::IfStatement, args result end .,., -module_eval <<'.,.,', 'grammar.ra', 495 +module_eval <<'.,.,', 'grammar.ra', 484 def _reduce_127( val, _values, result ) @lexer.commentpop args = { - :test => val[0], - :statements => ast(AST::Nop) - } + :test => val[0], + :statements => ast(AST::Nop) + } - if val[3] - args[:else] = val[3] - end + args[:else] = val[3] if val[3] - result = ast AST::IfStatement, args + result = ast AST::IfStatement, args result end .,., # reduce 128 omitted -module_eval <<'.,.,', 'grammar.ra', 501 +module_eval <<'.,.,', 'grammar.ra', 489 def _reduce_129( val, _values, result ) - #@lexer.commentpop result = ast AST::Else, :statements => val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 505 +module_eval <<'.,.,', 'grammar.ra', 493 def _reduce_130( val, _values, result ) @lexer.commentpop result = ast AST::Else, :statements => val[2] @@ -1933,7 +1925,7 @@ module_eval <<'.,.,', 'grammar.ra', 505 end .,., -module_eval <<'.,.,', 'grammar.ra', 509 +module_eval <<'.,.,', 'grammar.ra', 497 def _reduce_131( val, _values, result ) @lexer.commentpop result = ast AST::Else, :statements => ast(AST::Nop) @@ -1943,215 +1935,216 @@ module_eval <<'.,.,', 'grammar.ra', 509 # reduce 132 omitted -module_eval <<'.,.,', 'grammar.ra', 526 +module_eval <<'.,.,', 'grammar.ra', 514 def _reduce_133( val, _values, result ) result = ast AST::InOperator, :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 529 +module_eval <<'.,.,', 'grammar.ra', 517 def _reduce_134( val, _values, result ) result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 532 +module_eval <<'.,.,', 'grammar.ra', 520 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', 535 +module_eval <<'.,.,', 'grammar.ra', 523 def _reduce_136( val, _values, result ) result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 538 +module_eval <<'.,.,', 'grammar.ra', 526 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', 541 +module_eval <<'.,.,', 'grammar.ra', 529 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', 544 +module_eval <<'.,.,', 'grammar.ra', 532 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', 547 +module_eval <<'.,.,', 'grammar.ra', 535 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', 550 +module_eval <<'.,.,', 'grammar.ra', 538 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', 553 +module_eval <<'.,.,', 'grammar.ra', 541 def _reduce_142( val, _values, result ) result = ast AST::Minus, :value => val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 556 +module_eval <<'.,.,', 'grammar.ra', 544 def _reduce_143( val, _values, result ) result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 559 +module_eval <<'.,.,', 'grammar.ra', 547 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', 562 +module_eval <<'.,.,', 'grammar.ra', 550 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', 565 +module_eval <<'.,.,', 'grammar.ra', 553 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', 568 +module_eval <<'.,.,', 'grammar.ra', 556 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', 571 +module_eval <<'.,.,', 'grammar.ra', 559 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', 574 +module_eval <<'.,.,', 'grammar.ra', 562 def _reduce_149( val, _values, result ) result = ast AST::Not, :value => val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 577 +module_eval <<'.,.,', 'grammar.ra', 565 def _reduce_150( val, _values, result ) result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 580 +module_eval <<'.,.,', 'grammar.ra', 568 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', 583 +module_eval <<'.,.,', 'grammar.ra', 571 def _reduce_152( val, _values, result ) result = val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 592 +module_eval <<'.,.,', 'grammar.ra', 578 def _reduce_153( val, _values, result ) - @lexer.commentpop - options = val[3] - unless options.instance_of?(AST::ASTArray) - options = ast AST::ASTArray, :children => [val[3]] - end - result = ast AST::CaseStatement, :test => val[1], :options => options + @lexer.commentpop + options = val[3] + options = ast AST::ASTArray, :children => [val[3]] unless options.instance_of?(AST::ASTArray) + result = ast AST::CaseStatement, :test => val[1], :options => options result end .,., # reduce 154 omitted -module_eval <<'.,.,', 'grammar.ra', 602 +module_eval <<'.,.,', 'grammar.ra', 588 def _reduce_155( val, _values, result ) if val[0].instance_of?(AST::ASTArray) - val[0].push val[1] - result = val[0] - else - result = ast AST::ASTArray, :children => [val[0], val[1]] - end + val[0].push val[1] + result = val[0] + else + result = ast AST::ASTArray, :children => [val[0], val[1]] + end result end .,., -module_eval <<'.,.,', 'grammar.ra', 607 +module_eval <<'.,.,', 'grammar.ra', 593 def _reduce_156( val, _values, result ) - @lexer.commentpop - result = ast AST::CaseOpt, :value => val[0], :statements => val[3] + @lexer.commentpop + result = ast AST::CaseOpt, :value => val[0], :statements => val[3] result end .,., -module_eval <<'.,.,', 'grammar.ra', 613 +module_eval <<'.,.,', 'grammar.ra', 602 def _reduce_157( val, _values, result ) - @lexer.commentpop - result = ast(AST::CaseOpt, - :value => val[0], - :statements => ast(AST::ASTArray) - ) + @lexer.commentpop + + result = ast( + AST::CaseOpt, + :value => val[0], + + :statements => ast(AST::ASTArray) + ) result end .,., # reduce 158 omitted -module_eval <<'.,.,', 'grammar.ra', 623 +module_eval <<'.,.,', 'grammar.ra', 612 def _reduce_159( 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 + 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', 627 +module_eval <<'.,.,', 'grammar.ra', 616 def _reduce_160( val, _values, result ) - result = ast AST::Selector, :param => val[0], :values => val[2] + result = ast AST::Selector, :param => val[0], :values => val[2] result end .,., # reduce 161 omitted -module_eval <<'.,.,', 'grammar.ra', 633 +module_eval <<'.,.,', 'grammar.ra', 622 def _reduce_162( val, _values, result ) @lexer.commentpop result = val[1] @@ -2161,21 +2154,21 @@ module_eval <<'.,.,', 'grammar.ra', 633 # reduce 163 omitted -module_eval <<'.,.,', 'grammar.ra', 643 +module_eval <<'.,.,', 'grammar.ra', 632 def _reduce_164( 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 + 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', 647 +module_eval <<'.,.,', 'grammar.ra', 636 def _reduce_165( val, _values, result ) - result = ast AST::ResourceParam, :param => val[0], :value => val[2] + result = ast AST::ResourceParam, :param => val[0], :value => val[2] result end .,., @@ -2194,7 +2187,7 @@ module_eval <<'.,.,', 'grammar.ra', 647 # reduce 172 omitted -module_eval <<'.,.,', 'grammar.ra', 658 +module_eval <<'.,.,', 'grammar.ra', 647 def _reduce_173( val, _values, result ) result = ast AST::Default, :value => val[0][:value], :line => val[0][:line] result @@ -2203,7 +2196,7 @@ module_eval <<'.,.,', 'grammar.ra', 658 # reduce 174 omitted -module_eval <<'.,.,', 'grammar.ra', 661 +module_eval <<'.,.,', 'grammar.ra', 650 def _reduce_175( val, _values, result ) result = [val[0][:value]] result @@ -2212,108 +2205,108 @@ module_eval <<'.,.,', 'grammar.ra', 661 # reduce 176 omitted -module_eval <<'.,.,', 'grammar.ra', 663 +module_eval <<'.,.,', 'grammar.ra', 652 def _reduce_177( val, _values, result ) result = val[0] += val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 672 +module_eval <<'.,.,', 'grammar.ra', 661 def _reduce_178( val, _values, result ) - val[1].each do |file| - import(file) - end + val[1].each do |file| + import(file) + end - result = AST::ASTArray.new(:children => []) + result = AST::ASTArray.new(:children => []) result end .,., -module_eval <<'.,.,', 'grammar.ra', 683 +module_eval <<'.,.,', 'grammar.ra', 672 def _reduce_179( val, _values, result ) - @lexer.commentpop - newdefine classname(val[1]), :arguments => val[2], :code => val[4], :line => val[0][:line] - @lexer.indefine = false - result = nil + @lexer.commentpop + newdefine classname(val[1]), :arguments => val[2], :code => val[4], :line => val[0][:line] + @lexer.indefine = false + result = nil #} | DEFINE NAME argumentlist parent LBRACE RBRACE { result end .,., -module_eval <<'.,.,', 'grammar.ra', 688 +module_eval <<'.,.,', 'grammar.ra', 677 def _reduce_180( val, _values, result ) - @lexer.commentpop - newdefine classname(val[1]), :arguments => val[2], :line => val[0][:line] - @lexer.indefine = false - result = nil + @lexer.commentpop + newdefine classname(val[1]), :arguments => val[2], :line => val[0][:line] + @lexer.indefine = false + result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 697 +module_eval <<'.,.,', 'grammar.ra', 686 def _reduce_181( val, _values, result ) - @lexer.commentpop - # Our class gets defined in the parent namespace, not our own. - @lexer.namepop - newclass classname(val[1]), :arguments => val[2], :parent => val[3], :code => val[5], :line => val[0][:line] - result = nil + @lexer.commentpop + # Our class gets defined in the parent namespace, not our own. + @lexer.namepop + newclass classname(val[1]), :arguments => val[2], :parent => val[3], :code => val[5], :line => val[0][:line] + result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 703 +module_eval <<'.,.,', 'grammar.ra', 692 def _reduce_182( val, _values, result ) - @lexer.commentpop - # Our class gets defined in the parent namespace, not our own. - @lexer.namepop - newclass classname(val[1]), :arguments => val[2], :parent => val[3], :line => val[0][:line] - result = nil + @lexer.commentpop + # Our class gets defined in the parent namespace, not our own. + @lexer.namepop + newclass classname(val[1]), :arguments => val[2], :parent => val[3], :line => val[0][:line] + result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 709 +module_eval <<'.,.,', 'grammar.ra', 698 def _reduce_183( val, _values, result ) - @lexer.commentpop - newnode val[1], :parent => val[2], :code => val[4], :line => val[0][:line] - result = nil + @lexer.commentpop + newnode val[1], :parent => val[2], :code => val[4], :line => val[0][:line] + result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 713 +module_eval <<'.,.,', 'grammar.ra', 702 def _reduce_184( val, _values, result ) - @lexer.commentpop - newnode val[1], :parent => val[2], :line => val[0][:line] - result = nil + @lexer.commentpop + newnode val[1], :parent => val[2], :line => val[0][:line] + result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 714 +module_eval <<'.,.,', 'grammar.ra', 703 def _reduce_185( val, _values, result ) result = val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 716 +module_eval <<'.,.,', 'grammar.ra', 705 def _reduce_186( val, _values, result ) result = val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 717 +module_eval <<'.,.,', 'grammar.ra', 706 def _reduce_187( val, _values, result ) result = val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 718 +module_eval <<'.,.,', 'grammar.ra', 707 def _reduce_188( val, _values, result ) result = "class" result @@ -2322,7 +2315,7 @@ module_eval <<'.,.,', 'grammar.ra', 718 # reduce 189 omitted -module_eval <<'.,.,', 'grammar.ra', 728 +module_eval <<'.,.,', 'grammar.ra', 717 def _reduce_190( val, _values, result ) result = val[0] result = [result] unless result.is_a?(Array) @@ -2331,28 +2324,28 @@ module_eval <<'.,.,', 'grammar.ra', 728 end .,., -module_eval <<'.,.,', 'grammar.ra', 732 +module_eval <<'.,.,', 'grammar.ra', 721 def _reduce_191( val, _values, result ) - result = ast AST::HostName, :value => val[0] + result = ast AST::HostName, :value => val[0] result end .,., -module_eval <<'.,.,', 'grammar.ra', 733 +module_eval <<'.,.,', 'grammar.ra', 722 def _reduce_192( val, _values, result ) result = val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 734 +module_eval <<'.,.,', 'grammar.ra', 723 def _reduce_193( val, _values, result ) result = val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 735 +module_eval <<'.,.,', 'grammar.ra', 724 def _reduce_194( val, _values, result ) result = val[0][:value] result @@ -2361,30 +2354,30 @@ module_eval <<'.,.,', 'grammar.ra', 735 # reduce 195 omitted -module_eval <<'.,.,', 'grammar.ra', 741 +module_eval <<'.,.,', 'grammar.ra', 730 def _reduce_196( val, _values, result ) - result = nil + result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 745 +module_eval <<'.,.,', 'grammar.ra', 734 def _reduce_197( val, _values, result ) - result = ast AST::ASTArray, :children => [] + result = ast AST::ASTArray, :children => [] result end .,., # reduce 198 omitted -module_eval <<'.,.,', 'grammar.ra', 750 +module_eval <<'.,.,', 'grammar.ra', 739 def _reduce_199( val, _values, result ) result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 754 +module_eval <<'.,.,', 'grammar.ra', 743 def _reduce_200( val, _values, result ) result = val[1] result = [result] unless result[0].is_a?(Array) @@ -2394,7 +2387,7 @@ module_eval <<'.,.,', 'grammar.ra', 754 # reduce 201 omitted -module_eval <<'.,.,', 'grammar.ra', 761 +module_eval <<'.,.,', 'grammar.ra', 750 def _reduce_202( val, _values, result ) result = val[0] result = [result] unless result[0].is_a?(Array) @@ -2403,15 +2396,15 @@ module_eval <<'.,.,', 'grammar.ra', 761 end .,., -module_eval <<'.,.,', 'grammar.ra', 766 +module_eval <<'.,.,', 'grammar.ra', 755 def _reduce_203( val, _values, result ) - Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") - result = [val[0][:value], val[2]] + Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") + result = [val[0][:value], val[2]] result end .,., -module_eval <<'.,.,', 'grammar.ra', 770 +module_eval <<'.,.,', 'grammar.ra', 759 def _reduce_204( val, _values, result ) Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") result = [val[0][:value]] @@ -2419,23 +2412,23 @@ module_eval <<'.,.,', 'grammar.ra', 770 end .,., -module_eval <<'.,.,', 'grammar.ra', 772 +module_eval <<'.,.,', 'grammar.ra', 761 def _reduce_205( val, _values, result ) - result = [val[0][:value], val[2]] + result = [val[0][:value], val[2]] result end .,., -module_eval <<'.,.,', 'grammar.ra', 774 +module_eval <<'.,.,', 'grammar.ra', 763 def _reduce_206( val, _values, result ) - result = [val[0][:value]] + result = [val[0][:value]] result end .,., # reduce 207 omitted -module_eval <<'.,.,', 'grammar.ra', 779 +module_eval <<'.,.,', 'grammar.ra', 768 def _reduce_208( val, _values, result ) result = val[1] result @@ -2444,7 +2437,7 @@ module_eval <<'.,.,', 'grammar.ra', 779 # reduce 209 omitted -module_eval <<'.,.,', 'grammar.ra', 784 +module_eval <<'.,.,', 'grammar.ra', 773 def _reduce_210( val, _values, result ) result = val[1] result @@ -2455,38 +2448,38 @@ module_eval <<'.,.,', 'grammar.ra', 784 # reduce 212 omitted -module_eval <<'.,.,', 'grammar.ra', 790 +module_eval <<'.,.,', 'grammar.ra', 779 def _reduce_213( val, _values, result ) - result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line] + result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 798 +module_eval <<'.,.,', 'grammar.ra', 787 def _reduce_214( val, _values, result ) - if val[1].instance_of?(AST::ASTArray) - result = val[1] - else - result = ast AST::ASTArray, :children => [val[1]] - end + if val[1].instance_of?(AST::ASTArray) + result = val[1] + else + result = ast AST::ASTArray, :children => [val[1]] + end result end .,., -module_eval <<'.,.,', 'grammar.ra', 805 +module_eval <<'.,.,', 'grammar.ra', 794 def _reduce_215( val, _values, result ) if val[1].instance_of?(AST::ASTArray) - result = val[1] - else - result = ast AST::ASTArray, :children => [val[1]] - end + result = val[1] + else + result = ast AST::ASTArray, :children => [val[1]] + end result end .,., -module_eval <<'.,.,', 'grammar.ra', 807 +module_eval <<'.,.,', 'grammar.ra', 796 def _reduce_216( val, _values, result ) - result = ast AST::ASTArray + result = ast AST::ASTArray result end .,., @@ -2497,94 +2490,94 @@ module_eval <<'.,.,', 'grammar.ra', 807 # reduce 219 omitted -module_eval <<'.,.,', 'grammar.ra', 812 +module_eval <<'.,.,', 'grammar.ra', 801 def _reduce_220( val, _values, result ) result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 817 +module_eval <<'.,.,', 'grammar.ra', 806 def _reduce_221( val, _values, result ) - result = ast AST::Regex, :value => val[0][:value] + result = ast AST::Regex, :value => val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 825 +module_eval <<'.,.,', 'grammar.ra', 814 def _reduce_222( val, _values, result ) - if val[1].instance_of?(AST::ASTHash) - result = val[1] - else - result = ast AST::ASTHash, { :value => val[1] } - end + 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', 832 +module_eval <<'.,.,', 'grammar.ra', 821 def _reduce_223( val, _values, result ) if val[1].instance_of?(AST::ASTHash) - result = val[1] - else - result = ast AST::ASTHash, { :value => val[1] } - end + result = val[1] + else + result = ast AST::ASTHash, { :value => val[1] } + end result end .,., -module_eval <<'.,.,', 'grammar.ra', 834 +module_eval <<'.,.,', 'grammar.ra', 823 def _reduce_224( val, _values, result ) - result = ast AST::ASTHash + result = ast AST::ASTHash result end .,., # reduce 225 omitted -module_eval <<'.,.,', 'grammar.ra', 844 +module_eval <<'.,.,', 'grammar.ra', 833 def _reduce_226( 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 = val[0].merge(val[2]) + else + result = ast AST::ASTHash, :value => val[0] + result.merge(val[2]) + end result end .,., -module_eval <<'.,.,', 'grammar.ra', 848 +module_eval <<'.,.,', 'grammar.ra', 837 def _reduce_227( val, _values, result ) - result = ast AST::ASTHash, { :value => { val[0] => val[2] } } + result = ast AST::ASTHash, { :value => { val[0] => val[2] } } result end .,., -module_eval <<'.,.,', 'grammar.ra', 849 +module_eval <<'.,.,', 'grammar.ra', 838 def _reduce_228( val, _values, result ) result = val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 850 +module_eval <<'.,.,', 'grammar.ra', 839 def _reduce_229( val, _values, result ) result = val[0] result end .,., -module_eval <<'.,.,', 'grammar.ra', 855 +module_eval <<'.,.,', 'grammar.ra', 844 def _reduce_230( val, _values, result ) - result = ast AST::HashOrArrayAccess, :variable => val[0][:value], :key => val[2] + result = ast AST::HashOrArrayAccess, :variable => val[0][:value], :key => val[2] result end .,., # reduce 231 omitted -module_eval <<'.,.,', 'grammar.ra', 860 +module_eval <<'.,.,', 'grammar.ra', 849 def _reduce_232( val, _values, result ) result = ast AST::HashOrArrayAccess, :variable => val[0], :key => val[2] result diff --git a/spec/integration/parser/parser_spec.rb b/spec/integration/parser/parser_spec.rb index 7b85bcacb..20d87c228 100755 --- a/spec/integration/parser/parser_spec.rb +++ b/spec/integration/parser/parser_spec.rb @@ -109,5 +109,12 @@ describe Puppet::Parser::Parser do it "should correctly set the arrow type of a relationship" do "Notify[foo] <~ Notify[bar]".should parse_with { |rel| rel.arrow == "<~" } end + + it "should be able to parse deep hash access" do + %q{ + $hash = { 'a' => { 'b' => { 'c' => 'it works' } } } + $out = $hash['a']['b']['c'] + }.should parse_with { |v| v.value.is_a?(Puppet::Parser::AST::ASTHash) } + end end end -- cgit From 414e3a5989c4c1010af0c5d3f61af2608d91d9b8 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Sat, 12 Feb 2011 17:34:35 +0100 Subject: Fix #5516 - Hashes can't be used in selectors The following manifest was producing a parse error: $int = { 'eth0' => 'bla' } $foo = $int['eth0'] ? { 'bla' => 'foo', default => 'bleh' } because selectors didn't support hash access. Signed-off-by: Brice Figureau --- lib/puppet/parser/grammar.ra | 1 + lib/puppet/parser/parser.rb | 841 ++++++++++++++++++++-------------------- spec/unit/parser/parser_spec.rb | 6 + 3 files changed, 422 insertions(+), 426 deletions(-) diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index 7a316d4d7..3a386d89a 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -642,6 +642,7 @@ selectlhand: name | funcrvalue | boolean | undef + | hasharrayaccess | DEFAULT { result = ast AST::Default, :value => val[0][:value], :line => val[0][:line] } diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index 5be9e5a3f..d68cd05e7 100644 --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -13,9 +13,9 @@ require 'puppet/parser/lexer' require 'puppet/parser/ast' module Puppet - class ParseError < Puppet::Error; end - class ImportError < Racc::ParseError; end - class AlreadyImportedError < ImportError; end + class ParseError < Puppet::Error; end + class ImportError < Racc::ParseError; end + class AlreadyImportedError < ImportError; end end @@ -25,7 +25,7 @@ module Puppet class Parser < Racc::Parser -module_eval <<'..end grammar.ra modeval..id7145220b1b', 'grammar.ra', 876 +module_eval <<'..end grammar.ra modeval..id6535ba0b91', 'grammar.ra', 865 # It got too annoying having code in a file that needs to be compiled. require 'puppet/parser/parser_support' @@ -37,7 +37,7 @@ require 'puppet/parser/parser_support' # $Id$ -..end grammar.ra modeval..id7145220b1b +..end grammar.ra modeval..id6535ba0b91 ##### racc 1.4.5 generates ### @@ -1177,20 +1177,20 @@ Racc_debug_parser = false module_eval <<'.,.,', 'grammar.ra', 46 def _reduce_1( val, _values, result ) - if val[0] - # Make sure we always return an array. - if val[0].is_a?(AST::ASTArray) - if val[0].children.empty? - result = nil - else - result = val[0] - end - else - result = aryfy(val[0]) - end - else + if val[0] + # Make sure we always return an array. + if val[0].is_a?(AST::ASTArray) + if val[0].children.empty? result = nil + else + result = val[0] + end + else + result = aryfy(val[0]) end + else + result = nil + end result end .,., @@ -1202,16 +1202,16 @@ module_eval <<'.,.,', 'grammar.ra', 46 module_eval <<'.,.,', 'grammar.ra', 62 def _reduce_4( val, _values, result ) if val[0] and val[1] - if val[0].instance_of?(AST::ASTArray) - val[0].push(val[1]) - result = val[0] - else - result = ast AST::ASTArray, :children => [val[0],val[1]] - end - elsif obj = (val[0] || val[1]) - result = obj - else result = nil + if val[0].instance_of?(AST::ASTArray) + val[0].push(val[1]) + result = val[0] + else + result = ast AST::ASTArray, :children => [val[0],val[1]] end + elsif obj = (val[0] || val[1]) + result = obj + else result = nil + end result end .,., @@ -1246,7 +1246,7 @@ module_eval <<'.,.,', 'grammar.ra', 62 module_eval <<'.,.,', 'grammar.ra', 82 def _reduce_19( val, _values, result ) - result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context) + result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context) result end .,., @@ -1274,35 +1274,35 @@ module_eval <<'.,.,', 'grammar.ra', 85 module_eval <<'.,.,', 'grammar.ra', 98 def _reduce_28( val, _values, result ) - args = aryfy(val[2]) - result = ast AST::Function, - :name => val[0][:value], - :line => val[0][:line], - :arguments => args, - :ftype => :statement + args = aryfy(val[2]) + result = ast AST::Function, + :name => val[0][:value], + :line => val[0][:line], + :arguments => args, + :ftype => :statement result end .,., module_eval <<'.,.,', 'grammar.ra', 106 def _reduce_29( val, _values, result ) - args = aryfy(val[2]) - result = ast AST::Function, - :name => val[0][:value], - :line => val[0][:line], - :arguments => args, - :ftype => :statement + args = aryfy(val[2]) + result = ast AST::Function, + :name => val[0][:value], + :line => val[0][:line], + :arguments => args, + :ftype => :statement result end .,., module_eval <<'.,.,', 'grammar.ra', 112 def _reduce_30( val, _values, result ) - result = ast AST::Function, - :name => val[0][:value], - :line => val[0][:line], - :arguments => AST::ASTArray.new({}), - :ftype => :statement + result = ast AST::Function, + :name => val[0][:value], + :line => val[0][:line], + :arguments => AST::ASTArray.new({}), + :ftype => :statement result end .,., @@ -1311,10 +1311,10 @@ module_eval <<'.,.,', 'grammar.ra', 120 def _reduce_31( val, _values, result ) args = aryfy(val[1]) result = ast AST::Function, - :name => val[0][:value], - :line => val[0][:line], - :arguments => args, - :ftype => :statement + :name => val[0][:value], + :line => val[0][:line], + :arguments => args, + :ftype => :statement result end .,., @@ -1335,12 +1335,12 @@ module_eval <<'.,.,', 'grammar.ra', 128 module_eval <<'.,.,', 'grammar.ra', 137 def _reduce_35( val, _values, result ) unless val[0].is_a?(AST::ASTArray) - val[0] = aryfy(val[0]) - end + val[0] = aryfy(val[0]) + end - val[0].push(val[2]) + val[0].push(val[2]) - result = val[0] + result = val[0] result end .,., @@ -1363,171 +1363,166 @@ module_eval <<'.,.,', 'grammar.ra', 137 module_eval <<'.,.,', 'grammar.ra', 151 def _reduce_44( val, _values, result ) - result = ast AST::Name, :value => val[0][:value] + result = ast AST::Name, :value => val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 173 +module_eval <<'.,.,', 'grammar.ra', 172 def _reduce_45( val, _values, result ) - @lexer.commentpop - array = val[2] - if array.instance_of?(AST::ResourceInstance) - array = [array] - end - result = ast AST::ASTArray + @lexer.commentpop + array = val[2] + array = [array] if array.instance_of?(AST::ResourceInstance) + result = ast AST::ASTArray - # this iterates across each specified resourceinstance - array.each { |instance| - unless instance.instance_of?(AST::ResourceInstance) - raise Puppet::Dev, "Got something that isn't an instance" - end - # now, i need to somehow differentiate between those things with - # arrays in their names, and normal things - result.push ast(AST::Resource, - :type => val[0], - :title => instance[0], - :parameters => instance[1]) - } + # this iterates across each specified resourceinstance + array.each { |instance| + raise Puppet::Dev, "Got something that isn't an instance" unless instance.instance_of?(AST::ResourceInstance) + # now, i need to somehow differentiate between those things with + # arrays in their names, and normal things + + result.push ast( + AST::Resource, + :type => val[0], + :title => instance[0], + + :parameters => instance[1]) + } result end .,., -module_eval <<'.,.,', 'grammar.ra', 176 +module_eval <<'.,.,', 'grammar.ra', 175 def _reduce_46( val, _values, result ) - # This is a deprecated syntax. - error "All resource specifications require names" + # This is a deprecated syntax. + error "All resource specifications require names" result end .,., -module_eval <<'.,.,', 'grammar.ra', 180 +module_eval <<'.,.,', 'grammar.ra', 179 def _reduce_47( val, _values, result ) - # a defaults setting for a type - @lexer.commentpop - result = ast(AST::ResourceDefaults, :type => val[0], :parameters => val[2]) + # a defaults setting for a type + @lexer.commentpop + result = ast(AST::ResourceDefaults, :type => val[0], :parameters => val[2]) result end .,., -module_eval <<'.,.,', 'grammar.ra', 186 +module_eval <<'.,.,', 'grammar.ra', 185 def _reduce_48( val, _values, result ) - @lexer.commentpop - result = ast AST::ResourceOverride, :object => val[0], :parameters => val[2] + @lexer.commentpop + result = ast AST::ResourceOverride, :object => val[0], :parameters => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 213 +module_eval <<'.,.,', 'grammar.ra', 210 def _reduce_49( val, _values, result ) - type = val[0] + type = val[0] - if (type == :exported and ! Puppet[:storeconfigs]) and ! Puppet[:parseonly] - Puppet.warning addcontext("You cannot collect without storeconfigs being set") - end + if (type == :exported and ! Puppet[:storeconfigs]) and ! Puppet[:parseonly] + Puppet.warning addcontext("You cannot collect without storeconfigs being set") + end - if val[1].is_a? AST::ResourceDefaults - error "Defaults are not virtualizable" - end + error "Defaults are not virtualizable" if val[1].is_a? AST::ResourceDefaults - method = type.to_s + "=" + method = type.to_s + "=" - # Just mark our resources as exported and pass them through. - if val[1].instance_of?(AST::ASTArray) - val[1].each do |obj| - obj.send(method, true) - end - else - val[1].send(method, true) + # Just mark our resources as exported and pass them through. + if val[1].instance_of?(AST::ASTArray) + val[1].each do |obj| + obj.send(method, true) end + else + val[1].send(method, true) + end - result = val[1] + result = val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 214 +module_eval <<'.,.,', 'grammar.ra', 211 def _reduce_50( val, _values, result ) result = :virtual result end .,., -module_eval <<'.,.,', 'grammar.ra', 215 +module_eval <<'.,.,', 'grammar.ra', 212 def _reduce_51( val, _values, result ) result = :exported result end .,., -module_eval <<'.,.,', 'grammar.ra', 240 +module_eval <<'.,.,', 'grammar.ra', 235 def _reduce_52( val, _values, result ) - @lexer.commentpop - if val[0] =~ /^[a-z]/ - Puppet.warning addcontext("Collection names must now be capitalized") - end - type = val[0].downcase - args = {:type => type} + @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] - 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 + 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] + 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', 259 +module_eval <<'.,.,', 'grammar.ra', 254 def _reduce_53( 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 } + 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] - Puppet.warning addcontext("You cannot collect exported resources without storeconfigs being set; the collection will be ignored") - end - result = ast AST::Collection, args + 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] + 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', 269 +module_eval <<'.,.,', 'grammar.ra', 264 def _reduce_54( val, _values, result ) - if val[1] - result = val[1] - result.form = :virtual - else - result = :virtual - end + if val[1] + result = val[1] + result.form = :virtual + else + result = :virtual + end result end .,., -module_eval <<'.,.,', 'grammar.ra', 277 +module_eval <<'.,.,', 'grammar.ra', 272 def _reduce_55( val, _values, result ) if val[1] - result = val[1] - result.form = :exported - else - result = :exported - end + result = val[1] + result.form = :exported + else + result = :exported + end result end .,., @@ -1536,7 +1531,7 @@ module_eval <<'.,.,', 'grammar.ra', 277 # reduce 57 omitted -module_eval <<'.,.,', 'grammar.ra', 285 +module_eval <<'.,.,', 'grammar.ra', 280 def _reduce_58( val, _values, result ) result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2] result @@ -1545,7 +1540,7 @@ module_eval <<'.,.,', 'grammar.ra', 285 # reduce 59 omitted -module_eval <<'.,.,', 'grammar.ra', 291 +module_eval <<'.,.,', 'grammar.ra', 286 def _reduce_60( val, _values, result ) result = val[1] result.parens = true @@ -1553,30 +1548,30 @@ module_eval <<'.,.,', 'grammar.ra', 291 end .,., -module_eval <<'.,.,', 'grammar.ra', 292 +module_eval <<'.,.,', 'grammar.ra', 287 def _reduce_61( val, _values, result ) result=val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 293 +module_eval <<'.,.,', 'grammar.ra', 288 def _reduce_62( val, _values, result ) result=val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 300 +module_eval <<'.,.,', 'grammar.ra', 295 def _reduce_63( 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 = 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', 305 +module_eval <<'.,.,', 'grammar.ra', 300 def _reduce_64( val, _values, result ) result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2] #result = ast AST::CollExpr @@ -1589,23 +1584,23 @@ module_eval <<'.,.,', 'grammar.ra', 305 # reduce 66 omitted -module_eval <<'.,.,', 'grammar.ra', 312 +module_eval <<'.,.,', 'grammar.ra', 307 def _reduce_67( val, _values, result ) - result = ast AST::ResourceInstance, :children => [val[0],val[2]] + result = ast AST::ResourceInstance, :children => [val[0],val[2]] result end .,., # reduce 68 omitted -module_eval <<'.,.,', 'grammar.ra', 322 +module_eval <<'.,.,', 'grammar.ra', 317 def _reduce_69( val, _values, result ) if val[0].instance_of?(AST::ResourceInstance) - result = ast AST::ASTArray, :children => [val[0],val[2]] - else - val[0].push val[2] - result = val[0] - end + result = ast AST::ASTArray, :children => [val[0],val[2]] + else + val[0].push val[2] + result = val[0] + end result end .,., @@ -1614,23 +1609,23 @@ module_eval <<'.,.,', 'grammar.ra', 322 # reduce 71 omitted -module_eval <<'.,.,', 'grammar.ra', 329 +module_eval <<'.,.,', 'grammar.ra', 324 def _reduce_72( val, _values, result ) - result = ast AST::Undef, :value => :undef + result = ast AST::Undef, :value => :undef result end .,., -module_eval <<'.,.,', 'grammar.ra', 333 +module_eval <<'.,.,', 'grammar.ra', 328 def _reduce_73( val, _values, result ) - result = ast AST::Name, :value => val[0][:value], :line => val[0][:line] + result = ast AST::Name, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 337 +module_eval <<'.,.,', 'grammar.ra', 332 def _reduce_74( val, _values, result ) - result = ast AST::Type, :value => val[0][:value], :line => val[0][:line] + result = ast AST::Type, :value => val[0][:value], :line => val[0][:line] result end .,., @@ -1649,70 +1644,68 @@ module_eval <<'.,.,', 'grammar.ra', 337 # reduce 81 omitted -module_eval <<'.,.,', 'grammar.ra', 354 +module_eval <<'.,.,', 'grammar.ra', 347 def _reduce_82( val, _values, result ) - if val[0][:value] =~ /::/ - raise Puppet::ParseError, "Cannot assign to variables in other namespaces" - end - # 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] + 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', 357 +module_eval <<'.,.,', 'grammar.ra', 350 def _reduce_83( val, _values, result ) result = ast AST::VarDef, :name => val[0], :value => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 362 +module_eval <<'.,.,', 'grammar.ra', 355 def _reduce_84( 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] + 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', 367 +module_eval <<'.,.,', 'grammar.ra', 360 def _reduce_85( val, _values, result ) - result = ast AST::ASTArray + result = ast AST::ASTArray result end .,., -module_eval <<'.,.,', 'grammar.ra', 367 +module_eval <<'.,.,', 'grammar.ra', 360 def _reduce_86( val, _values, result ) result = val[0] result end .,., -module_eval <<'.,.,', 'grammar.ra', 376 +module_eval <<'.,.,', 'grammar.ra', 369 def _reduce_87( 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 + 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', 380 +module_eval <<'.,.,', 'grammar.ra', 373 def _reduce_88( val, _values, result ) - result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2] + result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 385 +module_eval <<'.,.,', 'grammar.ra', 378 def _reduce_89( val, _values, result ) - result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2], - :add => true + result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2], + :add => true result end .,., @@ -1721,41 +1714,41 @@ module_eval <<'.,.,', 'grammar.ra', 385 # reduce 91 omitted -module_eval <<'.,.,', 'grammar.ra', 393 +module_eval <<'.,.,', 'grammar.ra', 386 def _reduce_92( val, _values, result ) - result = ast AST::ASTArray + result = ast AST::ASTArray result end .,., -module_eval <<'.,.,', 'grammar.ra', 393 +module_eval <<'.,.,', 'grammar.ra', 386 def _reduce_93( val, _values, result ) result = val[0] result end .,., -module_eval <<'.,.,', 'grammar.ra', 402 +module_eval <<'.,.,', 'grammar.ra', 395 def _reduce_94( 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 + val[0].push(val[2]) + result = val[0] + else + result = ast AST::ASTArray, :children => [val[0],val[2]] + end result end .,., # reduce 95 omitted -module_eval <<'.,.,', 'grammar.ra', 411 +module_eval <<'.,.,', 'grammar.ra', 404 def _reduce_96( val, _values, result ) if val[0].instance_of?(AST::ASTArray) - result = val[0].push(val[2]) - else - result = ast AST::ASTArray, :children => [val[0],val[2]] - end + result = val[0].push(val[2]) + else + result = ast AST::ASTArray, :children => [val[0],val[2]] + end result end .,., @@ -1796,136 +1789,131 @@ module_eval <<'.,.,', 'grammar.ra', 411 # reduce 114 omitted -module_eval <<'.,.,', 'grammar.ra', 440 +module_eval <<'.,.,', 'grammar.ra', 433 def _reduce_115( val, _values, result ) - args = aryfy(val[2]) - result = ast AST::Function, - :name => val[0][:value], :line => val[0][:line], - :arguments => args, - :ftype => :rvalue + args = aryfy(val[2]) + result = ast AST::Function, + :name => val[0][:value], :line => val[0][:line], + :arguments => args, + :ftype => :rvalue result end .,., -module_eval <<'.,.,', 'grammar.ra', 445 +module_eval <<'.,.,', 'grammar.ra', 438 def _reduce_116( val, _values, result ) - result = ast AST::Function, - :name => val[0][:value], :line => val[0][:line], - :arguments => AST::ASTArray.new({}), - :ftype => :rvalue + result = ast AST::Function, + :name => val[0][:value], :line => val[0][:line], + :arguments => AST::ASTArray.new({}), + :ftype => :rvalue result end .,., -module_eval <<'.,.,', 'grammar.ra', 446 +module_eval <<'.,.,', 'grammar.ra', 439 def _reduce_117( val, _values, result ) result = ast AST::String, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 447 +module_eval <<'.,.,', 'grammar.ra', 440 def _reduce_118( 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', 449 +module_eval <<'.,.,', 'grammar.ra', 442 def _reduce_119( val, _values, result ) result = [val[0]] + val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 451 +module_eval <<'.,.,', 'grammar.ra', 444 def _reduce_120( val, _values, result ) result = [ast(AST::String,val[0])] result end .,., -module_eval <<'.,.,', 'grammar.ra', 452 +module_eval <<'.,.,', 'grammar.ra', 445 def _reduce_121( val, _values, result ) result = [ast(AST::String,val[0])] + val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 457 +module_eval <<'.,.,', 'grammar.ra', 450 def _reduce_122( val, _values, result ) - result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line] + result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 462 +module_eval <<'.,.,', 'grammar.ra', 455 def _reduce_123( 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] + 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', 464 +module_eval <<'.,.,', 'grammar.ra', 457 def _reduce_124( val, _values, result ) - result = ast AST::ResourceReference, :type => val[0], :title => val[2] + result = ast AST::ResourceReference, :type => val[0], :title => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 468 +module_eval <<'.,.,', 'grammar.ra', 461 def _reduce_125( val, _values, result ) - result = val[1] + result = val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 482 +module_eval <<'.,.,', 'grammar.ra', 473 def _reduce_126( val, _values, result ) - @lexer.commentpop - args = { - :test => val[0], - :statements => val[2] - } + @lexer.commentpop + args = { + :test => val[0], + :statements => val[2] + } - if val[4] - args[:else] = val[4] - end + args[:else] = val[4] if val[4] - result = ast AST::IfStatement, args + result = ast AST::IfStatement, args result end .,., -module_eval <<'.,.,', 'grammar.ra', 495 +module_eval <<'.,.,', 'grammar.ra', 484 def _reduce_127( val, _values, result ) @lexer.commentpop args = { - :test => val[0], - :statements => ast(AST::Nop) - } + :test => val[0], + :statements => ast(AST::Nop) + } - if val[3] - args[:else] = val[3] - end + args[:else] = val[3] if val[3] - result = ast AST::IfStatement, args + result = ast AST::IfStatement, args result end .,., # reduce 128 omitted -module_eval <<'.,.,', 'grammar.ra', 501 +module_eval <<'.,.,', 'grammar.ra', 489 def _reduce_129( val, _values, result ) - #@lexer.commentpop result = ast AST::Else, :statements => val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 505 +module_eval <<'.,.,', 'grammar.ra', 493 def _reduce_130( val, _values, result ) @lexer.commentpop result = ast AST::Else, :statements => val[2] @@ -1933,7 +1921,7 @@ module_eval <<'.,.,', 'grammar.ra', 505 end .,., -module_eval <<'.,.,', 'grammar.ra', 509 +module_eval <<'.,.,', 'grammar.ra', 497 def _reduce_131( val, _values, result ) @lexer.commentpop result = ast AST::Else, :statements => ast(AST::Nop) @@ -1943,215 +1931,216 @@ module_eval <<'.,.,', 'grammar.ra', 509 # reduce 132 omitted -module_eval <<'.,.,', 'grammar.ra', 526 +module_eval <<'.,.,', 'grammar.ra', 514 def _reduce_133( val, _values, result ) result = ast AST::InOperator, :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 529 +module_eval <<'.,.,', 'grammar.ra', 517 def _reduce_134( val, _values, result ) result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 532 +module_eval <<'.,.,', 'grammar.ra', 520 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', 535 +module_eval <<'.,.,', 'grammar.ra', 523 def _reduce_136( val, _values, result ) result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 538 +module_eval <<'.,.,', 'grammar.ra', 526 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', 541 +module_eval <<'.,.,', 'grammar.ra', 529 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', 544 +module_eval <<'.,.,', 'grammar.ra', 532 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', 547 +module_eval <<'.,.,', 'grammar.ra', 535 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', 550 +module_eval <<'.,.,', 'grammar.ra', 538 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', 553 +module_eval <<'.,.,', 'grammar.ra', 541 def _reduce_142( val, _values, result ) result = ast AST::Minus, :value => val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 556 +module_eval <<'.,.,', 'grammar.ra', 544 def _reduce_143( val, _values, result ) result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 559 +module_eval <<'.,.,', 'grammar.ra', 547 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', 562 +module_eval <<'.,.,', 'grammar.ra', 550 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', 565 +module_eval <<'.,.,', 'grammar.ra', 553 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', 568 +module_eval <<'.,.,', 'grammar.ra', 556 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', 571 +module_eval <<'.,.,', 'grammar.ra', 559 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', 574 +module_eval <<'.,.,', 'grammar.ra', 562 def _reduce_149( val, _values, result ) result = ast AST::Not, :value => val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 577 +module_eval <<'.,.,', 'grammar.ra', 565 def _reduce_150( val, _values, result ) result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 580 +module_eval <<'.,.,', 'grammar.ra', 568 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', 583 +module_eval <<'.,.,', 'grammar.ra', 571 def _reduce_152( val, _values, result ) result = val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 592 +module_eval <<'.,.,', 'grammar.ra', 578 def _reduce_153( val, _values, result ) - @lexer.commentpop - options = val[3] - unless options.instance_of?(AST::ASTArray) - options = ast AST::ASTArray, :children => [val[3]] - end - result = ast AST::CaseStatement, :test => val[1], :options => options + @lexer.commentpop + options = val[3] + options = ast AST::ASTArray, :children => [val[3]] unless options.instance_of?(AST::ASTArray) + result = ast AST::CaseStatement, :test => val[1], :options => options result end .,., # reduce 154 omitted -module_eval <<'.,.,', 'grammar.ra', 602 +module_eval <<'.,.,', 'grammar.ra', 588 def _reduce_155( val, _values, result ) if val[0].instance_of?(AST::ASTArray) - val[0].push val[1] - result = val[0] - else - result = ast AST::ASTArray, :children => [val[0], val[1]] - end + val[0].push val[1] + result = val[0] + else + result = ast AST::ASTArray, :children => [val[0], val[1]] + end result end .,., -module_eval <<'.,.,', 'grammar.ra', 607 +module_eval <<'.,.,', 'grammar.ra', 593 def _reduce_156( val, _values, result ) - @lexer.commentpop - result = ast AST::CaseOpt, :value => val[0], :statements => val[3] + @lexer.commentpop + result = ast AST::CaseOpt, :value => val[0], :statements => val[3] result end .,., -module_eval <<'.,.,', 'grammar.ra', 613 +module_eval <<'.,.,', 'grammar.ra', 602 def _reduce_157( val, _values, result ) - @lexer.commentpop - result = ast(AST::CaseOpt, - :value => val[0], - :statements => ast(AST::ASTArray) - ) + @lexer.commentpop + + result = ast( + AST::CaseOpt, + :value => val[0], + + :statements => ast(AST::ASTArray) + ) result end .,., # reduce 158 omitted -module_eval <<'.,.,', 'grammar.ra', 623 +module_eval <<'.,.,', 'grammar.ra', 612 def _reduce_159( 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 + 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', 627 +module_eval <<'.,.,', 'grammar.ra', 616 def _reduce_160( val, _values, result ) - result = ast AST::Selector, :param => val[0], :values => val[2] + result = ast AST::Selector, :param => val[0], :values => val[2] result end .,., # reduce 161 omitted -module_eval <<'.,.,', 'grammar.ra', 633 +module_eval <<'.,.,', 'grammar.ra', 622 def _reduce_162( val, _values, result ) @lexer.commentpop result = val[1] @@ -2161,21 +2150,21 @@ module_eval <<'.,.,', 'grammar.ra', 633 # reduce 163 omitted -module_eval <<'.,.,', 'grammar.ra', 643 +module_eval <<'.,.,', 'grammar.ra', 632 def _reduce_164( 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 + 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', 647 +module_eval <<'.,.,', 'grammar.ra', 636 def _reduce_165( val, _values, result ) - result = ast AST::ResourceParam, :param => val[0], :value => val[2] + result = ast AST::ResourceParam, :param => val[0], :value => val[2] result end .,., @@ -2194,7 +2183,7 @@ module_eval <<'.,.,', 'grammar.ra', 647 # reduce 172 omitted -module_eval <<'.,.,', 'grammar.ra', 658 +module_eval <<'.,.,', 'grammar.ra', 647 def _reduce_173( val, _values, result ) result = ast AST::Default, :value => val[0][:value], :line => val[0][:line] result @@ -2203,7 +2192,7 @@ module_eval <<'.,.,', 'grammar.ra', 658 # reduce 174 omitted -module_eval <<'.,.,', 'grammar.ra', 661 +module_eval <<'.,.,', 'grammar.ra', 650 def _reduce_175( val, _values, result ) result = [val[0][:value]] result @@ -2212,108 +2201,108 @@ module_eval <<'.,.,', 'grammar.ra', 661 # reduce 176 omitted -module_eval <<'.,.,', 'grammar.ra', 663 +module_eval <<'.,.,', 'grammar.ra', 652 def _reduce_177( val, _values, result ) result = val[0] += val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 672 +module_eval <<'.,.,', 'grammar.ra', 661 def _reduce_178( val, _values, result ) - val[1].each do |file| - import(file) - end + val[1].each do |file| + import(file) + end - result = AST::ASTArray.new(:children => []) + result = AST::ASTArray.new(:children => []) result end .,., -module_eval <<'.,.,', 'grammar.ra', 683 +module_eval <<'.,.,', 'grammar.ra', 672 def _reduce_179( val, _values, result ) - @lexer.commentpop - newdefine classname(val[1]), :arguments => val[2], :code => val[4], :line => val[0][:line] - @lexer.indefine = false - result = nil + @lexer.commentpop + newdefine classname(val[1]), :arguments => val[2], :code => val[4], :line => val[0][:line] + @lexer.indefine = false + result = nil #} | DEFINE NAME argumentlist parent LBRACE RBRACE { result end .,., -module_eval <<'.,.,', 'grammar.ra', 688 +module_eval <<'.,.,', 'grammar.ra', 677 def _reduce_180( val, _values, result ) - @lexer.commentpop - newdefine classname(val[1]), :arguments => val[2], :line => val[0][:line] - @lexer.indefine = false - result = nil + @lexer.commentpop + newdefine classname(val[1]), :arguments => val[2], :line => val[0][:line] + @lexer.indefine = false + result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 697 +module_eval <<'.,.,', 'grammar.ra', 686 def _reduce_181( val, _values, result ) - @lexer.commentpop - # Our class gets defined in the parent namespace, not our own. - @lexer.namepop - newclass classname(val[1]), :arguments => val[2], :parent => val[3], :code => val[5], :line => val[0][:line] - result = nil + @lexer.commentpop + # Our class gets defined in the parent namespace, not our own. + @lexer.namepop + newclass classname(val[1]), :arguments => val[2], :parent => val[3], :code => val[5], :line => val[0][:line] + result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 703 +module_eval <<'.,.,', 'grammar.ra', 692 def _reduce_182( val, _values, result ) - @lexer.commentpop - # Our class gets defined in the parent namespace, not our own. - @lexer.namepop - newclass classname(val[1]), :arguments => val[2], :parent => val[3], :line => val[0][:line] - result = nil + @lexer.commentpop + # Our class gets defined in the parent namespace, not our own. + @lexer.namepop + newclass classname(val[1]), :arguments => val[2], :parent => val[3], :line => val[0][:line] + result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 709 +module_eval <<'.,.,', 'grammar.ra', 698 def _reduce_183( val, _values, result ) - @lexer.commentpop - newnode val[1], :parent => val[2], :code => val[4], :line => val[0][:line] - result = nil + @lexer.commentpop + newnode val[1], :parent => val[2], :code => val[4], :line => val[0][:line] + result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 713 +module_eval <<'.,.,', 'grammar.ra', 702 def _reduce_184( val, _values, result ) - @lexer.commentpop - newnode val[1], :parent => val[2], :line => val[0][:line] - result = nil + @lexer.commentpop + newnode val[1], :parent => val[2], :line => val[0][:line] + result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 714 +module_eval <<'.,.,', 'grammar.ra', 703 def _reduce_185( val, _values, result ) result = val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 716 +module_eval <<'.,.,', 'grammar.ra', 705 def _reduce_186( val, _values, result ) result = val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 717 +module_eval <<'.,.,', 'grammar.ra', 706 def _reduce_187( val, _values, result ) result = val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 718 +module_eval <<'.,.,', 'grammar.ra', 707 def _reduce_188( val, _values, result ) result = "class" result @@ -2322,7 +2311,7 @@ module_eval <<'.,.,', 'grammar.ra', 718 # reduce 189 omitted -module_eval <<'.,.,', 'grammar.ra', 728 +module_eval <<'.,.,', 'grammar.ra', 717 def _reduce_190( val, _values, result ) result = val[0] result = [result] unless result.is_a?(Array) @@ -2331,28 +2320,28 @@ module_eval <<'.,.,', 'grammar.ra', 728 end .,., -module_eval <<'.,.,', 'grammar.ra', 732 +module_eval <<'.,.,', 'grammar.ra', 721 def _reduce_191( val, _values, result ) - result = ast AST::HostName, :value => val[0] + result = ast AST::HostName, :value => val[0] result end .,., -module_eval <<'.,.,', 'grammar.ra', 733 +module_eval <<'.,.,', 'grammar.ra', 722 def _reduce_192( val, _values, result ) result = val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 734 +module_eval <<'.,.,', 'grammar.ra', 723 def _reduce_193( val, _values, result ) result = val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 735 +module_eval <<'.,.,', 'grammar.ra', 724 def _reduce_194( val, _values, result ) result = val[0][:value] result @@ -2361,30 +2350,30 @@ module_eval <<'.,.,', 'grammar.ra', 735 # reduce 195 omitted -module_eval <<'.,.,', 'grammar.ra', 741 +module_eval <<'.,.,', 'grammar.ra', 730 def _reduce_196( val, _values, result ) - result = nil + result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 745 +module_eval <<'.,.,', 'grammar.ra', 734 def _reduce_197( val, _values, result ) - result = ast AST::ASTArray, :children => [] + result = ast AST::ASTArray, :children => [] result end .,., # reduce 198 omitted -module_eval <<'.,.,', 'grammar.ra', 750 +module_eval <<'.,.,', 'grammar.ra', 739 def _reduce_199( val, _values, result ) result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 754 +module_eval <<'.,.,', 'grammar.ra', 743 def _reduce_200( val, _values, result ) result = val[1] result = [result] unless result[0].is_a?(Array) @@ -2394,7 +2383,7 @@ module_eval <<'.,.,', 'grammar.ra', 754 # reduce 201 omitted -module_eval <<'.,.,', 'grammar.ra', 761 +module_eval <<'.,.,', 'grammar.ra', 750 def _reduce_202( val, _values, result ) result = val[0] result = [result] unless result[0].is_a?(Array) @@ -2403,15 +2392,15 @@ module_eval <<'.,.,', 'grammar.ra', 761 end .,., -module_eval <<'.,.,', 'grammar.ra', 766 +module_eval <<'.,.,', 'grammar.ra', 755 def _reduce_203( val, _values, result ) - Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") - result = [val[0][:value], val[2]] + Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") + result = [val[0][:value], val[2]] result end .,., -module_eval <<'.,.,', 'grammar.ra', 770 +module_eval <<'.,.,', 'grammar.ra', 759 def _reduce_204( val, _values, result ) Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") result = [val[0][:value]] @@ -2419,23 +2408,23 @@ module_eval <<'.,.,', 'grammar.ra', 770 end .,., -module_eval <<'.,.,', 'grammar.ra', 772 +module_eval <<'.,.,', 'grammar.ra', 761 def _reduce_205( val, _values, result ) - result = [val[0][:value], val[2]] + result = [val[0][:value], val[2]] result end .,., -module_eval <<'.,.,', 'grammar.ra', 774 +module_eval <<'.,.,', 'grammar.ra', 763 def _reduce_206( val, _values, result ) - result = [val[0][:value]] + result = [val[0][:value]] result end .,., # reduce 207 omitted -module_eval <<'.,.,', 'grammar.ra', 779 +module_eval <<'.,.,', 'grammar.ra', 768 def _reduce_208( val, _values, result ) result = val[1] result @@ -2444,7 +2433,7 @@ module_eval <<'.,.,', 'grammar.ra', 779 # reduce 209 omitted -module_eval <<'.,.,', 'grammar.ra', 784 +module_eval <<'.,.,', 'grammar.ra', 773 def _reduce_210( val, _values, result ) result = val[1] result @@ -2455,38 +2444,38 @@ module_eval <<'.,.,', 'grammar.ra', 784 # reduce 212 omitted -module_eval <<'.,.,', 'grammar.ra', 790 +module_eval <<'.,.,', 'grammar.ra', 779 def _reduce_213( val, _values, result ) - result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line] + result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 798 +module_eval <<'.,.,', 'grammar.ra', 787 def _reduce_214( val, _values, result ) - if val[1].instance_of?(AST::ASTArray) - result = val[1] - else - result = ast AST::ASTArray, :children => [val[1]] - end + if val[1].instance_of?(AST::ASTArray) + result = val[1] + else + result = ast AST::ASTArray, :children => [val[1]] + end result end .,., -module_eval <<'.,.,', 'grammar.ra', 805 +module_eval <<'.,.,', 'grammar.ra', 794 def _reduce_215( val, _values, result ) if val[1].instance_of?(AST::ASTArray) - result = val[1] - else - result = ast AST::ASTArray, :children => [val[1]] - end + result = val[1] + else + result = ast AST::ASTArray, :children => [val[1]] + end result end .,., -module_eval <<'.,.,', 'grammar.ra', 807 +module_eval <<'.,.,', 'grammar.ra', 796 def _reduce_216( val, _values, result ) - result = ast AST::ASTArray + result = ast AST::ASTArray result end .,., @@ -2497,94 +2486,94 @@ module_eval <<'.,.,', 'grammar.ra', 807 # reduce 219 omitted -module_eval <<'.,.,', 'grammar.ra', 812 +module_eval <<'.,.,', 'grammar.ra', 801 def _reduce_220( val, _values, result ) result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 817 +module_eval <<'.,.,', 'grammar.ra', 806 def _reduce_221( val, _values, result ) - result = ast AST::Regex, :value => val[0][:value] + result = ast AST::Regex, :value => val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 825 +module_eval <<'.,.,', 'grammar.ra', 814 def _reduce_222( val, _values, result ) - if val[1].instance_of?(AST::ASTHash) - result = val[1] - else - result = ast AST::ASTHash, { :value => val[1] } - end + 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', 832 +module_eval <<'.,.,', 'grammar.ra', 821 def _reduce_223( val, _values, result ) if val[1].instance_of?(AST::ASTHash) - result = val[1] - else - result = ast AST::ASTHash, { :value => val[1] } - end + result = val[1] + else + result = ast AST::ASTHash, { :value => val[1] } + end result end .,., -module_eval <<'.,.,', 'grammar.ra', 834 +module_eval <<'.,.,', 'grammar.ra', 823 def _reduce_224( val, _values, result ) - result = ast AST::ASTHash + result = ast AST::ASTHash result end .,., # reduce 225 omitted -module_eval <<'.,.,', 'grammar.ra', 844 +module_eval <<'.,.,', 'grammar.ra', 833 def _reduce_226( 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 = val[0].merge(val[2]) + else + result = ast AST::ASTHash, :value => val[0] + result.merge(val[2]) + end result end .,., -module_eval <<'.,.,', 'grammar.ra', 848 +module_eval <<'.,.,', 'grammar.ra', 837 def _reduce_227( val, _values, result ) - result = ast AST::ASTHash, { :value => { val[0] => val[2] } } + result = ast AST::ASTHash, { :value => { val[0] => val[2] } } result end .,., -module_eval <<'.,.,', 'grammar.ra', 849 +module_eval <<'.,.,', 'grammar.ra', 838 def _reduce_228( val, _values, result ) result = val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 850 +module_eval <<'.,.,', 'grammar.ra', 839 def _reduce_229( val, _values, result ) result = val[0] result end .,., -module_eval <<'.,.,', 'grammar.ra', 855 +module_eval <<'.,.,', 'grammar.ra', 844 def _reduce_230( val, _values, result ) - result = ast AST::HashOrArrayAccess, :variable => val[0][:value], :key => val[2] + result = ast AST::HashOrArrayAccess, :variable => val[0][:value], :key => val[2] result end .,., # reduce 231 omitted -module_eval <<'.,.,', 'grammar.ra', 860 +module_eval <<'.,.,', 'grammar.ra', 849 def _reduce_232( val, _values, result ) result = ast AST::HashOrArrayAccess, :variable => val[0], :key => val[2] result diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb index 07e2d220b..9e4c79588 100755 --- a/spec/unit/parser/parser_spec.rb +++ b/spec/unit/parser/parser_spec.rb @@ -76,6 +76,12 @@ describe Puppet::Parser do end + describe "when parsing selector" do + it "should support hash access on the left hand side" do + lambda { @parser.parse("$h = { 'a' => 'b' } $a = $h['a'] ? { 'b' => 'd', default => undef }") }.should_not raise_error + end + end + describe "when parsing 'if'" do it "not, it should create the correct ast objects" do ast::Not.expects(:new).with { |h| h[:value].is_a?(ast::Boolean) } -- cgit From b5b5923bf41196f5e72a69bfa627120c75732fe5 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Sat, 12 Feb 2011 11:44:19 -0800 Subject: misc: ast_context has two arguments, not one. This updates the spec expectation to reflect that, eliminating a warning during the spec run. --- spec/unit/parser/parser_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb index 9aab6a716..2f5d4b8ea 100755 --- a/spec/unit/parser/parser_spec.rb +++ b/spec/unit/parser/parser_spec.rb @@ -276,7 +276,7 @@ describe Puppet::Parser do it "should include docs when the AST class uses them" do @class.expects(:use_docs).returns true @class.stubs(:new) - @parser.expects(:ast_context).with{ |a| a[0] == true }.returns({}) + @parser.expects(:ast_context).with{ |docs, line| docs == true }.returns({}) @parser.ast(@class, :file => "/bar") end -- cgit From e512e3effa134271564177e095c6afc19bebe62f Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Sat, 12 Feb 2011 12:09:27 -0800 Subject: (#5977) fix spec test failure when new applications are introduced. The test here was previously fragile, in that it would break when new applications were introduced, and in that it depended on the order of items returned from reading the directories on disk. It is now insensitive to those changes, and still verifies that the results we require occur, reducing long term maintenance cost. Reviewed-by: James Turnbull --- spec/unit/util/command_line_spec.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) mode change 100644 => 100755 spec/unit/util/command_line_spec.rb diff --git a/spec/unit/util/command_line_spec.rb b/spec/unit/util/command_line_spec.rb old mode 100644 new mode 100755 index a648eb4a1..98ddb92f6 --- a/spec/unit/util/command_line_spec.rb +++ b/spec/unit/util/command_line_spec.rb @@ -108,8 +108,8 @@ describe Puppet::Util::CommandLine do end describe 'when loading commands' do before do - @core_apps = ["describe", "filebucket", "kick", "queue", "resource", "agent", "cert", "apply", "doc", "master"] - @command_line = Puppet::Util::CommandLine.new("foo", %w{ client --help w hatever.pp }, @tty ) + @core_apps = %w{describe filebucket kick queue resource agent cert apply doc master} + @command_line = Puppet::Util::CommandLine.new("foo", %w{ client --help whatever.pp }, @tty ) end it 'should be able to find all existing commands' do @core_apps.each do |command| @@ -122,10 +122,15 @@ describe Puppet::Util::CommandLine do @appdir="#{@dir}/puppet/application" FileUtils.mkdir_p(@appdir) FileUtils.touch("#{@appdir}/foo.rb") - $LOAD_PATH.unshift(@dir) + $LOAD_PATH.unshift(@dir) # WARNING: MUST MATCH THE AFTER ACTIONS! end it 'should be able to find commands from both paths' do - @command_line.available_subcommands.should == ['foo'] + @core_apps + found = @command_line.available_subcommands + found.should include 'foo' + @core_apps.each { |cmd| found.should include cmd } + end + after do + $LOAD_PATH.shift # WARNING: MUST MATCH THE BEFORE ACTIONS! end end end -- cgit From 5c26f6828e0e2c1370966472d4d62b2e001c9f0b Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Sat, 12 Feb 2011 15:25:00 -0800 Subject: (#5516) Rebuild parser.rb after merge. The automatically generated parser.rb needed to be rebuilt to make the syntax changes functional; this commits only that rebuild. --- lib/puppet/parser/parser.rb | 3171 ++++++++++++++++++++++--------------------- 1 file changed, 1630 insertions(+), 1541 deletions(-) diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index d68cd05e7..92064c15b 100644 --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -1,11 +1,10 @@ # # DO NOT MODIFY!!!! -# This file is automatically generated by racc 1.4.5 -# from racc grammer file "grammar.ra". +# This file is automatically generated by Racc 1.4.6 +# from Racc grammer file "". # -require 'racc/parser' - +require 'racc/parser.rb' require 'puppet' require 'puppet/util/loadedfile' @@ -18,14 +17,11 @@ module Puppet class AlreadyImportedError < ImportError; end end - module Puppet - module Parser - class Parser < Racc::Parser -module_eval <<'..end grammar.ra modeval..id6535ba0b91', 'grammar.ra', 865 +module_eval(<<'...end grammar.ra/module_eval...', 'grammar.ra', 866) # It got too annoying having code in a file that needs to be compiled. require 'puppet/parser/parser_support' @@ -36,302 +32,61 @@ require 'puppet/parser/parser_support' # End: # $Id$ - -..end grammar.ra modeval..id6535ba0b91 - -##### racc 1.4.5 generates ### - -racc_reduce_table = [ - 0, 0, :racc_error, - 1, 70, :_reduce_1, - 1, 70, :_reduce_none, - 1, 71, :_reduce_none, - 2, 71, :_reduce_4, - 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, 87, :_reduce_19, - 3, 87, :_reduce_20, - 1, 88, :_reduce_none, - 1, 88, :_reduce_none, - 1, 88, :_reduce_none, - 1, 89, :_reduce_none, - 1, 89, :_reduce_none, - 1, 89, :_reduce_none, - 1, 89, :_reduce_none, - 4, 81, :_reduce_28, - 5, 81, :_reduce_29, - 3, 81, :_reduce_30, - 2, 81, :_reduce_31, - 1, 91, :_reduce_none, - 1, 91, :_reduce_none, - 3, 91, :_reduce_34, - 3, 91, :_reduce_35, - 1, 92, :_reduce_none, - 1, 92, :_reduce_none, - 1, 92, :_reduce_none, - 1, 92, :_reduce_none, - 1, 92, :_reduce_none, - 1, 92, :_reduce_none, - 1, 92, :_reduce_none, - 1, 92, :_reduce_none, - 1, 92, :_reduce_44, - 5, 74, :_reduce_45, - 5, 74, :_reduce_46, - 5, 74, :_reduce_47, - 5, 85, :_reduce_48, - 2, 75, :_reduce_49, - 1, 108, :_reduce_50, - 2, 108, :_reduce_51, - 6, 76, :_reduce_52, - 2, 76, :_reduce_53, - 3, 109, :_reduce_54, - 3, 109, :_reduce_55, - 1, 110, :_reduce_none, - 1, 110, :_reduce_none, - 3, 110, :_reduce_58, - 1, 111, :_reduce_none, - 3, 111, :_reduce_60, - 1, 112, :_reduce_61, - 1, 112, :_reduce_62, - 3, 113, :_reduce_63, - 3, 113, :_reduce_64, - 1, 114, :_reduce_none, - 1, 114, :_reduce_none, - 4, 116, :_reduce_67, - 1, 102, :_reduce_none, - 3, 102, :_reduce_69, - 0, 103, :_reduce_none, - 1, 103, :_reduce_none, - 1, 118, :_reduce_72, - 1, 93, :_reduce_73, - 1, 95, :_reduce_74, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 3, 77, :_reduce_82, - 3, 77, :_reduce_83, - 3, 86, :_reduce_84, - 0, 104, :_reduce_85, - 1, 104, :_reduce_86, - 3, 104, :_reduce_87, - 3, 122, :_reduce_88, - 3, 124, :_reduce_89, - 1, 125, :_reduce_none, - 1, 125, :_reduce_none, - 0, 107, :_reduce_92, - 1, 107, :_reduce_93, - 3, 107, :_reduce_94, - 1, 126, :_reduce_none, - 3, 126, :_reduce_96, - 1, 115, :_reduce_none, - 1, 115, :_reduce_none, - 1, 115, :_reduce_none, - 1, 115, :_reduce_none, - 1, 115, :_reduce_none, - 1, 115, :_reduce_none, - 1, 123, :_reduce_none, - 1, 123, :_reduce_none, - 1, 123, :_reduce_none, - 1, 123, :_reduce_none, - 1, 123, :_reduce_none, - 1, 123, :_reduce_none, - 1, 123, :_reduce_none, - 1, 123, :_reduce_none, - 1, 123, :_reduce_none, - 1, 123, :_reduce_none, - 1, 123, :_reduce_none, - 1, 123, :_reduce_none, - 4, 97, :_reduce_115, - 3, 97, :_reduce_116, - 1, 99, :_reduce_117, - 2, 99, :_reduce_118, - 2, 129, :_reduce_119, - 1, 130, :_reduce_120, - 2, 130, :_reduce_121, - 1, 96, :_reduce_122, - 4, 90, :_reduce_123, - 4, 90, :_reduce_124, - 2, 79, :_reduce_125, - 5, 131, :_reduce_126, - 4, 131, :_reduce_127, - 0, 132, :_reduce_none, - 2, 132, :_reduce_129, - 4, 132, :_reduce_130, - 3, 132, :_reduce_131, - 1, 120, :_reduce_none, - 3, 120, :_reduce_133, - 3, 120, :_reduce_134, - 3, 120, :_reduce_135, - 3, 120, :_reduce_136, - 3, 120, :_reduce_137, - 3, 120, :_reduce_138, - 3, 120, :_reduce_139, - 3, 120, :_reduce_140, - 3, 120, :_reduce_141, - 2, 120, :_reduce_142, - 3, 120, :_reduce_143, - 3, 120, :_reduce_144, - 3, 120, :_reduce_145, - 3, 120, :_reduce_146, - 3, 120, :_reduce_147, - 3, 120, :_reduce_148, - 2, 120, :_reduce_149, - 3, 120, :_reduce_150, - 3, 120, :_reduce_151, - 3, 120, :_reduce_152, - 5, 78, :_reduce_153, - 1, 134, :_reduce_none, - 2, 134, :_reduce_155, - 5, 135, :_reduce_156, - 4, 135, :_reduce_157, - 1, 136, :_reduce_none, - 3, 136, :_reduce_159, - 3, 98, :_reduce_160, - 1, 138, :_reduce_none, - 4, 138, :_reduce_162, - 1, 140, :_reduce_none, - 3, 140, :_reduce_164, - 3, 139, :_reduce_165, - 1, 137, :_reduce_none, - 1, 137, :_reduce_none, - 1, 137, :_reduce_none, - 1, 137, :_reduce_none, - 1, 137, :_reduce_none, - 1, 137, :_reduce_none, - 1, 137, :_reduce_none, - 1, 137, :_reduce_173, - 1, 137, :_reduce_none, - 1, 141, :_reduce_175, - 1, 142, :_reduce_none, - 3, 142, :_reduce_177, - 2, 80, :_reduce_178, - 6, 82, :_reduce_179, - 5, 82, :_reduce_180, - 7, 83, :_reduce_181, - 6, 83, :_reduce_182, - 6, 84, :_reduce_183, - 5, 84, :_reduce_184, - 1, 106, :_reduce_185, - 1, 101, :_reduce_186, - 1, 101, :_reduce_187, - 1, 101, :_reduce_188, - 1, 145, :_reduce_none, - 3, 145, :_reduce_190, - 1, 147, :_reduce_191, - 1, 148, :_reduce_192, - 1, 148, :_reduce_193, - 1, 148, :_reduce_194, - 1, 148, :_reduce_none, - 0, 72, :_reduce_196, - 0, 149, :_reduce_197, - 1, 143, :_reduce_none, - 3, 143, :_reduce_199, - 3, 143, :_reduce_200, - 1, 150, :_reduce_none, - 3, 150, :_reduce_202, - 3, 151, :_reduce_203, - 1, 151, :_reduce_204, - 3, 151, :_reduce_205, - 1, 151, :_reduce_206, - 1, 146, :_reduce_none, - 2, 146, :_reduce_208, - 1, 144, :_reduce_none, - 2, 144, :_reduce_210, - 1, 152, :_reduce_none, - 1, 152, :_reduce_none, - 1, 94, :_reduce_213, - 3, 119, :_reduce_214, - 4, 119, :_reduce_215, - 2, 119, :_reduce_216, - 1, 127, :_reduce_none, - 1, 127, :_reduce_none, - 0, 105, :_reduce_none, - 1, 105, :_reduce_220, - 1, 133, :_reduce_221, - 3, 128, :_reduce_222, - 4, 128, :_reduce_223, - 2, 128, :_reduce_224, - 1, 153, :_reduce_none, - 3, 153, :_reduce_226, - 3, 154, :_reduce_227, - 1, 155, :_reduce_228, - 1, 155, :_reduce_229, - 4, 121, :_reduce_230, - 1, 100, :_reduce_none, - 4, 100, :_reduce_232 ] - -racc_reduce_n = 233 - -racc_shift_n = 384 +...end grammar.ra/module_eval... +##### State transition tables begin ### racc_action_table = [ - 256, 257, 228, 82, 54, 72, 75, 181, 251, 48, - 72, 75, 194, 205, 210, 163, 156, 348, 46, 47, - 344, 184, 201, 203, 206, 209, 162, 352, 54, 182, - 351, 169, 54, -168, 72, 75, 241, 242, 102, 305, - 106, 158, 58, 193, 230, 60, 204, 208, 193, 306, + 256, 257, 228, 82, 54, 72, 75, 228, 251, 176, + 72, 75, 194, 205, 210, 182, 156, 349, 254, 356, + 184, 184, 201, 203, 206, 209, -173, 357, 54, 306, + 353, 255, 54, 352, 72, 75, 241, 242, 102, 307, + 106, 158, 58, 193, 230, 60, 204, 208, 193, 308, 213, 196, 197, 198, 200, 202, 97, 207, 211, 72, 75, 72, 75, 163, 199, 59, 58, 71, 245, 60, 58, 83, 86, 60, 162, 92, 244, 72, 75, 169, - 78, 100, 352, 269, 89, 351, 63, 94, 64, 59, - 228, 326, 71, 59, 162, 59, 83, 86, 83, 268, - 92, 65, 92, 184, 76, 78, 307, 137, 163, 89, - 162, 89, 72, 75, 83, 268, 241, 242, 92, 162, - 59, 163, 59, 137, 169, 62, 254, 89, 207, 211, - 72, 75, 162, 308, 102, 199, 106, 169, 59, 255, - 213, 196, 197, 198, -166, 162, 309, 207, 211, 83, - 268, 310, 97, 92, 199, 72, 75, 355, 137, 102, - -170, 106, 89, 71, 218, 356, 173, 83, 86, 220, - 313, 92, -171, 59, 72, 75, 78, 100, 37, 218, - 89, 249, 38, 94, 220, 246, 247, 173, 71, 11, - 210, 59, 83, 86, 246, 367, 92, 271, 201, 37, - -167, 78, 37, 38, 270, 89, 38, 71, 246, 247, + 78, 100, 279, 270, 89, 278, 63, 94, 64, 59, + 181, 327, 71, 59, 71, 59, 83, 86, 83, 269, + 92, 65, 92, 345, 76, 78, 117, 137, 163, 89, + 71, 89, 72, 75, 83, 269, 241, 242, 92, 162, + 59, 163, 59, 137, 169, 62, 353, 89, 163, 352, + 72, 75, 162, 309, 102, 311, 106, 169, 59, 162, + 213, 196, 197, 198, 169, 71, 310, 207, 211, 83, + 269, -170, 97, 92, 199, 72, 75, 173, 137, 102, + 48, 106, 89, 71, 314, 207, 211, 83, 86, 46, + 47, 92, 199, 59, 72, 75, 78, 100, 37, 218, + 89, 249, 38, 94, 220, 246, 247, -171, 71, 11, + 210, 59, 83, 86, 173, 218, 92, 272, 201, 37, + 220, 78, 37, 38, 276, 89, 38, 71, 246, 275, 11, 83, 86, 11, 14, 92, 59, 72, 75, 76, - 78, 102, 278, 106, 89, 277, 213, 196, 197, 198, - 200, 202, 275, 207, 211, 59, 246, 274, 152, 97, - 199, 37, 318, 72, 75, 127, 319, 102, -169, 106, - 71, 63, 11, 14, 83, 86, -167, 37, 92, 207, - 211, 127, -169, 78, 100, 97, 199, 89, 11, 14, - 94, -166, 117, 72, 75, -185, 71, 82, 59, 336, - 83, 86, 197, 198, 92, 231, 338, 207, 211, 78, - 100, 181, 48, 89, 199, 74, 94, 240, -168, 72, - 75, 241, 242, 102, 59, 106, 71, 184, 176, 37, - 83, 86, 59, 38, 92, 345, 322, 175, 76, 78, - 11, 97, -172, 89, -171, 72, 75, -170, 59, 102, - 214, 106, 71, 64, 59, 215, 83, 86, 173, 217, - 92, -23, -23, -23, -23, 78, 100, 97, 155, 89, - 72, 75, 94, 122, 102, 152, 106, 82, 71, 223, - 59, 122, 83, 86, 72, 75, 92, -168, 102, 225, - 106, 78, 100, -166, 276, 89, 226, 117, 94, 44, - 45, 41, 42, 71, -169, -167, 59, 83, 86, 72, - 75, 92, 226, 102, 229, 106, 78, 71, 52, -168, - 89, 83, 86, 72, 75, 92, -166, 102, -169, 106, - 78, 59, 197, 198, 89, -167, -171, 207, 211, 365, - 231, 152, 71, 234, 199, 59, 83, 86, 50, 210, - 92, -21, -21, -21, -21, 78, 71, 201, 372, 89, - 83, 86, 49, 374, 92, 72, 75, 228, -220, 78, - 59, 226, 354, 89, 377, 72, 75, 40, 39, 102, - 237, 106, 341, nil, 59, 213, 196, 197, 198, 200, - 202, nil, 207, 211, nil, nil, nil, 97, 162, 199, - nil, nil, 83, 268, nil, nil, 92, nil, 71, nil, - nil, 137, 83, 86, nil, 89, 92, 44, 45, 41, - 42, 78, 100, 72, 75, 89, 59, 102, 94, 106, + 78, 102, -167, 106, 89, 152, 213, 196, 197, 198, + 200, 202, 271, 207, 211, 59, 246, 247, 319, 97, + 199, 37, 320, 72, 75, 127, -166, 102, 63, 106, + 71, -169, 11, 14, 83, 86, -169, 37, 92, 207, + 211, 127, -166, 78, 100, 97, 199, 89, 11, 14, + 94, 246, 368, 72, 75, -168, 71, 82, 59, -186, + 83, 86, 197, 198, 92, 337, 231, 207, 211, 78, + 100, 339, 181, 89, 199, 74, 94, 240, 48, 72, + 75, 241, 242, 102, 59, 106, 71, -168, 184, 37, + 83, 86, -167, 38, 92, 59, 323, 346, 76, 78, + 11, 97, 175, 89, -172, 72, 75, -171, -170, 102, + 59, 106, 71, 214, 59, 64, 83, 86, 215, 173, + 92, 44, 45, 41, 42, 78, 100, 97, 217, 89, + 72, 75, 94, 155, 102, 122, 106, 152, 71, 82, + 59, 223, 83, 86, 72, 75, 92, 122, 102, -168, + 106, 78, 100, 225, -166, 89, 277, 226, 94, -21, + -21, -21, -21, 71, 117, -169, 59, 83, 86, 72, + 75, 92, -167, 102, 226, 106, 78, 71, 229, 52, + 89, 83, 86, 72, 75, 92, -168, 102, -166, 106, + 78, 59, 197, 198, 89, -169, -167, 207, 211, -171, + 366, 231, 71, 152, 199, 59, 83, 86, 234, 210, + 92, 44, 45, 41, 42, 78, 71, 201, 50, 89, + 83, 86, 373, 49, 92, 72, 75, 375, 228, 78, + 59, -221, 355, 89, 226, 72, 75, 378, 40, 102, + 39, 106, 237, 342, 59, 213, 196, 197, 198, 200, + 202, nil, 207, 211, nil, nil, nil, 97, 71, 199, + nil, nil, 83, 269, nil, nil, 92, nil, 71, nil, + nil, 137, 83, 86, nil, 89, 92, -23, -23, -23, + -23, 78, 100, 72, 75, 89, 59, 102, 94, 106, 213, 196, 197, 198, 200, 202, 59, 207, 211, nil, 213, 196, 197, 198, 199, 97, nil, 207, 211, 72, 75, nil, nil, 102, 199, 106, 71, nil, nil, nil, @@ -369,8 +124,8 @@ racc_action_table = [ nil, nil, 72, 75, 78, 100, 97, nil, 89, 72, 75, 94, nil, 102, nil, 106, nil, 71, nil, 59, nil, 83, 86, nil, nil, 92, nil, nil, nil, nil, - 78, 100, nil, nil, 89, 162, nil, 94, nil, 83, - 268, nil, 71, 92, nil, 59, 83, 86, 137, nil, + 78, 100, nil, nil, 89, 71, nil, 94, nil, 83, + 269, nil, 71, 92, nil, 59, 83, 86, 137, nil, 92, nil, 89, nil, nil, 78, 72, 75, nil, 89, 102, nil, 106, 59, nil, nil, nil, nil, nil, nil, 59, nil, nil, nil, nil, 72, 75, nil, 97, nil, @@ -378,18 +133,18 @@ racc_action_table = [ nil, nil, nil, 83, 86, nil, nil, 92, 177, nil, 72, 75, 78, 100, nil, nil, 89, nil, 71, 94, nil, nil, 83, 86, nil, nil, 92, 59, 72, 75, - 76, 78, 102, 339, 106, 89, nil, nil, nil, nil, + 76, 78, 102, 340, 106, 89, nil, nil, nil, nil, nil, nil, nil, 71, nil, nil, 59, 83, 86, nil, 97, 92, nil, 72, 75, 76, 78, 102, nil, 106, 89, 71, nil, 72, 75, 83, 86, nil, nil, 92, nil, 59, nil, nil, 78, 100, nil, nil, 89, 72, 75, 94, nil, nil, nil, nil, 71, nil, nil, 59, - 83, 86, nil, nil, 92, nil, 162, nil, nil, 78, - 83, 268, nil, 89, 92, nil, 72, 75, nil, 137, - 102, nil, 162, 89, 59, nil, 83, 268, nil, nil, + 83, 86, nil, nil, 92, nil, 71, nil, nil, 78, + 83, 269, nil, 89, 92, nil, 72, 75, nil, 137, + 102, nil, 71, 89, 59, nil, 83, 269, nil, nil, 92, nil, 72, 75, 59, 137, 102, nil, 106, 89, nil, nil, 72, 75, nil, nil, 102, nil, 106, 71, - 59, nil, nil, 83, 268, nil, nil, 92, nil, nil, + 59, nil, nil, 83, 269, nil, nil, 92, nil, nil, nil, nil, 137, nil, 97, 71, 89, nil, nil, 83, 86, nil, nil, 92, nil, 71, nil, 59, 78, 83, 86, nil, 89, 92, nil, nil, nil, nil, 78, 100, @@ -401,7 +156,7 @@ racc_action_table = [ 89, nil, 71, 94, nil, nil, 83, 86, nil, 71, 92, 59, nil, 83, 86, 78, nil, 92, nil, 89, nil, nil, 78, 72, 75, nil, 89, 102, nil, 106, - 59, 162, nil, nil, nil, 83, 268, 59, nil, 92, + 59, 71, nil, nil, nil, 83, 269, 59, nil, 92, nil, 72, 75, nil, 137, 102, nil, 106, 89, nil, nil, nil, nil, nil, nil, nil, 71, nil, nil, 59, 83, 86, nil, 97, 92, nil, nil, nil, nil, 78, @@ -427,7 +182,7 @@ racc_action_table = [ 197, 198, 200, 202, nil, 207, 211, 205, 210, nil, nil, nil, 199, nil, nil, nil, 201, 203, 206, 209, nil, nil, 205, 210, nil, nil, nil, nil, nil, nil, - 273, 201, 203, 206, 209, nil, nil, nil, nil, nil, + 274, 201, 203, 206, 209, nil, nil, nil, nil, nil, nil, 208, nil, nil, 213, 196, 197, 198, 200, 202, nil, 207, 211, nil, nil, 204, 208, nil, 199, 213, 196, 197, 198, 200, 202, nil, 207, 211, 205, 210, @@ -437,29 +192,29 @@ racc_action_table = [ 11, 14, nil, 210, nil, 213, 196, 197, 198, 200, 202, 201, 207, 211, nil, nil, nil, nil, nil, 199, 213, 196, 197, 198, 200, 202, nil, 207, 211, nil, - nil, 324, nil, nil, 199, nil, nil, nil, nil, 213, + nil, 325, nil, nil, 199, nil, nil, nil, nil, 213, 196, 197, 198, 200, 202, nil, 207, 211, nil, nil, - 379, nil, 26, 199, 33, 1, nil, 7, 12, nil, + 380, nil, 26, 199, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, - 14, 26, 382, 33, 1, nil, 7, 12, nil, 17, + 14, 26, 383, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, 14, - nil, 296, nil, 26, nil, 33, 1, nil, 7, 12, + nil, 297, nil, 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, - 11, 14, 26, 364, 33, 1, nil, 7, 12, nil, + 11, 14, 26, 365, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, - 14, nil, 381, nil, 26, nil, 33, 1, nil, 7, + 14, nil, 382, nil, 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, - nil, 11, 14, 26, 383, 33, 1, nil, 7, 12, + nil, 11, 14, 26, 384, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, - 11, 14, nil, 357, nil, 26, nil, 33, 1, nil, + 11, 14, nil, 358, nil, 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, - nil, nil, 11, 14, 26, 363, 33, 1, nil, 7, + nil, nil, 11, 14, 26, 364, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, - nil, 11, 14, nil, 375, nil, 26, nil, 33, 1, + nil, 11, 14, nil, 376, nil, 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, - 3, nil, nil, 11, 14, 26, 304, 33, 1, nil, + 3, nil, nil, 11, 14, 26, 305, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, - nil, nil, 11, 14, nil, 349, nil, 26, nil, 33, + nil, nil, 11, 14, nil, 350, nil, 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, 14, 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, @@ -468,60 +223,60 @@ racc_action_table = [ nil, nil, 11, 14 ] racc_action_check = [ - 180, 180, 152, 86, 156, 106, 106, 272, 174, 7, - 277, 277, 106, 180, 180, 65, 55, 277, 7, 7, - 272, 86, 180, 180, 180, 180, 65, 296, 17, 80, - 296, 65, 158, 95, 202, 202, 174, 174, 202, 218, - 202, 55, 156, 106, 152, 156, 180, 180, 277, 219, + 180, 180, 152, 86, 156, 106, 106, 143, 174, 67, + 278, 278, 106, 180, 180, 80, 55, 278, 178, 301, + 143, 86, 180, 180, 180, 180, 67, 301, 17, 218, + 297, 178, 158, 297, 202, 202, 174, 174, 202, 219, + 202, 55, 156, 106, 152, 156, 180, 180, 278, 220, 180, 180, 180, 180, 180, 180, 202, 180, 180, 181, - 181, 368, 368, 239, 180, 156, 17, 202, 165, 17, - 158, 202, 202, 158, 239, 202, 165, 182, 182, 239, - 202, 202, 349, 182, 202, 349, 22, 202, 22, 17, - 143, 243, 181, 158, 368, 202, 181, 181, 368, 368, - 181, 22, 368, 143, 181, 181, 220, 368, 163, 181, - 182, 368, 355, 355, 182, 182, 243, 243, 182, 163, - 181, 62, 368, 182, 163, 22, 178, 182, 281, 281, - 351, 351, 62, 221, 351, 281, 351, 62, 182, 178, - 285, 285, 285, 285, 101, 355, 221, 285, 285, 355, - 355, 224, 351, 355, 285, 341, 341, 300, 355, 341, - 91, 341, 355, 351, 308, 300, 226, 351, 351, 308, - 227, 351, 90, 355, 184, 184, 351, 351, 12, 122, - 351, 171, 12, 351, 122, 171, 171, 229, 341, 12, - 286, 351, 341, 341, 343, 343, 341, 184, 286, 1, - 87, 341, 30, 1, 183, 341, 30, 184, 183, 183, - 1, 184, 184, 30, 30, 184, 341, 196, 196, 184, - 184, 196, 195, 196, 184, 195, 286, 286, 286, 286, - 286, 286, 188, 286, 286, 184, 188, 188, 231, 196, - 286, 120, 232, 197, 197, 120, 233, 197, 103, 197, - 196, 85, 120, 120, 196, 196, 105, 43, 196, 280, - 280, 43, 84, 196, 196, 197, 280, 196, 43, 43, - 196, 81, 215, 23, 23, 78, 197, 23, 196, 250, - 197, 197, 279, 279, 197, 252, 253, 279, 279, 197, - 197, 77, 71, 197, 279, 23, 197, 160, 68, 26, - 26, 160, 160, 26, 197, 26, 23, 268, 67, 234, - 23, 23, 211, 234, 23, 274, 234, 66, 23, 23, - 234, 26, 107, 23, 108, 198, 198, 109, 207, 198, - 114, 198, 26, 115, 23, 119, 26, 26, 64, 121, - 26, 35, 35, 35, 35, 26, 26, 198, 52, 26, - 29, 29, 26, 51, 29, 50, 29, 127, 198, 132, - 26, 36, 198, 198, 307, 307, 198, 133, 307, 136, - 307, 198, 198, 138, 192, 198, 139, 33, 198, 34, - 34, 34, 34, 29, 140, 142, 198, 29, 29, 305, - 305, 29, 315, 305, 144, 305, 29, 307, 16, 327, - 29, 307, 307, 199, 199, 307, 328, 199, 330, 199, - 307, 29, 297, 297, 307, 331, 332, 297, 297, 337, - 153, 175, 305, 154, 297, 307, 305, 305, 9, 288, - 305, 28, 28, 28, 28, 305, 199, 288, 352, 305, - 199, 199, 8, 356, 199, 298, 298, 173, 367, 199, - 305, 172, 298, 199, 369, 200, 200, 3, 2, 200, - 157, 200, 263, nil, 199, 288, 288, 288, 288, 288, - 288, nil, 288, 288, nil, nil, nil, 200, 298, 288, - nil, nil, 298, 298, nil, nil, 298, nil, 200, nil, - nil, 298, 200, 200, nil, 298, 200, 4, 4, 4, - 4, 200, 200, 39, 39, 200, 298, 39, 200, 39, - 293, 293, 293, 293, 293, 293, 200, 293, 293, nil, - 283, 283, 283, 283, 293, 39, nil, 283, 283, 201, - 201, nil, nil, 201, 283, 201, 39, nil, nil, nil, + 181, 369, 369, 163, 180, 156, 17, 202, 165, 17, + 158, 202, 202, 158, 163, 202, 165, 182, 182, 163, + 202, 202, 195, 182, 202, 195, 22, 202, 22, 17, + 273, 243, 181, 158, 369, 202, 181, 181, 369, 369, + 181, 22, 369, 273, 181, 181, 215, 369, 65, 181, + 182, 369, 356, 356, 182, 182, 243, 243, 182, 65, + 181, 239, 369, 182, 65, 22, 350, 182, 62, 350, + 352, 352, 239, 221, 352, 224, 352, 239, 182, 62, + 284, 284, 284, 284, 62, 356, 221, 284, 284, 356, + 356, 91, 352, 356, 284, 342, 342, 226, 356, 342, + 7, 342, 356, 352, 227, 282, 282, 352, 352, 7, + 7, 352, 282, 356, 184, 184, 352, 352, 1, 122, + 352, 171, 1, 352, 122, 171, 171, 90, 342, 1, + 287, 352, 342, 342, 229, 309, 342, 184, 287, 12, + 309, 342, 30, 12, 188, 342, 30, 184, 188, 188, + 12, 184, 184, 30, 30, 184, 342, 196, 196, 184, + 184, 196, 87, 196, 184, 231, 287, 287, 287, 287, + 287, 287, 183, 287, 287, 184, 183, 183, 232, 196, + 287, 43, 233, 197, 197, 43, 101, 197, 85, 197, + 196, 103, 43, 43, 196, 196, 84, 120, 196, 281, + 281, 120, 81, 196, 196, 197, 281, 196, 120, 120, + 196, 344, 344, 23, 23, 95, 197, 23, 196, 78, + 197, 197, 298, 298, 197, 250, 252, 298, 298, 197, + 197, 253, 77, 197, 298, 23, 197, 160, 71, 26, + 26, 160, 160, 26, 197, 26, 23, 68, 269, 234, + 23, 23, 105, 234, 23, 211, 234, 275, 23, 23, + 234, 26, 66, 23, 107, 198, 198, 108, 109, 198, + 207, 198, 26, 114, 23, 115, 26, 26, 119, 64, + 26, 34, 34, 34, 34, 26, 26, 198, 121, 26, + 29, 29, 26, 52, 29, 51, 29, 50, 198, 127, + 26, 132, 198, 198, 308, 308, 198, 36, 308, 133, + 308, 198, 198, 136, 138, 198, 192, 139, 198, 28, + 28, 28, 28, 29, 33, 140, 198, 29, 29, 306, + 306, 29, 142, 306, 316, 306, 29, 308, 144, 16, + 29, 308, 308, 199, 199, 308, 328, 199, 329, 199, + 308, 29, 280, 280, 308, 331, 332, 280, 280, 333, + 338, 153, 306, 175, 280, 308, 306, 306, 154, 289, + 306, 4, 4, 4, 4, 306, 199, 289, 9, 306, + 199, 199, 353, 8, 199, 299, 299, 357, 173, 199, + 306, 368, 299, 199, 172, 200, 200, 370, 3, 200, + 2, 200, 157, 264, 199, 289, 289, 289, 289, 289, + 289, nil, 289, 289, nil, nil, nil, 200, 299, 289, + nil, nil, 299, 299, nil, nil, 299, nil, 200, nil, + nil, 299, 200, 200, nil, 299, 200, 35, 35, 35, + 35, 200, 200, 39, 39, 200, 299, 39, 200, 39, + 294, 294, 294, 294, 294, 294, 200, 294, 294, nil, + 286, 286, 286, 286, 294, 39, nil, 286, 286, 201, + 201, nil, nil, 201, 286, 201, 39, nil, nil, nil, 39, 39, nil, nil, 39, nil, nil, nil, nil, 39, 39, 201, nil, 39, nil, nil, 39, nil, nil, 46, 46, nil, 201, 46, 39, 46, 201, 201, nil, nil, @@ -553,14 +308,14 @@ racc_action_check = [ 63, nil, nil, 63, nil, nil, nil, nil, 63, nil, 208, nil, 63, nil, 209, 209, nil, nil, 209, nil, 209, 208, nil, 63, nil, 208, 208, nil, nil, 208, - nil, nil, 269, 269, 208, 208, 209, nil, 208, 276, - 276, 208, nil, 276, nil, 276, nil, 209, nil, 208, + nil, nil, 270, 270, 208, 208, 209, nil, 208, 277, + 277, 208, nil, 277, nil, 277, nil, 209, nil, 208, nil, 209, 209, nil, nil, 209, nil, nil, nil, nil, - 209, 209, nil, nil, 209, 269, nil, 209, nil, 269, - 269, nil, 276, 269, nil, 209, 276, 276, 269, nil, - 276, nil, 269, nil, nil, 276, 256, 256, nil, 276, - 256, nil, 256, 269, nil, nil, nil, nil, nil, nil, - 276, nil, nil, nil, nil, 74, 74, nil, 256, nil, + 209, 209, nil, nil, 209, 270, nil, 209, nil, 270, + 270, nil, 277, 270, nil, 209, 277, 277, 270, nil, + 277, nil, 270, nil, nil, 277, 256, 256, nil, 277, + 256, nil, 256, 270, nil, nil, nil, nil, nil, nil, + 277, nil, nil, nil, nil, 74, 74, nil, 256, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 256, nil, nil, nil, 256, 256, nil, nil, 256, 74, nil, 254, 254, 256, 256, nil, nil, 256, nil, 74, 256, @@ -580,9 +335,9 @@ racc_action_check = [ nil, nil, 225, nil, 210, 82, 225, nil, nil, 82, 82, nil, nil, 82, nil, 210, nil, 225, 82, 210, 210, nil, 82, 210, nil, nil, nil, nil, 210, 210, - 213, 213, 210, 82, 213, 210, 213, 284, 284, 284, - 284, 284, 284, 210, 284, 284, nil, nil, nil, 102, - 102, 284, 213, 102, 102, 102, 230, 230, nil, nil, + 213, 213, 210, 82, 213, 210, 213, 285, 285, 285, + 285, 285, 285, 210, 285, 285, nil, nil, nil, 102, + 102, 285, 213, 102, 102, 102, 230, 230, nil, nil, 230, nil, 230, 213, nil, nil, nil, 213, 213, nil, nil, 213, nil, nil, nil, nil, 213, 213, 214, 214, 213, nil, 102, 213, nil, nil, 102, 102, nil, 230, @@ -611,303 +366,285 @@ racc_action_check = [ 131, 131, 131, 131, nil, nil, nil, nil, nil, 130, 130, nil, nil, 130, 130, 130, 130, 130, 130, nil, 130, 130, nil, nil, 131, 131, nil, 130, 131, 131, - 131, 131, 131, 131, nil, 131, 131, 287, 287, nil, - nil, nil, 131, nil, nil, nil, 287, 287, 287, 287, + 131, 131, 131, 131, nil, 131, 131, 288, 288, nil, + nil, nil, 131, nil, nil, nil, 288, 288, 288, 288, nil, nil, 186, 186, nil, nil, nil, nil, nil, nil, 186, 186, 186, 186, 186, nil, nil, nil, nil, nil, - nil, 287, nil, nil, 287, 287, 287, 287, 287, 287, - nil, 287, 287, nil, nil, 186, 186, nil, 287, 186, - 186, 186, 186, 186, 186, nil, 186, 186, 291, 291, - nil, nil, nil, 186, nil, nil, nil, 291, 291, 291, - 291, nil, nil, 19, 292, 19, 19, nil, 19, 19, - nil, 19, 292, 19, nil, 19, nil, 19, nil, nil, - 19, 19, nil, 289, nil, 291, 291, 291, 291, 291, - 291, 289, 291, 291, nil, nil, nil, nil, nil, 291, - 292, 292, 292, 292, 292, 292, nil, 292, 292, nil, - nil, 237, nil, nil, 292, nil, nil, nil, nil, 289, - 289, 289, 289, 289, 289, nil, 289, 289, nil, nil, - 372, nil, 237, 289, 237, 237, nil, 237, 237, nil, + nil, 288, nil, nil, 288, 288, 288, 288, 288, 288, + nil, 288, 288, nil, nil, 186, 186, nil, 288, 186, + 186, 186, 186, 186, 186, nil, 186, 186, 292, 292, + nil, nil, nil, 186, nil, nil, nil, 292, 292, 292, + 292, nil, nil, 19, 293, 19, 19, nil, 19, 19, + nil, 19, 293, 19, nil, 19, nil, 19, nil, nil, + 19, 19, nil, 290, nil, 292, 292, 292, 292, 292, + 292, 290, 292, 292, nil, nil, nil, nil, nil, 292, + 293, 293, 293, 293, 293, 293, nil, 293, 293, nil, + nil, 237, nil, nil, 293, nil, nil, nil, nil, 290, + 290, 290, 290, 290, 290, nil, 290, 290, nil, nil, + 373, nil, 237, 290, 237, 237, nil, 237, 237, nil, 237, nil, 237, nil, 237, nil, 237, nil, nil, 237, - 237, 372, 378, 372, 372, nil, 372, 372, nil, 372, - nil, 372, nil, 372, nil, 372, nil, nil, 372, 372, - nil, 212, nil, 378, nil, 378, 378, nil, 378, 378, - nil, 378, nil, 378, nil, 378, nil, 378, nil, nil, - 378, 378, 212, 323, 212, 212, nil, 212, 212, nil, + 237, 373, 379, 373, 373, nil, 373, 373, nil, 373, + nil, 373, nil, 373, nil, 373, nil, nil, 373, 373, + nil, 212, nil, 379, nil, 379, 379, nil, 379, 379, + nil, 379, nil, 379, nil, 379, nil, 379, nil, nil, + 379, 379, 212, 324, 212, 212, nil, 212, 212, nil, 212, nil, 212, nil, 212, nil, 212, nil, nil, 212, - 212, nil, 374, nil, 323, nil, 323, 323, nil, 323, - 323, nil, 323, nil, 323, nil, 323, nil, 323, nil, - nil, 323, 323, 374, 380, 374, 374, nil, 374, 374, - nil, 374, nil, 374, nil, 374, nil, 374, nil, nil, - 374, 374, nil, 303, nil, 380, nil, 380, 380, nil, - 380, 380, nil, 380, nil, 380, nil, 380, nil, 380, - nil, nil, 380, 380, 303, 319, 303, 303, nil, 303, - 303, nil, 303, nil, 303, nil, 303, nil, 303, nil, - nil, 303, 303, nil, 362, nil, 319, nil, 319, 319, - nil, 319, 319, nil, 319, nil, 319, nil, 319, nil, - 319, nil, nil, 319, 319, 362, 217, 362, 362, nil, - 362, 362, nil, 362, nil, 362, nil, 362, nil, 362, - nil, nil, 362, 362, nil, 295, nil, 217, nil, 217, + 212, nil, 375, nil, 324, nil, 324, 324, nil, 324, + 324, nil, 324, nil, 324, nil, 324, nil, 324, nil, + nil, 324, 324, 375, 381, 375, 375, nil, 375, 375, + nil, 375, nil, 375, nil, 375, nil, 375, nil, nil, + 375, 375, nil, 304, nil, 381, nil, 381, 381, nil, + 381, 381, nil, 381, nil, 381, nil, 381, nil, 381, + nil, nil, 381, 381, 304, 320, 304, 304, nil, 304, + 304, nil, 304, nil, 304, nil, 304, nil, 304, nil, + nil, 304, 304, nil, 363, nil, 320, nil, 320, 320, + nil, 320, 320, nil, 320, nil, 320, nil, 320, nil, + 320, nil, nil, 320, 320, 363, 217, 363, 363, nil, + 363, 363, nil, 363, nil, 363, nil, 363, nil, 363, + nil, nil, 363, 363, nil, 296, nil, 217, nil, 217, 217, nil, 217, 217, nil, 217, nil, 217, nil, 217, - nil, 217, nil, nil, 217, 217, 295, nil, 295, 295, - nil, 295, 295, nil, 295, nil, 295, nil, 295, nil, - 295, nil, nil, 295, 295, 0, nil, 0, 0, nil, + nil, 217, nil, nil, 217, 217, 296, nil, 296, 296, + nil, 296, 296, nil, 296, nil, 296, nil, 296, nil, + 296, nil, nil, 296, 296, 0, nil, 0, 0, nil, 0, 0, nil, 0, nil, 0, nil, 0, nil, 0, nil, nil, 0, 0 ] racc_action_pointer = [ - 1795, 163, 443, 413, 433, nil, nil, 3, 434, 420, - nil, nil, 142, nil, nil, nil, 398, 26, nil, 1483, - nil, nil, 80, 271, nil, nil, 297, nil, 367, 348, - 166, nil, nil, 375, 315, 277, 337, nil, nil, 501, - nil, nil, nil, 221, nil, nil, 557, 583, 608, 622, - 315, 329, 348, nil, nil, 4, nil, nil, nil, nil, - nil, nil, 97, 780, 298, -9, 309, 302, 275, nil, - nil, 286, nil, nil, 923, 966, nil, 279, 269, nil, - 6, 248, 1060, nil, 239, 245, -3, 177, nil, nil, - 149, 137, nil, nil, 1209, 10, nil, 1239, nil, nil, - 755, 121, 1137, 225, nil, 233, 3, 299, 301, 304, - nil, 1298, nil, nil, 322, 325, nil, nil, nil, 323, - 205, 331, 144, nil, 1313, nil, nil, 351, nil, nil, - 1359, 1374, 352, 344, nil, nil, 328, nil, 350, 364, - 361, nil, 362, 79, 374, nil, nil, nil, nil, nil, - nil, nil, -9, 408, 386, nil, 2, 452, 30, nil, - 251, nil, nil, 84, nil, 50, nil, nil, nil, nil, - nil, 174, 439, 436, -14, 381, 647, nil, 114, nil, - -4, 57, 75, 197, 172, nil, 1435, nil, 225, nil, - nil, nil, 363, nil, nil, 213, 215, 241, 323, 401, - 453, 527, 32, 673, 699, 729, 1265, 265, 806, 832, - 1070, 249, 1612, 1118, 1166, 270, nil, 1757, 24, 24, - 91, 121, nil, nil, 142, 1044, 126, 161, 1191, 147, - 1144, 198, 233, 238, 273, nil, nil, 1552, nil, 39, + 1795, 142, 445, 414, 367, nil, nil, 154, 435, 430, + nil, nil, 163, nil, nil, nil, 399, 26, nil, 1483, + nil, nil, 80, 271, nil, nil, 297, nil, 315, 348, + 166, nil, nil, 382, 277, 433, 343, nil, nil, 501, + nil, nil, nil, 205, nil, nil, 557, 583, 608, 622, + 317, 331, 353, nil, nil, 4, nil, nil, nil, nil, + nil, nil, 104, 780, 299, 84, 314, 3, 284, nil, + nil, 292, nil, nil, 923, 966, nil, 280, 273, nil, + -8, 239, 1060, nil, 233, 242, -3, 199, nil, nil, + 164, 128, nil, nil, 1209, 252, nil, 1239, nil, nil, + 755, 223, 1137, 228, nil, 289, 3, 301, 304, 305, + nil, 1298, nil, nil, 325, 327, nil, nil, nil, 326, + 221, 340, 144, nil, 1313, nil, nil, 353, nil, nil, + 1359, 1374, 354, 346, nil, nil, 332, nil, 351, 365, + 362, nil, 369, -4, 378, nil, nil, nil, nil, nil, + nil, nil, -9, 409, 391, nil, 2, 454, 30, nil, + 251, nil, nil, 39, nil, 50, nil, nil, nil, nil, + nil, 174, 442, 437, -14, 383, 647, nil, 6, nil, + -4, 57, 75, 225, 172, nil, 1435, nil, 197, nil, + nil, nil, 365, nil, nil, 73, 215, 241, 323, 401, + 453, 527, 32, 673, 699, 729, 1265, 267, 806, 832, + 1070, 252, 1612, 1118, 1166, 104, nil, 1757, 14, 14, + 34, 121, nil, nil, 126, 1044, 117, 155, 1191, 154, + 1144, 185, 229, 234, 273, nil, nil, 1552, nil, 97, nil, nil, nil, 66, 1017, 1001, nil, nil, 991, nil, - 270, nil, 273, 279, 948, nil, 904, nil, nil, nil, - nil, nil, nil, 451, nil, nil, nil, nil, 283, 850, - nil, nil, -5, nil, 308, nil, 857, 8, nil, 226, - 198, 67, nil, 466, 1073, 86, 172, 1420, 411, 1515, - nil, 1481, 1496, 456, nil, 1776, -4, 356, 443, nil, - 145, nil, nil, 1694, nil, 387, nil, 362, 129, nil, - nil, nil, nil, nil, nil, 380, nil, nil, nil, 1716, - nil, nil, nil, 1634, nil, nil, nil, 376, 383, nil, - 385, 392, 393, nil, nil, nil, nil, 410, nil, nil, - nil, 153, nil, 183, nil, nil, nil, nil, nil, 51, - nil, 128, 430, nil, nil, 110, 435, nil, nil, nil, - nil, nil, 1735, nil, nil, nil, nil, 439, 59, 445, - nil, nil, 1571, nil, 1653, nil, nil, nil, 1593, nil, - 1675, nil, nil, nil ] + 276, nil, 274, 284, 948, nil, 904, nil, nil, nil, + nil, nil, nil, nil, 452, nil, nil, nil, nil, 284, + 850, nil, nil, 78, nil, 310, nil, 857, 8, nil, + 356, 198, 104, nil, 86, 1073, 466, 172, 1420, 411, + 1515, nil, 1481, 1496, 456, nil, 1776, -1, 226, 443, + nil, 7, nil, nil, 1694, nil, 387, nil, 362, 160, + nil, nil, nil, nil, nil, nil, 382, nil, nil, nil, + 1716, nil, nil, nil, 1634, nil, nil, nil, 383, 385, + nil, 392, 393, 396, nil, nil, nil, nil, 411, nil, + nil, nil, 153, nil, 260, nil, nil, nil, nil, nil, + 95, nil, 128, 434, nil, nil, 110, 439, nil, nil, + nil, nil, nil, 1735, nil, nil, nil, nil, 442, 59, + 448, nil, nil, 1571, nil, 1653, nil, nil, nil, 1593, + nil, 1675, nil, nil, nil ] racc_action_default = [ - -196, -233, -233, -50, -233, -8, -9, -233, -233, -22, - -10, -187, -188, -11, -185, -12, -233, -233, -13, -1, - -14, -2, -233, -186, -15, -3, -233, -16, -5, -233, - -233, -17, -6, -233, -18, -7, -196, -188, -186, -233, - -51, -26, -27, -233, -24, -25, -233, -233, -233, -85, - -92, -196, -233, -195, -193, -196, -189, -191, -192, -221, - -194, -4, -196, -233, -85, -196, -53, -231, -42, -174, - -43, -213, -117, -33, -233, -233, -44, -31, -74, -32, - -233, -36, -233, -122, -37, -233, -73, -38, -172, -72, - -39, -40, -173, -41, -233, -103, -111, -233, -132, -112, - -233, -104, -233, -108, -110, -105, -233, -114, -106, -113, - -109, -233, -125, -107, -233, -233, -49, -175, -176, -178, - -233, -233, -197, -198, -83, -19, -22, -186, -21, -23, - -82, -84, -233, -75, -86, -81, -70, -74, -76, -219, - -79, -68, -77, -73, -233, -171, -170, -80, -78, -90, - -91, -93, -233, -219, -196, 384, -233, -233, -233, -207, - -233, -57, -213, -196, -59, -233, -66, -65, -56, -73, - -95, -233, -219, -233, -233, -92, -233, -30, -233, -118, - -233, -233, -233, -233, -233, -142, -233, -149, -233, -216, - -229, -225, -233, -228, -224, -233, -233, -233, -233, -233, - -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, - -233, -233, -233, -233, -233, -233, -20, -233, -206, -233, - -204, -233, -201, -230, -233, -71, -220, -233, -233, -85, - -233, -220, -233, -233, -233, -209, -190, -233, -208, -233, - -54, -62, -61, -233, -233, -233, -217, -218, -233, -124, - -233, -55, -219, -233, -233, -28, -233, -120, -119, -35, - -34, -168, -166, -233, -169, -160, -167, -161, -73, -233, - -123, -116, -233, -152, -218, -214, -233, -233, -222, -137, - -139, -138, -133, -140, -144, -141, -146, -151, -148, -145, - -134, -150, -147, -143, -135, -233, -128, -136, -233, -154, - -233, -158, -177, -233, -180, -233, -199, -233, -233, -200, - -45, -69, -87, -46, -88, -219, -89, -94, -48, -233, - -211, -210, -212, -233, -184, -58, -60, -97, -98, -63, - -102, -99, -100, -101, -64, -96, -47, -233, -232, -29, - -121, -233, -163, -219, -115, -215, -227, -226, -223, -128, - -127, -233, -233, -155, -153, -233, -233, -179, -205, -203, - -202, -67, -233, -182, -183, -52, -165, -218, -233, -233, - -126, -129, -233, -159, -233, -181, -164, -162, -233, -131, - -233, -157, -130, -156 ] + -197, -234, -234, -50, -234, -8, -9, -234, -234, -22, + -10, -188, -189, -11, -186, -12, -234, -234, -13, -1, + -14, -2, -234, -187, -15, -3, -234, -16, -5, -234, + -234, -17, -6, -234, -18, -7, -197, -189, -187, -234, + -51, -26, -27, -234, -24, -25, -234, -234, -234, -85, + -92, -197, -234, -196, -194, -197, -190, -192, -193, -222, + -195, -4, -197, -234, -85, -197, -53, -232, -42, -175, + -43, -214, -117, -33, -234, -234, -44, -31, -74, -32, + -234, -36, -234, -122, -37, -234, -73, -38, -172, -72, + -39, -40, -174, -41, -234, -103, -111, -234, -132, -112, + -234, -104, -234, -108, -110, -105, -234, -114, -106, -113, + -109, -234, -125, -107, -234, -234, -49, -176, -177, -179, + -234, -234, -198, -199, -83, -19, -22, -187, -21, -23, + -82, -84, -234, -75, -86, -81, -70, -74, -76, -220, + -79, -68, -77, -73, -234, -171, -170, -80, -78, -90, + -91, -93, -234, -220, -197, 385, -234, -234, -234, -208, + -234, -57, -214, -197, -59, -234, -66, -65, -56, -73, + -95, -234, -220, -234, -234, -92, -234, -30, -234, -118, + -234, -234, -234, -234, -234, -142, -234, -149, -234, -217, + -230, -226, -234, -229, -225, -234, -234, -234, -234, -234, + -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, + -234, -234, -234, -234, -234, -234, -20, -234, -207, -234, + -205, -234, -202, -231, -234, -71, -221, -234, -234, -85, + -234, -221, -234, -234, -234, -210, -191, -234, -209, -234, + -54, -62, -61, -234, -234, -234, -218, -219, -234, -124, + -234, -55, -220, -234, -234, -28, -234, -120, -119, -35, + -34, -173, -168, -166, -234, -169, -160, -167, -161, -73, + -234, -123, -116, -234, -152, -219, -215, -234, -234, -223, + -137, -139, -138, -133, -140, -144, -141, -146, -151, -148, + -145, -134, -150, -147, -143, -135, -234, -128, -136, -234, + -154, -234, -158, -178, -234, -181, -234, -200, -234, -234, + -201, -45, -69, -87, -46, -88, -220, -89, -94, -48, + -234, -212, -211, -213, -234, -185, -58, -60, -97, -98, + -63, -102, -99, -100, -101, -64, -96, -47, -234, -233, + -29, -121, -234, -163, -220, -115, -216, -228, -227, -224, + -128, -127, -234, -234, -155, -153, -234, -234, -180, -206, + -204, -203, -67, -234, -183, -184, -52, -165, -219, -234, + -234, -126, -129, -234, -159, -234, -182, -164, -162, -234, + -131, -234, -157, -130, -156 ] racc_goto_table = [ - 22, 9, 68, 112, 53, 118, 61, 36, 91, 222, - 19, 267, 70, 93, 2, 227, 139, 191, 51, 22, - 9, 179, 77, 56, 73, 149, 21, 141, 133, 232, - 115, 172, 153, 2, 146, 263, 125, 116, 135, 148, - 147, 299, 129, 22, 126, 260, 160, 350, 250, 174, - 128, 171, 43, 68, 121, 329, 334, 298, 368, 91, - 258, 265, 123, 70, 93, 317, 343, 301, 136, 154, - 183, 119, 224, 178, 233, 73, 55, 123, 157, 66, - 238, 159, 120, 219, 221, 190, 325, 321, 195, 16, - 188, nil, nil, nil, nil, nil, nil, nil, 342, nil, - 370, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, 216, nil, nil, nil, nil, 260, 129, - 22, 126, 263, nil, nil, 353, nil, 128, 337, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 81, - nil, nil, nil, 53, nil, 53, nil, 243, nil, nil, - 149, 301, nil, nil, nil, nil, nil, 252, nil, nil, - 68, 261, 236, 68, nil, 138, 91, 146, nil, 91, - 70, 93, nil, 70, 93, nil, nil, nil, 166, nil, - 235, 166, 259, 272, nil, 73, nil, 302, 347, nil, - 81, 361, nil, 261, 290, 360, 315, 376, 294, 146, - nil, 312, 340, 311, 133, nil, 149, nil, 373, nil, - 146, nil, 22, 9, 135, 148, 147, 22, 9, 369, - nil, 263, 295, 327, 327, nil, 2, 303, nil, 146, - 146, 2, nil, 68, 333, 333, nil, 22, 9, 91, - 320, 88, nil, 70, 93, nil, nil, 323, 261, nil, - nil, 2, nil, nil, 146, 259, 190, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, 88, nil, nil, - nil, nil, nil, nil, nil, 87, nil, 261, nil, 166, - nil, nil, 61, 146, nil, nil, nil, nil, nil, nil, - 61, nil, 88, nil, nil, 22, 9, 81, 262, nil, - 81, 142, nil, 22, 9, nil, nil, nil, nil, 2, - 61, nil, nil, nil, nil, nil, nil, 2, nil, 22, - 9, nil, nil, 22, 9, nil, 87, nil, 371, 362, - 262, nil, nil, 2, 261, nil, nil, 2, nil, nil, - 146, 138, nil, nil, nil, nil, nil, 261, nil, 61, - nil, nil, nil, 146, nil, 166, nil, nil, nil, nil, - 328, 328, 22, 9, 114, 61, nil, 61, nil, 84, - 81, nil, 22, 9, 22, 9, 2, 90, 22, 9, - 22, 9, 378, 132, 380, 262, 2, nil, 2, nil, - nil, nil, 2, nil, 2, 140, nil, nil, 170, 88, - 88, nil, 88, 145, nil, nil, nil, nil, 167, nil, - nil, 167, nil, nil, 262, nil, nil, 170, nil, nil, - 84, nil, nil, nil, nil, nil, nil, nil, 90, nil, - nil, nil, 88, 87, 266, nil, 87, 170, nil, nil, - nil, nil, nil, 88, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 88, 88, nil, nil, 266, nil, nil, nil, - nil, 262, 88, nil, nil, nil, nil, 142, nil, nil, - nil, nil, nil, nil, 262, nil, nil, 88, nil, nil, - nil, nil, nil, nil, nil, nil, 331, 331, nil, nil, - nil, nil, nil, nil, nil, nil, 87, nil, nil, 167, - nil, 253, nil, nil, nil, nil, 88, nil, nil, nil, - nil, 266, nil, nil, nil, nil, nil, 84, 264, nil, - 84, nil, nil, nil, 282, 90, 145, nil, 90, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 266, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 264, nil, nil, 314, nil, 316, nil, 124, 145, nil, - nil, 140, nil, 88, 130, 131, nil, nil, nil, 145, - nil, nil, nil, 335, nil, 167, 88, nil, nil, nil, - 330, 330, nil, nil, nil, nil, nil, nil, 332, 332, - 84, nil, nil, 180, nil, nil, nil, 266, 90, nil, - nil, 346, nil, nil, nil, 264, nil, nil, nil, nil, - 266, nil, 185, 145, nil, 186, nil, nil, 187, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 358, nil, 359, nil, 264, nil, nil, nil, nil, nil, - nil, nil, 145, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 366, nil, nil, nil, + 22, 9, 68, 112, 222, 264, 61, 36, 53, 179, + 268, 141, 70, 19, 2, 77, 191, 118, 51, 22, + 9, 139, 116, 21, 73, 91, 56, 147, 133, 149, + 115, 227, 153, 2, 300, 128, 172, 302, 135, 160, + 125, 129, 174, 22, 126, 232, 351, 43, 171, 299, + 260, 146, 369, 68, 121, 330, 335, 258, 266, 123, + 318, 344, 136, 70, 250, 119, 178, 183, 224, 154, + 233, 55, 157, 66, 123, 73, 91, 120, 159, 238, + 219, 221, 326, 322, 195, 190, 16, 188, nil, nil, + nil, nil, nil, 264, nil, nil, nil, nil, 343, 371, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 128, nil, nil, 88, nil, 216, 129, 354, + 22, 126, 302, 260, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, 264, nil, nil, nil, nil, nil, nil, nil, 145, - nil, nil, nil, nil, 264, nil, nil, nil, nil, nil, - nil, nil, 145, nil, 279, 280, 281, nil, 283, 284, - 285, 286, 287, 288, 289, nil, 291, 292, 293, nil, - nil, 297, nil, nil, nil, nil, nil, nil, nil, nil, + 243, 88, nil, nil, 338, nil, nil, 53, nil, 53, + nil, nil, nil, nil, 149, nil, nil, 252, nil, nil, + 68, 262, nil, 68, nil, 236, 88, nil, nil, nil, + 70, nil, nil, 70, nil, nil, 273, 235, nil, 374, + nil, nil, 259, 91, 146, 73, 91, 312, 348, nil, + 341, 361, 264, 262, 87, nil, 261, 377, 291, 303, + nil, 316, 295, 147, 133, 313, nil, nil, 362, nil, + 149, nil, 22, 9, 135, nil, 146, 22, 9, nil, + 142, nil, nil, 328, 328, 296, 2, 146, 261, nil, + 304, 2, nil, 68, nil, nil, 370, 22, 9, nil, + 321, nil, nil, 70, nil, 87, 146, 146, nil, 262, + 324, 2, nil, nil, nil, 259, 91, 190, 261, 261, + nil, 81, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 146, 88, 88, nil, 88, nil, 262, nil, + nil, nil, nil, 61, 261, nil, nil, 138, 84, nil, + nil, 61, nil, nil, nil, nil, 22, 9, nil, nil, + 166, 146, nil, 166, 22, 9, 88, nil, nil, nil, + 2, 61, 81, 261, 140, nil, nil, 88, 2, nil, + 22, 9, nil, nil, 22, 9, nil, 167, nil, 372, + 167, nil, nil, 363, 2, 262, 88, 88, 2, 84, + nil, 90, nil, nil, nil, nil, 88, nil, 262, nil, + 61, nil, 87, 267, nil, 87, nil, nil, 146, nil, + nil, nil, 88, 22, 9, nil, 61, 145, 61, nil, + 261, 146, nil, 22, 9, 22, 9, 2, 114, 22, + 9, 22, 9, 261, 93, 267, 379, 2, 381, 2, + nil, 88, 90, 2, nil, 2, 142, 132, nil, nil, + nil, 166, nil, nil, nil, nil, nil, nil, nil, nil, + 148, nil, 170, nil, nil, 332, 332, nil, nil, 81, + 263, nil, 81, nil, nil, 87, nil, nil, 167, nil, + nil, 170, nil, nil, nil, 93, nil, nil, nil, nil, + nil, 267, nil, nil, nil, nil, 84, 265, 88, 84, + nil, 170, 263, nil, nil, nil, nil, nil, nil, nil, + nil, 88, nil, 138, nil, nil, nil, nil, nil, nil, + 267, nil, nil, nil, nil, nil, nil, 166, 124, 265, + nil, nil, 329, 329, nil, 130, 131, nil, nil, nil, + 140, nil, 81, nil, nil, nil, nil, nil, nil, 90, + 145, nil, 90, nil, 167, nil, nil, nil, 263, 331, + 331, nil, nil, nil, 180, nil, nil, nil, nil, 84, + nil, nil, nil, nil, nil, 253, nil, 267, nil, nil, + nil, nil, 145, 185, nil, 265, 186, 263, nil, 187, + 267, nil, 93, 145, nil, 93, nil, nil, 283, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 333, 333, 265, nil, nil, nil, nil, nil, + nil, nil, 90, nil, nil, nil, nil, 315, nil, 317, + nil, nil, nil, nil, nil, nil, 148, nil, 145, nil, + nil, nil, nil, nil, 263, nil, nil, 336, nil, nil, + nil, nil, nil, nil, nil, 334, 334, 263, nil, nil, + nil, nil, nil, nil, nil, 93, nil, 145, nil, nil, + nil, 265, nil, nil, nil, nil, 347, nil, nil, nil, + nil, nil, nil, nil, 265, 280, 281, 282, nil, 284, + 285, 286, 287, 288, 289, 290, nil, 292, 293, 294, + nil, nil, 298, nil, nil, 359, nil, 360, 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, 180 ] + nil, nil, nil, nil, 145, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, 145, nil, nil, + nil, 367, nil, nil, nil, 180 ] racc_goto_check = [ - 37, 21, 30, 62, 64, 72, 4, 32, 28, 82, - 2, 70, 31, 29, 52, 36, 35, 85, 32, 37, - 21, 60, 22, 78, 21, 53, 3, 47, 30, 36, - 37, 35, 38, 52, 28, 68, 19, 5, 31, 29, - 50, 66, 7, 37, 21, 23, 41, 63, 36, 41, - 5, 57, 20, 30, 74, 46, 46, 65, 58, 28, - 61, 69, 3, 31, 29, 56, 71, 68, 33, 74, - 57, 73, 34, 22, 75, 21, 76, 3, 77, 40, - 79, 3, 20, 80, 81, 30, 42, 83, 84, 1, - 57, nil, nil, nil, nil, nil, nil, nil, 70, nil, - 63, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, 19, nil, nil, nil, nil, 23, 7, - 37, 21, 68, nil, nil, 66, nil, 5, 36, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 24, - nil, nil, nil, 64, nil, 64, nil, 41, nil, nil, - 53, 68, nil, nil, nil, nil, nil, 38, nil, nil, - 30, 30, 78, 30, nil, 24, 28, 28, nil, 28, - 31, 29, nil, 31, 29, nil, nil, nil, 24, nil, - 3, 24, 21, 22, nil, 21, nil, 72, 85, nil, - 24, 36, nil, 30, 64, 82, 35, 70, 64, 28, - nil, 53, 60, 47, 30, nil, 53, nil, 68, nil, - 28, nil, 37, 21, 31, 29, 50, 37, 21, 36, - nil, 68, 2, 30, 30, nil, 52, 2, nil, 28, - 28, 52, nil, 30, 29, 29, nil, 37, 21, 28, - 32, 49, nil, 31, 29, nil, nil, 2, 30, nil, - nil, 52, nil, nil, 28, 21, 30, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, 49, nil, nil, - nil, nil, nil, nil, nil, 26, nil, 30, nil, 24, - nil, nil, 4, 28, nil, nil, nil, nil, nil, nil, - 4, nil, 49, nil, nil, 37, 21, 24, 24, nil, - 24, 26, nil, 37, 21, nil, nil, nil, nil, 52, - 4, nil, nil, nil, nil, nil, nil, 52, nil, 37, - 21, nil, nil, 37, 21, nil, 26, nil, 62, 2, - 24, nil, nil, 52, 30, nil, nil, 52, nil, nil, - 28, 24, nil, nil, nil, nil, nil, 30, nil, 4, - nil, nil, nil, 28, nil, 24, nil, nil, nil, nil, - 24, 24, 37, 21, 54, 4, nil, 4, nil, 25, - 24, nil, 37, 21, 37, 21, 52, 27, 37, 21, - 37, 21, 2, 54, 2, 24, 52, nil, 52, nil, - nil, nil, 52, nil, 52, 25, nil, nil, 54, 49, - 49, nil, 49, 27, nil, nil, nil, nil, 25, nil, - nil, 25, nil, nil, 24, nil, nil, 54, nil, nil, - 25, nil, nil, nil, nil, nil, nil, nil, 27, nil, - nil, nil, 49, 26, 26, nil, 26, 54, nil, nil, - nil, nil, nil, 49, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 49, 49, nil, nil, 26, nil, nil, nil, - nil, 24, 49, nil, nil, nil, nil, 26, nil, nil, - nil, nil, nil, nil, 24, nil, nil, 49, nil, nil, - nil, nil, nil, nil, nil, nil, 26, 26, nil, nil, - nil, nil, nil, nil, nil, nil, 26, nil, nil, 25, - nil, 54, nil, nil, nil, nil, 49, nil, nil, nil, - nil, 26, nil, nil, nil, nil, nil, 25, 25, nil, - 25, nil, nil, nil, 54, 27, 27, nil, 27, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 26, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 25, nil, nil, 54, nil, 54, nil, 51, 27, nil, - nil, 25, nil, 49, 51, 51, nil, nil, nil, 27, - nil, nil, nil, 54, nil, 25, 49, nil, nil, nil, - 25, 25, nil, nil, nil, nil, nil, nil, 27, 27, - 25, nil, nil, 51, nil, nil, nil, 26, 27, nil, - nil, 54, nil, nil, nil, 25, nil, nil, nil, nil, - 26, nil, 51, 27, nil, 51, nil, nil, 51, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 54, nil, 54, nil, 25, nil, nil, nil, nil, nil, - nil, nil, 27, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 54, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + 37, 21, 30, 62, 82, 68, 4, 32, 64, 60, + 70, 47, 31, 2, 52, 22, 85, 72, 32, 37, + 21, 35, 5, 3, 21, 28, 78, 50, 30, 53, + 37, 36, 38, 52, 66, 5, 35, 68, 31, 41, + 19, 7, 41, 37, 21, 36, 63, 20, 57, 65, + 23, 28, 58, 30, 74, 46, 46, 61, 69, 3, + 56, 71, 33, 31, 36, 73, 22, 57, 34, 74, + 75, 76, 77, 40, 3, 21, 28, 20, 3, 79, + 80, 81, 42, 83, 84, 30, 1, 57, nil, nil, + nil, nil, nil, 68, nil, nil, nil, nil, 70, 63, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, 25, nil, nil, nil, nil, nil, nil, nil, 27, - nil, nil, nil, nil, 25, nil, nil, nil, nil, nil, - nil, nil, 27, nil, 51, 51, 51, nil, 51, 51, - 51, 51, 51, 51, 51, nil, 51, 51, 51, nil, - nil, 51, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 5, nil, nil, 49, nil, 19, 7, 66, + 37, 21, 68, 23, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + 41, 49, nil, nil, 36, nil, nil, 64, nil, 64, + nil, nil, nil, nil, 53, nil, nil, 38, nil, nil, + 30, 30, nil, 30, nil, 78, 49, nil, nil, nil, + 31, nil, nil, 31, nil, nil, 22, 3, nil, 68, + nil, nil, 21, 28, 28, 21, 28, 47, 85, nil, + 60, 82, 68, 30, 26, nil, 52, 70, 64, 72, + nil, 35, 64, 50, 30, 53, nil, nil, 36, nil, + 53, nil, 37, 21, 31, nil, 28, 37, 21, nil, + 26, nil, nil, 30, 30, 2, 52, 28, 52, nil, + 2, 52, nil, 30, nil, nil, 36, 37, 21, nil, + 32, nil, nil, 31, nil, 26, 28, 28, nil, 30, + 2, 52, nil, nil, nil, 21, 28, 30, 52, 52, + nil, 24, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 28, 49, 49, nil, 49, nil, 30, nil, + nil, nil, nil, 4, 52, nil, nil, 24, 25, nil, + nil, 4, nil, nil, nil, nil, 37, 21, nil, nil, + 24, 28, nil, 24, 37, 21, 49, nil, nil, nil, + 52, 4, 24, 52, 25, nil, nil, 49, 52, nil, + 37, 21, nil, nil, 37, 21, nil, 25, nil, 62, + 25, nil, nil, 2, 52, 30, 49, 49, 52, 25, + nil, 27, nil, nil, nil, nil, 49, nil, 30, nil, + 4, nil, 26, 26, nil, 26, nil, nil, 28, nil, + nil, nil, 49, 37, 21, nil, 4, 27, 4, nil, + 52, 28, nil, 37, 21, 37, 21, 52, 54, 37, + 21, 37, 21, 52, 29, 26, 2, 52, 2, 52, + nil, 49, 27, 52, nil, 52, 26, 54, nil, nil, + nil, 24, nil, nil, nil, nil, nil, nil, nil, nil, + 29, nil, 54, nil, nil, 26, 26, nil, nil, 24, + 24, nil, 24, nil, nil, 26, nil, nil, 25, nil, + nil, 54, nil, nil, nil, 29, nil, nil, nil, nil, + nil, 26, nil, nil, nil, nil, 25, 25, 49, 25, + nil, 54, 24, nil, nil, nil, nil, nil, nil, nil, + nil, 49, nil, 24, nil, nil, nil, nil, nil, nil, + 26, nil, nil, nil, nil, nil, nil, 24, 51, 25, + nil, nil, 24, 24, nil, 51, 51, nil, nil, nil, + 25, nil, 24, nil, nil, nil, nil, nil, nil, 27, + 27, nil, 27, nil, 25, nil, nil, nil, 24, 25, + 25, nil, nil, nil, 51, nil, nil, nil, nil, 25, + nil, nil, nil, nil, nil, 54, nil, 26, nil, nil, + nil, nil, 27, 51, nil, 25, 51, 24, nil, 51, + 26, nil, 29, 27, nil, 29, nil, nil, 54, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 27, 27, 25, nil, nil, nil, nil, nil, + nil, nil, 27, nil, nil, nil, nil, 54, nil, 54, + nil, nil, nil, nil, nil, nil, 29, nil, 27, nil, + nil, nil, nil, nil, 24, nil, nil, 54, nil, nil, + nil, nil, nil, nil, nil, 29, 29, 24, nil, nil, + nil, nil, nil, nil, nil, 29, nil, 27, nil, nil, + nil, 25, nil, nil, nil, nil, 54, nil, nil, nil, + nil, nil, nil, nil, 25, 51, 51, 51, nil, 51, + 51, 51, 51, 51, 51, 51, nil, 51, 51, 51, + nil, nil, 51, nil, nil, 54, nil, 54, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 51 ] + nil, nil, nil, nil, 27, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, 27, nil, nil, + nil, 54, nil, nil, nil, 51 ] racc_goto_pointer = [ - nil, 89, 10, 26, -13, 7, nil, -1, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, -7, - 48, 1, -1, -136, 116, 346, 252, 354, -15, -10, - -21, -11, 6, 19, -64, -33, -124, 0, -18, nil, - 57, -16, -153, nil, nil, nil, -189, -22, nil, 218, - -9, 528, 14, -25, 335, nil, -166, -12, -285, nil, - -54, -120, -23, -249, -13, -157, -173, nil, -147, -121, - -171, -203, -28, 38, 18, -80, 59, 23, 6, -78, - -39, -38, -113, -147, -18, -89, nil ] + nil, 86, 13, 23, -13, -8, nil, -2, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, -3, + 43, 1, -8, -131, 238, 265, 171, 318, 2, 361, + -21, -11, 6, 13, -68, -28, -108, 0, -18, nil, + 51, -23, -157, nil, nil, nil, -189, -38, nil, 92, + -22, 439, 14, -21, 349, nil, -171, -15, -292, nil, + -66, -123, -23, -251, -9, -165, -180, nil, -177, -124, + -172, -209, -16, 32, 18, -84, 54, 17, 9, -79, + -42, -41, -118, -151, -22, -90, nil ] racc_goto_default = [ nil, nil, nil, 168, 25, 28, 32, 35, 5, 6, @@ -916,268 +653,508 @@ racc_goto_default = [ 95, 96, 8, nil, nil, nil, nil, 85, nil, 30, nil, nil, 161, 239, 164, 165, nil, nil, 144, 107, 110, 111, 67, 134, 98, 150, 151, nil, 248, 104, - nil, nil, nil, nil, 69, nil, nil, 300, 80, nil, + nil, nil, nil, nil, 69, nil, nil, 301, 80, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 57, nil, nil, nil, nil, nil, nil, 192 ] -racc_token_table = { - false => 0, - Object.new => 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_reduce_table = [ + 0, 0, :racc_error, + 1, 70, :_reduce_1, + 1, 70, :_reduce_none, + 1, 71, :_reduce_none, + 2, 71, :_reduce_4, + 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, 87, :_reduce_19, + 3, 87, :_reduce_20, + 1, 88, :_reduce_none, + 1, 88, :_reduce_none, + 1, 88, :_reduce_none, + 1, 89, :_reduce_none, + 1, 89, :_reduce_none, + 1, 89, :_reduce_none, + 1, 89, :_reduce_none, + 4, 81, :_reduce_28, + 5, 81, :_reduce_29, + 3, 81, :_reduce_30, + 2, 81, :_reduce_31, + 1, 91, :_reduce_none, + 1, 91, :_reduce_none, + 3, 91, :_reduce_34, + 3, 91, :_reduce_35, + 1, 92, :_reduce_none, + 1, 92, :_reduce_none, + 1, 92, :_reduce_none, + 1, 92, :_reduce_none, + 1, 92, :_reduce_none, + 1, 92, :_reduce_none, + 1, 92, :_reduce_none, + 1, 92, :_reduce_none, + 1, 92, :_reduce_44, + 5, 74, :_reduce_45, + 5, 74, :_reduce_46, + 5, 74, :_reduce_47, + 5, 85, :_reduce_48, + 2, 75, :_reduce_49, + 1, 108, :_reduce_50, + 2, 108, :_reduce_51, + 6, 76, :_reduce_52, + 2, 76, :_reduce_53, + 3, 109, :_reduce_54, + 3, 109, :_reduce_55, + 1, 110, :_reduce_none, + 1, 110, :_reduce_none, + 3, 110, :_reduce_58, + 1, 111, :_reduce_none, + 3, 111, :_reduce_60, + 1, 112, :_reduce_61, + 1, 112, :_reduce_62, + 3, 113, :_reduce_63, + 3, 113, :_reduce_64, + 1, 114, :_reduce_none, + 1, 114, :_reduce_none, + 4, 116, :_reduce_67, + 1, 102, :_reduce_none, + 3, 102, :_reduce_69, + 0, 103, :_reduce_none, + 1, 103, :_reduce_none, + 1, 118, :_reduce_72, + 1, 93, :_reduce_73, + 1, 95, :_reduce_74, + 1, 117, :_reduce_none, + 1, 117, :_reduce_none, + 1, 117, :_reduce_none, + 1, 117, :_reduce_none, + 1, 117, :_reduce_none, + 1, 117, :_reduce_none, + 1, 117, :_reduce_none, + 3, 77, :_reduce_82, + 3, 77, :_reduce_83, + 3, 86, :_reduce_84, + 0, 104, :_reduce_85, + 1, 104, :_reduce_86, + 3, 104, :_reduce_87, + 3, 122, :_reduce_88, + 3, 124, :_reduce_89, + 1, 125, :_reduce_none, + 1, 125, :_reduce_none, + 0, 107, :_reduce_92, + 1, 107, :_reduce_93, + 3, 107, :_reduce_94, + 1, 126, :_reduce_none, + 3, 126, :_reduce_96, + 1, 115, :_reduce_none, + 1, 115, :_reduce_none, + 1, 115, :_reduce_none, + 1, 115, :_reduce_none, + 1, 115, :_reduce_none, + 1, 115, :_reduce_none, + 1, 123, :_reduce_none, + 1, 123, :_reduce_none, + 1, 123, :_reduce_none, + 1, 123, :_reduce_none, + 1, 123, :_reduce_none, + 1, 123, :_reduce_none, + 1, 123, :_reduce_none, + 1, 123, :_reduce_none, + 1, 123, :_reduce_none, + 1, 123, :_reduce_none, + 1, 123, :_reduce_none, + 1, 123, :_reduce_none, + 4, 97, :_reduce_115, + 3, 97, :_reduce_116, + 1, 99, :_reduce_117, + 2, 99, :_reduce_118, + 2, 129, :_reduce_119, + 1, 130, :_reduce_120, + 2, 130, :_reduce_121, + 1, 96, :_reduce_122, + 4, 90, :_reduce_123, + 4, 90, :_reduce_124, + 2, 79, :_reduce_125, + 5, 131, :_reduce_126, + 4, 131, :_reduce_127, + 0, 132, :_reduce_none, + 2, 132, :_reduce_129, + 4, 132, :_reduce_130, + 3, 132, :_reduce_131, + 1, 120, :_reduce_none, + 3, 120, :_reduce_133, + 3, 120, :_reduce_134, + 3, 120, :_reduce_135, + 3, 120, :_reduce_136, + 3, 120, :_reduce_137, + 3, 120, :_reduce_138, + 3, 120, :_reduce_139, + 3, 120, :_reduce_140, + 3, 120, :_reduce_141, + 2, 120, :_reduce_142, + 3, 120, :_reduce_143, + 3, 120, :_reduce_144, + 3, 120, :_reduce_145, + 3, 120, :_reduce_146, + 3, 120, :_reduce_147, + 3, 120, :_reduce_148, + 2, 120, :_reduce_149, + 3, 120, :_reduce_150, + 3, 120, :_reduce_151, + 3, 120, :_reduce_152, + 5, 78, :_reduce_153, + 1, 134, :_reduce_none, + 2, 134, :_reduce_155, + 5, 135, :_reduce_156, + 4, 135, :_reduce_157, + 1, 136, :_reduce_none, + 3, 136, :_reduce_159, + 3, 98, :_reduce_160, + 1, 138, :_reduce_none, + 4, 138, :_reduce_162, + 1, 140, :_reduce_none, + 3, 140, :_reduce_164, + 3, 139, :_reduce_165, + 1, 137, :_reduce_none, + 1, 137, :_reduce_none, + 1, 137, :_reduce_none, + 1, 137, :_reduce_none, + 1, 137, :_reduce_none, + 1, 137, :_reduce_none, + 1, 137, :_reduce_none, + 1, 137, :_reduce_none, + 1, 137, :_reduce_174, + 1, 137, :_reduce_none, + 1, 141, :_reduce_176, + 1, 142, :_reduce_none, + 3, 142, :_reduce_178, + 2, 80, :_reduce_179, + 6, 82, :_reduce_180, + 5, 82, :_reduce_181, + 7, 83, :_reduce_182, + 6, 83, :_reduce_183, + 6, 84, :_reduce_184, + 5, 84, :_reduce_185, + 1, 106, :_reduce_186, + 1, 101, :_reduce_187, + 1, 101, :_reduce_188, + 1, 101, :_reduce_189, + 1, 145, :_reduce_none, + 3, 145, :_reduce_191, + 1, 147, :_reduce_192, + 1, 148, :_reduce_193, + 1, 148, :_reduce_194, + 1, 148, :_reduce_195, + 1, 148, :_reduce_none, + 0, 72, :_reduce_197, + 0, 149, :_reduce_198, + 1, 143, :_reduce_none, + 3, 143, :_reduce_200, + 3, 143, :_reduce_201, + 1, 150, :_reduce_none, + 3, 150, :_reduce_203, + 3, 151, :_reduce_204, + 1, 151, :_reduce_205, + 3, 151, :_reduce_206, + 1, 151, :_reduce_207, + 1, 146, :_reduce_none, + 2, 146, :_reduce_209, + 1, 144, :_reduce_none, + 2, 144, :_reduce_211, + 1, 152, :_reduce_none, + 1, 152, :_reduce_none, + 1, 94, :_reduce_214, + 3, 119, :_reduce_215, + 4, 119, :_reduce_216, + 2, 119, :_reduce_217, + 1, 127, :_reduce_none, + 1, 127, :_reduce_none, + 0, 105, :_reduce_none, + 1, 105, :_reduce_221, + 1, 133, :_reduce_222, + 3, 128, :_reduce_223, + 4, 128, :_reduce_224, + 2, 128, :_reduce_225, + 1, 153, :_reduce_none, + 3, 153, :_reduce_227, + 3, 154, :_reduce_228, + 1, 155, :_reduce_229, + 1, 155, :_reduce_230, + 4, 121, :_reduce_231, + 1, 100, :_reduce_none, + 4, 100, :_reduce_233 ] + +racc_reduce_n = 234 + +racc_shift_n = 385 -racc_use_result_var = true +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_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', -'nil', -'statement', -'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'] + "$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", + "nil", + "statement", + "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 -##### racc system variables end ##### +##### State transition tables end ##### - # reduce 0 omitted +# reduce 0 omitted -module_eval <<'.,.,', 'grammar.ra', 46 - def _reduce_1( val, _values, result ) - if val[0] +module_eval(<<'.,.,', 'grammar.ra', 31) + def _reduce_1(val, _values, result) + if val[0] # Make sure we always return an array. if val[0].is_a?(AST::ASTArray) if val[0].children.empty? @@ -1191,17 +1168,18 @@ module_eval <<'.,.,', 'grammar.ra', 46 else result = nil end - result + + result end .,., - # reduce 2 omitted +# reduce 2 omitted - # reduce 3 omitted +# reduce 3 omitted -module_eval <<'.,.,', 'grammar.ra', 62 - def _reduce_4( val, _values, result ) - if val[0] and val[1] +module_eval(<<'.,.,', 'grammar.ra', 50) + def _reduce_4(val, _values, result) + if val[0] and val[1] if val[0].instance_of?(AST::ASTArray) val[0].push(val[1]) result = val[0] @@ -1212,165 +1190,175 @@ module_eval <<'.,.,', 'grammar.ra', 62 result = obj else result = nil end - result + + result end .,., - # reduce 5 omitted +# reduce 5 omitted - # reduce 6 omitted +# reduce 6 omitted - # reduce 7 omitted +# reduce 7 omitted - # reduce 8 omitted +# reduce 8 omitted - # reduce 9 omitted +# reduce 9 omitted - # reduce 10 omitted +# reduce 10 omitted - # reduce 11 omitted +# reduce 11 omitted - # reduce 12 omitted +# reduce 12 omitted - # reduce 13 omitted +# reduce 13 omitted - # reduce 14 omitted +# reduce 14 omitted - # reduce 15 omitted +# reduce 15 omitted - # reduce 16 omitted +# reduce 16 omitted - # reduce 17 omitted +# reduce 17 omitted - # reduce 18 omitted +# reduce 18 omitted -module_eval <<'.,.,', 'grammar.ra', 82 - def _reduce_19( val, _values, result ) - result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context) - result +module_eval(<<'.,.,', 'grammar.ra', 80) + def _reduce_19(val, _values, result) + result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context) + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 85 - def _reduce_20( val, _values, result ) - result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context) - result +module_eval(<<'.,.,', 'grammar.ra', 83) + def _reduce_20(val, _values, result) + result = AST::Relationship.new(val[0], val[2], val[1][:value], ast_context) + + result end .,., - # reduce 21 omitted +# reduce 21 omitted - # reduce 22 omitted +# reduce 22 omitted - # reduce 23 omitted +# reduce 23 omitted - # reduce 24 omitted +# reduce 24 omitted - # reduce 25 omitted +# reduce 25 omitted - # reduce 26 omitted +# reduce 26 omitted - # reduce 27 omitted +# reduce 27 omitted -module_eval <<'.,.,', 'grammar.ra', 98 - def _reduce_28( val, _values, result ) - args = aryfy(val[2]) +module_eval(<<'.,.,', 'grammar.ra', 91) + def _reduce_28(val, _values, result) + args = aryfy(val[2]) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => args, :ftype => :statement - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 106 - def _reduce_29( val, _values, result ) - args = aryfy(val[2]) +module_eval(<<'.,.,', 'grammar.ra', 99) + def _reduce_29(val, _values, result) + args = aryfy(val[2]) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => args, :ftype => :statement - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 112 - def _reduce_30( val, _values, result ) - result = ast AST::Function, +module_eval(<<'.,.,', 'grammar.ra', 106) + def _reduce_30(val, _values, result) + result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => AST::ASTArray.new({}), :ftype => :statement - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 120 - def _reduce_31( val, _values, result ) - args = aryfy(val[1]) +module_eval(<<'.,.,', 'grammar.ra', 113) + def _reduce_31(val, _values, result) + args = aryfy(val[1]) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => args, :ftype => :statement - result + + result end .,., - # reduce 32 omitted +# reduce 32 omitted - # reduce 33 omitted +# reduce 33 omitted -module_eval <<'.,.,', 'grammar.ra', 128 - def _reduce_34( val, _values, result ) - result = aryfy(val[0], val[2]) +module_eval(<<'.,.,', 'grammar.ra', 124) + def _reduce_34(val, _values, result) + result = aryfy(val[0], val[2]) result.line = @lexer.line result.file = @lexer.file - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 137 - def _reduce_35( val, _values, result ) - unless val[0].is_a?(AST::ASTArray) +module_eval(<<'.,.,', 'grammar.ra', 129) + def _reduce_35(val, _values, result) + unless val[0].is_a?(AST::ASTArray) val[0] = aryfy(val[0]) end val[0].push(val[2]) result = val[0] - result + + result end .,., - # reduce 36 omitted +# reduce 36 omitted - # reduce 37 omitted +# reduce 37 omitted - # reduce 38 omitted +# reduce 38 omitted - # reduce 39 omitted +# reduce 39 omitted - # reduce 40 omitted +# reduce 40 omitted - # reduce 41 omitted +# reduce 41 omitted - # reduce 42 omitted +# reduce 42 omitted - # reduce 43 omitted +# reduce 43 omitted -module_eval <<'.,.,', 'grammar.ra', 151 - def _reduce_44( val, _values, result ) - result = ast AST::Name, :value => val[0][:value] - result +module_eval(<<'.,.,', 'grammar.ra', 149) + def _reduce_44(val, _values, result) + result = ast AST::Name, :value => val[0][:value] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 172 - def _reduce_45( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 153) + def _reduce_45(val, _values, result) + @lexer.commentpop array = val[2] array = [array] if array.instance_of?(AST::ResourceInstance) result = ast AST::ASTArray @@ -1388,38 +1376,42 @@ module_eval <<'.,.,', 'grammar.ra', 172 :parameters => instance[1]) } - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 175 - def _reduce_46( val, _values, result ) - # This is a deprecated syntax. +module_eval(<<'.,.,', 'grammar.ra', 172) + def _reduce_46(val, _values, result) + # This is a deprecated syntax. error "All resource specifications require names" - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 179 - def _reduce_47( val, _values, result ) - # a defaults setting for a type +module_eval(<<'.,.,', 'grammar.ra', 175) + def _reduce_47(val, _values, result) + # a defaults setting for a type @lexer.commentpop result = ast(AST::ResourceDefaults, :type => val[0], :parameters => val[2]) - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 185 - def _reduce_48( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 182) + def _reduce_48(val, _values, result) + @lexer.commentpop result = ast AST::ResourceOverride, :object => val[0], :parameters => val[2] - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 210 - def _reduce_49( val, _values, result ) - type = val[0] +module_eval(<<'.,.,', 'grammar.ra', 189) + def _reduce_49(val, _values, result) + type = val[0] if (type == :exported and ! Puppet[:storeconfigs]) and ! Puppet[:parseonly] Puppet.warning addcontext("You cannot collect without storeconfigs being set") @@ -1439,27 +1431,28 @@ module_eval <<'.,.,', 'grammar.ra', 210 end result = val[1] - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 211 - def _reduce_50( val, _values, result ) - result = :virtual - result +module_eval(<<'.,.,', 'grammar.ra', 211) + def _reduce_50(val, _values, result) + result = :virtual + result end .,., -module_eval <<'.,.,', 'grammar.ra', 212 - def _reduce_51( val, _values, result ) - result = :exported - result +module_eval(<<'.,.,', 'grammar.ra', 212) + def _reduce_51(val, _values, result) + result = :exported + result end .,., -module_eval <<'.,.,', 'grammar.ra', 235 - def _reduce_52( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 217) + def _reduce_52(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} @@ -1476,13 +1469,14 @@ module_eval <<'.,.,', 'grammar.ra', 235 end args[:override] = val[3] result = ast AST::Collection, args - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 254 - def _reduce_53( val, _values, result ) - if val[0] =~ /^[a-z]/ +module_eval(<<'.,.,', 'grammar.ra', 236) + def _reduce_53(val, _values, result) + if val[0] =~ /^[a-z]/ Puppet.warning addcontext("Collection names must now be capitalized") end type = val[0].downcase @@ -1499,384 +1493,412 @@ module_eval <<'.,.,', 'grammar.ra', 254 Puppet.warning addcontext("You cannot collect exported resources without storeconfigs being set; the collection will be ignored") end result = ast AST::Collection, args - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 264 - def _reduce_54( val, _values, result ) - if val[1] +module_eval(<<'.,.,', 'grammar.ra', 257) + def _reduce_54(val, _values, result) + if val[1] result = val[1] result.form = :virtual else result = :virtual end - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 272 - def _reduce_55( val, _values, result ) - if val[1] +module_eval(<<'.,.,', 'grammar.ra', 265) + def _reduce_55(val, _values, result) + if val[1] result = val[1] result.form = :exported else result = :exported end - result + + result end .,., - # reduce 56 omitted +# reduce 56 omitted + +# reduce 57 omitted - # reduce 57 omitted +module_eval(<<'.,.,', 'grammar.ra', 278) + def _reduce_58(val, _values, result) + result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2] -module_eval <<'.,.,', 'grammar.ra', 280 - def _reduce_58( val, _values, result ) - result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2] - result + result end .,., - # reduce 59 omitted +# reduce 59 omitted -module_eval <<'.,.,', 'grammar.ra', 286 - def _reduce_60( val, _values, result ) - result = val[1] +module_eval(<<'.,.,', 'grammar.ra', 283) + def _reduce_60(val, _values, result) + result = val[1] result.parens = true - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 287 - def _reduce_61( val, _values, result ) - result=val[0][:value] - result +module_eval(<<'.,.,', 'grammar.ra', 287) + def _reduce_61(val, _values, result) + result=val[0][:value] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 288 - def _reduce_62( val, _values, result ) - result=val[0][:value] - result +module_eval(<<'.,.,', 'grammar.ra', 288) + def _reduce_62(val, _values, result) + result=val[0][:value] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 295 - def _reduce_63( val, _values, result ) - result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2] +module_eval(<<'.,.,', 'grammar.ra', 291) + def _reduce_63(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 + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 300 - def _reduce_64( val, _values, result ) - result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2] +module_eval(<<'.,.,', 'grammar.ra', 296) + 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 + + result end .,., - # reduce 65 omitted +# reduce 65 omitted + +# reduce 66 omitted - # reduce 66 omitted +module_eval(<<'.,.,', 'grammar.ra', 305) + def _reduce_67(val, _values, result) + result = ast AST::ResourceInstance, :children => [val[0],val[2]] -module_eval <<'.,.,', 'grammar.ra', 307 - def _reduce_67( val, _values, result ) - result = ast AST::ResourceInstance, :children => [val[0],val[2]] - result + result end .,., - # reduce 68 omitted +# reduce 68 omitted -module_eval <<'.,.,', 'grammar.ra', 317 - def _reduce_69( val, _values, result ) - if val[0].instance_of?(AST::ResourceInstance) +module_eval(<<'.,.,', 'grammar.ra', 310) + def _reduce_69(val, _values, result) + if val[0].instance_of?(AST::ResourceInstance) result = ast AST::ASTArray, :children => [val[0],val[2]] else val[0].push val[2] result = val[0] end - result + + result end .,., - # reduce 70 omitted +# reduce 70 omitted - # reduce 71 omitted +# reduce 71 omitted -module_eval <<'.,.,', 'grammar.ra', 324 - def _reduce_72( val, _values, result ) - result = ast AST::Undef, :value => :undef - result +module_eval(<<'.,.,', 'grammar.ra', 322) + def _reduce_72(val, _values, result) + result = ast AST::Undef, :value => :undef + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 328 - def _reduce_73( val, _values, result ) - result = ast AST::Name, :value => val[0][:value], :line => val[0][:line] - result +module_eval(<<'.,.,', 'grammar.ra', 326) + def _reduce_73(val, _values, result) + result = ast AST::Name, :value => val[0][:value], :line => val[0][:line] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 332 - def _reduce_74( val, _values, result ) - result = ast AST::Type, :value => val[0][:value], :line => val[0][:line] - result +module_eval(<<'.,.,', 'grammar.ra', 330) + def _reduce_74(val, _values, result) + result = ast AST::Type, :value => val[0][:value], :line => val[0][:line] + + result end .,., - # reduce 75 omitted +# reduce 75 omitted - # reduce 76 omitted +# reduce 76 omitted - # reduce 77 omitted +# reduce 77 omitted - # reduce 78 omitted +# reduce 78 omitted - # reduce 79 omitted +# reduce 79 omitted - # reduce 80 omitted +# reduce 80 omitted - # reduce 81 omitted +# reduce 81 omitted -module_eval <<'.,.,', 'grammar.ra', 347 - def _reduce_82( val, _values, result ) - raise Puppet::ParseError, "Cannot assign to variables in other namespaces" if val[0][:value] =~ /::/ +module_eval(<<'.,.,', 'grammar.ra', 342) + def _reduce_82(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 + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 350 - def _reduce_83( val, _values, result ) - result = ast AST::VarDef, :name => val[0], :value => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 348) + def _reduce_83(val, _values, result) + result = ast AST::VarDef, :name => val[0], :value => val[2] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 355 - def _reduce_84( val, _values, result ) - variable = ast AST::Name, :value => val[0][:value], :line => val[0][:line] +module_eval(<<'.,.,', 'grammar.ra', 352) + def _reduce_84(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 + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 360 - def _reduce_85( val, _values, result ) - result = ast AST::ASTArray - result +module_eval(<<'.,.,', 'grammar.ra', 358) + def _reduce_85(val, _values, result) + result = ast AST::ASTArray + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 360 - def _reduce_86( val, _values, result ) - result = val[0] - result +module_eval(<<'.,.,', 'grammar.ra', 360) + def _reduce_86(val, _values, result) + result = val[0] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 369 - def _reduce_87( val, _values, result ) - if val[0].instance_of?(AST::ASTArray) +module_eval(<<'.,.,', 'grammar.ra', 362) + def _reduce_87(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 + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 373 - def _reduce_88( val, _values, result ) - result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 371) + def _reduce_88(val, _values, result) + result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 378 - def _reduce_89( val, _values, result ) - result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2], +module_eval(<<'.,.,', 'grammar.ra', 375) + def _reduce_89(val, _values, result) + result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2], :add => true - result + + result end .,., - # reduce 90 omitted +# reduce 90 omitted - # reduce 91 omitted +# reduce 91 omitted -module_eval <<'.,.,', 'grammar.ra', 386 - def _reduce_92( val, _values, result ) - result = ast AST::ASTArray - result +module_eval(<<'.,.,', 'grammar.ra', 384) + def _reduce_92(val, _values, result) + result = ast AST::ASTArray + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 386 - def _reduce_93( val, _values, result ) - result = val[0] - result +module_eval(<<'.,.,', 'grammar.ra', 386) + def _reduce_93(val, _values, result) + result = val[0] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 395 - def _reduce_94( val, _values, result ) - if val[0].instance_of?(AST::ASTArray) +module_eval(<<'.,.,', 'grammar.ra', 388) + def _reduce_94(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 + + result end .,., - # reduce 95 omitted +# reduce 95 omitted -module_eval <<'.,.,', 'grammar.ra', 404 - def _reduce_96( val, _values, result ) - if val[0].instance_of?(AST::ASTArray) +module_eval(<<'.,.,', 'grammar.ra', 398) + def _reduce_96(val, _values, result) + if val[0].instance_of?(AST::ASTArray) result = val[0].push(val[2]) else result = ast AST::ASTArray, :children => [val[0],val[2]] end - result + + result end .,., - # reduce 97 omitted +# reduce 97 omitted - # reduce 98 omitted +# reduce 98 omitted - # reduce 99 omitted +# reduce 99 omitted - # reduce 100 omitted +# reduce 100 omitted - # reduce 101 omitted +# reduce 101 omitted - # reduce 102 omitted +# reduce 102 omitted - # reduce 103 omitted +# reduce 103 omitted - # reduce 104 omitted +# reduce 104 omitted - # reduce 105 omitted +# reduce 105 omitted - # reduce 106 omitted +# reduce 106 omitted - # reduce 107 omitted +# reduce 107 omitted - # reduce 108 omitted +# reduce 108 omitted - # reduce 109 omitted +# reduce 109 omitted - # reduce 110 omitted +# reduce 110 omitted - # reduce 111 omitted +# reduce 111 omitted - # reduce 112 omitted +# reduce 112 omitted - # reduce 113 omitted +# reduce 113 omitted - # reduce 114 omitted +# reduce 114 omitted -module_eval <<'.,.,', 'grammar.ra', 433 - def _reduce_115( val, _values, result ) - args = aryfy(val[2]) +module_eval(<<'.,.,', 'grammar.ra', 427) + def _reduce_115(val, _values, result) + args = aryfy(val[2]) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => args, :ftype => :rvalue - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 438 - def _reduce_116( val, _values, result ) - result = ast AST::Function, +module_eval(<<'.,.,', 'grammar.ra', 433) + def _reduce_116(val, _values, result) + result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => AST::ASTArray.new({}), :ftype => :rvalue - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 439 - def _reduce_117( val, _values, result ) - result = ast AST::String, :value => val[0][:value], :line => val[0][:line] - result +module_eval(<<'.,.,', 'grammar.ra', 439) + def _reduce_117(val, _values, result) + result = ast AST::String, :value => val[0][:value], :line => val[0][:line] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 440 - def _reduce_118( val, _values, result ) - result = ast AST::Concat, :value => [ast(AST::String,val[0])]+val[1], :line => val[0][:line] - result +module_eval(<<'.,.,', 'grammar.ra', 440) + def _reduce_118(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', 442 - def _reduce_119( val, _values, result ) - result = [val[0]] + val[1] - result +module_eval(<<'.,.,', 'grammar.ra', 442) + def _reduce_119(val, _values, result) + result = [val[0]] + val[1] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 444 - def _reduce_120( val, _values, result ) - result = [ast(AST::String,val[0])] - result +module_eval(<<'.,.,', 'grammar.ra', 444) + def _reduce_120(val, _values, result) + result = [ast(AST::String,val[0])] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 445 - def _reduce_121( val, _values, result ) - result = [ast(AST::String,val[0])] + val[1] - result +module_eval(<<'.,.,', 'grammar.ra', 445) + def _reduce_121(val, _values, result) + result = [ast(AST::String,val[0])] + val[1] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 450 - def _reduce_122( val, _values, result ) - result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line] - result +module_eval(<<'.,.,', 'grammar.ra', 448) + def _reduce_122(val, _values, result) + result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 455 - def _reduce_123( val, _values, result ) - Puppet.warning addcontext("Deprecation notice: Resource references should now be capitalized") +module_eval(<<'.,.,', 'grammar.ra', 452) + def _reduce_123(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 + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 457 - def _reduce_124( val, _values, result ) - result = ast AST::ResourceReference, :type => val[0], :title => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 455) + def _reduce_124(val, _values, result) + result = ast AST::ResourceReference, :type => val[0], :title => val[2] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 461 - def _reduce_125( val, _values, result ) - result = val[1] - result +module_eval(<<'.,.,', 'grammar.ra', 459) + def _reduce_125(val, _values, result) + result = val[1] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 473 - def _reduce_126( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 463) + def _reduce_126(val, _values, result) + @lexer.commentpop args = { :test => val[0], :statements => val[2] @@ -1885,13 +1907,14 @@ module_eval <<'.,.,', 'grammar.ra', 473 args[:else] = val[4] if val[4] result = ast AST::IfStatement, args - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 484 - def _reduce_127( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 474) + def _reduce_127(val, _values, result) + @lexer.commentpop args = { :test => val[0], :statements => ast(AST::Nop) @@ -1900,212 +1923,239 @@ module_eval <<'.,.,', 'grammar.ra', 484 args[:else] = val[3] if val[3] result = ast AST::IfStatement, args - result + + result end .,., - # reduce 128 omitted +# reduce 128 omitted + +module_eval(<<'.,.,', 'grammar.ra', 487) + def _reduce_129(val, _values, result) + result = ast AST::Else, :statements => val[1] -module_eval <<'.,.,', 'grammar.ra', 489 - def _reduce_129( val, _values, result ) - result = ast AST::Else, :statements => val[1] - result + result end .,., -module_eval <<'.,.,', 'grammar.ra', 493 - def _reduce_130( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 490) + def _reduce_130(val, _values, result) + @lexer.commentpop result = ast AST::Else, :statements => val[2] - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 497 - def _reduce_131( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 494) + def _reduce_131(val, _values, result) + @lexer.commentpop result = ast AST::Else, :statements => ast(AST::Nop) - result + + result end .,., - # reduce 132 omitted +# reduce 132 omitted + +module_eval(<<'.,.,', 'grammar.ra', 512) + def _reduce_133(val, _values, result) + result = ast AST::InOperator, :lval => val[0], :rval => val[2] -module_eval <<'.,.,', 'grammar.ra', 514 - def _reduce_133( val, _values, result ) - result = ast AST::InOperator, :lval => val[0], :rval => val[2] - result + result end .,., -module_eval <<'.,.,', 'grammar.ra', 517 - def _reduce_134( val, _values, result ) - result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 515) + def _reduce_134(val, _values, result) + result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 520 - def _reduce_135( val, _values, result ) - result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 518) + 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', 523 - def _reduce_136( val, _values, result ) - result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 521) + def _reduce_136(val, _values, result) + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 526 - def _reduce_137( val, _values, result ) - result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 524) + 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', 529 - def _reduce_138( val, _values, result ) - result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 527) + 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', 532 - def _reduce_139( val, _values, result ) - result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 530) + 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', 535 - def _reduce_140( val, _values, result ) - result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 533) + 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', 538 - def _reduce_141( val, _values, result ) - result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 536) + 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', 541 - def _reduce_142( val, _values, result ) - result = ast AST::Minus, :value => val[1] - result +module_eval(<<'.,.,', 'grammar.ra', 539) + def _reduce_142(val, _values, result) + result = ast AST::Minus, :value => val[1] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 544 - def _reduce_143( val, _values, result ) - result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 542) + def _reduce_143(val, _values, result) + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 547 - def _reduce_144( val, _values, result ) - result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 545) + 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', 550 - def _reduce_145( val, _values, result ) - result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 548) + 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', 553 - def _reduce_146( val, _values, result ) - result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 551) + 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', 556 - def _reduce_147( val, _values, result ) - result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 554) + 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', 559 - def _reduce_148( val, _values, result ) - result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 557) + 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', 562 - def _reduce_149( val, _values, result ) - result = ast AST::Not, :value => val[1] - result +module_eval(<<'.,.,', 'grammar.ra', 560) + def _reduce_149(val, _values, result) + result = ast AST::Not, :value => val[1] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 565 - def _reduce_150( val, _values, result ) - result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 563) + def _reduce_150(val, _values, result) + result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 568 - def _reduce_151( val, _values, result ) - result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 566) + 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', 571 - def _reduce_152( val, _values, result ) - result = val[1] - result +module_eval(<<'.,.,', 'grammar.ra', 569) + def _reduce_152(val, _values, result) + result = val[1] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 578 - def _reduce_153( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 573) + def _reduce_153(val, _values, result) + @lexer.commentpop options = val[3] options = ast AST::ASTArray, :children => [val[3]] unless options.instance_of?(AST::ASTArray) result = ast AST::CaseStatement, :test => val[1], :options => options - result + + result end .,., - # reduce 154 omitted +# reduce 154 omitted -module_eval <<'.,.,', 'grammar.ra', 588 - def _reduce_155( val, _values, result ) - if val[0].instance_of?(AST::ASTArray) +module_eval(<<'.,.,', 'grammar.ra', 581) + def _reduce_155(val, _values, result) + if val[0].instance_of?(AST::ASTArray) val[0].push val[1] result = val[0] else result = ast AST::ASTArray, :children => [val[0], val[1]] end - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 593 - def _reduce_156( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 590) + def _reduce_156(val, _values, result) + @lexer.commentpop result = ast AST::CaseOpt, :value => val[0], :statements => val[3] - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 602 - def _reduce_157( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 593) + def _reduce_157(val, _values, result) + @lexer.commentpop result = ast( AST::CaseOpt, @@ -2113,479 +2163,518 @@ module_eval <<'.,.,', 'grammar.ra', 602 :statements => ast(AST::ASTArray) ) - result + + result end .,., - # reduce 158 omitted +# reduce 158 omitted -module_eval <<'.,.,', 'grammar.ra', 612 - def _reduce_159( val, _values, result ) - if val[0].instance_of?(AST::ASTArray) +module_eval(<<'.,.,', 'grammar.ra', 605) + def _reduce_159(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 + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 616 - def _reduce_160( val, _values, result ) - result = ast AST::Selector, :param => val[0], :values => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 614) + def _reduce_160(val, _values, result) + result = ast AST::Selector, :param => val[0], :values => val[2] + + result end .,., - # reduce 161 omitted +# reduce 161 omitted -module_eval <<'.,.,', 'grammar.ra', 622 - def _reduce_162( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 619) + def _reduce_162(val, _values, result) + @lexer.commentpop result = val[1] - result + + result end .,., - # reduce 163 omitted +# reduce 163 omitted -module_eval <<'.,.,', 'grammar.ra', 632 - def _reduce_164( val, _values, result ) - if val[0].instance_of?(AST::ASTArray) +module_eval(<<'.,.,', 'grammar.ra', 625) + def _reduce_164(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 + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 636 - def _reduce_165( val, _values, result ) - result = ast AST::ResourceParam, :param => val[0], :value => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 634) + def _reduce_165(val, _values, result) + result = ast AST::ResourceParam, :param => val[0], :value => val[2] + + result end .,., - # reduce 166 omitted +# reduce 166 omitted + +# reduce 167 omitted - # reduce 167 omitted +# reduce 168 omitted - # reduce 168 omitted +# reduce 169 omitted - # reduce 169 omitted +# reduce 170 omitted - # reduce 170 omitted +# reduce 171 omitted - # reduce 171 omitted +# reduce 172 omitted - # reduce 172 omitted +# reduce 173 omitted -module_eval <<'.,.,', 'grammar.ra', 647 - def _reduce_173( val, _values, result ) - result = ast AST::Default, :value => val[0][:value], :line => val[0][:line] - result +module_eval(<<'.,.,', 'grammar.ra', 646) + def _reduce_174(val, _values, result) + result = ast AST::Default, :value => val[0][:value], :line => val[0][:line] + + result end .,., - # reduce 174 omitted +# reduce 175 omitted -module_eval <<'.,.,', 'grammar.ra', 650 - def _reduce_175( val, _values, result ) - result = [val[0][:value]] - result +module_eval(<<'.,.,', 'grammar.ra', 651) + def _reduce_176(val, _values, result) + result = [val[0][:value]] + result end .,., - # reduce 176 omitted +# reduce 177 omitted -module_eval <<'.,.,', 'grammar.ra', 652 - def _reduce_177( val, _values, result ) - result = val[0] += val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 653) + def _reduce_178(val, _values, result) + result = val[0] += val[2] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 661 - def _reduce_178( val, _values, result ) - val[1].each do |file| +module_eval(<<'.,.,', 'grammar.ra', 656) + def _reduce_179(val, _values, result) + val[1].each do |file| import(file) end result = AST::ASTArray.new(:children => []) - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 672 - def _reduce_179( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 666) + def _reduce_180(val, _values, result) + @lexer.commentpop newdefine classname(val[1]), :arguments => val[2], :code => val[4], :line => val[0][:line] @lexer.indefine = false result = nil #} | DEFINE NAME argumentlist parent LBRACE RBRACE { - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 677 - def _reduce_180( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 673) + def _reduce_181(val, _values, result) + @lexer.commentpop newdefine classname(val[1]), :arguments => val[2], :line => val[0][:line] @lexer.indefine = false result = nil - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 686 - def _reduce_181( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 681) + def _reduce_182(val, _values, result) + @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop newclass classname(val[1]), :arguments => val[2], :parent => val[3], :code => val[5], :line => val[0][:line] result = nil - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 692 - def _reduce_182( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 687) + def _reduce_183(val, _values, result) + @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop newclass classname(val[1]), :arguments => val[2], :parent => val[3], :line => val[0][:line] result = nil - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 698 - def _reduce_183( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 695) + def _reduce_184(val, _values, result) + @lexer.commentpop newnode val[1], :parent => val[2], :code => val[4], :line => val[0][:line] result = nil - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 702 - def _reduce_184( val, _values, result ) - @lexer.commentpop +module_eval(<<'.,.,', 'grammar.ra', 699) + def _reduce_185(val, _values, result) + @lexer.commentpop newnode val[1], :parent => val[2], :line => val[0][:line] result = nil - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 703 - def _reduce_185( val, _values, result ) - result = val[0][:value] - result +module_eval(<<'.,.,', 'grammar.ra', 704) + def _reduce_186(val, _values, result) + result = val[0][:value] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 705 - def _reduce_186( val, _values, result ) - result = val[0][:value] - result +module_eval(<<'.,.,', 'grammar.ra', 706) + def _reduce_187(val, _values, result) + result = val[0][:value] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 706 - def _reduce_187( val, _values, result ) - result = val[0][:value] - result +module_eval(<<'.,.,', 'grammar.ra', 707) + def _reduce_188(val, _values, result) + result = val[0][:value] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 707 - def _reduce_188( val, _values, result ) - result = "class" - result +module_eval(<<'.,.,', 'grammar.ra', 708) + def _reduce_189(val, _values, result) + result = "class" + result end .,., - # reduce 189 omitted +# reduce 190 omitted -module_eval <<'.,.,', 'grammar.ra', 717 - def _reduce_190( val, _values, result ) - result = val[0] +module_eval(<<'.,.,', 'grammar.ra', 714) + def _reduce_191(val, _values, result) + result = val[0] result = [result] unless result.is_a?(Array) result << val[2] - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 721 - def _reduce_191( val, _values, result ) - result = ast AST::HostName, :value => val[0] - result +module_eval(<<'.,.,', 'grammar.ra', 720) + def _reduce_192(val, _values, result) + result = ast AST::HostName, :value => val[0] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 722 - def _reduce_192( val, _values, result ) - result = val[0][:value] - result +module_eval(<<'.,.,', 'grammar.ra', 723) + def _reduce_193(val, _values, result) + result = val[0][:value] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 723 - def _reduce_193( val, _values, result ) - result = val[0][:value] - result +module_eval(<<'.,.,', 'grammar.ra', 724) + def _reduce_194(val, _values, result) + result = val[0][:value] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 724 - def _reduce_194( val, _values, result ) - result = val[0][:value] - result +module_eval(<<'.,.,', 'grammar.ra', 725) + def _reduce_195(val, _values, result) + result = val[0][:value] + result end .,., - # reduce 195 omitted +# reduce 196 omitted -module_eval <<'.,.,', 'grammar.ra', 730 - def _reduce_196( val, _values, result ) - result = nil - result +module_eval(<<'.,.,', 'grammar.ra', 729) + def _reduce_197(val, _values, result) + result = nil + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 734 - def _reduce_197( val, _values, result ) - result = ast AST::ASTArray, :children => [] - result +module_eval(<<'.,.,', 'grammar.ra', 733) + def _reduce_198(val, _values, result) + result = ast AST::ASTArray, :children => [] + + result end .,., - # reduce 198 omitted +# reduce 199 omitted -module_eval <<'.,.,', 'grammar.ra', 739 - def _reduce_199( val, _values, result ) - result = nil - result +module_eval(<<'.,.,', 'grammar.ra', 738) + def _reduce_200(val, _values, result) + result = nil + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 743 - def _reduce_200( val, _values, result ) - result = val[1] +module_eval(<<'.,.,', 'grammar.ra', 741) + def _reduce_201(val, _values, result) + result = val[1] result = [result] unless result[0].is_a?(Array) - result + + result end .,., - # reduce 201 omitted +# reduce 202 omitted -module_eval <<'.,.,', 'grammar.ra', 750 - def _reduce_202( val, _values, result ) - result = val[0] +module_eval(<<'.,.,', 'grammar.ra', 747) + def _reduce_203(val, _values, result) + result = val[0] result = [result] unless result[0].is_a?(Array) result << val[2] - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 755 - def _reduce_203( val, _values, result ) - Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") +module_eval(<<'.,.,', 'grammar.ra', 753) + def _reduce_204(val, _values, result) + Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") result = [val[0][:value], val[2]] - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 759 - def _reduce_204( val, _values, result ) - Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") +module_eval(<<'.,.,', 'grammar.ra', 757) + def _reduce_205(val, _values, result) + Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") result = [val[0][:value]] - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 761 - def _reduce_205( val, _values, result ) - result = [val[0][:value], val[2]] - result +module_eval(<<'.,.,', 'grammar.ra', 760) + def _reduce_206(val, _values, result) + result = [val[0][:value], val[2]] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 763 - def _reduce_206( val, _values, result ) - result = [val[0][:value]] - result +module_eval(<<'.,.,', 'grammar.ra', 762) + def _reduce_207(val, _values, result) + result = [val[0][:value]] + + result end .,., - # reduce 207 omitted +# reduce 208 omitted -module_eval <<'.,.,', 'grammar.ra', 768 - def _reduce_208( val, _values, result ) - result = val[1] - result +module_eval(<<'.,.,', 'grammar.ra', 767) + def _reduce_209(val, _values, result) + result = val[1] + + result end .,., - # reduce 209 omitted +# reduce 210 omitted -module_eval <<'.,.,', 'grammar.ra', 773 - def _reduce_210( val, _values, result ) - result = val[1] - result +module_eval(<<'.,.,', 'grammar.ra', 772) + def _reduce_211(val, _values, result) + result = val[1] + + result end .,., - # reduce 211 omitted +# reduce 212 omitted + +# reduce 213 omitted - # reduce 212 omitted +module_eval(<<'.,.,', 'grammar.ra', 778) + def _reduce_214(val, _values, result) + result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line] -module_eval <<'.,.,', 'grammar.ra', 779 - def _reduce_213( val, _values, result ) - result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line] - result + result end .,., -module_eval <<'.,.,', 'grammar.ra', 787 - def _reduce_214( val, _values, result ) - if val[1].instance_of?(AST::ASTArray) +module_eval(<<'.,.,', 'grammar.ra', 782) + def _reduce_215(val, _values, result) + if val[1].instance_of?(AST::ASTArray) result = val[1] else result = ast AST::ASTArray, :children => [val[1]] end - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 794 - def _reduce_215( val, _values, result ) - if val[1].instance_of?(AST::ASTArray) +module_eval(<<'.,.,', 'grammar.ra', 789) + def _reduce_216(val, _values, result) + if val[1].instance_of?(AST::ASTArray) result = val[1] else result = ast AST::ASTArray, :children => [val[1]] end - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 796 - def _reduce_216( val, _values, result ) - result = ast AST::ASTArray - result +module_eval(<<'.,.,', 'grammar.ra', 795) + def _reduce_217(val, _values, result) + result = ast AST::ASTArray + + result end .,., - # reduce 217 omitted +# reduce 218 omitted - # reduce 218 omitted +# reduce 219 omitted - # reduce 219 omitted +# reduce 220 omitted -module_eval <<'.,.,', 'grammar.ra', 801 - def _reduce_220( val, _values, result ) - result = nil - result +module_eval(<<'.,.,', 'grammar.ra', 802) + def _reduce_221(val, _values, result) + result = nil + result end .,., -module_eval <<'.,.,', 'grammar.ra', 806 - def _reduce_221( val, _values, result ) - result = ast AST::Regex, :value => val[0][:value] - result +module_eval(<<'.,.,', 'grammar.ra', 805) + def _reduce_222(val, _values, result) + result = ast AST::Regex, :value => val[0][:value] + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 814 - def _reduce_222( val, _values, result ) - if val[1].instance_of?(AST::ASTHash) +module_eval(<<'.,.,', 'grammar.ra', 809) + def _reduce_223(val, _values, result) + if val[1].instance_of?(AST::ASTHash) result = val[1] else result = ast AST::ASTHash, { :value => val[1] } end - result + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 821 - def _reduce_223( val, _values, result ) - if val[1].instance_of?(AST::ASTHash) +module_eval(<<'.,.,', 'grammar.ra', 816) + 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 + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 823 - def _reduce_224( val, _values, result ) - result = ast AST::ASTHash - result +module_eval(<<'.,.,', 'grammar.ra', 822) + def _reduce_225(val, _values, result) + result = ast AST::ASTHash + + result end .,., - # reduce 225 omitted +# reduce 226 omitted -module_eval <<'.,.,', 'grammar.ra', 833 - def _reduce_226( val, _values, result ) - if val[0].instance_of?(AST::ASTHash) +module_eval(<<'.,.,', 'grammar.ra', 827) + def _reduce_227(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 + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 837 - def _reduce_227( val, _values, result ) - result = ast AST::ASTHash, { :value => { val[0] => val[2] } } - result +module_eval(<<'.,.,', 'grammar.ra', 836) + def _reduce_228(val, _values, result) + result = ast AST::ASTHash, { :value => { val[0] => val[2] } } + + result end .,., -module_eval <<'.,.,', 'grammar.ra', 838 - def _reduce_228( val, _values, result ) - result = val[0][:value] - result +module_eval(<<'.,.,', 'grammar.ra', 839) + def _reduce_229(val, _values, result) + result = val[0][:value] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 839 - def _reduce_229( val, _values, result ) - result = val[0] - result +module_eval(<<'.,.,', 'grammar.ra', 840) + def _reduce_230(val, _values, result) + result = val[0] + result end .,., -module_eval <<'.,.,', 'grammar.ra', 844 - def _reduce_230( val, _values, result ) - result = ast AST::HashOrArrayAccess, :variable => val[0][:value], :key => val[2] - result +module_eval(<<'.,.,', 'grammar.ra', 843) + def _reduce_231(val, _values, result) + result = ast AST::HashOrArrayAccess, :variable => val[0][:value], :key => val[2] + + result end .,., - # reduce 231 omitted +# reduce 232 omitted + +module_eval(<<'.,.,', 'grammar.ra', 848) + def _reduce_233(val, _values, result) + result = ast AST::HashOrArrayAccess, :variable => val[0], :key => val[2] -module_eval <<'.,.,', 'grammar.ra', 849 - def _reduce_232( val, _values, result ) - result = ast AST::HashOrArrayAccess, :variable => val[0], :key => val[2] - result + result end .,., - def _reduce_none( val, _values, result ) - result - end +def _reduce_none(val, _values, result) + val[0] +end end # class Parser - - end # module Parser - -end # module Puppet + end # module Parser + end # module Puppet -- cgit From 193016dd152ff17ba94867897656ddca41621b3e Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Sat, 12 Feb 2011 12:09:27 -0800 Subject: (#5977) fix spec test failure when new applications are introduced. The test here was previously fragile, in that it would break when new applications were introduced, and in that it depended on the order of items returned from reading the directories on disk. It is now insensitive to those changes, and still verifies that the results we require occur, reducing long term maintenance cost. Reviewed-by: James Turnbull --- spec/unit/util/command_line_spec.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) mode change 100644 => 100755 spec/unit/util/command_line_spec.rb diff --git a/spec/unit/util/command_line_spec.rb b/spec/unit/util/command_line_spec.rb old mode 100644 new mode 100755 index a648eb4a1..98ddb92f6 --- a/spec/unit/util/command_line_spec.rb +++ b/spec/unit/util/command_line_spec.rb @@ -108,8 +108,8 @@ describe Puppet::Util::CommandLine do end describe 'when loading commands' do before do - @core_apps = ["describe", "filebucket", "kick", "queue", "resource", "agent", "cert", "apply", "doc", "master"] - @command_line = Puppet::Util::CommandLine.new("foo", %w{ client --help w hatever.pp }, @tty ) + @core_apps = %w{describe filebucket kick queue resource agent cert apply doc master} + @command_line = Puppet::Util::CommandLine.new("foo", %w{ client --help whatever.pp }, @tty ) end it 'should be able to find all existing commands' do @core_apps.each do |command| @@ -122,10 +122,15 @@ describe Puppet::Util::CommandLine do @appdir="#{@dir}/puppet/application" FileUtils.mkdir_p(@appdir) FileUtils.touch("#{@appdir}/foo.rb") - $LOAD_PATH.unshift(@dir) + $LOAD_PATH.unshift(@dir) # WARNING: MUST MATCH THE AFTER ACTIONS! end it 'should be able to find commands from both paths' do - @command_line.available_subcommands.should == ['foo'] + @core_apps + found = @command_line.available_subcommands + found.should include 'foo' + @core_apps.each { |cmd| found.should include cmd } + end + after do + $LOAD_PATH.shift # WARNING: MUST MATCH THE BEFORE ACTIONS! end end end -- cgit From b25d9e42808112c6a0a3f5c6bbe7e8a05b02a6d2 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Mon, 14 Feb 2011 11:28:32 -0800 Subject: maint: make rspec exit with status 1 when there are failures Hudson wasn't notifying us when there was a test failure because fail_on_error was set to false. This appears to be because of a misconception that setting this to true caused the specs to run slower. That is not the case. Paired-with: Nick Lewis --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 38cfec6ce..6cc53fe18 100644 --- a/Rakefile +++ b/Rakefile @@ -44,7 +44,7 @@ task :puppetpackages => [:create_gem, :package] RSpec::Core::RakeTask.new do |t| t.pattern ='spec/{unit,integration}/**/*.rb' - t.fail_on_error = false + t.fail_on_error = true end desc "Run the unit tests" -- cgit From 7ef2fbf1ac217ef78181ffb41a9a226c7bb2b40f Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Mon, 14 Feb 2011 06:08:50 +1100 Subject: Updated fix for #3646 - apply / compile documentation --- lib/puppet/util/command_line/puppetd | 11 ++++++++--- lib/puppet/util/command_line/puppetmasterd | 6 +----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/puppet/util/command_line/puppetd b/lib/puppet/util/command_line/puppetd index 71b28429b..d7d94ce09 100755 --- a/lib/puppet/util/command_line/puppetd +++ b/lib/puppet/util/command_line/puppetd @@ -15,6 +15,7 @@ # [-o|--onetime] [--serve ] [-t|--test] [--noop] # [--digest ] [--fingerprint] [-V|--version] # [-v|--verbose] [-w|--waitforcert ] +# [--apply catalog] # # = Description # @@ -60,7 +61,7 @@ # before signing a certificate request on the master, the certificate request the # master received is the same as the one the client sent (to prevent against # man-in-the-middle attacks when signing certificates). -# +# # # = Options # @@ -133,8 +134,8 @@ # makes sense when used in conjunction with --listen. # # onetime:: -# Run the configuration once. Runs a single (normally daemonized) Puppet run. -# Useful for interactively running puppet agent when used in conjunction with +# Run the configuration once. Runs a single (normally daemonized) Puppet run. +# Useful for interactively running puppet agent when used in conjunction with # the --no-daemonize option. # # fingerprint:: @@ -172,6 +173,10 @@ # client. You can turn off waiting for certificates by specifying a time # of 0. # +# apply:: +# Capability to apply JSON catalog (such as one generated with --compile on the Puppet master). +# You can either specify a JSON catalog file or pipe in JSON from standard input. +# # = Example # # puppet agent --server puppet.domain.com diff --git a/lib/puppet/util/command_line/puppetmasterd b/lib/puppet/util/command_line/puppetmasterd index 445169820..3b76db82b 100755 --- a/lib/puppet/util/command_line/puppetmasterd +++ b/lib/puppet/util/command_line/puppetmasterd @@ -9,7 +9,7 @@ # # puppet master [-D|--daemonize|--no-daemonize] [-d|--debug] [-h|--help] # [-l|--logdest |console|syslog] [-v|--verbose] [-V|--version] -# [--compile ] [--apply ] +# [--compile ] # # = Description # @@ -54,10 +54,6 @@ # Capability to compile a catalogue and output it in JSON from the Puppet master. Uses # facts contained in the $vardir/yaml/ directory to compile the catalog. # -# apply:: -# Capability to apply JSON catalog (such as one generated with --compile). You can either specify -# a JSON file or pipe in JSON from standard input. -# # = Example # # puppet master -- cgit From 4b6519a84378006b99f9b7c2fbc395ac2f4994c3 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Mon, 14 Feb 2011 11:42:23 -0800 Subject: Updated CHANGELOG for 2.6.5rc3 --- CHANGELOG | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index feba175cc..3a2854005 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +2.6.5rc3 +======== +7ef2fbf Updated fix for #3646 - apply / compile documentation +193016d (#5977) fix spec test failure when new applications are introduced. + 2.6.5rc2 ======== 1f89906 (#6257) Speed up PUT and POST requests under rack -- cgit From 664ef670da62f9c3dd83d047dc9e575e9ffbb8a2 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Mon, 14 Feb 2011 13:57:51 -0800 Subject: (#3646) Fix the documentation fix for `puppet apply --apply` --apply is actually off of `puppet apply`, not off of `puppet agent` (nor `puppet master`), so move the documentation accordingly. Paired-with: Jesse Wolfe --- lib/puppet/util/command_line/puppet | 6 +++++- lib/puppet/util/command_line/puppetd | 5 ----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/puppet/util/command_line/puppet b/lib/puppet/util/command_line/puppet index e75b92af8..ba3d57c19 100755 --- a/lib/puppet/util/command_line/puppet +++ b/lib/puppet/util/command_line/puppet @@ -7,7 +7,7 @@ # = Usage # # puppet apply [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] [-e|--execute] -# [--detailed-exitcodes] [-l|--logdest ] +# [--detailed-exitcodes] [-l|--logdest ] [--apply catalog] # # = Description # @@ -53,6 +53,10 @@ # verbose:: # Print extra information. # +# apply:: +# Capability to apply JSON catalog (such as one generated with --compile on the Puppet master). +# You can either specify a JSON catalog file or pipe in JSON from standard input. +# # = Example # # puppet -l /tmp/manifest.log manifest.pp diff --git a/lib/puppet/util/command_line/puppetd b/lib/puppet/util/command_line/puppetd index d7d94ce09..b4eafb483 100755 --- a/lib/puppet/util/command_line/puppetd +++ b/lib/puppet/util/command_line/puppetd @@ -15,7 +15,6 @@ # [-o|--onetime] [--serve ] [-t|--test] [--noop] # [--digest ] [--fingerprint] [-V|--version] # [-v|--verbose] [-w|--waitforcert ] -# [--apply catalog] # # = Description # @@ -173,10 +172,6 @@ # client. You can turn off waiting for certificates by specifying a time # of 0. # -# apply:: -# Capability to apply JSON catalog (such as one generated with --compile on the Puppet master). -# You can either specify a JSON catalog file or pipe in JSON from standard input. -# # = Example # # puppet agent --server puppet.domain.com -- cgit From 9e0f9c5cfecf4ff81724c048c5afe5a288fcc9b2 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Mon, 14 Feb 2011 14:04:18 -0800 Subject: Updated CHANGELOG for 2.6.5rc4 --- CHANGELOG | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 3a2854005..683d92deb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +2.6.5rc4 +======== +664ef67 (#3646) Fix the documentation fix for `puppet apply --apply` + 2.6.5rc3 ======== 7ef2fbf Updated fix for #3646 - apply / compile documentation -- cgit From 4d25d90d5e77389eec81b3e6cd4a1e9919d601fa Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Tue, 15 Feb 2011 15:38:29 -0800 Subject: (#6331) Inline documentation: Fix rotted links pointing at the Trac wiki This patch updates links in three files and marks a link in a fourth file as unrecoverable. --- README.queueing | 2 +- examples/modules/sample-module/README.txt | 4 ++-- ext/puppetstoredconfigclean.rb | 2 +- tasks/rake/git_workflow.rake | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.queueing b/README.queueing index 8c4a18029..83a8e19c0 100644 --- a/README.queueing +++ b/README.queueing @@ -8,7 +8,7 @@ Queue Daemon). Currently this is only supported for "Storeconfigs" which is documented at: -http://reductivelabs.com/trac/puppet/wiki/UsingStoredConfiguration +http://projects.puppetlabs.com/projects/1/wiki/Using_Stored_Configuration In the future this feature can be extended to any new puppet data which involves storage in a database. diff --git a/examples/modules/sample-module/README.txt b/examples/modules/sample-module/README.txt index cd35c83a1..233e54b8d 100644 --- a/examples/modules/sample-module/README.txt +++ b/examples/modules/sample-module/README.txt @@ -12,6 +12,6 @@ templates/sample.erb Note the consistent naming of files for Puppet::Util::Autoload Reference Documents: -http://reductivelabs.com/trac/puppet/wiki/ModuleOrganisation +http://docs.puppetlabs.com/guides/modules.html http://docs.puppetlabs.com/guides/custom_functions.html -http://reductivelabs.com/trac/puppet/wiki/FunctionReference +http://docs.puppetlabs.com/references/latest/function.html diff --git a/ext/puppetstoredconfigclean.rb b/ext/puppetstoredconfigclean.rb index 16f39efa1..dcbefa816 100644 --- a/ext/puppetstoredconfigclean.rb +++ b/ext/puppetstoredconfigclean.rb @@ -3,7 +3,7 @@ # Script to clean up stored configs for (a) given host(s) # # Credits: -# Script was taken from http://reductivelabs.com/trac/puppet/attachment/wiki/UsingStoredConfiguration/kill_node_in_storedconfigs_db.rb +# Script was taken from http://reductivelabs.com/trac/puppet/attachment/wiki/UsingStoredConfiguration/kill_node_in_storedconfigs_db.rb (link no longer valid), # which haven been initially posted by James Turnbull # duritong adapted and improved the script a bit. diff --git a/tasks/rake/git_workflow.rake b/tasks/rake/git_workflow.rake index b2f96c603..980d2fbce 100644 --- a/tasks/rake/git_workflow.rake +++ b/tasks/rake/git_workflow.rake @@ -1,5 +1,5 @@ # This set of tasks helps automate the workflow as described on -# http://reductivelabs.com/trac/puppet/wiki/Development/DevelopmentLifecycle +# http://projects.puppetlabs.com/projects/puppet/wiki/Development_Lifecycle def find_start(start) -- cgit From b5bae9f99fb2ab2bd2429d047db7e53aa8c90fbd Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Tue, 15 Feb 2011 16:58:27 -0800 Subject: (#6331) Remove final special :trac: link from the file content property The file content property had a weird garbage string in its doc variable which appeared to be part of our older reference generator code. Since the code to strip these odd links out no longer appears to exist, the nonsense would propagate to the generated types reference. --- lib/puppet/type/file/content.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb index cf924f371..63c0aaf4d 100755 --- a/lib/puppet/type/file/content.rb +++ b/lib/puppet/type/file/content.rb @@ -31,8 +31,7 @@ module Puppet } } - This attribute is especially useful when used with - `PuppetTemplating templating`:trac:." + This attribute is especially useful when used with templating." # Store a checksum as the value, rather than the actual content. # Simplifies everything. -- cgit From 7cb884e44db412ed4cc19d9eb3e07d4b5b17f6b3 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Tue, 15 Feb 2011 17:10:42 -0800 Subject: (#6346) Move the trap calls onto Signal so they're easier to stub Once you stub signal traps in tests, you can hit ctrl+c in the middle of a spec run and it will stop the run instead of puppet catching the SIGINT. I had trouble easily tracking down all the places to stub traps when the trap was being called as a private method on applications and daemons, but calling trap on Signal is equivalent since Kernel calls Signal.trap and Object mixes in Kernel to provide trap as a private method on all objects. A bigger solution would be to refactor everywhere we call trap into a method that's called consistently since right now we sprinkle SIGINT and SIGTERM trap handling over applications and daemons in inconsistent ways, returning different error codes and using different messages. I've captured this info in ticket #6345. Reviewed-by: Jacob Helwig --- lib/puppet/application/agent.rb | 2 +- lib/puppet/application/apply.rb | 2 +- lib/puppet/application/filebucket.rb | 2 +- lib/puppet/application/inspect.rb | 2 +- lib/puppet/application/kick.rb | 4 ++-- lib/puppet/application/master.rb | 2 +- lib/puppet/application/queue.rb | 4 ++-- lib/puppet/daemon.rb | 2 +- spec/spec_helper.rb | 1 + spec/unit/application/agent_spec.rb | 6 +----- spec/unit/application/apply_spec.rb | 3 +-- spec/unit/application/filebucket_spec.rb | 2 +- spec/unit/application/queue_spec.rb | 6 +----- spec/unit/daemon_spec.rb | 6 +----- 14 files changed, 16 insertions(+), 28 deletions(-) diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb index 2b75505fd..895156f11 100644 --- a/lib/puppet/application/agent.rb +++ b/lib/puppet/application/agent.rb @@ -9,7 +9,7 @@ class Puppet::Application::Agent < Puppet::Application def preinit # Do an initial trap, so that cancels don't get a stack trace. - trap(:INT) do + Signal.trap(:INT) do $stderr.puts "Cancelling startup" exit(0) end diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index 33a70ce8a..8f5aa86d0 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -143,7 +143,7 @@ class Puppet::Application::Apply < Puppet::Application client = nil server = nil - trap(:INT) do + Signal.trap(:INT) do $stderr.puts "Exiting" exit(1) end diff --git a/lib/puppet/application/filebucket.rb b/lib/puppet/application/filebucket.rb index 9c3c79bc3..5c91c4f64 100644 --- a/lib/puppet/application/filebucket.rb +++ b/lib/puppet/application/filebucket.rb @@ -52,7 +52,7 @@ class Puppet::Application::Filebucket < Puppet::Application @client = nil @server = nil - trap(:INT) do + Signal.trap(:INT) do $stderr.puts "Cancelling" exit(1) end diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb index 52ef97530..9e2aaed57 100644 --- a/lib/puppet/application/inspect.rb +++ b/lib/puppet/application/inspect.rb @@ -82,7 +82,7 @@ Licensed under the GNU General Public License version 2 Puppet::Util::Log.newdestination(@report) Puppet::Util::Log.newdestination(:console) unless options[:logset] - trap(:INT) do + Signal.trap(:INT) do $stderr.puts "Exiting" exit(1) end diff --git a/lib/puppet/application/kick.rb b/lib/puppet/application/kick.rb index 37aeb1ef2..b3c95e21d 100644 --- a/lib/puppet/application/kick.rb +++ b/lib/puppet/application/kick.rb @@ -151,7 +151,7 @@ class Puppet::Application::Kick < Puppet::Application def preinit [:INT, :TERM].each do |signal| - trap(signal) do + Signal.trap(signal) do $stderr.puts "Cancelling" exit(1) end @@ -195,7 +195,7 @@ class Puppet::Application::Kick < Puppet::Application # If we get a signal, then kill all of our children and get out. [:INT, :TERM].each do |signal| - trap(signal) do + Signal.trap(signal) do Puppet.notice "Caught #{signal}; shutting down" @children.each do |pid, host| Process.kill("INT", pid) diff --git a/lib/puppet/application/master.rb b/lib/puppet/application/master.rb index fde474907..6d1cdef1b 100644 --- a/lib/puppet/application/master.rb +++ b/lib/puppet/application/master.rb @@ -26,7 +26,7 @@ class Puppet::Application::Master < Puppet::Application end def preinit - trap(:INT) do + Signal.trap(:INT) do $stderr.puts "Cancelling startup" exit(0) end diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb index 239f6b2ad..ede47d0a6 100644 --- a/lib/puppet/application/queue.rb +++ b/lib/puppet/application/queue.rb @@ -15,13 +15,13 @@ class Puppet::Application::Queue < Puppet::Application # Do an initial trap, so that cancels don't get a stack trace. # This exits with exit code 1 - trap(:INT) do + Signal.trap(:INT) do $stderr.puts "Caught SIGINT; shutting down" exit(1) end # This is a normal shutdown, so code 0 - trap(:TERM) do + Signal.trap(:TERM) do $stderr.puts "Caught SIGTERM; shutting down" exit(0) end diff --git a/lib/puppet/daemon.rb b/lib/puppet/daemon.rb index c76d63a54..22630ffb8 100755 --- a/lib/puppet/daemon.rb +++ b/lib/puppet/daemon.rb @@ -95,7 +95,7 @@ class Puppet::Daemon # extended signals not supported under windows signals.update({:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs }) unless Puppet.features.microsoft_windows? signals.each do |signal, method| - trap(signal) do + Signal.trap(signal) do Puppet.notice "Caught #{signal}; calling #{method}" send(method) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ed4e826c9..a374fb008 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -64,6 +64,7 @@ RSpec.configure do |config| # these globals are set by Application $puppet_application_mode = nil $puppet_application_name = nil + Signal.stubs(:trap) # Set the confdir and vardir to gibberish so that tests # have to be correctly mocked. diff --git a/spec/unit/application/agent_spec.rb b/spec/unit/application/agent_spec.rb index ff504eedf..9fc7879c9 100755 --- a/spec/unit/application/agent_spec.rb +++ b/spec/unit/application/agent_spec.rb @@ -50,12 +50,8 @@ describe Puppet::Application::Agent do end describe "in preinit" do - before :each do - @puppetd.stubs(:trap) - end - it "should catch INT" do - @puppetd.expects(:trap).with { |arg,block| arg == :INT } + Signal.expects(:trap).with { |arg,block| arg == :INT } @puppetd.preinit end diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb index 4e1744206..ceba4a333 100755 --- a/spec/unit/application/apply_spec.rb +++ b/spec/unit/application/apply_spec.rb @@ -52,7 +52,6 @@ describe Puppet::Application::Apply do before :each do Puppet::Log.stubs(:newdestination) - Puppet.stubs(:trap) Puppet::Log.stubs(:level=) Puppet.stubs(:parse_config) Puppet::FileBucket::Dipper.stubs(:new) @@ -78,7 +77,7 @@ describe Puppet::Application::Apply do end it "should set INT trap" do - @apply.expects(:trap).with(:INT) + Signal.expects(:trap).with(:INT) @apply.setup end diff --git a/spec/unit/application/filebucket_spec.rb b/spec/unit/application/filebucket_spec.rb index e6272f179..95135c7eb 100644 --- a/spec/unit/application/filebucket_spec.rb +++ b/spec/unit/application/filebucket_spec.rb @@ -56,7 +56,7 @@ describe Puppet::Application::Filebucket do end it "should trap INT" do - @filebucket.expects(:trap).with(:INT) + Signal.expects(:trap).with(:INT) @filebucket.setup end diff --git a/spec/unit/application/queue_spec.rb b/spec/unit/application/queue_spec.rb index bd0d53ab1..f8ebbd0b4 100755 --- a/spec/unit/application/queue_spec.rb +++ b/spec/unit/application/queue_spec.rb @@ -29,12 +29,8 @@ describe Puppet::Application::Queue do end describe "in preinit" do - before :each do - @queue.stubs(:trap) - end - it "should catch INT" do - @queue.expects(:trap).with { |arg,block| arg == :INT } + Signal.expects(:trap).with { |arg,block| arg == :INT } @queue.preinit end diff --git a/spec/unit/daemon_spec.rb b/spec/unit/daemon_spec.rb index e24db7881..39592b7c9 100755 --- a/spec/unit/daemon_spec.rb +++ b/spec/unit/daemon_spec.rb @@ -29,13 +29,9 @@ describe Puppet::Daemon do end describe "when setting signal traps" do - before do - @daemon.stubs(:trap) - end - {:INT => :stop, :TERM => :stop, :HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs}.each do |signal, method| it "should log and call #{method} when it receives #{signal}" do - @daemon.expects(:trap).with(signal).yields + Signal.expects(:trap).with(signal).yields Puppet.expects(:notice) -- cgit From 489b065b9e25b8dcb389ae63b73ba0c696f0ead5 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 10:26:22 -0800 Subject: (#1204) Reformat help text for puppet doc and puppet agent. Markdown changes for compatibility with Ronn, in the interest of better manpages. --- lib/puppet/application/agent.rb | 243 ++++++++++++++++++++-------------------- lib/puppet/application/doc.rb | 69 +++++++----- 2 files changed, 163 insertions(+), 149 deletions(-) diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb index fa1ec58a5..fa06aae36 100644 --- a/lib/puppet/application/agent.rb +++ b/lib/puppet/application/agent.rb @@ -86,26 +86,30 @@ class Puppet::Application::Agent < Puppet::Application def help <<-HELP -SYNOPSIS +puppet-agent(8) -- The puppet agent daemon ======== -Retrieve the client configuration from the puppet master and apply it to + +SYNOPSIS +-------- +Retrieves the client configuration from the puppet master and applies it to the local host. -Currently must be run out periodically, using cron or something similar. +This service may be run as a daemon, run periodically using cron (or something +similar), or run interactively for testing purposes. USAGE -===== - puppet agent [-D|--daemonize|--no-daemonize] [-d|--debug] - [--detailed-exitcodes] [--disable] [--enable] - [-h|--help] [--certname ] [-l|--logdest syslog||console] - [-o|--onetime] [--serve ] [-t|--test] [--noop] - [--digest ] [--fingerprint] [-V|--version] - [-v|--verbose] [-w|--waitforcert ] +----- +puppet agent [-D|--daemonize|--no-daemonize] [-d|--debug] + [--detailed-exitcodes] [--disable] [--enable] [-h|--help] + [--certname ] [-l|--logdest syslog||console] + [-o|--onetime] [--serve ] [-t|--test] [--noop] + [--digest ] [--fingerprint] [-V|--version] + [-v|--verbose] [-w|--waitforcert ] DESCRIPTION -=========== +----------- This is the main puppet client. Its job is to retrieve the local machine's configuration from a remote server and apply it. In order to successfully communicate with the remote server, the client must have a @@ -120,10 +124,10 @@ configuration and apply it. USAGE NOTES -=========== +----------- 'puppet agent' does its best to find a compromise between interactive use and daemon use. Run with no arguments and no configuration, it will -go into the backgroun, attempt to get a signed certificate, and retrieve +go into the background, attempt to get a signed certificate, and retrieve and apply its configuration every 30 minutes. Some flags are meant specifically for interactive use -- in particular, @@ -156,7 +160,7 @@ when signing certificates). OPTIONS -======= +------- Note that any configuration parameter that's valid in the configuration file is also a valid long argument. For example, 'server' is a valid configuration parameter, so you can specify '--server ' as @@ -168,121 +172,122 @@ full list of acceptable parameters. A commented list of all configuration options can also be generated by running puppet agent 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. - -digest: Change the certificate fingerprinting digest - algorithm. The default is MD5. Valid values depends - on the version of OpenSSL installed, but should - always at least contain MD5, MD2, SHA1 and SHA256. - -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. This - option only makes sense in conjunction with - --onetime. - -disable: Disable working on the local system. This puts a - lock file in place, causing 'puppet agent' not to - work on the system until the lock file is removed. - This is useful if you are testing a configuration - and do not want the central configuration to - override the local state until everything is tested - and committed. - -'puppet agent' uses the same lock file while it is running, so no more -than one 'puppet agent' process is working at a time. - -'puppet agent' exits after executing this. - -enable: Enable working on the local system. This removes any - lock file, causing 'puppet agent' to start managing - the local system again (although it will continue to - use its normal scheduling, so it might not start for - another half hour). - -'puppet agent' exits after executing this. - -certname: Set the certname (unique ID) of the client. The - master reads this unique identifying string, which - is usually set to the node's fully-qualified domain - name, to determine which configurations the node - will receive. Use this option to debug setup - problems or implement unusual node identification - schemes. - -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. - -no-client: Do not create a config client. This will cause the - daemon to run without ever checking for its - configuration automatically, and only makes sense - -onetime: Run the configuration once. Runs a single (normally - daemonized) Puppet run. Useful for interactively - running puppet agent when used in conjunction with - the --no-daemonize option. - -fingerprint: Display the current certificate or certificate - signing request fingerprint and then exit. Use the - '--digest' option to change the digest algorithm - used. - -serve: Start another type of server. By default, 'puppet - agent' will start a service handler that allows - authenticated and authorized remote nodes to trigger - the configuration to be pulled down and applied. You - can specify any handler here that does not require - configuration, e.g., filebucket, ca, or resource. - The handlers are in 'lib/puppet/network/handler', - and the names must match exactly, both in the call - to 'serve' and in 'namespaceauth.conf'. - -test: Enable the most common options used for testing. - These are 'onetime', 'verbose', 'ignorecache', - 'no-daemonize', 'no-usecacheonfailure', - 'detailed-exit-codes', 'no-splay', and 'show_diff'. - -noop: Use 'noop' mode where the daemon runs in a no-op or - dry-run mode. This is useful for seeing what changes - Puppet will make without actually executing the - changes. - -verbose: Turn on verbose reporting. - -version: Print the puppet version number and exit. - -waitforcert: This option only matters for daemons that do not yet - have certificates and it is enabled by default, with - a value of 120 (seconds). This causes 'puppet agent' - to connect to the server every 2 minutes and ask it - to sign a certificate request. This is useful for - the initial setup of a puppet client. You can turn - off waiting for certificates by specifying a time of - 0. +* --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. + +* --digest: + Change the certificate fingerprinting digest algorithm. The default is + MD5. Valid values depends on the version of OpenSSL installed, but + should always at least contain MD5, MD2, SHA1 and SHA256. + +* --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. This option + only makes sense in conjunction with --onetime. + +* --disable: + Disable working on the local system. This puts a lock file in place, + causing 'puppet agent' not to work on the system until the lock file + is removed. This is useful if you are testing a configuration and do + not want the central configuration to override the local state until + everything is tested and committed. + + 'puppet agent' uses the same lock file while it is running, so no more + than one 'puppet agent' process is working at a time. + + 'puppet agent' exits after executing this. + +* --enable: + Enable working on the local system. This removes any lock file, + causing 'puppet agent' to start managing the local system again + (although it will continue to use its normal scheduling, so it might + not start for another half hour). + + 'puppet agent' exits after executing this. + +* --certname: + Set the certname (unique ID) of the client. The master reads this + unique identifying string, which is usually set to the node's + fully-qualified domain name, to determine which configurations the + node will receive. Use this option to debug setup problems or + implement unusual node identification schemes. + +* --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. + +* --no-client: + Do not create a config client. This will cause the daemon to run + without ever checking for its configuration automatically, and only + makes sense + +* --onetime: + Run the configuration once. Runs a single (normally daemonized) Puppet + run. Useful for interactively running puppet agent when used in + conjunction with the --no-daemonize option. + +* --fingerprint: + Display the current certificate or certificate signing request + fingerprint and then exit. Use the '--digest' option to change the + digest algorithm used. + +* --serve: + Start another type of server. By default, 'puppet agent' will start a + service handler that allows authenticated and authorized remote nodes + to trigger the configuration to be pulled down and applied. You can + specify any handler here that does not require configuration, e.g., + filebucket, ca, or resource. The handlers are in + 'lib/puppet/network/handler', and the names must match exactly, both + in the call to 'serve' and in 'namespaceauth.conf'. + +* --test: + Enable the most common options used for testing. These are 'onetime', + 'verbose', 'ignorecache', 'no-daemonize', 'no-usecacheonfailure', + 'detailed-exit-codes', 'no-splay', and 'show_diff'. + +* --noop: + Use 'noop' mode where the daemon runs in a no-op or dry-run mode. This + is useful for seeing what changes Puppet will make without actually + executing the changes. + +* --verbose: + Turn on verbose reporting. + +* --version: + Print the puppet version number and exit. + +* --waitforcert: + This option only matters for daemons that do not yet have certificates + and it is enabled by default, with a value of 120 (seconds). This + causes 'puppet agent' to connect to the server every 2 minutes and ask + it to sign a certificate request. This is useful for the initial setup + of a puppet client. You can turn off waiting for certificates by + specifying a time of 0. EXAMPLE -======= - puppet agent --server puppet.domain.com +------- + $ puppet agent --server puppet.domain.com AUTHOR -====== +------ Luke Kanies COPYRIGHT -========= +--------- Copyright (c) 2005, 2006 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/lib/puppet/application/doc.rb b/lib/puppet/application/doc.rb index c7f270c8d..3bfe41653 100644 --- a/lib/puppet/application/doc.rb +++ b/lib/puppet/application/doc.rb @@ -53,20 +53,24 @@ class Puppet::Application::Doc < Puppet::Application def help <<-HELP -SYNOPSIS +puppet-doc(8) -- Generate Puppet documentation and references ======== -Generate a reference for all Puppet types. Largely meant for internal + +SYNOPSIS +-------- +Generates a reference for all Puppet types. Largely meant for internal Puppet Labs use. USAGE -===== - puppet doc [-a|--all] [-h|--help] [-o|--outputdir ] [-m|--mode ] - [-r|--reference <[type]|configuration|..>] [--charset CHARSET] [manifest-file] +----- +puppet doc [-a|--all] [-h|--help] [-o|--outputdir ] + [-m|--mode text|pdf|rdoc] [-r|--reference ] + [--charset ] [] DESCRIPTION -=========== +----------- If mode is not 'rdoc', then this command generates a Markdown document describing all installed Puppet types or all allowable arguments to puppet executables. It is largely meant for internal use and is used to @@ -77,57 +81,62 @@ the manifests that are in 'manifestdir' and 'modulepath' configuration directives. The generated documentation directory is doc by default but can be changed with the 'outputdir' option. -If the command is started with 'manifest-file' command-line arguments, -puppet doc generate a single manifest documentation that is output on -stdout. +If the command is run with the name of a manifest file as an argument, +puppet doc will output a single manifest's documentation on stdout. OPTIONS -======= -all: Output the docs for all of the reference types. In 'rdoc' - modes, this also outputs documentation for all resources +------- +* --all: + Output the docs for all of the reference types. In 'rdoc' + modes, this also outputs documentation for all resources -help: Print this help message +* --help: + Print this help message -outputdir: Specifies the directory where to output the rdoc - documentation in 'rdoc' mode. +* --outputdir: + Specifies the directory where to output the rdoc + documentation in 'rdoc' mode. -mode: Determine the output mode. Valid modes are 'text', 'pdf' and - 'rdoc'. The 'pdf' mode creates PDF formatted files in the - /tmp directory. The default mode is 'text'. In 'rdoc' mode - you must provide 'manifests-path' +* --mode: + Determine the output mode. Valid modes are 'text', 'pdf' and + 'rdoc'. The 'pdf' mode creates PDF formatted files in the + /tmp directory. The default mode is 'text'. In 'rdoc' mode + you must provide 'manifests-path' -reference: Build a particular reference. Get a list of references by - running 'puppet doc --list'. +* --reference: + Build a particular reference. Get a list of references by + running 'puppet doc --list'. -charset: Used only in 'rdoc' mode. It sets the charset used in the - html files produced. +* --charset: + Used only in 'rdoc' mode. It sets the charset used in the + html files produced. EXAMPLE -======= - $ puppet doc -r type > /tmp/type_reference.markdown +------- + $ puppet doc -r type > /tmp/type_reference.markdown or - $ puppet doc --outputdir /tmp/rdoc --mode rdoc /path/to/manifests + $ puppet doc --outputdir /tmp/rdoc --mode rdoc /path/to/manifests or - $ puppet doc /etc/puppet/manifests/site.pp + $ puppet doc /etc/puppet/manifests/site.pp or - $ puppet doc -m pdf -r configuration + $ puppet doc -m pdf -r configuration AUTHOR -====== +------ Luke Kanies COPYRIGHT -========= +--------- Copyright (c) 2005-2007 Puppet Labs, LLC Licensed under the GNU Public License -- cgit From 969b8b0e039c37b78d3ce63035ac6bb823b1afbe Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 11:03:19 -0800 Subject: (#1204) Edit content and formatting of puppet apply help The puppet apply help was somewhat lacking, so I edited the content while making its formatting ronn-compatible. --- lib/puppet/application/apply.rb | 82 ++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index 1a5ab2c0c..37029cfb5 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -29,30 +29,42 @@ class Puppet::Application::Apply < Puppet::Application def help <<-HELP -SYNOPSIS +puppet-apply(8) -- Apply Puppet manifests locally ======== -Run a stand-alone 'puppet' manifest. + +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 ] +----- +puppet apply [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] + [-e|--execute] [--detailed-exitcodes] [-l|--logdest ] DESCRIPTION -=========== -This is the standalone puppet execution tool; use it to execute -individual manifests that you write. If you need to execute site-wide -manifests, use 'puppet agent' and 'puppet master'. +----------- +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, 'ssldir' is a valid -configuration parameter, so you can specify '--ssldir ' as an -argument. +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 @@ -60,42 +72,46 @@ 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. +* --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. +* --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 +* --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. +* --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. +* --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 +* --execute: + Execute a specific piece of Puppet code -verbose: Print extra information. +* --verbose: + Print extra information. EXAMPLE -======= - puppet -l /tmp/manifest.log manifest.pp +------- + $ puppet apply -l /tmp/manifest.log manifest.pp + $ puppet apply --modulepath=/root/dev/modules -e "include ntpd::server" AUTHOR -====== +------ Luke Kanies COPYRIGHT -========= +--------- Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License -- cgit From f653b8df5226e24bf2e89226ee6cd1e20684ff91 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 13:10:48 -0800 Subject: (#1204) Reformat help text for puppet cert and describe Markdown changes for compatibility with Ronn. --- lib/puppet/application/cert.rb | 121 ++++++++++++++++++++----------------- lib/puppet/application/describe.rb | 42 +++++++------ 2 files changed, 90 insertions(+), 73 deletions(-) diff --git a/lib/puppet/application/cert.rb b/lib/puppet/application/cert.rb index 0db968e9e..0808a42da 100644 --- a/lib/puppet/application/cert.rb +++ b/lib/puppet/application/cert.rb @@ -48,30 +48,32 @@ class Puppet::Application::Cert < Puppet::Application def help <<-HELP -SYNOPSIS +puppet-cert(8) -- Manage certificates and requests ======== -Stand-alone certificate authority. Capable of generating certificates -but mostly meant for signing certificate requests from puppet clients. + +SYNOPSIS +-------- +Standalone certificate authority. Capable of generating certificates, +but mostly used for signing certificate requests from puppet clients. USAGE -===== - puppet cert [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] - [-g|--generate] [-l|--list] [-s|--sign] [-r|--revoke] - [-p|--print] [-c|--clean] [--verify] [--digest DIGEST] - [--fingerprint] [host] +----- +puppet cert [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] + [-g|--generate] [-l|--list] [-s|--sign] [-r|--revoke] [-p|--print] + [-c|--clean] [--verify] [--digest ] [--fingerprint] [host] DESCRIPTION -=========== -Because the puppetmasterd daemon defaults to not signing client +----------- +Because the puppet master service defaults to not signing client certificate requests, this script is available for signing outstanding requests. It can be used to list outstanding requests and then either sign them individually or sign all of them. 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 @@ -83,73 +85,82 @@ full list of acceptable parameters. A commented list of all configuration options can also be generated by running puppet cert with '--genconfig'. -all: Operate on all items. Currently only makes sense with - '--sign', '--clean', or '--list'. +* --all: + Operate on all items. Currently only makes sense with '--sign', + '--clean', or '--list'. -digest: Set the digest for fingerprinting (defaults to md5). Valid - values depends on your openssl and openssl ruby extension - version, but should contain at least md5, sha1, md2, - sha256. +* --digest: + Set the digest for fingerprinting (defaults to md5). Valid values + depends on your openssl and openssl ruby extension version, but should + contain at least md5, sha1, md2, sha256. -clean: Remove all files related to a host from puppet cert's - storage. This is useful when rebuilding hosts, since new - certificate signing requests will only be honored if puppet - cert does not have a copy of a signed certificate for that - host. The certificate of the host is also revoked. If - '--all' is specified then all host certificates, both - signed and unsigned, will be removed. +* --clean: + Remove all files related to a host from puppet cert's storage. This is + useful when rebuilding hosts, since new certificate signing requests + will only be honored if puppet cert does not have a copy of a signed + certificate for that host. The certificate of the host is also + revoked. If '--all' is specified then all host certificates, both + signed and unsigned, will be removed. -debug: Enable full debugging. +* --debug: + Enable full debugging. -generate: Generate a certificate for a named client. A - certificate/keypair will be generated for each client named - on the command line. +* --generate: + Generate a certificate for a named client. A certificate/keypair will + be generated for each client named on the command line. -help: Print this help message +* --help: + Print this help message -list: List outstanding certificate requests. If '--all' is - specified, signed certificates are also listed, prefixed by - '+', and revoked or invalid certificates are prefixed by - '-' (the verification outcome is printed in parenthesis). +* --list: + List outstanding certificate requests. If '--all' is specified, signed + certificates are also listed, prefixed by '+', and revoked or invalid + certificates are prefixed by '-' (the verification outcome is printed + in parenthesis). -print: Print the full-text version of a host's certificate. +* --print: + Print the full-text version of a host's certificate. -fingerprint: Print the DIGEST (defaults to md5) fingerprint of a host's - certificate. +* --fingerprint: + Print the DIGEST (defaults to md5) fingerprint of a host's + certificate. -revoke: Revoke the certificate of a client. The certificate can be - specified either by its serial number, given as a decimal - number or a hexadecimal number prefixed by '0x', or by its - hostname. The certificate is revoked by adding it to the - Certificate Revocation List given by the 'cacrl' config - parameter. Note that the puppetmasterd needs to be - restarted after revoking certificates. +* --revoke: + Revoke the certificate of a client. The certificate can be specified + either by its serial number, given as a decimal number or a + hexadecimal number prefixed by '0x', or by its hostname. The + certificate is revoked by adding it to the Certificate Revocation List + given by the 'cacrl' config parameter. Note that the puppetmasterd + needs to be restarted after revoking certificates. -sign: Sign an outstanding certificate request. Unless '--all' is - specified, hosts must be listed after all flags. +* --sign: + Sign an outstanding certificate request. Unless '--all' is specified, + hosts must be listed after all flags. -verbose: Enable verbosity. +* --verbose: + Enable verbosity. -version: Print the puppet version number and exit. +* --version: + Print the puppet version number and exit. -verify: Verify the named certificate against the local CA - certificate. +* --verify: + Verify the named certificate against the local CA certificate. EXAMPLE -======= - $ puppet cert -l - culain.madstop.com - $ puppet cert -s culain.madstop.com +------- + $ puppet cert -l + culain.madstop.com + $ puppet cert -s culain.madstop.com AUTHOR -====== +------ Luke Kanies COPYRIGHT -========= +--------- Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/lib/puppet/application/describe.rb b/lib/puppet/application/describe.rb index 0c7bea96d..bd2337577 100644 --- a/lib/puppet/application/describe.rb +++ b/lib/puppet/application/describe.rb @@ -183,50 +183,56 @@ class Puppet::Application::Describe < Puppet::Application def help <<-HELP -SYNOPSIS +puppet-describe(8) -- Display help about resource types ======== -Print help about puppet types on the console. Run with '-h' to get -detailed help. +SYNOPSIS +-------- +Prints help about Puppet resource types, providers, and metaparameters. USAGE -===== - puppet describe [-h|--help] [-s|--short] [-p|--providers] [-l|--list] [-m|--meta] +----- +puppet describe [-h|--help] [-s|--short] [-p|--providers] [-l|--list] [-m|--meta] DESCRIPTION -=========== +----------- Prints details of Puppet types, providers and metaparameters on the console. OPTIONS -======= -help: Print this help text +------- +* --help: + Print this help text -providers: Describe providers in detail for each type +* --providers: + Describe providers in detail for each type -list: List all types +* --list: + List all types -meta: List all metaparameters +* --meta: + List all metaparameters -short: List only parameters without detail +* --short: + List only parameters without detail EXAMPLE -======= - puppet describe --list - puppet describe file --providers - puppet describe user -s -m +------- + $ puppet describe --list + $ puppet describe file --providers + $ puppet describe user -s -m AUTHOR -====== +------ David Lutterkort COPYRIGHT -========= +--------- Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License -- cgit From 1800d0026bfc6574495adc8275576468a36d9cb0 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 13:16:02 -0800 Subject: (#1204) Edit content of puppet describe help It's a simple tool, it doesn't need both synopsis and description. Especially when they're identical. --- lib/puppet/application/describe.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/puppet/application/describe.rb b/lib/puppet/application/describe.rb index bd2337577..79643159e 100644 --- a/lib/puppet/application/describe.rb +++ b/lib/puppet/application/describe.rb @@ -190,17 +190,12 @@ SYNOPSIS -------- Prints help about Puppet resource types, providers, and metaparameters. + USAGE ----- puppet describe [-h|--help] [-s|--short] [-p|--providers] [-l|--list] [-m|--meta] -DESCRIPTION ------------ -Prints details of Puppet types, providers and metaparameters on the -console. - - OPTIONS ------- * --help: -- cgit From c35aa609922704b72ea6517d90dc645da7177a5c Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 13:34:38 -0800 Subject: (#1204) Fix garbled help for puppet filebucket The actual text was somewhat disarrayed. No ronn fixes in this patch. --- lib/puppet/application/filebucket.rb | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/lib/puppet/application/filebucket.rb b/lib/puppet/application/filebucket.rb index 77ebbb843..998f006d2 100644 --- a/lib/puppet/application/filebucket.rb +++ b/lib/puppet/application/filebucket.rb @@ -22,20 +22,11 @@ A stand-alone Puppet filebucket client. USAGE ===== - puppet filebucket [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] + puppet filebucket [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] [-l|--local] [-r|--remote] [-s|--server ] [-b|--bucket ] ... - -DESCRIPTION -=========== -This is a stand-alone filebucket client for sending files to a local or -central filebucket. - - -USAGE -===== -This client can operate in three modes, with only one mode per call: +Puppet filebucket can operate in three modes, with only one mode per call: backup: Send one or more files to the specified file bucket. Each sent file is printed with its resulting md5 sum. @@ -45,7 +36,13 @@ get: Return the text associated with an md5 sum. The text is printed restore: Given a file path and an md5 sum, store the content associated with the sum into the specified file path. You can specify an - entirely new path to this argument; you are not restricted to + entirely new path to this argument; you are not restricted to restoring the content to its original location. + + +DESCRIPTION +=========== +This is a stand-alone filebucket client for sending files to a local or +central filebucket. Note that 'filebucket' defaults to using a network-based filebucket available on the server named 'puppet'. To use this, you'll have to be @@ -53,14 +50,6 @@ running as a user with valid Puppet certificates. Alternatively, you can use your local file bucket by specifying '--local'. -EXAMPLE -======= - $ puppet filebucket backup /etc/passwd - /etc/passwd: 429b225650b912a2ee067b0a4cf1e949 - $ puppet filebucket restore /tmp/passwd 429b225650b912a2ee067b0a4cf1e949 - $ - - OPTIONS ======= Note that any configuration parameter that's valid in the configuration @@ -93,7 +82,9 @@ version: Print version information. EXAMPLE ======= - puppet filebucket -b /tmp/filebucket /my/file + $ puppet filebucket backup /etc/passwd + /etc/passwd: 429b225650b912a2ee067b0a4cf1e949 + $ puppet filebucket restore /tmp/passwd 429b225650b912a2ee067b0a4cf1e949 AUTHOR -- cgit From d198db2ee529dfdb74b7dee5c3f5def77b782b4a Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 14:40:02 -0800 Subject: (#1204) Reformat help text for puppet filebucket Markdown changes for compatibility with ronn. --- lib/puppet/application/filebucket.rb | 72 +++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/lib/puppet/application/filebucket.rb b/lib/puppet/application/filebucket.rb index 998f006d2..460115586 100644 --- a/lib/puppet/application/filebucket.rb +++ b/lib/puppet/application/filebucket.rb @@ -15,32 +15,39 @@ class Puppet::Application::Filebucket < Puppet::Application def help <<-HELP -SYNOPSIS +puppet-filebucket(8) -- Store and retrieve files in a filebucket ======== + +SYNOPSIS +-------- A stand-alone Puppet filebucket client. USAGE -===== - puppet filebucket [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] - [-l|--local] [-r|--remote] - [-s|--server ] [-b|--bucket ] ... +----- +puppet filebucket [-h|--help] [-V|--version] [-d|--debug] + [-v|--verbose] [-l|--local] [-r|--remote] [-s|--server ] + [-b|--bucket ] ... Puppet filebucket can operate in three modes, with only one mode per call: -backup: Send one or more files to the specified file bucket. Each sent - file is printed with its resulting md5 sum. +backup: + Send one or more files to the specified file bucket. Each sent file is + printed with its resulting md5 sum. -get: Return the text associated with an md5 sum. The text is printed - to stdout, and only one file can be retrieved at a time. +get: + Return the text associated with an md5 sum. The text is printed to + stdout, and only one file can be retrieved at a time. -restore: Given a file path and an md5 sum, store the content associated - with the sum into the specified file path. You can specify an - entirely new path to this argument; you are not restricted to restoring the content to its original location. +restore: + Given a file path and an md5 sum, store the content associated with + the sum into the specified file path. You can specify an entirely new + path to this argument; you are not restricted to restoring the content + to its original location. DESCRIPTION -=========== +----------- This is a stand-alone filebucket client for sending files to a local or central filebucket. @@ -51,7 +58,7 @@ use your local file bucket by specifying '--local'. 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 @@ -63,37 +70,44 @@ 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. +* --debug: + Enable full debugging. -help: Print this help message +* --help: + Print this help message -local: Use the local filebucket. This will use the default - configuration information. +* --local: + Use the local filebucket. This will use the default configuration + information. -remote: Use a remote filebucket. This will use the default - configuration information. +* --remote: + Use a remote filebucket. This will use the default configuration + information. -server: The server to send the file to, instead of locally. +* --server: + The server to send the file to, instead of locally. -verbose: Print extra information. +* --verbose: + Print extra information. -version: Print version information. +* --version: + Print version information. EXAMPLE -======= - $ puppet filebucket backup /etc/passwd - /etc/passwd: 429b225650b912a2ee067b0a4cf1e949 - $ puppet filebucket restore /tmp/passwd 429b225650b912a2ee067b0a4cf1e949 +------- + $ puppet filebucket backup /etc/passwd + /etc/passwd: 429b225650b912a2ee067b0a4cf1e949 + $ puppet filebucket restore /tmp/passwd 429b225650b912a2ee067b0a4cf1e949 AUTHOR -====== +------ Luke Kanies COPYRIGHT -========= +--------- Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License -- cgit From 3f1c26ff5699589e06f9fd48c0bd9ac3379a4c07 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 14:55:58 -0800 Subject: (#1204) Reformat help text for puppet kick and inspect Markdown changes for compatibility with ronn. --- lib/puppet/application/inspect.rb | 23 +++++----- lib/puppet/application/kick.rb | 92 ++++++++++++++++++++++----------------- 2 files changed, 64 insertions(+), 51 deletions(-) diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb index 599898a07..578588144 100644 --- a/lib/puppet/application/inspect.rb +++ b/lib/puppet/application/inspect.rb @@ -22,20 +22,22 @@ class Puppet::Application::Inspect < Puppet::Application def help <<-HELP -SYNOPSIS +puppet-inspect(8) -- Send an inspection report ======== -Prepare and submit an inspection report to the puppet master. +SYNOPSIS +-------- + +Prepares and submits an inspection report to the puppet master. USAGE -===== - - puppet inspect +----- +puppet inspect DESCRIPTION -=========== +----------- This command uses the cached catalog from the previous run of 'puppet agent' to determine which attributes of which resources have been @@ -44,11 +46,12 @@ the current state of the system, writes the state of the specified resource attributes to a report, and submits the report to the puppet master. -Puppet inspect does not run as a daemon, and must be run manually or from cron. +Puppet inspect does not run as a daemon, and must be run manually or +from cron. OPTIONS -======= +------- Any configuration setting which is valid in the configuration file is also a valid long argument, e.g. '--server=master.domain.com'. See the @@ -58,13 +61,13 @@ the full list of acceptable settings. AUTHOR -====== +------ Puppet Labs COPYRIGHT -========= +--------- Copyright (c) 2011 Puppet Labs, LLC Licensed under the GNU General Public License version 2 diff --git a/lib/puppet/application/kick.rb b/lib/puppet/application/kick.rb index 4cf06036f..9612a72aa 100644 --- a/lib/puppet/application/kick.rb +++ b/lib/puppet/application/kick.rb @@ -40,20 +40,23 @@ class Puppet::Application::Kick < Puppet::Application def help <<-HELP -SYNOPSIS +puppet-kick(8) -- Remotely control puppet agent ======== + +SYNOPSIS +-------- Trigger a puppet agent run on a set of hosts. USAGE -===== - puppet kick [-a|--all] [-c|--class ] [-d|--debug] [-f|--foreground] - [-h|--help] [--host ] [--no-fqdn] [--ignoreschedules] - [-t|--tag ] [--test] [-p|--ping] [ [...]] +----- +puppet kick [-a|--all] [-c|--class ] [-d|--debug] [-f|--foreground] + [-h|--help] [--host ] [--no-fqdn] [--ignoreschedules] + [-t|--tag ] [--test] [-p|--ping] [ [...]] DESCRIPTION -=========== +----------- This script can be used to connect to a set of machines running 'puppet agent' and trigger them to run their configurations. The most common usage would be to specify a class of hosts and a set of tags, and @@ -72,11 +75,11 @@ copy things like LDAP settings. USAGE NOTES -=========== +----------- 'puppet kick' is useless unless 'puppet agent' is listening. See its documentation for more information, but the gist is that you must enable 'listen' on the 'puppet agent' daemon, either using '--listen' on the -command line or adding 'listen: true' in its config file. In addition, +command line or adding 'listen = true' in its config file. In addition, you need to set the daemons up to specifically allow connections by creating the 'namespaceauth' file, normally at '/etc/puppet/namespaceauth.conf'. This file specifies who has access to @@ -84,7 +87,7 @@ each namespace; if you create the file you must add every namespace you want any Puppet daemon to allow -- it is currently global to all Puppet daemons. -An example file looks like this:: +An example file looks like this: [fileserver] allow *.madstop.com @@ -100,68 +103,75 @@ could leave off the 'fileserver' and 'puppetmaster' namespaces. 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://reductivelabs.com/projects/puppet/reference/configref.html for +http://docs.puppetlabs.com/references/latest/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'. -all: Connect to all available hosts. Requires LDAP support - at this point. - -class: Specify a class of machines to which to connect. This - only works if you have LDAP configured, at the moment. +* --all: + Connect to all available hosts. Requires LDAP support at this point. -debug: Enable full debugging. +* --class: + Specify a class of machines to which to connect. This only works if + you have LDAP configured, at the moment. -foreground: Run each configuration in the foreground; that is, when - connecting to a host, do not return until the host has - finished its run. The default is false. +* --debug: + Enable full debugging. -help: Print this help message +* --foreground: + Run each configuration in the foreground; that is, when connecting to + a host, do not return until the host has finished its run. The default + is false. -host: A specific host to which to connect. This flag can be - specified more than once. +* --help: + Print this help message -ignoreschedules: Whether the client should ignore schedules when running - its configuration. This can be used to force the client - to perform work it would not normally perform so soon. - The default is false. +* --host: + A specific host to which to connect. This flag can be specified more + than once. -parallel: How parallel to make the connections. Parallelization - is provided by forking for each client to which to - connect. The default is 1, meaning serial execution. +* --ignoreschedules: + Whether the client should ignore schedules when running its + configuration. This can be used to force the client to perform work it + would not normally perform so soon. The default is false. -tag: Specify a tag for selecting the objects to apply. Does - not work with the --test option. +* --parallel: + How parallel to make the connections. Parallelization is provided by + forking for each client to which to connect. The default is 1, meaning + serial execution. -test: Print the hosts you would connect to but do not - actually connect. This option requires LDAP support at - this point. +* --tag: + Specify a tag for selecting the objects to apply. Does not work with + the --test option. -ping:: +* --test: + Print the hosts you would connect to but do not actually connect. This + option requires LDAP support at this point. - Do a ICMP echo against the target host. Skip hosts that don't respond to ping. +* --ping: + Do a ICMP echo against the target host. Skip hosts that don't respond + to ping. EXAMPLE -======= - sudo puppet kick -p 10 -t remotefile -t webserver host1 host2 +------- + $ sudo puppet kick -p 10 -t remotefile -t webserver host1 host2 AUTHOR -====== +------ Luke Kanies COPYRIGHT -========= +--------- Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License -- cgit From 768d9a1a796b631de7ec4da2e75ec52211716c9a Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 15:06:42 -0800 Subject: (#1204) Reformat help text for puppet master Markdown changes for compatibility with ronn. --- lib/puppet/application/master.rb | 71 ++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/lib/puppet/application/master.rb b/lib/puppet/application/master.rb index b2b77f870..39af33dc8 100644 --- a/lib/puppet/application/master.rb +++ b/lib/puppet/application/master.rb @@ -28,25 +28,32 @@ class Puppet::Application::Master < Puppet::Application def help <<-HELP -SYNOPSIS +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 ] [--apply ] +----- +puppet master [-D|--daemonize|--no-daemonize] [-d|--debug] [-h|--help] + [-l|--logdest |console|syslog] [-v|--verbose] [-V|--version] + [--compile ] [--apply ] + DESCRIPTION -=========== -This is the puppet central daemon. +----------- +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 @@ -55,47 +62,55 @@ 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 puppetmasterdd +configuration options can also be generated by running puppet master with '--genconfig'. -daemonize: Send the process into the background. This is the default. +* --daemonize: + Send the process into the background. This is the default. -no-daemonize: Do not send the process into the background. +* --no-daemonize: + Do not send the process into the background. -debug: Enable full debugging. +* --debug: + Enable full debugging. -help: Print this help message. +* --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. +* --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. +* --verbose: + Enable verbosity. -version: Print the puppet version number and exit. +* --version: + Print the puppet version number and exit. -compile: Capability to compile a catalogue and output it in JSON - from the Puppet master. Uses facts contained in the - $vardir/yaml/ directory to compile the catalog. +* --compile: + Capability to compile a catalogue and output it in JSON from the + Puppet master. Uses facts contained in the $vardir/yaml/ directory to + compile the catalog. -apply: Capability to apply JSON catalog (such as one generated - with --compile). You can either specify a JSON file or - pipe in JSON from standard input. +* --apply: + Capability to apply JSON catalog (such as one generated with + --compile). You can either specify a JSON file or pipe in JSON from + standard input. EXAMPLE -======= +------- puppet master AUTHOR -====== +------ Luke Kanies COPYRIGHT -========= +--------- Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License -- cgit From bd14ff5e1ea5bad3e1cba1fd19610f63158c5bc4 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 15:09:56 -0800 Subject: (#1204) Fix --compile and --apply options Forward-porting a fix from 2.6.x to the new help text locations. --- lib/puppet/application/apply.rb | 7 ++++++- lib/puppet/application/master.rb | 12 +++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index 37029cfb5..a1edf6243 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -40,7 +40,8 @@ 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 ] + [-e|--execute] [--detailed-exitcodes] [-l|--logdest ] + [--apply ] DESCRIPTION @@ -98,6 +99,10 @@ configuration options can also be generated by running puppet with * --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 ------- diff --git a/lib/puppet/application/master.rb b/lib/puppet/application/master.rb index 39af33dc8..f689b9e01 100644 --- a/lib/puppet/application/master.rb +++ b/lib/puppet/application/master.rb @@ -41,7 +41,7 @@ USAGE ----- puppet master [-D|--daemonize|--no-daemonize] [-d|--debug] [-h|--help] [-l|--logdest |console|syslog] [-v|--verbose] [-V|--version] - [--compile ] [--apply ] + [--compile ] DESCRIPTION @@ -89,14 +89,8 @@ with '--genconfig'. Print the puppet version number and exit. * --compile: - Capability to compile a catalogue and output it in JSON from the - Puppet master. Uses facts contained in the $vardir/yaml/ directory to - compile the catalog. - -* --apply: - Capability to apply JSON catalog (such as one generated with - --compile). You can either specify a JSON file or pipe in JSON from - standard input. + 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 -- cgit From f4c7e484dc1781567f55f80619d8a34def22f18d Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 15:26:15 -0800 Subject: (#1204) Edit content and formatting of puppet queue help Puppet queue had inadequate help, so I added to it while reformatting for ronn. --- lib/puppet/application/queue.rb | 48 ++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb index d32ec9a6f..00ace37fa 100644 --- a/lib/puppet/application/queue.rb +++ b/lib/puppet/application/queue.rb @@ -40,24 +40,34 @@ class Puppet::Application::Queue < Puppet::Application def help <<-HELP -SYNOPSIS +puppet-queue(8) -- Queuing daemon for asynchronous storeconfigs ======== -Retrieve serialized records from a queue and process them in order. + +SYNOPSIS +-------- +Retrieves serialized storeconfigs records from a queue and processes +them in order. USAGE -===== - puppet queue [-d|--debug] [-v|--verbose] +----- +puppet queue [-d|--debug] [-v|--verbose] DESCRIPTION -=========== -This is a simple application that just processes entities in a queue as -they are recieved. +----------- +This application runs as a daemon and processes storeconfigs data, +retrieving the data from a stomp server message queue and writing it to +a database. + +For more information, including instructions for properly setting up +your puppet master and message queue, see the documentation on setting +up asynchronous storeconfigs at: +http://projects.puppetlabs.com/projects/1/wiki/Using_Stored_Configuration OPTIONS -======= +------- Note that any configuration parameter that's valid in the configuration file is also a valid long argument. For example, 'server' is a valid configuration parameter, so you can specify '--server ' as @@ -66,30 +76,34 @@ 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 puppetd with +configuration options can also be generated by running puppet queue with '--genconfig'. -debug: Enable full debugging. +* --debug: + Enable full debugging. -help: Print this help message +* --help: + Print this help message -verbose: Turn on verbose reporting. +* --verbose: + Turn on verbose reporting. -version: Print the puppet version number and exit. +* --version: + Print the puppet version number and exit. EXAMPLE -======= - puppet queue +------- + $ puppet queue AUTHOR -====== +------ Luke Kanies COPYRIGHT -========= +--------- Copyright (c) 2009 Puppet Labs, LLC Licensed under the GNU Public License -- cgit From 9e19d2267dfd254a12f1fe5fc37a524af8e1efc7 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 15:36:44 -0800 Subject: (#1204) Edit content and formatting of puppet resource help Clarified how to modify the system state with puppet resource, and reformatted the markdown for compatibility with ronn. --- lib/puppet/application/resource.rb | 89 +++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/lib/puppet/application/resource.rb b/lib/puppet/application/resource.rb index a0e33408d..f5741b9ee 100644 --- a/lib/puppet/application/resource.rb +++ b/lib/puppet/application/resource.rb @@ -38,37 +38,41 @@ class Puppet::Application::Resource < Puppet::Application def help <<-HELP -SYNOPSIS +puppet-resource(8) -- The resource abstraction layer shell ======== -Use the Puppet RAL to directly interact with the system. + +SYNOPSIS +-------- +Uses the Puppet RAL to directly interact with the system. USAGE -===== - puppet resource [-h|--help] [-d|--debug] [-v|--verbose] [-e|--edit] - [-H|--host ] [-p|--param ] [-t|--types] - type +----- +puppet resource [-h|--help] [-d|--debug] [-v|--verbose] [-e|--edit] + [-H|--host ] [-p|--param ] [-t|--types] [] + [= ...] DESCRIPTION -=========== +----------- This command provides simple facilities for converting current system -state into Puppet code, along with some ability to use Puppet to affect -the current state. +state into Puppet code, along with some ability to modify the current +state using Puppet's RAL. -By default, you must at least provide a type to list, which case puppet -resource will tell you everything it knows about all instances of that -type. You can optionally specify an instance name, and puppet resource -will only describe that single instance. +By default, you must at least provide a type to list, in which case +puppet resource will tell you everything it knows about all resources of +that type. You can optionally specify an instance name, and puppet +resource will only describe that single instance. -You can also add '--edit' as an argument, and puppet resource will write -its output to a file, open that file in an editor, and then apply the -file as a Puppet transaction. You can easily use this to use Puppet to -make simple changes to a system. +If given a type, a name, and a series of = pairs, +puppet resource will modify the state of the specified resource. +Alternately, if given a type, a name, and the '--edit' flag, puppet +resource will write its output to a file, open that file in an editor, +and then apply the saved file as a Puppet transaction. 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 @@ -80,59 +84,54 @@ 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. - -edit: +* --debug: + Enable full debugging. +* --edit: Write the results of the query to a file, open the file in an editor, and read the file back in as an executable Puppet manifest. -host: - +* --host: When specified, connect to the resource server on the named host and retrieve the list of resouces of the type specified. -help: - +* --help: Print this help message. -param: - +* --param: Add more parameters to be outputted from queries. -types: - +* --types: List all available types. -verbose: - +* --verbose: Print extra information. EXAMPLE -======= -This example uses `puppet resource` to return Puppet configuration for +------- +This example uses `puppet resource` to return a Puppet configuration for the user `luke`: - $ puppet resource user luke - user { 'luke': - home => '/home/luke', - uid => '100', - ensure => 'present', - comment => 'Luke Kanies,,,', - gid => '1000', - shell => '/bin/bash', - groups => ['sysadmin','audio','video','puppet'] - } + $ puppet resource user luke + user { 'luke': + home => '/home/luke', + uid => '100', + ensure => 'present', + comment => 'Luke Kanies,,,', + gid => '1000', + shell => '/bin/bash', + groups => ['sysadmin','audio','video','puppet'] + } AUTHOR -====== +------ Luke Kanies COPYRIGHT -========= +--------- Copyright (c) 2005-2007 Puppet Labs, LLC Licensed under the GNU Public License -- cgit From c61952001509768faa7fa09e7ddc2e7d86f2981f Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 16:01:16 -0800 Subject: (#1204) Move man generation task from install.rb to a rake task Having this be commented-out code in the installer script doesn't really make sense for our workflow; we want to be able to regenerate these manpages at will and make sure they're always up-to-date. This will help us keep them in sync with the help text. This commit also changes the ronn invocation to specify a manual name and organization. --- install.rb | 53 ------------------------------------------------ tasks/rake/manpages.rake | 27 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 53 deletions(-) create mode 100644 tasks/rake/manpages.rake diff --git a/install.rb b/install.rb index 7627a8d11..72acb24f5 100755 --- a/install.rb +++ b/install.rb @@ -53,18 +53,6 @@ rescue LoadError $haverdoc = false end -begin - if $haverdoc - ronn = %x{which ronn} - $haveman = true - else - $haveman = false - end -rescue - puts "Missing ronn; skipping man page creation" - $haveman = false -end - PREREQS = %w{openssl facter xmlrpc/client xmlrpc/server cgi} MIN_FACTER_VERSION = 1.5 @@ -178,15 +166,6 @@ def prepare_installation end - if $haveman - InstallOptions.man = true - if $operatingsystem == "windows" - InstallOptions.man = false - end - else - InstallOptions.man = false - end - InstallOptions.tests = true ARGV.options do |opts| @@ -198,9 +177,6 @@ def prepare_installation opts.on('--[no-]ri', 'Prevents the creation of RI output.', 'Default off on mswin32.') do |onri| InstallOptions.ri = onri end - opts.on('--[no-]man', 'Prevents the creation of man pages.', 'Default on.') do |onman| - InstallOptions.man = onman - end opts.on('--[no-]tests', 'Prevents the execution of unit tests.', 'Default on.') do |ontest| InstallOptions.tests = ontest end @@ -233,7 +209,6 @@ def prepare_installation end opts.on('--full', 'Performs a full installation. All', 'optional installation steps are run.') do |full| InstallOptions.rdoc = true - InstallOptions.man = true InstallOptions.ri = true InstallOptions.tests = true InstallOptions.configs = true @@ -368,33 +343,6 @@ def build_ri(files) end end -def build_man(bins, sbins) - return unless $haveman - begin - # Locate ronn - ronn = %x{which ronn} - ronn.chomp! - # Create puppet.conf.5 man page - %x{bin/puppetdoc --reference configuration > ./man/man5/puppetconf.5.ronn} - %x{#{ronn} -r ./man/man5/puppetconf.5.ronn} - File.move("./man/man5/puppetconf.5", "./man/man5/puppet.conf.5") - File.unlink("./man/man5/puppetconf.5.ronn") - - # Create binary man pages - binary = bins + sbins - binary.each do |bin| - b = bin.gsub( /(bin|sbin)\//, "") - %x{#{bin} --help > ./man/man8/#{b}.8.ronn} - %x{#{ronn} -r ./man/man8/#{b}.8.ronn} - File.unlink("./man/man8/#{b}.8.ronn") - end - -rescue SystemCallError - $stderr.puts "Couldn't build man pages: " + $ERROR_INFO - $stderr.puts "Continuing with install..." - end -end - def run_tests(test_list) require 'test/unit/ui/console/testrunner' $LOAD_PATH.unshift "lib" @@ -488,7 +436,6 @@ prepare_installation #run_tests(tests) if InstallOptions.tests #build_rdoc(rdoc) if InstallOptions.rdoc #build_ri(ri) if InstallOptions.ri -#build_man(bins, sbins) if InstallOptions.man do_configs(configs, InstallOptions.config_dir) if InstallOptions.configs do_bins(sbins, InstallOptions.sbin_dir) do_bins(bins, InstallOptions.bin_dir) diff --git a/tasks/rake/manpages.rake b/tasks/rake/manpages.rake new file mode 100644 index 000000000..752a6a7a6 --- /dev/null +++ b/tasks/rake/manpages.rake @@ -0,0 +1,27 @@ +# require 'fileutils' + +desc "Build Puppet manpages" +task :gen_manpages do + + sbins = Dir.glob(%w{sbin/*}) + bins = Dir.glob(%w{bin/*}) + + # Locate ronn + ronn = %x{which ronn} + ronn.chomp! + # Create puppet.conf.5 man page + %x{RUBYLIB=./lib:$RUBYLIB bin/puppetdoc --reference configuration > ./man/man5/puppetconf.5.ronn} + %x{#{ronn} --manual="Puppet manual" --organization="Puppet Labs, LLC" -r ./man/man5/puppetconf.5.ronn} + File.move("./man/man5/puppetconf.5", "./man/man5/puppet.conf.5") + File.unlink("./man/man5/puppetconf.5.ronn") + + # Create binary man pages + binary = bins + sbins + binary.each do |bin| + b = bin.gsub( /(bin|sbin)\//, "") + %x{RUBYLIB=./lib:$RUBYLIB #{bin} --help > ./man/man8/#{b}.8.ronn} + %x{#{ronn} --manual="Puppet manual" --organization="Puppet Labs, LLC" -r ./man/man8/#{b}.8.ronn} + File.unlink("./man/man8/#{b}.8.ronn") + end + +end \ No newline at end of file -- cgit From a0cff49aaa6586347b77437137cfa57f8013c344 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 17:43:54 -0800 Subject: (#1204) Update all the manpages We got the rake task working! We're not done, but all the manpages look a lot better, so let's commit that. --- man/man5/puppet.conf.5 | 1019 ++++++++++++---------------------------------- man/man8/filebucket.8 | 118 +++--- man/man8/pi.8 | 54 ++- man/man8/puppet.8 | 4 +- man/man8/puppetca.8 | 199 +++------ man/man8/puppetd.8 | 320 ++++----------- man/man8/puppetdoc.8 | 89 ++-- man/man8/puppetmasterd.8 | 75 ++-- man/man8/puppetqd.8 | 55 ++- man/man8/puppetrun.8 | 174 +++----- man/man8/ralsh.8 | 97 +++-- 11 files changed, 732 insertions(+), 1472 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 210f36786..feccf1083 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,14 +1,13 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "August 2010" "" "" -\fBThis page is autogenerated; any changes will get overwritten\fR \fI(last generated on Sat Aug 28 14:00:20 \-0700 2010)\fR -. -.P -{:toc} +.TH "PUPPETCONF" "5" "February 2011" "Puppet Labs, LLC" "Puppet manual" +\fBThis page is autogenerated; any changes will get overwritten\fR \fI(last generated on Wed Feb 16 17:06:38 \-0800 2011)\fR . .SH "Specifying Configuration Parameters" -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\. +. +.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\. @@ -44,19 +43,13 @@ $ puppet agent \-\-no\-storeconfigs .P The invocations above will enable and disable, respectively, the storage of the client configuration\. . -.P -Configuration Files +++++++++++++++++++ -. -.P +.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 -File Format \'\'\'\'\'\'\'\'\'\'\' -. -.P The file follows INI\-style formatting\. Here is an example of a very simple \fBpuppet\.conf\fR file: . .IP "" 4 @@ -75,14 +68,14 @@ The file follows INI\-style formatting\. Here is an example of a very simple \fB Note that boolean parameters must be explicitly specified as \fBtrue\fR or \fBfalse\fR as seen above\. . .P -If you need to change file parameters (e\.g\., reset the mode or owner), do so within curly braces on the same line: +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] - myfile = /tmp/whatever {owner = root, mode = 644} + vardir = /new/vardir {owner = root, mode = 644} . .fi . @@ -139,21 +132,31 @@ Sending the \fBSIGUSR1\fR signal to an instance of \fBpuppet agent\fR will cause .SH "Configuration Parameter Reference" Below is a list of all documented parameters\. Not all of them are valid with all Puppet executables, but the executables will ignore any inappropriate values\. . -.P -async_storeconfigs ++++++++++++++++++ +.SS "archive_file_server" +During an inspect run, the file bucket server to archive files to if archive_files is set\. . -.P -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: $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 . -.P -authconfig ++++++++++ +.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\. . -.P +.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 @@ -161,10 +164,7 @@ The configuration file that defines the rights to the different namespaces and m . .IP "" 0 . -.P -autoflush +++++++++ -. -.P +.SS "autoflush" Whether log files should always flush to disk\. . .IP "\(bu" 4 @@ -172,10 +172,7 @@ Whether log files should always flush to disk\. . .IP "" 0 . -.P -autosign ++++++++ -. -.P +.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 @@ -183,16 +180,10 @@ Whether to enable autosign\. Valid values are true (which autosigns any key requ . .IP "" 0 . -.P -bindaddress +++++++++++ -. -.P +.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\. . -.P -bucketdir +++++++++ -. -.P +.SS "bucketdir" Where FileBucket files are stored\. . .IP "\(bu" 4 @@ -200,10 +191,7 @@ Where FileBucket files are stored\. . .IP "" 0 . -.P -ca ++ -. -.P +.SS "ca" Wether the master should function as a certificate authority\. . .IP "\(bu" 4 @@ -211,16 +199,10 @@ Wether the master should function as a certificate authority\. . .IP "" 0 . -.P -ca_days +++++++ -. -.P +.SS "ca_days" How long a certificate should be valid\. This parameter is deprecated, use ca_ttl instead . -.P -ca_md +++++ -. -.P +.SS "ca_md" The type of hash used in certificates\. . .IP "\(bu" 4 @@ -228,21 +210,15 @@ The type of hash used in certificates\. . .IP "" 0 . -.P -ca_name +++++++ -. -.P +.SS "ca_name" The name to use the Certificate Authority certificate\. . .IP "\(bu" 4 -\fIDefault\fR: $certname +\fIDefault\fR: Puppet CA: $certname . .IP "" 0 . -.P -ca_port +++++++ -. -.P +.SS "ca_port" The port to use for the certificate authority\. . .IP "\(bu" 4 @@ -250,10 +226,7 @@ The port to use for the certificate authority\. . .IP "" 0 . -.P -ca_server +++++++++ -. -.P +.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 @@ -261,10 +234,7 @@ The server to use for certificate authority requests\. It\'s a separate server b . .IP "" 0 . -.P -ca_ttl ++++++ -. -.P +.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 @@ -272,10 +242,7 @@ The default TTL for new certificates; valid values must be an integer, optionall . .IP "" 0 . -.P -cacert ++++++ -. -.P +.SS "cacert" The CA certificate\. . .IP "\(bu" 4 @@ -283,10 +250,7 @@ The CA certificate\. . .IP "" 0 . -.P -cacrl +++++ -. -.P +.SS "cacrl" The certificate revocation list (CRL) for the CA\. Will be used if present but otherwise ignored\. . .IP "\(bu" 4 @@ -294,10 +258,7 @@ The certificate revocation list (CRL) for the CA\. Will be used if present but o . .IP "" 0 . -.P -cadir +++++ -. -.P +.SS "cadir" The root directory for the certificate authority\. . .IP "\(bu" 4 @@ -305,10 +266,7 @@ The root directory for the certificate authority\. . .IP "" 0 . -.P -cakey +++++ -. -.P +.SS "cakey" The CA private key\. . .IP "\(bu" 4 @@ -316,10 +274,7 @@ The CA private key\. . .IP "" 0 . -.P -capass ++++++ -. -.P +.SS "capass" Where the CA stores the password for the private key . .IP "\(bu" 4 @@ -327,10 +282,7 @@ Where the CA stores the password for the private key . .IP "" 0 . -.P -caprivatedir ++++++++++++ -. -.P +.SS "caprivatedir" Where the CA stores private certificate information\. . .IP "\(bu" 4 @@ -338,10 +290,7 @@ Where the CA stores private certificate information\. . .IP "" 0 . -.P -capub +++++ -. -.P +.SS "capub" The CA public key\. . .IP "\(bu" 4 @@ -349,16 +298,10 @@ The CA public key\. . .IP "" 0 . -.P -catalog_format ++++++++++++++ -. -.P +.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\. . -.P -catalog_terminus ++++++++++++++++ -. -.P +.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 @@ -366,10 +309,7 @@ Where to get node catalogs\. This is useful to change if, for instance, you\'d l . .IP "" 0 . -.P -cert_inventory ++++++++++++++ -. -.P +.SS "cert_inventory" A Complete listing of all certificates . .IP "\(bu" 4 @@ -377,10 +317,7 @@ A Complete listing of all certificates . .IP "" 0 . -.P -certdir +++++++ -. -.P +.SS "certdir" The certificate directory\. . .IP "\(bu" 4 @@ -388,16 +325,10 @@ The certificate directory\. . .IP "" 0 . -.P -certdnsnames ++++++++++++ -. -.P +.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\'\. . -.P -certificate_revocation ++++++++++++++++++++++ -. -.P +.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 @@ -405,21 +336,15 @@ Whether certificate revocation should be supported by downloading a Certificate . .IP "" 0 . -.P -certname ++++++++ -. -.P +.SS "certname" The name to use when handling certificates\. Defaults to the fully qualified domain name\. . .IP "\(bu" 4 -\fIDefault\fR: pelin\.members\.linode\.com +\fIDefault\fR: magpie\.puppetlabs\.lan . .IP "" 0 . -.P -classfile +++++++++ -. -.P +.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 @@ -427,10 +352,7 @@ The file in which puppet agent stores a list of the classes associated with the . .IP "" 0 . -.P -client_datadir ++++++++++++++ -. -.P +.SS "client_datadir" The directory in which serialized data is stored on the client\. . .IP "\(bu" 4 @@ -438,10 +360,7 @@ The directory in which serialized data is stored on the client\. . .IP "" 0 . -.P -clientbucketdir +++++++++++++++ -. -.P +.SS "clientbucketdir" Where FileBucket files are stored locally\. . .IP "\(bu" 4 @@ -449,10 +368,7 @@ Where FileBucket files are stored locally\. . .IP "" 0 . -.P -clientyamldir +++++++++++++ -. -.P +.SS "clientyamldir" The directory in which client\-side YAML data is stored\. . .IP "\(bu" 4 @@ -460,16 +376,10 @@ The directory in which client\-side YAML data is stored\. . .IP "" 0 . -.P -code ++++ -. -.P +.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 . -.P -color +++++ -. -.P +.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 @@ -477,21 +387,15 @@ Whether to use colors when logging to the console\. Valid values are \fBansi\fR . .IP "" 0 . -.P -confdir +++++++ -. -.P -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 \fBpuppet master\fR 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 \fB~\fR\. +.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 . -.P -config ++++++ -. -.P +.SS "config" The configuration file for doc\. . .IP "\(bu" 4 @@ -499,22 +403,13 @@ The configuration file for doc\. . .IP "" 0 . -.P -config_version ++++++++++++++ -. -.P +.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\. . -.P -configprint +++++++++++ -. -.P +.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\. . -.P -configtimeout +++++++++++++ -. -.P +.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 @@ -522,10 +417,7 @@ How long the client should wait for the configuration to be retrieved before con . .IP "" 0 . -.P -couchdb_url +++++++++++ -. -.P +.SS "couchdb_url" The url where the puppet couchdb database will be created . .IP "\(bu" 4 @@ -533,10 +425,7 @@ The url where the puppet couchdb database will be created . .IP "" 0 . -.P -csrdir ++++++ -. -.P +.SS "csrdir" Where the CA stores certificate requests . .IP "\(bu" 4 @@ -544,10 +433,7 @@ Where the CA stores certificate requests . .IP "" 0 . -.P -daemonize +++++++++ -. -.P +.SS "daemonize" Send the process into the background\. This is the default\. . .IP "\(bu" 4 @@ -555,10 +441,7 @@ Send the process into the background\. This is the default\. . .IP "" 0 . -.P -dbadapter +++++++++ -. -.P +.SS "dbadapter" The type of database to use\. . .IP "\(bu" 4 @@ -566,21 +449,10 @@ The type of database to use\. . .IP "" 0 . -.P -dbconnections +++++++++++++ -. -.P -The number of database connections\. Only used when networked databases are used\. Will be ignored if the value is an empty string or is less than 1\. -. -.IP "\(bu" 4 -\fIDefault\fR: 0 -. -.IP "" 0 -. -.P -dblocation ++++++++++ +.SS "dbconnections" +The number of database connections for networked databases\. Will be ignored unless the value is a positive integer\. . -.P +.SS "dblocation" The database cache for client configurations\. Used for querying within the language\. . .IP "\(bu" 4 @@ -588,10 +460,7 @@ The database cache for client configurations\. Used for querying within the lang . .IP "" 0 . -.P -dbmigrate +++++++++ -. -.P +.SS "dbmigrate" Whether to automatically migrate the database\. . .IP "\(bu" 4 @@ -599,10 +468,7 @@ Whether to automatically migrate the database\. . .IP "" 0 . -.P -dbname ++++++ -. -.P +.SS "dbname" The name of the database to use\. . .IP "\(bu" 4 @@ -610,10 +476,7 @@ The name of the database to use\. . .IP "" 0 . -.P -dbpassword ++++++++++ -. -.P +.SS "dbpassword" The database password for caching\. Only used when networked databases are used\. . .IP "\(bu" 4 @@ -621,16 +484,10 @@ The database password for caching\. Only used when networked databases are used\ . .IP "" 0 . -.P -dbport ++++++ -. -.P +.SS "dbport" The database password for caching\. Only used when networked databases are used\. . -.P -dbserver ++++++++ -. -.P +.SS "dbserver" The database server for caching\. Only used when networked databases are used\. . .IP "\(bu" 4 @@ -638,16 +495,10 @@ The database server for caching\. Only used when networked databases are used\. . .IP "" 0 . -.P -dbsocket ++++++++ -. -.P +.SS "dbsocket" The database socket location\. Only used when networked databases are used\. Will be ignored if the value is an empty string\. . -.P -dbuser ++++++ -. -.P +.SS "dbuser" The database user for caching\. Only used when networked databases are used\. . .IP "\(bu" 4 @@ -655,10 +506,7 @@ The database user for caching\. Only used when networked databases are used\. . .IP "" 0 . -.P -diff ++++ -. -.P +.SS "diff" Which diff command to use when printing differences between files\. . .IP "\(bu" 4 @@ -666,10 +514,7 @@ Which diff command to use when printing differences between files\. . .IP "" 0 . -.P -diff_args +++++++++ -. -.P +.SS "diff_args" Which arguments to pass to the diff command when printing differences between files\. . .IP "\(bu" 4 @@ -677,10 +522,7 @@ Which arguments to pass to the diff command when printing differences between fi . .IP "" 0 . -.P -downcasefacts +++++++++++++ -. -.P +.SS "downcasefacts" Whether facts should be made all lowercase when sent to the server\. . .IP "\(bu" 4 @@ -688,10 +530,7 @@ Whether facts should be made all lowercase when sent to the server\. . .IP "" 0 . -.P -dynamicfacts ++++++++++++ -. -.P +.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 @@ -699,10 +538,7 @@ Facts that are dynamic; these facts will be ignored when deciding whether change . .IP "" 0 . -.P -environment +++++++++++ -. -.P +.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 @@ -710,10 +546,7 @@ The environment Puppet is running in\. For clients (e\.g\., \fBpuppet agent\fR) . .IP "" 0 . -.P -evaltrace +++++++++ -. -.P +.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 @@ -721,10 +554,7 @@ Whether each resource should log when it is being evaluated\. This allows you to . .IP "" 0 . -.P -external_nodes ++++++++++++++ -. -.P +.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 @@ -732,10 +562,7 @@ An external command that can produce node information\. The output must be a YAM . .IP "" 0 . -.P -factdest ++++++++ -. -.P +.SS "factdest" Where Puppet should store facts that it pulls down from the central server\. . .IP "\(bu" 4 @@ -743,10 +570,7 @@ Where Puppet should store facts that it pulls down from the central server\. . .IP "" 0 . -.P -factpath ++++++++ -. -.P +.SS "factpath" Where Puppet should look for facts\. Multiple directories should be colon\-separated, like normal PATH variables\. . .IP "\(bu" 4 @@ -754,10 +578,7 @@ Where Puppet should look for facts\. Multiple directories should be colon\-separ . .IP "" 0 . -.P -facts_terminus ++++++++++++++ -. -.P +.SS "facts_terminus" The node facts terminus\. . .IP "\(bu" 4 @@ -765,10 +586,7 @@ The node facts terminus\. . .IP "" 0 . -.P -factsignore +++++++++++ -. -.P +.SS "factsignore" What files to ignore when pulling down facts\. . .IP "\(bu" 4 @@ -776,10 +594,7 @@ What files to ignore when pulling down facts\. . .IP "" 0 . -.P -factsource ++++++++++ -. -.P +.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 @@ -787,10 +602,7 @@ From where to retrieve facts\. The standard Puppet \fBfile\fR type is used for r . .IP "" 0 . -.P -factsync ++++++++ -. -.P +.SS "factsync" Whether facts should be synced with the central server\. . .IP "\(bu" 4 @@ -798,10 +610,7 @@ Whether facts should be synced with the central server\. . .IP "" 0 . -.P -fileserverconfig ++++++++++++++++ -. -.P +.SS "fileserverconfig" Where the fileserver configuration is stored\. . .IP "\(bu" 4 @@ -809,10 +618,7 @@ Where the fileserver configuration is stored\. . .IP "" 0 . -.P -filetimeout +++++++++++ -. -.P +.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 @@ -820,10 +626,7 @@ The minimum time to wait (in seconds) between checking for updates in configurat . .IP "" 0 . -.P -freeze_main +++++++++++ -. -.P +.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 @@ -831,10 +634,7 @@ Freezes the \'main\' class, disallowing any code to be added to it\. This essent . .IP "" 0 . -.P -genconfig +++++++++ -. -.P +.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 @@ -842,10 +642,7 @@ Whether to just print a configuration to stdout and exit\. Only makes sense when . .IP "" 0 . -.P -genmanifest +++++++++++ -. -.P +.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 @@ -853,10 +650,7 @@ Whether to just print a manifest to stdout and exit\. Only makes sense when used . .IP "" 0 . -.P -graph +++++ -. -.P +.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 @@ -864,10 +658,7 @@ Whether to create dot graph files for the different configuration graphs\. These . .IP "" 0 . -.P -graphdir ++++++++ -. -.P +.SS "graphdir" Where to store dot\-outputted graphs\. . .IP "\(bu" 4 @@ -875,10 +666,7 @@ Where to store dot\-outputted graphs\. . .IP "" 0 . -.P -group +++++ -. -.P +.SS "group" The group puppet master should run as\. . .IP "\(bu" 4 @@ -886,10 +674,7 @@ The group puppet master should run as\. . .IP "" 0 . -.P -hostcert ++++++++ -. -.P +.SS "hostcert" Where individual hosts store and look for their certificates\. . .IP "\(bu" 4 @@ -897,10 +682,7 @@ Where individual hosts store and look for their certificates\. . .IP "" 0 . -.P -hostcrl +++++++ -. -.P +.SS "hostcrl" Where the host\'s certificate revocation list can be found\. This is distinct from the certificate authority\'s CRL\. . .IP "\(bu" 4 @@ -908,10 +690,7 @@ Where the host\'s certificate revocation list can be found\. This is distinct fr . .IP "" 0 . -.P -hostcsr +++++++ -. -.P +.SS "hostcsr" Where individual hosts store and look for their certificate requests\. . .IP "\(bu" 4 @@ -919,10 +698,7 @@ Where individual hosts store and look for their certificate requests\. . .IP "" 0 . -.P -hostprivkey +++++++++++ -. -.P +.SS "hostprivkey" Where individual hosts store and look for their private key\. . .IP "\(bu" 4 @@ -930,10 +706,7 @@ Where individual hosts store and look for their private key\. . .IP "" 0 . -.P -hostpubkey ++++++++++ -. -.P +.SS "hostpubkey" Where individual hosts store and look for their public key\. . .IP "\(bu" 4 @@ -941,10 +714,7 @@ Where individual hosts store and look for their public key\. . .IP "" 0 . -.P -http_compression ++++++++++++++++ -. -.P +.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 @@ -952,10 +722,7 @@ Allow http compression in REST communication with the master\. This setting migh . .IP "" 0 . -.P -http_proxy_host +++++++++++++++ -. -.P +.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 @@ -963,10 +730,7 @@ The HTTP proxy host to use for outgoing connections\. Note: You may need to use . .IP "" 0 . -.P -http_proxy_port +++++++++++++++ -. -.P +.SS "http_proxy_port" The HTTP proxy port to use for outgoing connections . .IP "\(bu" 4 @@ -974,10 +738,7 @@ The HTTP proxy port to use for outgoing connections . .IP "" 0 . -.P -httplog +++++++ -. -.P +.SS "httplog" Where the puppet agent web server logs\. . .IP "\(bu" 4 @@ -985,10 +746,7 @@ Where the puppet agent web server logs\. . .IP "" 0 . -.P -ignorecache +++++++++++ -. -.P +.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 @@ -996,10 +754,7 @@ Ignore cache and always recompile the configuration\. This is useful for testing . .IP "" 0 . -.P -ignoreimport ++++++++++++ -. -.P +.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 @@ -1007,10 +762,7 @@ A parameter that can be used in commit hooks, since it enables you to parse\-che . .IP "" 0 . -.P -ignoreschedules +++++++++++++++ -. -.P +.SS "ignoreschedules" Boolean; whether puppet agent should ignore schedules\. This is useful for initial puppet agent runs\. . .IP "\(bu" 4 @@ -1018,10 +770,31 @@ Boolean; whether puppet agent should ignore schedules\. This is useful for initi . .IP "" 0 . -.P -keylength +++++++++ +.SS "inventory_port" +The port to communicate with the inventory_server\. . -.P +.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 @@ -1029,10 +802,23 @@ The bit length of keys\. . .IP "" 0 . -.P -ldapattrs +++++++++ +.SS "lastrunfile" +Where puppet agent stores the last run report summary in yaml format\. . -.P +.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 @@ -1040,16 +826,10 @@ The LDAP attributes to include when querying LDAP for nodes\. All returned attri . .IP "" 0 . -.P -ldapbase ++++++++ -. -.P +.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\. . -.P -ldapclassattrs ++++++++++++++ -. -.P +.SS "ldapclassattrs" The LDAP attributes to use to define Puppet classes\. Values should be comma\-separated\. . .IP "\(bu" 4 @@ -1057,10 +837,7 @@ The LDAP attributes to use to define Puppet classes\. Values should be comma\-se . .IP "" 0 . -.P -ldapnodes +++++++++ -. -.P +.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 @@ -1068,10 +845,7 @@ Whether to search for node configurations in LDAP\. See http://projects\.puppetl . .IP "" 0 . -.P -ldapparentattr ++++++++++++++ -. -.P +.SS "ldapparentattr" The attribute to use to define the parent node\. . .IP "\(bu" 4 @@ -1079,16 +853,10 @@ The attribute to use to define the parent node\. . .IP "" 0 . -.P -ldappassword ++++++++++++ -. -.P +.SS "ldappassword" The password to use to connect to LDAP\. . -.P -ldapport ++++++++ -. -.P +.SS "ldapport" The LDAP port\. Only used if \fBldapnodes\fR is enabled\. . .IP "\(bu" 4 @@ -1096,10 +864,7 @@ The LDAP port\. Only used if \fBldapnodes\fR is enabled\. . .IP "" 0 . -.P -ldapserver ++++++++++ -. -.P +.SS "ldapserver" The LDAP server\. Only used if \fBldapnodes\fR is enabled\. . .IP "\(bu" 4 @@ -1107,10 +872,7 @@ The LDAP server\. Only used if \fBldapnodes\fR is enabled\. . .IP "" 0 . -.P -ldapssl +++++++ -. -.P +.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 @@ -1118,10 +880,7 @@ Whether SSL should be used when searching for nodes\. Defaults to false because . .IP "" 0 . -.P -ldapstackedattrs ++++++++++++++++ -. -.P +.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 @@ -1129,10 +888,7 @@ The LDAP attributes that should be stacked to arrays by adding the values in all . .IP "" 0 . -.P -ldapstring ++++++++++ -. -.P +.SS "ldapstring" The search string used to find an LDAP node\. . .IP "\(bu" 4 @@ -1140,10 +896,7 @@ The search string used to find an LDAP node\. . .IP "" 0 . -.P -ldaptls +++++++ -. -.P +.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 @@ -1151,16 +904,10 @@ Whether TLS should be used when searching for nodes\. Defaults to false because . .IP "" 0 . -.P -ldapuser ++++++++ -. -.P +.SS "ldapuser" The user to use to connect to LDAP\. Must be specified as a full DN\. . -.P -lexical +++++++ -. -.P +.SS "lexical" Whether to use lexical scoping (vs\. dynamic)\. . .IP "\(bu" 4 @@ -1168,10 +915,7 @@ Whether to use lexical scoping (vs\. dynamic)\. . .IP "" 0 . -.P -libdir ++++++ -. -.P +.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 @@ -1179,10 +923,7 @@ An extra search path for Puppet\. This is only useful for those files that Puppe . .IP "" 0 . -.P -listen ++++++ -. -.P +.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 @@ -1190,10 +931,7 @@ Whether puppet agent should listen for connections\. If this is true, then by de . .IP "" 0 . -.P -localcacert +++++++++++ -. -.P +.SS "localcacert" Where each client stores the CA certificate\. . .IP "\(bu" 4 @@ -1201,10 +939,7 @@ Where each client stores the CA certificate\. . .IP "" 0 . -.P -localconfig +++++++++++ -. -.P +.SS "localconfig" Where puppet agent caches the local configuration\. An extension indicating the cache format is added automatically\. . .IP "\(bu" 4 @@ -1212,10 +947,7 @@ Where puppet agent caches the local configuration\. An extension indicating the . .IP "" 0 . -.P -logdir ++++++ -. -.P +.SS "logdir" The Puppet log directory\. . .IP "\(bu" 4 @@ -1223,10 +955,7 @@ The Puppet log directory\. . .IP "" 0 . -.P -manage_internal_file_permissions ++++++++++++++++++++++++++++++++ -. -.P +.SS "manage_internal_file_permissions" Whether Puppet should manage the owner, group, and mode of files it uses internally . .IP "\(bu" 4 @@ -1234,10 +963,7 @@ Whether Puppet should manage the owner, group, and mode of files it uses interna . .IP "" 0 . -.P -manifest ++++++++ -. -.P +.SS "manifest" The entry\-point manifest for puppet master\. . .IP "\(bu" 4 @@ -1245,10 +971,7 @@ The entry\-point manifest for puppet master\. . .IP "" 0 . -.P -manifestdir +++++++++++ -. -.P +.SS "manifestdir" Where puppet master looks for its manifests\. . .IP "\(bu" 4 @@ -1256,10 +979,7 @@ Where puppet master looks for its manifests\. . .IP "" 0 . -.P -masterhttplog +++++++++++++ -. -.P +.SS "masterhttplog" Where the puppet master web server logs\. . .IP "\(bu" 4 @@ -1267,10 +987,7 @@ Where the puppet master web server logs\. . .IP "" 0 . -.P -masterlog +++++++++ -. -.P +.SS "masterlog" Where puppet master logs\. This is generally not used, since syslog is the default log destination\. . .IP "\(bu" 4 @@ -1278,10 +995,7 @@ Where puppet master logs\. This is generally not used, since syslog is the defau . .IP "" 0 . -.P -masterport ++++++++++ -. -.P +.SS "masterport" Which port puppet master listens on\. . .IP "\(bu" 4 @@ -1289,10 +1003,7 @@ Which port puppet master listens on\. . .IP "" 0 . -.P -maximum_uid +++++++++++ -. -.P +.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 @@ -1300,10 +1011,7 @@ The maximum allowed UID\. Some platforms use negative UIDs but then ship with to . .IP "" 0 . -.P -mkusers +++++++ -. -.P +.SS "mkusers" Whether to create the necessary user and group that puppet agent will run as\. . .IP "\(bu" 4 @@ -1311,10 +1019,7 @@ Whether to create the necessary user and group that puppet agent will run as\. . .IP "" 0 . -.P -modulepath ++++++++++ -. -.P +.SS "modulepath" The search path for modules as a colon\-separated list of directories\. . .IP "\(bu" 4 @@ -1322,10 +1027,7 @@ The search path for modules as a colon\-separated list of directories\. . .IP "" 0 . -.P -name ++++ -. -.P +.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 @@ -1333,10 +1035,7 @@ The name of the application, if we are running as one\. The default is essential . .IP "" 0 . -.P -node_name +++++++++ -. -.P +.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 @@ -1344,10 +1043,7 @@ How the puppetmaster determines the client\'s identity and sets the \'hostname\' . .IP "" 0 . -.P -node_terminus +++++++++++++ -. -.P +.SS "node_terminus" Where to find information about nodes\. . .IP "\(bu" 4 @@ -1355,10 +1051,7 @@ Where to find information about nodes\. . .IP "" 0 . -.P -noop ++++ -. -.P +.SS "noop" Whether puppet agent should be run in noop mode\. . .IP "\(bu" 4 @@ -1366,10 +1059,7 @@ Whether puppet agent should be run in noop mode\. . .IP "" 0 . -.P -onetime +++++++ -. -.P +.SS "onetime" Run the configuration once, rather than as a long\-running daemon\. This is useful for interactively running puppetd\. . .IP "\(bu" 4 @@ -1377,10 +1067,7 @@ Run the configuration once, rather than as a long\-running daemon\. This is usef . .IP "" 0 . -.P -parseonly +++++++++ -. -.P +.SS "parseonly" Just check the syntax of the manifests\. . .IP "\(bu" 4 @@ -1388,10 +1075,7 @@ Just check the syntax of the manifests\. . .IP "" 0 . -.P -passfile ++++++++ -. -.P +.SS "passfile" Where puppet agent stores the password for its private key\. Generally unused\. . .IP "\(bu" 4 @@ -1399,10 +1083,7 @@ Where puppet agent stores the password for its private key\. Generally unused\. . .IP "" 0 . -.P -path ++++ -. -.P +.SS "path" The shell search path\. Defaults to whatever is inherited from the parent process\. . .IP "\(bu" 4 @@ -1410,10 +1091,7 @@ The shell search path\. Defaults to whatever is inherited from the parent proces . .IP "" 0 . -.P -pidfile +++++++ -. -.P +.SS "pidfile" The pid file . .IP "\(bu" 4 @@ -1421,10 +1099,7 @@ The pid file . .IP "" 0 . -.P -plugindest ++++++++++ -. -.P +.SS "plugindest" Where Puppet should store plugins that it pulls down from the central server\. . .IP "\(bu" 4 @@ -1432,10 +1107,7 @@ Where Puppet should store plugins that it pulls down from the central server\. . .IP "" 0 . -.P -pluginsignore +++++++++++++ -. -.P +.SS "pluginsignore" What files to ignore when pulling down plugins\. . .IP "\(bu" 4 @@ -1443,10 +1115,7 @@ What files to ignore when pulling down plugins\. . .IP "" 0 . -.P -pluginsource ++++++++++++ -. -.P +.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 @@ -1454,10 +1123,7 @@ From where to retrieve plugins\. The standard Puppet \fBfile\fR type is used for . .IP "" 0 . -.P -pluginsync ++++++++++ -. -.P +.SS "pluginsync" Whether plugins should be synced with the central server\. . .IP "\(bu" 4 @@ -1465,16 +1131,10 @@ Whether plugins should be synced with the central server\. . .IP "" 0 . -.P -postrun_command +++++++++++++++ -. -.P +.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\. . -.P -preferred_serialization_format ++++++++++++++++++++++++++++++ -. -.P +.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 @@ -1482,16 +1142,10 @@ The preferred means of serializing ruby instances for passing over the wire\. Th . .IP "" 0 . -.P -prerun_command ++++++++++++++ -. -.P +.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\. . -.P -privatedir ++++++++++ -. -.P +.SS "privatedir" Where the client stores private certificate information\. . .IP "\(bu" 4 @@ -1499,10 +1153,7 @@ Where the client stores private certificate information\. . .IP "" 0 . -.P -privatekeydir +++++++++++++ -. -.P +.SS "privatekeydir" The private key directory\. . .IP "\(bu" 4 @@ -1510,10 +1161,7 @@ The private key directory\. . .IP "" 0 . -.P -publickeydir ++++++++++++ -. -.P +.SS "publickeydir" The public key directory\. . .IP "\(bu" 4 @@ -1521,10 +1169,7 @@ The public key directory\. . .IP "" 0 . -.P -puppetdlockfile +++++++++++++++ -. -.P +.SS "puppetdlockfile" A lock file to temporarily stop puppet agent from doing anything\. . .IP "\(bu" 4 @@ -1532,10 +1177,7 @@ A lock file to temporarily stop puppet agent from doing anything\. . .IP "" 0 . -.P -puppetdlog ++++++++++ -. -.P +.SS "puppetdlog" The log file for puppet agent\. This is generally not used\. . .IP "\(bu" 4 @@ -1543,10 +1185,7 @@ The log file for puppet agent\. This is generally not used\. . .IP "" 0 . -.P -puppetport ++++++++++ -. -.P +.SS "puppetport" Which port puppet agent listens on\. . .IP "\(bu" 4 @@ -1554,10 +1193,7 @@ Which port puppet agent listens on\. . .IP "" 0 . -.P -queue_source ++++++++++++ -. -.P +.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 @@ -1565,10 +1201,7 @@ Which type of queue to use for asynchronous processing\. If your stomp server re . .IP "" 0 . -.P -queue_type ++++++++++ -. -.P +.SS "queue_type" Which type of queue to use for asynchronous processing\. . .IP "\(bu" 4 @@ -1576,10 +1209,7 @@ Which type of queue to use for asynchronous processing\. . .IP "" 0 . -.P -rails_loglevel ++++++++++++++ -. -.P +.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 @@ -1587,10 +1217,7 @@ The log level for Rails connections\. The value must be a valid log level within . .IP "" 0 . -.P -railslog ++++++++ -. -.P +.SS "railslog" Where Rails\-specific logs are sent . .IP "\(bu" 4 @@ -1598,21 +1225,15 @@ Where Rails\-specific logs are sent . .IP "" 0 . -.P -report ++++++ -. -.P +.SS "report" Whether to send reports after every transaction\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: true . .IP "" 0 . -.P -report_port +++++++++++ -. -.P +.SS "report_port" The port to communicate with the report_server\. . .IP "\(bu" 4 @@ -1620,21 +1241,15 @@ The port to communicate with the report_server\. . .IP "" 0 . -.P -report_server +++++++++++++ -. -.P -The server to which to send transaction reports\. +.SS "report_server" +The server to send transaction reports to\. . .IP "\(bu" 4 \fIDefault\fR: $server . .IP "" 0 . -.P -reportdir +++++++++ -. -.P +.SS "reportdir" The directory in which to store reports received from the client\. Each client gets a separate subdirectory\. . .IP "\(bu" 4 @@ -1642,21 +1257,15 @@ The directory in which to store reports received from the client\. Each client g . .IP "" 0 . -.P -reportfrom ++++++++++ -. -.P +.SS "reportfrom" The \'from\' email address for the reports\. . .IP "\(bu" 4 -\fIDefault\fR: report@pelin\.members\.linode\.com +\fIDefault\fR: report@magpie\.puppetlabs\.lan . .IP "" 0 . -.P -reports +++++++ -. -.P +.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 @@ -1664,10 +1273,7 @@ The list of reports to generate\. All reports are looked for in \fBpuppet/report . .IP "" 0 . -.P -reportserver ++++++++++++ -. -.P +.SS "reportserver" (Deprecated for \'report_server\') The server to which to send transaction reports\. . .IP "\(bu" 4 @@ -1675,10 +1281,7 @@ reportserver ++++++++++++ . .IP "" 0 . -.P -reporturl +++++++++ -. -.P +.SS "reporturl" The URL used by the http reports processor to send reports . .IP "\(bu" 4 @@ -1686,10 +1289,7 @@ The URL used by the http reports processor to send reports . .IP "" 0 . -.P -req_bits ++++++++ -. -.P +.SS "req_bits" The bit length of the certificates\. . .IP "\(bu" 4 @@ -1697,10 +1297,7 @@ The bit length of the certificates\. . .IP "" 0 . -.P -requestdir ++++++++++ -. -.P +.SS "requestdir" Where host certificate requests are stored\. . .IP "\(bu" 4 @@ -1708,10 +1305,7 @@ Where host certificate requests are stored\. . .IP "" 0 . -.P -rest_authconfig +++++++++++++++ -. -.P +.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 @@ -1719,10 +1313,7 @@ The configuration file that defines the rights to the different rest indirection . .IP "" 0 . -.P -rrddir ++++++ -. -.P +.SS "rrddir" The directory where RRD database files are stored\. Directories for each reporting host will be created under this directory\. . .IP "\(bu" 4 @@ -1730,10 +1321,7 @@ The directory where RRD database files are stored\. Directories for each reporti . .IP "" 0 . -.P -rrdinterval +++++++++++ -. -.P +.SS "rrdinterval" How often RRD should expect data\. This should match how often the hosts report back to the server\. . .IP "\(bu" 4 @@ -1741,10 +1329,7 @@ How often RRD should expect data\. This should match how often the hosts report . .IP "" 0 . -.P -run_mode ++++++++ -. -.P +.SS "run_mode" The effective \'run mode\' of the application: master, agent, or user\. . .IP "\(bu" 4 @@ -1752,10 +1337,7 @@ The effective \'run mode\' of the application: master, agent, or user\. . .IP "" 0 . -.P -rundir ++++++ -. -.P +.SS "rundir" Where Puppet PID files are kept\. . .IP "\(bu" 4 @@ -1763,10 +1345,7 @@ Where Puppet PID files are kept\. . .IP "" 0 . -.P -runinterval +++++++++++ -. -.P +.SS "runinterval" How often puppet agent applies the client configuration; in seconds\. . .IP "\(bu" 4 @@ -1774,10 +1353,7 @@ How often puppet agent applies the client configuration; in seconds\. . .IP "" 0 . -.P -sendmail ++++++++ -. -.P +.SS "sendmail" Where to find the sendmail binary with which to send email\. . .IP "\(bu" 4 @@ -1785,10 +1361,7 @@ Where to find the sendmail binary with which to send email\. . .IP "" 0 . -.P -serial ++++++ -. -.P +.SS "serial" Where the serial number for certificates is stored\. . .IP "\(bu" 4 @@ -1796,10 +1369,7 @@ Where the serial number for certificates is stored\. . .IP "" 0 . -.P -server ++++++ -. -.P +.SS "server" The server to which server puppet agent should connect . .IP "\(bu" 4 @@ -1807,10 +1377,7 @@ The server to which server puppet agent should connect . .IP "" 0 . -.P -server_datadir ++++++++++++++ -. -.P +.SS "server_datadir" The directory in which serialized data is stored, usually in a subdirectory\. . .IP "\(bu" 4 @@ -1818,10 +1385,7 @@ The directory in which serialized data is stored, usually in a subdirectory\. . .IP "" 0 . -.P -servertype ++++++++++ -. -.P +.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 @@ -1829,10 +1393,7 @@ The type of server to use\. Currently supported options are webrick and mongrel\ . .IP "" 0 . -.P -show_diff +++++++++ -. -.P +.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 @@ -1840,10 +1401,7 @@ Whether to print a contextual diff when files are being replaced\. The diff is p . .IP "" 0 . -.P -signeddir +++++++++ -. -.P +.SS "signeddir" Where the CA stores signed certificates\. . .IP "\(bu" 4 @@ -1851,10 +1409,7 @@ Where the CA stores signed certificates\. . .IP "" 0 . -.P -smtpserver ++++++++++ -. -.P +.SS "smtpserver" The server through which to send email reports\. . .IP "\(bu" 4 @@ -1862,10 +1417,7 @@ The server through which to send email reports\. . .IP "" 0 . -.P -splay +++++ -. -.P +.SS "splay" Whether to sleep for a pseudo\-random (but consistent) amount of time before a run\. . .IP "\(bu" 4 @@ -1873,10 +1425,7 @@ Whether to sleep for a pseudo\-random (but consistent) amount of time before a r . .IP "" 0 . -.P -splaylimit ++++++++++ -. -.P +.SS "splaylimit" The maximum time to delay before runs\. Defaults to being the same as the run interval\. . .IP "\(bu" 4 @@ -1884,10 +1433,7 @@ The maximum time to delay before runs\. Defaults to being the same as the run in . .IP "" 0 . -.P -ssl_client_header +++++++++++++++++ -. -.P +.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 @@ -1895,10 +1441,7 @@ The header containing an authenticated client\'s SSL DN\. Only used with Mongrel . .IP "" 0 . -.P -ssl_client_verify_header ++++++++++++++++++++++++ -. -.P +.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 @@ -1906,10 +1449,7 @@ The header containing the status message of the client verification\. Only used . .IP "" 0 . -.P -ssldir ++++++ -. -.P +.SS "ssldir" Where SSL certificates are kept\. . .IP "\(bu" 4 @@ -1917,10 +1457,7 @@ Where SSL certificates are kept\. . .IP "" 0 . -.P -statedir ++++++++ -. -.P +.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 @@ -1928,10 +1465,7 @@ The directory where Puppet state is stored\. Generally, this directory can be re . .IP "" 0 . -.P -statefile +++++++++ -. -.P +.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 @@ -1939,10 +1473,7 @@ Where puppet agent and puppet master store state associated with the running con . .IP "" 0 . -.P -storeconfigs ++++++++++++ -. -.P +.SS "storeconfigs" Whether to store each client\'s configuration\. This requires ActiveRecord from Ruby on Rails\. . .IP "\(bu" 4 @@ -1950,10 +1481,7 @@ Whether to store each client\'s configuration\. This requires ActiveRecord from . .IP "" 0 . -.P -strict_hostname_checking ++++++++++++++++++++++++ -. -.P +.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 @@ -1961,10 +1489,7 @@ Whether to only search for the complete hostname as it is in the certificate whe . .IP "" 0 . -.P -summarize +++++++++ -. -.P +.SS "summarize" Whether to print a transaction summary\. . .IP "\(bu" 4 @@ -1972,10 +1497,7 @@ Whether to print a transaction summary\. . .IP "" 0 . -.P -syslogfacility ++++++++++++++ -. -.P +.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 @@ -1983,10 +1505,7 @@ What syslog facility to use when logging to syslog\. Syslog has a fixed list of . .IP "" 0 . -.P -tagmap ++++++ -. -.P +.SS "tagmap" The mapping between reporting tags and email addresses\. . .IP "\(bu" 4 @@ -1994,16 +1513,10 @@ The mapping between reporting tags and email addresses\. . .IP "" 0 . -.P -tags ++++ -. -.P +.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\. . -.P -templatedir +++++++++++ -. -.P +.SS "templatedir" Where Puppet looks for template files\. Can be a list of colon\-seperated directories\. . .IP "\(bu" 4 @@ -2011,10 +1524,7 @@ Where Puppet looks for template files\. Can be a list of colon\-seperated direct . .IP "" 0 . -.P -thin_storeconfigs +++++++++++++++++ -. -.P +.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 @@ -2022,10 +1532,7 @@ Boolean; wether storeconfigs store in the database only the facts and exported r . .IP "" 0 . -.P -trace +++++ -. -.P +.SS "trace" Whether to print stack traces on some errors . .IP "\(bu" 4 @@ -2033,10 +1540,7 @@ Whether to print stack traces on some errors . .IP "" 0 . -.P -use_cached_catalog ++++++++++++++++++ -. -.P +.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 @@ -2044,10 +1548,7 @@ Whether to only use the cached catalog rather than compiling a new catalog on ev . .IP "" 0 . -.P -usecacheonfailure +++++++++++++++++ -. -.P +.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 @@ -2055,10 +1556,7 @@ Whether to use the cached configuration when the remote configuration will not c . .IP "" 0 . -.P -user ++++ -. -.P +.SS "user" The user puppet master should run as\. . .IP "\(bu" 4 @@ -2066,10 +1564,7 @@ The user puppet master should run as\. . .IP "" 0 . -.P -vardir ++++++ -. -.P +.SS "vardir" Where Puppet stores dynamic and growing data\. The default for this parameter is calculated specially, like \fBconfdir\fR_\. . .IP "\(bu" 4 @@ -2077,10 +1572,7 @@ Where Puppet stores dynamic and growing data\. The default for this parameter is . .IP "" 0 . -.P -yamldir +++++++ -. -.P +.SS "yamldir" The directory in which YAML data is stored, usually in a subdirectory\. . .IP "\(bu" 4 @@ -2088,10 +1580,7 @@ The directory in which YAML data is stored, usually in a subdirectory\. . .IP "" 0 . -.P -zlib ++++ -. -.P +.SS "zlib" Boolean; whether to use the zlib library . .IP "\(bu" 4 @@ -2100,4 +1589,4 @@ Boolean; whether to use the zlib library .IP "" 0 . .P -\fIThis page autogenerated on Sat Aug 28 14:00:20 \-0700 2010\fR +\fIThis page autogenerated on Wed Feb 16 17:06:38 \-0800 2011\fR diff --git a/man/man8/filebucket.8 b/man/man8/filebucket.8 index 59afc2ed3..7ff0da9af 100644 --- a/man/man8/filebucket.8 +++ b/man/man8/filebucket.8 @@ -1,105 +1,81 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "FILEBUCKET" "8" "August 2010" "" "" -A stand\-alone Puppet filebucket client\.puppet filebucket [\-h|\-\-help] [\-V|\-\-version] [\-d|\-\-debug] [\-v|\-\-verbose] +.TH "PUPPET\-FILEBUCKET" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" . -.IP "" 4 +.SH "NAME" +\fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket . -.nf - - [\-l|\-\-local] [\-r|\-\-remote] - [\-s|\-\-server ] [\-b|\-\-bucket ] \.\.\. +.SH "SYNOPSIS" +A stand\-alone Puppet filebucket client\. . -.fi -. -.IP "" 0 -This is a stand\-alone filebucket client for sending files to a local or central filebucket\.This client can operate in three modes, with only one mode per call: +.SH "USAGE" +puppet filebucket \fImode\fR [\-h|\-\-help] [\-V|\-\-version] [\-d|\-\-debug] [\-v|\-\-verbose] [\-l|\-\-local] [\-r|\-\-remote] [\-s|\-\-server \fIserver\fR] [\-b|\-\-bucket \fIdirectory\fR] \fIfile\fR \fIfile\fR \.\.\. . .P -backup: Send one or more files to the specified file bucket\. Each sent -. -.IP "" 4 -. -.nf - - file is printed with its resulting md5 sum\. -. -.fi -. -.IP "" 0 +Puppet filebucket can operate in three modes, with only one mode per call: . .P -get: Return the text associated with an md5 sum\. The text is printed -. -.IP "" 4 -. -.nf - - to stdout, and only one file can be retrieved at a time\. -. -.fi -. -.IP "" 0 +backup: Send one or more files to the specified file bucket\. Each sent file is printed with its resulting md5 sum\. . .P -restore: Given a file path and an md5 sum, store the content associated -. -.IP "" 4 +get: Return the text associated with an md5 sum\. The text is printed to stdout, and only one file can be retrieved at a time\. . -.nf - - with the sum into the specified file path\. You can specify an - entirely new path to this argument; you are not restricted to - restoring the content to its original location\. -. -.fi +.P +restore: Given a file path and an md5 sum, store the content associated with the sum into the specified file path\. You can specify an entirely new path to this argument; you are not restricted to restoring the content to its original location\. . -.IP "" 0 +.SH "DESCRIPTION" +This is a stand\-alone filebucket client for sending files to a local or central filebucket\. . .P -Note that +filebucket+ defaults to using a network\-based filebucket available on the server named +puppet+\. To use this, you\'ll have to be running as a user with valid Puppet certificates\. Alternatively, you can use your local file bucket by specifying +\-\-local+\.$ puppet filebucket backup /etc/passwd /etc/passwd: 429b225650b912a2ee067b0a4cf1e949 $ puppet filebucket restore /tmp/passwd 429b225650b912a2ee067b0a4cf1e949 $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 \fIdirectory\fR\' as an argument\. +Note that \'filebucket\' defaults to using a network\-based filebucket available on the server named \'puppet\'\. To use this, you\'ll have to be running as a user with valid Puppet certificates\. Alternatively, you can use your local file bucket by specifying \'\-\-local\'\. +. +.SH "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 \fIdirectory\fR\' as an argument\. . .P 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\'\. . -.P -debug: Enable full debugging\. +.TP +\-\-debug +Enable full debugging\. . -.P -help: Print this help message +.TP +\-\-help +Print this help message . -.P -local: Use the local filebucket\. This will use the default +.TP +\-\-local +Use the local filebucket\. This will use the default configuration information\. . -.IP "" 4 +.TP +\-\-remote +Use a remote filebucket\. This will use the default configuration information\. . -.nf - - configuration information\. +.TP +\-\-server +The server to send the file to, instead of locally\. . -.fi +.TP +\-\-verbose +Print extra information\. . -.IP "" 0 +.TP +\-\-version +Print version information\. . -.P -remote: Use a remote filebucket\. This will use the default -. -.IP "" 4 +.SH "EXAMPLE" . .nf - configuration information\. +$ puppet filebucket backup /etc/passwd +/etc/passwd: 429b225650b912a2ee067b0a4cf1e949 +$ puppet filebucket restore /tmp/passwd 429b225650b912a2ee067b0a4cf1e949 . .fi . -.IP "" 0 +.SH "AUTHOR" +Luke Kanies . -.P -server: The server to send the file to, instead of locally\. -. -.P -verbose: Print extra information\. -. -.P -version: Print version information\.puppet filebucket \-b /tmp/filebucket /my/fileLuke KaniesCopyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License +.SH "COPYRIGHT" +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/pi.8 b/man/man8/pi.8 index b70a128e7..c54a7bec7 100644 --- a/man/man8/pi.8 +++ b/man/man8/pi.8 @@ -1,17 +1,51 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PI" "8" "August 2010" "" "" -Print help about puppet types on the console\. Run with \'\-h\' to get detailed help\.puppet describe [\-h|\-\-help] [\-s|\-\-short] [\-p|\-\-providers] [\-l|\-\-list] [\-m|\-\-meta]Prints details of Puppet types, providers and metaparameters on the console\.help: Print this help text +.TH "PUPPET\-DESCRIBE" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" . -.P -providers: Describe providers in detail for each type +.SH "NAME" +\fBpuppet\-describe\fR \- Display help about resource types . -.P -list: List all types +.SH "SYNOPSIS" +Prints help about Puppet resource types, providers, and metaparameters\. . -.P -meta: List all metaparameters +.SH "USAGE" +puppet describe [\-h|\-\-help] [\-s|\-\-short] [\-p|\-\-providers] [\-l|\-\-list] [\-m|\-\-meta] . -.P -short: List only parameters without detailpuppet describe \-\-list puppet describe file \-\-providers puppet describe user \-s \-mDavid LutterkortCopyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License +.SH "OPTIONS" +. +.TP +\-\-help +Print this help text +. +.TP +\-\-providers +Describe providers in detail for each type +. +.TP +\-\-list +List all types +. +.TP +\-\-meta +List all metaparameters +. +.TP +\-\-short +List only parameters without detail +. +.SH "EXAMPLE" +. +.nf + +$ puppet describe \-\-list +$ puppet describe file \-\-providers +$ puppet describe user \-s \-m +. +.fi +. +.SH "AUTHOR" +David Lutterkort +. +.SH "COPYRIGHT" +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 513d45338..f58a54d41 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,10 +1,10 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "August 2010" "" "" +.TH "PUPPET" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" . .SH "NAME" \fBpuppet\fR . .P -Usage: puppet command \fIspace separated arguments\fR Available commands are: agent, apply, cert, describe, doc, filebucket, kick, master, queue, resource +Usage: puppet command \fIspace separated arguments\fR Available commands are: agent, apply, cert, describe, doc, filebucket, inspect, kick, master, queue, resource diff --git a/man/man8/puppetca.8 b/man/man8/puppetca.8 index 62fa7a5bf..bea7596d4 100644 --- a/man/man8/puppetca.8 +++ b/man/man8/puppetca.8 @@ -1,169 +1,94 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCA" "8" "August 2010" "" "" -Stand\-alone certificate authority\. Capable of generating certificates but mostly meant for signing certificate requests from puppet clients\.puppet cert [\-h|\-\-help] [\-V|\-\-version] [\-d|\-\-debug] [\-v|\-\-verbose] +.TH "PUPPET\-CERT" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" . -.IP "" 4 +.SH "NAME" +\fBpuppet\-cert\fR \- Manage certificates and requests . -.nf - - [\-g|\-\-generate] [\-l|\-\-list] [\-s|\-\-sign] [\-r|\-\-revoke] - [\-p|\-\-print] [\-c|\-\-clean] [\-\-verify] [\-\-digest DIGEST] - [\-\-fingerprint] [host] -. -.fi -. -.IP "" 0 -Because the puppetmasterd daemon defaults to not signing client certificate requests, this script is available for signing outstanding requests\. It can be used to list outstanding requests and then either sign them individually or sign all of them\.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 \fIdirectory\fR\' as an argument\. -. -.P -See the configuration file documentation at http://reductivelabs\.com/projects/puppet/reference/configref\.html for the full list of acceptable parameters\. A commented list of all configuration options can also be generated by running puppet cert with \'\-\-genconfig\'\. -. -.P -all: Operate on all items\. Currently only makes sense with +.SH "SYNOPSIS" +Standalone certificate authority\. Capable of generating certificates, but mostly used for signing certificate requests from puppet clients\. . -.IP "" 4 +.SH "USAGE" +puppet cert [\-h|\-\-help] [\-V|\-\-version] [\-d|\-\-debug] [\-v|\-\-verbose] [\-g|\-\-generate] [\-l|\-\-list] [\-s|\-\-sign] [\-r|\-\-revoke] [\-p|\-\-print] [\-c|\-\-clean] [\-\-verify] [\-\-digest \fIdigest\fR] [\-\-fingerprint] [host] . -.nf - - \'\-\-sign\', \'\-\-clean\', or \'\-\-list\'\. +.SH "DESCRIPTION" +Because the puppet master service defaults to not signing client certificate requests, this script is available for signing outstanding requests\. It can be used to list outstanding requests and then either sign them individually or sign all of them\. . -.fi -. -.IP "" 0 +.SH "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 \fIdirectory\fR\' as an argument\. . .P -digest: Set the digest for fingerprinting (defaults to md5)\. Valid -. -.IP "" 4 -. -.nf - - values depends on your openssl and openssl ruby extension - version, but should contain at least md5, sha1, md2, - sha256\. -. -.fi +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 cert with \'\-\-genconfig\'\. . -.IP "" 0 +.TP +\-\-all +Operate on all items\. Currently only makes sense with \'\-\-sign\', \'\-\-clean\', or \'\-\-list\'\. . -.P -clean: Remove all files related to a host from puppet cert\'s +.TP +\-\-digest +Set the digest for fingerprinting (defaults to md5)\. Valid values depends on your openssl and openssl ruby extension version, but should contain at least md5, sha1, md2, sha256\. . -.IP "" 4 +.TP +\-\-clean +Remove all files related to a host from puppet cert\'s storage\. This is useful when rebuilding hosts, since new certificate signing requests will only be honored if puppet cert does not have a copy of a signed certificate for that host\. The certificate of the host is also revoked\. If \'\-\-all\' is specified then all host certificates, both signed and unsigned, will be removed\. . -.nf - - storage\. This is useful when rebuilding hosts, since new - certificate signing requests will only be honored if puppet - cert does not have a copy of a signed certificate for that - host\. The certificate of the host remains valid\. If \'\-\-all\' - is specified then all host certificates, both signed and - unsigned, will be removed\. +.TP +\-\-debug +Enable full debugging\. . -.fi +.TP +\-\-generate +Generate a certificate for a named client\. A certificate/keypair will be generated for each client named on the command line\. . -.IP "" 0 +.TP +\-\-help +Print this help message . -.P -debug: Enable full debugging\. +.TP +\-\-list +List outstanding certificate requests\. If \'\-\-all\' is specified, signed certificates are also listed, prefixed by \'+\', and revoked or invalid certificates are prefixed by \'\-\' (the verification outcome is printed in parenthesis)\. . -.P -generate: Generate a certificate for a named client\. A +.TP +\-\-print +Print the full\-text version of a host\'s certificate\. . -.IP "" 4 +.TP +\-\-fingerprint +Print the DIGEST (defaults to md5) fingerprint of a host\'s certificate\. . -.nf - - certificate/keypair will be generated for each client named - on the command line\. +.TP +\-\-revoke +Revoke the certificate of a client\. The certificate can be specified either by its serial number, given as a decimal number or a hexadecimal number prefixed by \'0x\', or by its hostname\. The certificate is revoked by adding it to the Certificate Revocation List given by the \'cacrl\' config parameter\. Note that the puppetmasterd needs to be restarted after revoking certificates\. . -.fi +.TP +\-\-sign +Sign an outstanding certificate request\. Unless \'\-\-all\' is specified, hosts must be listed after all flags\. . -.IP "" 0 +.TP +\-\-verbose +Enable verbosity\. . -.P -help: Print this help message +.TP +\-\-version +Print the puppet version number and exit\. . -.P -list: List outstanding certificate requests\. If \'\-\-all\' is +.TP +\-\-verify +Verify the named certificate against the local CA certificate\. . -.IP "" 4 +.SH "EXAMPLE" . .nf - specified, signed certificates are also listed, prefixed by - \'+\', and revoked or invalid certificates are prefixed by - \'\-\' (the verification outcome is printed in parenthesis)\. +$ puppet cert \-l +culain\.madstop\.com +$ puppet cert \-s culain\.madstop\.com . .fi . -.IP "" 0 -. -.P -print: Print the full\-text version of a host\'s certificate\. -. -.P -fingerprint: Print the DIGEST (defaults to md5) fingerprint of a host\'s -. -.IP "" 4 -. -.nf - - certificate\. -. -.fi -. -.IP "" 0 -. -.P -revoke: Revoke the certificate of a client\. The certificate can be -. -.IP "" 4 -. -.nf - - specified either by its serial number, given as a decimal - number or a hexadecimal number prefixed by \'0x\', or by its - hostname\. The certificate is revoked by adding it to the - Certificate Revocation List given by the \'cacrl\' config - parameter\. Note that the puppetmasterd needs to be - restarted after revoking certificates\. -. -.fi -. -.IP "" 0 -. -.P -sign: Sign an outstanding certificate request\. Unless \'\-\-all\' is -. -.IP "" 4 -. -.nf - - specified, hosts must be listed after all flags\. -. -.fi -. -.IP "" 0 -. -.P -verbose: Enable verbosity\. -. -.P -version: Print the puppet version number and exit\. -. -.P -verify: Verify the named certificate against the local CA -. -.IP "" 4 -. -.nf - - certificate\. -. -.fi +.SH "AUTHOR" +Luke Kanies . -.IP "" 0 -$ puppet cert \-l culain\.madstop\.com $ puppet cert \-s culain\.madstop\.comLuke KaniesCopyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License +.SH "COPYRIGHT" +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppetd.8 b/man/man8/puppetd.8 index 861137553..3fadd9df7 100644 --- a/man/man8/puppetd.8 +++ b/man/man8/puppetd.8 @@ -1,283 +1,139 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETD" "8" "August 2010" "" "" -puppet agent [\-D|\-\-daemonize|\-\-no\-daemonize] [\-d|\-\-debug] +.TH "PUPPET\-AGENT" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" . -.IP "" 4 +.SH "NAME" +\fBpuppet\-agent\fR \- The puppet agent daemon . -.nf - - [\-\-detailed\-exitcodes] [\-\-disable] [\-\-enable] - [\-h|\-\-help] [\-\-fqdn ] [\-l|\-\-logdest syslog||console] - [\-o|\-\-onetime] [\-\-serve ] [\-t|\-\-test] [\-\-noop] - [\-\-digest ] [\-\-fingerprint] [\-V|\-\-version] - [\-v|\-\-verbose] [\-w|\-\-waitforcert ] -. -.fi -. -.IP "" 0 -This is the main puppet client\. Its job is to retrieve the local machine\'s configuration from a remote server and apply it\. In order to successfully communicate with the remote server, the client must have a certificate signed by a certificate authority that the server trusts; the recommended method for this, at the moment, is to run a certificate authority as part of the puppet server (which is the default)\. The client will connect and request a signed certificate, and will continue connecting until it receives one\. -. -.P -Once the client has a signed certificate, it will retrieve its configuration and apply it\.+puppet agent+ does its best to find a compromise between interactive use and daemon use\. Run with no arguments and no configuration, it will go into the backgroun, attempt to get a signed certificate, and retrieve and apply its configuration every 30 minutes\. -. -.P -Some flags are meant specifically for interactive use \-\- in particular, +test+, +tags+ or +fingerprint+ are useful\. +test+ enables verbose logging, causes the daemon to stay in the foreground, exits if the server\'s configuration is invalid (this happens if, for instance, you\'ve left a syntax error on the server), and exits after running the configuration once (rather than hanging around as a long\-running process)\. -. -.P -+tags+ allows you to specify what portions of a configuration you want to apply\. Puppet elements are tagged with all of the class or definition names that contain them, and you can use the +tags+ flag to specify one of these names, causing only configuration elements contained within that class or definition to be applied\. This is very useful when you are testing new configurations \-\- for instance, if you are just starting to manage +ntpd+, you would put all of the new elements into an +ntpd+ class, and call puppet with +\-\-tags ntpd+, which would only apply that small portion of the configuration during your testing, rather than applying the whole thing\. -. -.P -+fingerprint+ is a one\-time flag\. In this mode +puppet agent+ will run once and display on the console (and in the log) the current certificate (or certificate request) fingerprint\. Providing the +\-\-digest+ option allows to use a different digest algorithm to generate the fingerprint\. The main use is to verify that before signing a certificate request on the master, the certificate request the master received is the same as the one the client sent (to prevent against man\-in\-the\-middle attacks when signing certificates)\.Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument\. For example, \'server\' is a valid configuration parameter, so you can specify \'\-\-server \fIservername\fR\' as an argument\. -. -.P -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 agent with \'\-\-genconfig\'\. -. -.P -daemonize: Send the process into the background\. This is the -. -.IP "" 4 -. -.nf - - default\. -. -.fi -. -.IP "" 0 -. -.P -no\-daemonize: Do not send the process into the background\. -. -.P -debug: Enable full debugging\. +.SH "SYNOPSIS" +Retrieves the client configuration from the puppet master and applies it to the local host\. . .P -digest: Change the certificate fingerprinting digest -. -.IP "" 4 -. -.nf - - algorithm\. The default is MD5\. Valid values depends - on the version of OpenSSL installed, but should - always at least contain MD5, MD2, SHA1 and SHA256\. -. -.fi -. -.IP "" 0 +This service may be run as a daemon, run periodically using cron (or something similar), or run interactively for testing purposes\. . -.P -detailed\-exitcodes: Provide transaction information via exit codes\. If -. -.IP "" 4 -. -.nf - - 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\. This - option only makes sense in conjunction with - \-\-onetime\. -. -.fi +.SH "USAGE" +puppet agent [\-D|\-\-daemonize|\-\-no\-daemonize] [\-d|\-\-debug] [\-\-detailed\-exitcodes] [\-\-disable] [\-\-enable] [\-h|\-\-help] [\-\-certname \fIhost name\fR] [\-l|\-\-logdest syslog|\fIfile\fR|console] [\-o|\-\-onetime] [\-\-serve \fIhandler\fR] [\-t|\-\-test] [\-\-noop] [\-\-digest \fIdigest\fR] [\-\-fingerprint] [\-V|\-\-version] [\-v|\-\-verbose] [\-w|\-\-waitforcert \fIseconds\fR] . -.IP "" 0 +.SH "DESCRIPTION" +This is the main puppet client\. Its job is to retrieve the local machine\'s configuration from a remote server and apply it\. In order to successfully communicate with the remote server, the client must have a certificate signed by a certificate authority that the server trusts; the recommended method for this, at the moment, is to run a certificate authority as part of the puppet server (which is the default)\. The client will connect and request a signed certificate, and will continue connecting until it receives one\. . .P -disable: Disable working on the local system\. This puts a -. -.IP "" 4 -. -.nf - - lock file in place, causing +puppet agent+ not to - work on the system until the lock file is removed\. - This is useful if you are testing a configuration - and do not want the central configuration to - override the local state until everything is tested - and committed\. -. -.fi +Once the client has a signed certificate, it will retrieve its configuration and apply it\. . -.IP "" 0 +.SH "USAGE NOTES" +\'puppet agent\' does its best to find a compromise between interactive use and daemon use\. Run with no arguments and no configuration, it will go into the background, attempt to get a signed certificate, and retrieve and apply its configuration every 30 minutes\. . .P -+puppet agent+ uses the same lock file while it is running, so no more than one +puppet agent+ process is working at a time\. +Some flags are meant specifically for interactive use \-\- in particular, \'test\', \'tags\' or \'fingerprint\' are useful\. \'test\' enables verbose logging, causes the daemon to stay in the foreground, exits if the server\'s configuration is invalid (this happens if, for instance, you\'ve left a syntax error on the server), and exits after running the configuration once (rather than hanging around as a long\-running process)\. . .P -+puppet agent+ exits after executing this\. +\'tags\' allows you to specify what portions of a configuration you want to apply\. Puppet elements are tagged with all of the class or definition names that contain them, and you can use the \'tags\' flag to specify one of these names, causing only configuration elements contained within that class or definition to be applied\. This is very useful when you are testing new configurations \-\- for instance, if you are just starting to manage \'ntpd\', you would put all of the new elements into an \'ntpd\' class, and call puppet with \'\-\-tags ntpd\', which would only apply that small portion of the configuration during your testing, rather than applying the whole thing\. . .P -enable: Enable working on the local system\. This removes any +\'fingerprint\' is a one\-time flag\. In this mode \'puppet agent\' will run once and display on the console (and in the log) the current certificate (or certificate request) fingerprint\. Providing the \'\-\-digest\' option allows to use a different digest algorithm to generate the fingerprint\. The main use is to verify that before signing a certificate request on the master, the certificate request the master received is the same as the one the client sent (to prevent against man\-in\-the\-middle attacks when signing certificates)\. . -.IP "" 4 -. -.nf - - lock file, causing +puppet agent+ to start managing - the local system again (although it will continue to - use its normal scheduling, so it might not start for - another half hour)\. -. -.fi -. -.IP "" 0 +.SH "OPTIONS" +Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument\. For example, \'server\' is a valid configuration parameter, so you can specify \'\-\-server \fIservername\fR\' as an argument\. . .P -+puppet agent+ exits after executing this\. -. -.P -fqdn: Set the fully\-qualified domain name of the client\. +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 agent with \'\-\-genconfig\'\. . -.IP "" 4 +.TP +\-\-daemonize +Send the process into the background\. This is the default\. . -.nf - - This is only used for certificate purposes, but can - be used to override the discovered hostname\. If you - need to use this flag, it is generally an indication - of a setup problem\. +.TP +\-\-no\-daemonize +Do not send the process into the background\. . -.fi +.TP +\-\-debug +Enable full debugging\. . -.IP "" 0 +.TP +\-\-digest +Change the certificate fingerprinting digest algorithm\. The default is MD5\. Valid values depends on the version of OpenSSL installed, but should always at least contain MD5, MD2, SHA1 and SHA256\. . -.P -help: Print this help message +.TP +\-\-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\. This option only makes sense in conjunction with \-\-onetime\. . -.P -logdest: Where to send messages\. Choose between syslog, the +.TP +\-\-disable +Disable working on the local system\. This puts a lock file in place, causing \'puppet agent\' not to work on the system until the lock file is removed\. This is useful if you are testing a configuration and do not want the central configuration to override the local state until everything is tested and committed\. . -.IP "" 4 +.IP +\'puppet agent\' uses the same lock file while it is running, so no more than one \'puppet agent\' process is working at a time\. . -.nf - - console, and a log file\. Defaults to sending - messages to syslog, or the console if debugging or - verbosity is enabled\. +.IP +\'puppet agent\' exits after executing this\. . -.fi +.TP +\-\-enable +Enable working on the local system\. This removes any lock file, causing \'puppet agent\' to start managing the local system again (although it will continue to use its normal scheduling, so it might not start for another half hour)\. . -.IP "" 0 +.IP +\'puppet agent\' exits after executing this\. . -.P -no\-client: Do not create a config client\. This will cause the +.TP +\-\-certname +Set the certname (unique ID) of the client\. The master reads this unique identifying string, which is usually set to the node\'s fully\-qualified domain name, to determine which configurations the node will receive\. Use this option to debug setup problems or implement unusual node identification schemes\. . -.IP "" 4 +.TP +\-\-help +Print this help message . -.nf - - daemon to run without ever checking for its - configuration automatically, and only makes sense - when used in conjunction with \-\-listen\. +.TP +\-\-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\. . -.fi +.TP +\-\-no\-client +Do not create a config client\. This will cause the daemon to run without ever checking for its configuration automatically, and only makes sense . -.IP "" 0 +.TP +\-\-onetime +Run the configuration once\. Runs a single (normally daemonized) Puppet run\. Useful for interactively running puppet agent when used in conjunction with the \-\-no\-daemonize option\. . -.P -onetime: Run the configuration once\. Runs a single (normally +.TP +\-\-fingerprint +Display the current certificate or certificate signing request fingerprint and then exit\. Use the \'\-\-digest\' option to change the digest algorithm used\. . -.IP "" 4 +.TP +\-\-serve +Start another type of server\. By default, \'puppet agent\' will start a service handler that allows authenticated and authorized remote nodes to trigger the configuration to be pulled down and applied\. You can specify any handler here that does not require configuration, e\.g\., filebucket, ca, or resource\. The handlers are in \'lib/puppet/network/handler\', and the names must match exactly, both in the call to \'serve\' and in \'namespaceauth\.conf\'\. . -.nf - - daemonized) Puppet run\. Useful for interactively - running puppet agent when used in conjunction with - the \-\-no\-daemonize option\. -. -.fi -. -.IP "" 0 -. -.P -fingerprint: Display the current certificate or certificate +.TP +\-\-test +Enable the most common options used for testing\. These are \'onetime\', \'verbose\', \'ignorecache\', \'no\-daemonize\', \'no\-usecacheonfailure\', \'detailed\-exit\-codes\', \'no\-splay\', and \'show_diff\'\. . -.IP "" 4 +.TP +\-\-noop +Use \'noop\' mode where the daemon runs in a no\-op or dry\-run mode\. This is useful for seeing what changes Puppet will make without actually executing the changes\. . -.nf - - signing request fingerprint and then exit\. Use the - +\-\-digest+ option to change the digest algorithm - used\. +.TP +\-\-verbose +Turn on verbose reporting\. . -.fi +.TP +\-\-version +Print the puppet version number and exit\. . -.IP "" 0 +.TP +\-\-waitforcert +This option only matters for daemons that do not yet have certificates and it is enabled by default, with a value of 120 (seconds)\. This causes \'puppet agent\' to connect to the server every 2 minutes and ask it to sign a certificate request\. This is useful for the initial setup of a puppet client\. You can turn off waiting for certificates by specifying a time of 0\. . -.P -serve: Start another type of server\. By default, +puppet -. -.IP "" 4 +.SH "EXAMPLE" . .nf - agent+ will start a service handler that allows - authenticated and authorized remote nodes to trigger - the configuration to be pulled down and applied\. You - can specify any handler here that does not require - configuration, e\.g\., filebucket, ca, or resource\. - The handlers are in +lib/puppet/network/handler+, - and the names must match exactly, both in the call - to +serve+ and in +namespaceauth\.conf+\. +$ puppet agent \-\-server puppet\.domain\.com . .fi . -.IP "" 0 -. -.P -test: Enable the most common options used for testing\. -. -.IP "" 4 -. -.nf - - These are +onetime+, +verbose+, +ignorecache, - +no\-daemonize+, and +no\-usecacheonfailure+\. -. -.fi -. -.IP "" 0 -. -.P -noop: Use +noop+ mode where the daemon runs in a no\-op or -. -.IP "" 4 -. -.nf - - dry\-run mode\. This is useful for seeing what changes - Puppet will make without actually executing the - changes\. -. -.fi -. -.IP "" 0 -. -.P -verbose: Turn on verbose reporting\. -. -.P -version: Print the puppet version number and exit\. -. -.P -waitforcert: This option only matters for daemons that do not yet -. -.IP "" 4 -. -.nf - - have certificates and it is enabled by default, with - a value of 120 (seconds)\. This causes +puppet agent+ - to connect to the server every 2 minutes and ask it - to sign a certificate request\. This is useful for - the initial setup of a puppet client\. You can turn - off waiting for certificates by specifying a time of - 0\. -. -.fi +.SH "AUTHOR" +Luke Kanies . -.IP "" 0 -puppet agent \-\-server puppet\.domain\.comLuke KaniesCopyright (c) 2005, 2006 Puppet Labs, LLC Licensed under the GNU Public License +.SH "COPYRIGHT" +Copyright (c) 2005, 2006 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppetdoc.8 b/man/man8/puppetdoc.8 index 47df0e764..e0cabd5d1 100644 --- a/man/man8/puppetdoc.8 +++ b/man/man8/puppetdoc.8 @@ -1,108 +1,101 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETDOC" "8" "August 2010" "" "" -Generate a reference for all Puppet types\. Largely meant for internal Puppet Labs use\.puppet doc [\-a|\-\-all] [\-h|\-\-help] [\-o|\-\-outputdir \fIrdoc outputdir\fR] [\-m|\-\-mode \fItext|pdf|rdoc\fR] +.TH "PUPPET\-DOC" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" . -.IP "" 4 +.SH "NAME" +\fBpuppet\-doc\fR \- Generate Puppet documentation and references . -.nf - - [\-r|\-\-reference <[type]|configuration|\.\.>] [\-\-charset CHARSET] [manifest\-file] +.SH "SYNOPSIS" +Generates a reference for all Puppet types\. Largely meant for internal Puppet Labs use\. . -.fi +.SH "USAGE" +puppet doc [\-a|\-\-all] [\-h|\-\-help] [\-o|\-\-outputdir \fIrdoc\-outputdir\fR] [\-m|\-\-mode text|pdf|rdoc] [\-r|\-\-reference \fIreference\-name\fR] [\-\-charset \fIcharset\fR] [\fImanifest\-file\fR] . -.IP "" 0 +.SH "DESCRIPTION" If mode is not \'rdoc\', then this command generates a Markdown document describing all installed Puppet types or all allowable arguments to puppet executables\. It is largely meant for internal use and is used to generate the reference document available on the Puppet Labs web site\. . .P In \'rdoc\' mode, this command generates an html RDoc hierarchy describing the manifests that are in \'manifestdir\' and \'modulepath\' configuration directives\. The generated documentation directory is doc by default but can be changed with the \'outputdir\' option\. . .P -If the command is started with \'manifest\-file\' command\-line arguments, puppet doc generate a single manifest documentation that is output on stdout\.all: Output the docs for all of the reference types\. In \'rdoc\' +If the command is run with the name of a manifest file as an argument, puppet doc will output a single manifest\'s documentation on stdout\. . -.IP "" 4 +.SH "OPTIONS" . -.nf - - modes, this also outputs documentation for all resources +.TP +\-\-all +Output the docs for all of the reference types\. In \'rdoc\' modes, this also outputs documentation for all resources . -.fi +.TP +\-\-help +Print this help message . -.IP "" 0 +.TP +\-\-outputdir +Specifies the directory where to output the rdoc documentation in \'rdoc\' mode\. . -.P -help: Print this help message +.TP +\-\-mode +Determine the output mode\. Valid modes are \'text\', \'pdf\' and \'rdoc\'\. The \'pdf\' mode creates PDF formatted files in the /tmp directory\. The default mode is \'text\'\. In \'rdoc\' mode you must provide \'manifests\-path\' . -.P -outputdir: Specifies the directory where to output the rdoc +.TP +\-\-reference +Build a particular reference\. Get a list of references by running \'puppet doc \-\-list\'\. . -.IP "" 4 +.TP +\-\-charset +Used only in \'rdoc\' mode\. It sets the charset used in the html files produced\. +. +.SH "EXAMPLE" . .nf - documentation in \'rdoc\' mode\. +$ puppet doc \-r type > /tmp/type_reference\.markdown . .fi . -.IP "" 0 -. .P -mode: Determine the output mode\. Valid modes are \'text\', \'trac\', +or . .IP "" 4 . .nf - \'pdf\' and \'rdoc\'\. The \'pdf\' mode creates PDF formatted files - in the /tmp directory\. The default mode is \'text\'\. In \'rdoc\' - mode you must provide \'manifests\-path\' +$ puppet doc \-\-outputdir /tmp/rdoc \-\-mode rdoc /path/to/manifests . .fi . .IP "" 0 . .P -reference: Build a particular reference\. Get a list of references by +or . .IP "" 4 . .nf - running +puppet doc \-\-list+\. +$ puppet doc /etc/puppet/manifests/site\.pp . .fi . .IP "" 0 . .P -charset: Used only in \'rdoc\' mode\. It sets the charset used in the +or . .IP "" 4 . .nf - html files produced\. +$ puppet doc \-m pdf \-r configuration . .fi . .IP "" 0 -$ puppet doc \-r type > /tmp/type_reference\.rst -. -.P -or -. -.P -$ puppet doc \-\-outputdir /tmp/rdoc \-\-mode rdoc /path/to/manifests . -.P -or -. -.P -$ puppet doc /etc/puppet/manifests/site\.pp +.SH "AUTHOR" +Luke Kanies . -.P -or -. -.P -$ puppet doc \-m pdf \-r configurationLuke KaniesCopyright (c) 2005\-2007 Puppet Labs, LLC Licensed under the GNU Public License +.SH "COPYRIGHT" +Copyright (c) 2005\-2007 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppetmasterd.8 b/man/man8/puppetmasterd.8 index dde93a3d6..9ed2a6ad6 100644 --- a/man/man8/puppetmasterd.8 +++ b/man/man8/puppetmasterd.8 @@ -1,52 +1,63 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETMASTERD" "8" "August 2010" "" "" -The central puppet server\. Functions as a certificate authority by default\.puppet master [\-D|\-\-daemonize|\-\-no\-daemonize] [\-d|\-\-debug] [\-h|\-\-help] +.TH "PUPPET\-MASTER" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" . -.IP "" 4 +.SH "NAME" +\fBpuppet\-master\fR \- The puppet master daemon . -.nf - - [\-l|\-\-logdest |console|syslog] [\-v|\-\-verbose] [\-V|\-\-version] +.SH "SYNOPSIS" +The central puppet server\. Functions as a certificate authority by default\. . -.fi +.SH "USAGE" +puppet master [\-D|\-\-daemonize|\-\-no\-daemonize] [\-d|\-\-debug] [\-h|\-\-help] [\-l|\-\-logdest \fIfile\fR|console|syslog] [\-v|\-\-verbose] [\-V|\-\-version] [\-\-compile \fInode\-name\fR] . -.IP "" 0 -This is the puppet central daemon\.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 \fIdirectory\fR\' as an argument\. +.SH "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\. . -.P -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 puppetmasterdd with \'\-\-genconfig\'\. +.SH "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 \fIdirectory\fR\' as an argument\. . .P -daemonize: Send the process into the background\. This is the default\. +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\'\. . -.P -no\-daemonize: Do not send the process into the background\. +.TP +\-\-daemonize +Send the process into the background\. This is the default\. . -.P -debug: Enable full debugging\. +.TP +\-\-no\-daemonize +Do not send the process into the background\. . -.P -help: Print this help message\. +.TP +\-\-debug +Enable full debugging\. . -.P -logdest: Where to send messages\. Choose between syslog, the +.TP +\-\-help +Print this help message\. . -.IP "" 4 +.TP +\-\-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\. . -.nf - - console, and a log file\. Defaults to sending messages to - syslog, or the console if debugging or verbosity is - enabled\. +.TP +\-\-verbose +Enable verbosity\. . -.fi +.TP +\-\-version +Print the puppet version number and exit\. . -.IP "" 0 +.TP +\-\-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\. . -.P -verbose: Enable verbosity\. +.SH "EXAMPLE" +puppet master . -.P -version: Print the puppet version number and exit\.puppet masterLuke KaniesCopyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License +.SH "AUTHOR" +Luke Kanies +. +.SH "COPYRIGHT" +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppetqd.8 b/man/man8/puppetqd.8 index f630c74a5..7dbd683bf 100644 --- a/man/man8/puppetqd.8 +++ b/man/man8/puppetqd.8 @@ -1,20 +1,55 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETQD" "8" "August 2010" "" "" -puppet queue [\-d|\-\-debug] [\-v|\-\-verbose]This is a simple application that just processes entities in a queue as they are recieved\.Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument\. For example, \'server\' is a valid configuration parameter, so you can specify \'\-\-server \fIservername\fR\' as an argument\. +.TH "PUPPET\-QUEUE" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" . -.P -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 puppetd with \'\-\-genconfig\'\. +.SH "NAME" +\fBpuppet\-queue\fR \- Queuing daemon for asynchronous storeconfigs . -.P -debug: Enable full debugging\. +.SH "SYNOPSIS" +Retrieves serialized storeconfigs records from a queue and processes them in order\. . -.P -help: Print this help message +.SH "USAGE" +puppet queue [\-d|\-\-debug] [\-v|\-\-verbose] +. +.SH "DESCRIPTION" +This application runs as a daemon and processes storeconfigs data, retrieving the data from a stomp server message queue and writing it to a database\. . .P -verbose: Turn on verbose reporting\. +For more information, including instructions for properly setting up your puppet master and message queue, see the documentation on setting up asynchronous storeconfigs at: http://projects\.puppetlabs\.com/projects/1/wiki/Using_Stored_Configuration +. +.SH "OPTIONS" +Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument\. For example, \'server\' is a valid configuration parameter, so you can specify \'\-\-server \fIservername\fR\' as an argument\. . .P -version: Print the puppet version number and exit\.puppet queueLuke KaniesCopyright (c) 2009 Puppet Labs, LLC Licensed under the GNU Public License +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 queue with \'\-\-genconfig\'\. +. +.TP +\-\-debug +Enable full debugging\. +. +.TP +\-\-help +Print this help message +. +.TP +\-\-verbose +Turn on verbose reporting\. +. +.TP +\-\-version +Print the puppet version number and exit\. +. +.SH "EXAMPLE" +. +.nf + +$ puppet queue +. +.fi +. +.SH "AUTHOR" +Luke Kanies +. +.SH "COPYRIGHT" +Copyright (c) 2009 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppetrun.8 b/man/man8/puppetrun.8 index 09fa31b15..b6a868918 100644 --- a/man/man8/puppetrun.8 +++ b/man/man8/puppetrun.8 @@ -1,32 +1,34 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETRUN" "8" "August 2010" "" "" -Trigger a puppet agent run on a set of hosts\.puppet kick [\-a|\-\-all] [\-c|\-\-class \fIclass\fR] [\-d|\-\-debug] [\-f|\-\-foreground] +.TH "PUPPET\-KICK" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" . -.IP "" 4 +.SH "NAME" +\fBpuppet\-kick\fR \- Remotely control puppet agent . -.nf - - [\-h|\-\-help] [\-\-host ] [\-\-no\-fqdn] [\-\-ignoreschedules] - [\-t|\-\-tag ] [\-\-test] [\-p|\-\-ping] [ [\.\.\.]] +.SH "SYNOPSIS" +Trigger a puppet agent run on a set of hosts\. . -.fi +.SH "USAGE" +puppet kick [\-a|\-\-all] [\-c|\-\-class \fIclass\fR] [\-d|\-\-debug] [\-f|\-\-foreground] [\-h|\-\-help] [\-\-host \fIhost\fR] [\-\-no\-fqdn] [\-\-ignoreschedules] [\-t|\-\-tag \fItag\fR] [\-\-test] [\-p|\-\-ping] \fIhost\fR [\fIhost\fR [\.\.\.]] . -.IP "" 0 -This script can be used to connect to a set of machines running +puppet agent+ and trigger them to run their configurations\. The most common usage would be to specify a class of hosts and a set of tags, and +puppet kick+ would look up in LDAP all of the hosts matching that class, then connect to each host and trigger a run of all of the objects with the specified tags\. +.SH "DESCRIPTION" +This script can be used to connect to a set of machines running \'puppet agent\' and trigger them to run their configurations\. The most common usage would be to specify a class of hosts and a set of tags, and \'puppet kick\' would look up in LDAP all of the hosts matching that class, then connect to each host and trigger a run of all of the objects with the specified tags\. . .P If you are not storing your host configurations in LDAP, you can specify hosts manually\. . .P -You will most likely have to run +puppet kick+ as root to get access to the SSL certificates\. +You will most likely have to run \'puppet kick\' as root to get access to the SSL certificates\. . .P -+puppet kick+ reads +puppet master+\'s configuration file, so that it can copy things like LDAP settings\.+puppet kick+ is useless unless +puppet agent+ is listening\. See its documentation for more information, but the gist is that you must enable +listen+ on the +puppet agent+ daemon, either using +\-\-listen+ on the command line or adding \'listen: true\' in its config file\. In addition, you need to set the daemons up to specifically allow connections by creating the +namespaceauth+ file, normally at \'/etc/puppet/namespaceauth\.conf\'\. This file specifies who has access to each namespace; if you create the file you must add every namespace you want any Puppet daemon to allow \-\- it is currently global to all Puppet daemons\. +\'puppet kick\' reads \'puppet master\'\'s configuration file, so that it can copy things like LDAP settings\. +. +.SH "USAGE NOTES" +\'puppet kick\' is useless unless \'puppet agent\' is listening\. See its documentation for more information, but the gist is that you must enable \'listen\' on the \'puppet agent\' daemon, either using \'\-\-listen\' on the command line or adding \'listen = true\' in its config file\. In addition, you need to set the daemons up to specifically allow connections by creating the \'namespaceauth\' file, normally at \'/etc/puppet/namespaceauth\.conf\'\. This file specifies who has access to each namespace; if you create the file you must add every namespace you want any Puppet daemon to allow \-\- it is currently global to all Puppet daemons\. . .P -An example file looks like this:: +An example file looks like this: . .IP "" 4 . @@ -46,128 +48,68 @@ An example file looks like this:: .IP "" 0 . .P -This is what you would install on your Puppet master; non\-master hosts could leave off the \'fileserver\' and \'puppetmaster\' namespaces\.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 \fIdirectory\fR\' as an argument\. -. -.P -See the configuration file documentation at http://reductivelabs\.com/projects/puppet/reference/configref\.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\'\. -. -.P -all: Connect to all available hosts\. Requires LDAP support -. -.IP "" 4 -. -.nf - - at this point\. -. -.fi -. -.IP "" 0 -. -.P -class: Specify a class of machines to which to connect\. This -. -.IP "" 4 -. -.nf - - only works if you have LDAP configured, at the moment\. -. -.fi -. -.IP "" 0 -. -.P -debug: Enable full debugging\. -. -.P -foreground: Run each configuration in the foreground; that is, when -. -.IP "" 4 -. -.nf - - connecting to a host, do not return until the host has - finished its run\. The default is false\. -. -.fi -. -.IP "" 0 -. -.P -help: Print this help message +This is what you would install on your Puppet master; non\-master hosts could leave off the \'fileserver\' and \'puppetmaster\' namespaces\. . -.P -host: A specific host to which to connect\. This flag can be -. -.IP "" 4 -. -.nf - - specified more than once\. -. -.fi -. -.IP "" 0 +.SH "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 \fIdirectory\fR\' as an argument\. . .P -ignoreschedules: Whether the client should ignore schedules when running +See the configuration file documentation at http://docs\.puppetlabs\.com/references/latest/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\'\. . -.IP "" 4 +.TP +\-\-all +Connect to all available hosts\. Requires LDAP support at this point\. . -.nf - - its configuration\. This can be used to force the client - to perform work it would not normally perform so soon\. - The default is false\. +.TP +\-\-class +Specify a class of machines to which to connect\. This only works if you have LDAP configured, at the moment\. . -.fi +.TP +\-\-debug +Enable full debugging\. . -.IP "" 0 +.TP +\-\-foreground +Run each configuration in the foreground; that is, when connecting to a host, do not return until the host has finished its run\. The default is false\. . -.P -parallel: How parallel to make the connections\. Parallelization +.TP +\-\-help +Print this help message . -.IP "" 4 +.TP +\-\-host +A specific host to which to connect\. This flag can be specified more than once\. . -.nf - - is provided by forking for each client to which to - connect\. The default is 1, meaning serial execution\. -. -.fi -. -.IP "" 0 -. -.P -tag: Specify a tag for selecting the objects to apply\. Does -. -.IP "" 4 +.TP +\-\-ignoreschedules +Whether the client should ignore schedules when running its configuration\. This can be used to force the client to perform work it would not normally perform so soon\. The default is false\. . -.nf - - not work with the \-\-test option\. +.TP +\-\-parallel +How parallel to make the connections\. Parallelization is provided by forking for each client to which to connect\. The default is 1, meaning serial execution\. . -.fi +.TP +\-\-tag +Specify a tag for selecting the objects to apply\. Does not work with the \-\-test option\. . -.IP "" 0 +.TP +\-\-test +Print the hosts you would connect to but do not actually connect\. This option requires LDAP support at this point\. . -.P -test: Print the hosts you would connect to but do not +.TP +\-\-ping +Do a ICMP echo against the target host\. Skip hosts that don\'t respond to ping\. . -.IP "" 4 +.SH "EXAMPLE" . .nf - actually connect\. This option requires LDAP support at - this point\. +$ sudo puppet kick \-p 10 \-t remotefile \-t webserver host1 host2 . .fi . -.IP "" 0 +.SH "AUTHOR" +Luke Kanies . -.P -ping:: -. -.P -Do a ICMP echo against the target host\. Skip hosts that don\'t respond to ping\.sudo puppet kick \-p 10 \-t remotefile \-t webserver host1 host2Luke KaniesCopyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License +.SH "COPYRIGHT" +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/ralsh.8 b/man/man8/ralsh.8 index bdc81e90a..f1bc84954 100644 --- a/man/man8/ralsh.8 +++ b/man/man8/ralsh.8 @@ -1,85 +1,84 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "RALSH" "8" "August 2010" "" "" -Use the Puppet RAL to directly interact with the system\.puppet resource [\-h|\-\-help] [\-d|\-\-debug] [\-v|\-\-verbose] [\-e|\-\-edit] +.TH "PUPPET\-RESOURCE" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" . -.IP "" 4 +.SH "NAME" +\fBpuppet\-resource\fR \- The resource abstraction layer shell . -.nf - - [\-H|\-\-host ] [\-p|\-\-param ] [\-t|\-\-types] - type +.SH "SYNOPSIS" +Uses the Puppet RAL to directly interact with the system\. . -.fi +.SH "USAGE" +puppet resource [\-h|\-\-help] [\-d|\-\-debug] [\-v|\-\-verbose] [\-e|\-\-edit] [\-H|\-\-host \fIhost\fR] [\-p|\-\-param] [\-t|\-\-types] \fItype\fR [\fIname\fR] [\fIattribute\fR=\fIvalue\fR \.\.\.] . -.IP "" 0 -This command provides simple facilities for converting current system state into Puppet code, along with some ability to use Puppet to affect the current state\. +.SH "DESCRIPTION" +This command provides simple facilities for converting current system state into Puppet code, along with some ability to modify the current state using Puppet\'s RAL\. . .P -By default, you must at least provide a type to list, which case puppet resource will tell you everything it knows about all instances of that type\. You can optionally specify an instance name, and puppet resource will only describe that single instance\. +By default, you must at least provide a type to list, in which case puppet resource will tell you everything it knows about all resources of that type\. You can optionally specify an instance name, and puppet resource will only describe that single instance\. . .P -You can also add +\-\-edit+ as an argument, and puppet resource will write its output to a file, open that file in an editor, and then apply the file as a Puppet transaction\. You can easily use this to use Puppet to make simple changes to a system\.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 \fIdirectory\fR\' as an argument\. +If given a type, a name, and a series of \fIattribute\fR=\fIvalue\fR pairs, puppet resource will modify the state of the specified resource\. Alternately, if given a type, a name, and the \'\-\-edit\' flag, puppet resource will write its output to a file, open that file in an editor, and then apply the saved file as a Puppet transaction\. . -.P -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\'\. +.SH "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 \fIdirectory\fR\' as an argument\. . .P -debug: Enable full debugging\. +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\'\. . -.P -edit: +.TP +\-\-debug +Enable full debugging\. . -.P +.TP +\-\-edit Write the results of the query to a file, open the file in an editor, and read the file back in as an executable Puppet manifest\. . -.P -host: -. -.P +.TP +\-\-host When specified, connect to the resource server on the named host and retrieve the list of resouces of the type specified\. . -.P -help: -. -.P +.TP +\-\-help Print this help message\. . -.P -param: -. -.P +.TP +\-\-param Add more parameters to be outputted from queries\. . -.P -types: -. -.P +.TP +\-\-types List all available types\. . -.P -verbose: +.TP +\-\-verbose +Print extra information\. . -.P -Print extra information\.This example uses \fBpuppet resource\fR to return Puppet configuration for the user \fBluke\fR: +.SH "EXAMPLE" +This example uses \fBpuppet resource\fR to return a Puppet configuration for the user \fBluke\fR: . .IP "" 4 . .nf - $ puppet resource user luke - user { \'luke\': - home => \'/home/luke\', - uid => \'100\', - ensure => \'present\', - comment => \'Luke Kanies,,,\', - gid => \'1000\', - shell => \'/bin/bash\', - groups => [\'sysadmin\',\'audio\',\'video\',\'puppet\'] - } +$ puppet resource user luke +user { \'luke\': + home => \'/home/luke\', + uid => \'100\', + ensure => \'present\', + comment => \'Luke Kanies,,,\', + gid => \'1000\', + shell => \'/bin/bash\', + groups => [\'sysadmin\',\'audio\',\'video\',\'puppet\'] +} . .fi . .IP "" 0 -Luke KaniesCopyright (c) 2005\-2007 Puppet Labs, LLC Licensed under the GNU Public License +. +.SH "AUTHOR" +Luke Kanies +. +.SH "COPYRIGHT" +Copyright (c) 2005\-2007 Puppet Labs, LLC Licensed under the GNU Public License -- cgit From dac032d589862a9f5c2f054aaf17686bf96f0c09 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 18:36:33 -0800 Subject: (#1204) Make rake gen_manpages output puppet-{application} manpages The manpage generator can now make manpages for the modern executable in addition to the legacy executables. The section for the legacy names should be deleted upon the release of 2.8.0. --- tasks/rake/manpages.rake | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tasks/rake/manpages.rake b/tasks/rake/manpages.rake index 752a6a7a6..f48e57cc7 100644 --- a/tasks/rake/manpages.rake +++ b/tasks/rake/manpages.rake @@ -5,23 +5,33 @@ task :gen_manpages do sbins = Dir.glob(%w{sbin/*}) bins = Dir.glob(%w{bin/*}) - + applications = Dir.glob(%w{lib/puppet/application/*}) # Locate ronn ronn = %x{which ronn} ronn.chomp! + # Create puppet.conf.5 man page %x{RUBYLIB=./lib:$RUBYLIB bin/puppetdoc --reference configuration > ./man/man5/puppetconf.5.ronn} %x{#{ronn} --manual="Puppet manual" --organization="Puppet Labs, LLC" -r ./man/man5/puppetconf.5.ronn} File.move("./man/man5/puppetconf.5", "./man/man5/puppet.conf.5") File.unlink("./man/man5/puppetconf.5.ronn") - # Create binary man pages + # Create LEGACY binary man pages (i.e. delete me for 2.8.0) binary = bins + sbins binary.each do |bin| - b = bin.gsub( /(bin|sbin)\//, "") + b = bin.gsub( /^s?bin\//, "") %x{RUBYLIB=./lib:$RUBYLIB #{bin} --help > ./man/man8/#{b}.8.ronn} %x{#{ronn} --manual="Puppet manual" --organization="Puppet Labs, LLC" -r ./man/man8/#{b}.8.ronn} File.unlink("./man/man8/#{b}.8.ronn") end - + + # Create modern binary man pages + applications.each do |app| + app.gsub!( /^lib\/puppet\/application\/(.*?)\.rb/, '\1') + %x{RUBYLIB=./lib:$RUBYLIB bin/puppet #{app} --help > ./man/man8/puppet-#{app}.8.ronn} + %x{#{ronn} --manual="Puppet manual" --organization="Puppet Labs, LLC" -r ./man/man8/puppet-#{app}.8.ronn} + File.unlink("./man/man8/puppet-#{app}.8.ronn") + end + + end \ No newline at end of file -- cgit From f6485d6eb8378e874ca22e67c2976835ab7601fa Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Thu, 17 Feb 2011 10:00:06 -0800 Subject: (#1204) Fix --param flag in puppet resource manpage Ronn doesn't like for some reason. --- lib/puppet/application/resource.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/application/resource.rb b/lib/puppet/application/resource.rb index f5741b9ee..3995c285b 100644 --- a/lib/puppet/application/resource.rb +++ b/lib/puppet/application/resource.rb @@ -49,8 +49,8 @@ Uses the Puppet RAL to directly interact with the system. USAGE ----- puppet resource [-h|--help] [-d|--debug] [-v|--verbose] [-e|--edit] - [-H|--host ] [-p|--param ] [-t|--types] [] - [= ...] + [-H|--host ] [-p|--param ] [-t|--types] + [] [= ...] DESCRIPTION -- cgit From ae4112b4ea9631d402ecd072322bce738161fbc4 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Wed, 16 Feb 2011 18:40:42 -0800 Subject: (#1204) Add manpages for modern apps and update puppet.conf manpage --- man/man5/puppet.conf.5 | 4 +- man/man8/puppet-agent.8 | 139 +++++++++++++++++++++++++++++++++++++++++++ man/man8/puppet-apply.8 | 75 +++++++++++++++++++++++ man/man8/puppet-cert.8 | 94 +++++++++++++++++++++++++++++ man/man8/puppet-describe.8 | 51 ++++++++++++++++ man/man8/puppet-doc.8 | 101 +++++++++++++++++++++++++++++++ man/man8/puppet-filebucket.8 | 81 +++++++++++++++++++++++++ man/man8/puppet-inspect.8 | 28 +++++++++ man/man8/puppet-kick.8 | 115 +++++++++++++++++++++++++++++++++++ man/man8/puppet-master.8 | 63 ++++++++++++++++++++ man/man8/puppet-queue.8 | 55 +++++++++++++++++ man/man8/puppet-resource.8 | 84 ++++++++++++++++++++++++++ man/man8/ralsh.8 | 2 +- 13 files changed, 889 insertions(+), 3 deletions(-) create mode 100644 man/man8/puppet-agent.8 create mode 100644 man/man8/puppet-apply.8 create mode 100644 man/man8/puppet-cert.8 create mode 100644 man/man8/puppet-describe.8 create mode 100644 man/man8/puppet-doc.8 create mode 100644 man/man8/puppet-filebucket.8 create mode 100644 man/man8/puppet-inspect.8 create mode 100644 man/man8/puppet-kick.8 create mode 100644 man/man8/puppet-master.8 create mode 100644 man/man8/puppet-queue.8 create mode 100644 man/man8/puppet-resource.8 diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index feccf1083..f6c9926c3 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -2,7 +2,7 @@ .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "PUPPETCONF" "5" "February 2011" "Puppet Labs, LLC" "Puppet manual" -\fBThis page is autogenerated; any changes will get overwritten\fR \fI(last generated on Wed Feb 16 17:06:38 \-0800 2011)\fR +\fBThis page is autogenerated; any changes will get overwritten\fR \fI(last generated on Thu Feb 17 09:56:34 \-0800 2011)\fR . .SH "Specifying Configuration Parameters" . @@ -1589,4 +1589,4 @@ Boolean; whether to use the zlib library .IP "" 0 . .P -\fIThis page autogenerated on Wed Feb 16 17:06:38 \-0800 2011\fR +\fIThis page autogenerated on Thu Feb 17 09:56:34 \-0800 2011\fR diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 new file mode 100644 index 000000000..3fadd9df7 --- /dev/null +++ b/man/man8/puppet-agent.8 @@ -0,0 +1,139 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "PUPPET\-AGENT" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" +. +.SH "NAME" +\fBpuppet\-agent\fR \- The puppet agent daemon +. +.SH "SYNOPSIS" +Retrieves the client configuration from the puppet master and applies it to the local host\. +. +.P +This service may be run as a daemon, run periodically using cron (or something similar), or run interactively for testing purposes\. +. +.SH "USAGE" +puppet agent [\-D|\-\-daemonize|\-\-no\-daemonize] [\-d|\-\-debug] [\-\-detailed\-exitcodes] [\-\-disable] [\-\-enable] [\-h|\-\-help] [\-\-certname \fIhost name\fR] [\-l|\-\-logdest syslog|\fIfile\fR|console] [\-o|\-\-onetime] [\-\-serve \fIhandler\fR] [\-t|\-\-test] [\-\-noop] [\-\-digest \fIdigest\fR] [\-\-fingerprint] [\-V|\-\-version] [\-v|\-\-verbose] [\-w|\-\-waitforcert \fIseconds\fR] +. +.SH "DESCRIPTION" +This is the main puppet client\. Its job is to retrieve the local machine\'s configuration from a remote server and apply it\. In order to successfully communicate with the remote server, the client must have a certificate signed by a certificate authority that the server trusts; the recommended method for this, at the moment, is to run a certificate authority as part of the puppet server (which is the default)\. The client will connect and request a signed certificate, and will continue connecting until it receives one\. +. +.P +Once the client has a signed certificate, it will retrieve its configuration and apply it\. +. +.SH "USAGE NOTES" +\'puppet agent\' does its best to find a compromise between interactive use and daemon use\. Run with no arguments and no configuration, it will go into the background, attempt to get a signed certificate, and retrieve and apply its configuration every 30 minutes\. +. +.P +Some flags are meant specifically for interactive use \-\- in particular, \'test\', \'tags\' or \'fingerprint\' are useful\. \'test\' enables verbose logging, causes the daemon to stay in the foreground, exits if the server\'s configuration is invalid (this happens if, for instance, you\'ve left a syntax error on the server), and exits after running the configuration once (rather than hanging around as a long\-running process)\. +. +.P +\'tags\' allows you to specify what portions of a configuration you want to apply\. Puppet elements are tagged with all of the class or definition names that contain them, and you can use the \'tags\' flag to specify one of these names, causing only configuration elements contained within that class or definition to be applied\. This is very useful when you are testing new configurations \-\- for instance, if you are just starting to manage \'ntpd\', you would put all of the new elements into an \'ntpd\' class, and call puppet with \'\-\-tags ntpd\', which would only apply that small portion of the configuration during your testing, rather than applying the whole thing\. +. +.P +\'fingerprint\' is a one\-time flag\. In this mode \'puppet agent\' will run once and display on the console (and in the log) the current certificate (or certificate request) fingerprint\. Providing the \'\-\-digest\' option allows to use a different digest algorithm to generate the fingerprint\. The main use is to verify that before signing a certificate request on the master, the certificate request the master received is the same as the one the client sent (to prevent against man\-in\-the\-middle attacks when signing certificates)\. +. +.SH "OPTIONS" +Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument\. For example, \'server\' is a valid configuration parameter, so you can specify \'\-\-server \fIservername\fR\' as an argument\. +. +.P +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 agent with \'\-\-genconfig\'\. +. +.TP +\-\-daemonize +Send the process into the background\. This is the default\. +. +.TP +\-\-no\-daemonize +Do not send the process into the background\. +. +.TP +\-\-debug +Enable full debugging\. +. +.TP +\-\-digest +Change the certificate fingerprinting digest algorithm\. The default is MD5\. Valid values depends on the version of OpenSSL installed, but should always at least contain MD5, MD2, SHA1 and SHA256\. +. +.TP +\-\-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\. This option only makes sense in conjunction with \-\-onetime\. +. +.TP +\-\-disable +Disable working on the local system\. This puts a lock file in place, causing \'puppet agent\' not to work on the system until the lock file is removed\. This is useful if you are testing a configuration and do not want the central configuration to override the local state until everything is tested and committed\. +. +.IP +\'puppet agent\' uses the same lock file while it is running, so no more than one \'puppet agent\' process is working at a time\. +. +.IP +\'puppet agent\' exits after executing this\. +. +.TP +\-\-enable +Enable working on the local system\. This removes any lock file, causing \'puppet agent\' to start managing the local system again (although it will continue to use its normal scheduling, so it might not start for another half hour)\. +. +.IP +\'puppet agent\' exits after executing this\. +. +.TP +\-\-certname +Set the certname (unique ID) of the client\. The master reads this unique identifying string, which is usually set to the node\'s fully\-qualified domain name, to determine which configurations the node will receive\. Use this option to debug setup problems or implement unusual node identification schemes\. +. +.TP +\-\-help +Print this help message +. +.TP +\-\-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\. +. +.TP +\-\-no\-client +Do not create a config client\. This will cause the daemon to run without ever checking for its configuration automatically, and only makes sense +. +.TP +\-\-onetime +Run the configuration once\. Runs a single (normally daemonized) Puppet run\. Useful for interactively running puppet agent when used in conjunction with the \-\-no\-daemonize option\. +. +.TP +\-\-fingerprint +Display the current certificate or certificate signing request fingerprint and then exit\. Use the \'\-\-digest\' option to change the digest algorithm used\. +. +.TP +\-\-serve +Start another type of server\. By default, \'puppet agent\' will start a service handler that allows authenticated and authorized remote nodes to trigger the configuration to be pulled down and applied\. You can specify any handler here that does not require configuration, e\.g\., filebucket, ca, or resource\. The handlers are in \'lib/puppet/network/handler\', and the names must match exactly, both in the call to \'serve\' and in \'namespaceauth\.conf\'\. +. +.TP +\-\-test +Enable the most common options used for testing\. These are \'onetime\', \'verbose\', \'ignorecache\', \'no\-daemonize\', \'no\-usecacheonfailure\', \'detailed\-exit\-codes\', \'no\-splay\', and \'show_diff\'\. +. +.TP +\-\-noop +Use \'noop\' mode where the daemon runs in a no\-op or dry\-run mode\. This is useful for seeing what changes Puppet will make without actually executing the changes\. +. +.TP +\-\-verbose +Turn on verbose reporting\. +. +.TP +\-\-version +Print the puppet version number and exit\. +. +.TP +\-\-waitforcert +This option only matters for daemons that do not yet have certificates and it is enabled by default, with a value of 120 (seconds)\. This causes \'puppet agent\' to connect to the server every 2 minutes and ask it to sign a certificate request\. This is useful for the initial setup of a puppet client\. You can turn off waiting for certificates by specifying a time of 0\. +. +.SH "EXAMPLE" +. +.nf + +$ puppet agent \-\-server puppet\.domain\.com +. +.fi +. +.SH "AUTHOR" +Luke Kanies +. +.SH "COPYRIGHT" +Copyright (c) 2005, 2006 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 new file mode 100644 index 000000000..d8d864b56 --- /dev/null +++ b/man/man8/puppet-apply.8 @@ -0,0 +1,75 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "PUPPET\-APPLY" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" +. +.SH "NAME" +\fBpuppet\-apply\fR \- Apply Puppet manifests locally +. +.SH "SYNOPSIS" +Applies a standalone Puppet manifest to the local system\. +. +.SH "USAGE" +puppet apply [\-h|\-\-help] [\-V|\-\-version] [\-d|\-\-debug] [\-v|\-\-verbose] [\-e|\-\-execute] [\-\-detailed\-exitcodes] [\-l|\-\-logdest \fIfile\fR] [\-\-apply \fIcatalog\fR] \fIfile\fR +. +.SH "DESCRIPTION" +This is the standalone puppet execution tool; use it to apply individual manifests\. +. +.P +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\. +. +.P +Most users should use \'puppet agent\' and \'puppet master\' for site\-wide manifests\. +. +.SH "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 \fIclass\fR,\fItag\fR\' as an argument\. +. +.P +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\'\. +. +.TP +\-\-debug +Enable full debugging\. +. +.TP +\-\-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\. +. +.TP +\-\-help +Print this help message +. +.TP +\-\-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\. +. +.TP +\-\-logdest +Where to send messages\. Choose between syslog, the console, and a log file\. Defaults to sending messages to the console\. +. +.TP +\-\-execute +Execute a specific piece of Puppet code +. +.TP +\-\-verbose +Print extra information\. +. +.TP +\-\-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\. +. +.SH "EXAMPLE" +. +.nf + +$ puppet apply \-l /tmp/manifest\.log manifest\.pp +$ puppet apply \-\-modulepath=/root/dev/modules \-e "include ntpd::server" +. +.fi +. +.SH "AUTHOR" +Luke Kanies +. +.SH "COPYRIGHT" +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppet-cert.8 b/man/man8/puppet-cert.8 new file mode 100644 index 000000000..bea7596d4 --- /dev/null +++ b/man/man8/puppet-cert.8 @@ -0,0 +1,94 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "PUPPET\-CERT" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" +. +.SH "NAME" +\fBpuppet\-cert\fR \- Manage certificates and requests +. +.SH "SYNOPSIS" +Standalone certificate authority\. Capable of generating certificates, but mostly used for signing certificate requests from puppet clients\. +. +.SH "USAGE" +puppet cert [\-h|\-\-help] [\-V|\-\-version] [\-d|\-\-debug] [\-v|\-\-verbose] [\-g|\-\-generate] [\-l|\-\-list] [\-s|\-\-sign] [\-r|\-\-revoke] [\-p|\-\-print] [\-c|\-\-clean] [\-\-verify] [\-\-digest \fIdigest\fR] [\-\-fingerprint] [host] +. +.SH "DESCRIPTION" +Because the puppet master service defaults to not signing client certificate requests, this script is available for signing outstanding requests\. It can be used to list outstanding requests and then either sign them individually or sign all of them\. +. +.SH "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 \fIdirectory\fR\' as an argument\. +. +.P +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 cert with \'\-\-genconfig\'\. +. +.TP +\-\-all +Operate on all items\. Currently only makes sense with \'\-\-sign\', \'\-\-clean\', or \'\-\-list\'\. +. +.TP +\-\-digest +Set the digest for fingerprinting (defaults to md5)\. Valid values depends on your openssl and openssl ruby extension version, but should contain at least md5, sha1, md2, sha256\. +. +.TP +\-\-clean +Remove all files related to a host from puppet cert\'s storage\. This is useful when rebuilding hosts, since new certificate signing requests will only be honored if puppet cert does not have a copy of a signed certificate for that host\. The certificate of the host is also revoked\. If \'\-\-all\' is specified then all host certificates, both signed and unsigned, will be removed\. +. +.TP +\-\-debug +Enable full debugging\. +. +.TP +\-\-generate +Generate a certificate for a named client\. A certificate/keypair will be generated for each client named on the command line\. +. +.TP +\-\-help +Print this help message +. +.TP +\-\-list +List outstanding certificate requests\. If \'\-\-all\' is specified, signed certificates are also listed, prefixed by \'+\', and revoked or invalid certificates are prefixed by \'\-\' (the verification outcome is printed in parenthesis)\. +. +.TP +\-\-print +Print the full\-text version of a host\'s certificate\. +. +.TP +\-\-fingerprint +Print the DIGEST (defaults to md5) fingerprint of a host\'s certificate\. +. +.TP +\-\-revoke +Revoke the certificate of a client\. The certificate can be specified either by its serial number, given as a decimal number or a hexadecimal number prefixed by \'0x\', or by its hostname\. The certificate is revoked by adding it to the Certificate Revocation List given by the \'cacrl\' config parameter\. Note that the puppetmasterd needs to be restarted after revoking certificates\. +. +.TP +\-\-sign +Sign an outstanding certificate request\. Unless \'\-\-all\' is specified, hosts must be listed after all flags\. +. +.TP +\-\-verbose +Enable verbosity\. +. +.TP +\-\-version +Print the puppet version number and exit\. +. +.TP +\-\-verify +Verify the named certificate against the local CA certificate\. +. +.SH "EXAMPLE" +. +.nf + +$ puppet cert \-l +culain\.madstop\.com +$ puppet cert \-s culain\.madstop\.com +. +.fi +. +.SH "AUTHOR" +Luke Kanies +. +.SH "COPYRIGHT" +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 new file mode 100644 index 000000000..c54a7bec7 --- /dev/null +++ b/man/man8/puppet-describe.8 @@ -0,0 +1,51 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "PUPPET\-DESCRIBE" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" +. +.SH "NAME" +\fBpuppet\-describe\fR \- Display help about resource types +. +.SH "SYNOPSIS" +Prints help about Puppet resource types, providers, and metaparameters\. +. +.SH "USAGE" +puppet describe [\-h|\-\-help] [\-s|\-\-short] [\-p|\-\-providers] [\-l|\-\-list] [\-m|\-\-meta] +. +.SH "OPTIONS" +. +.TP +\-\-help +Print this help text +. +.TP +\-\-providers +Describe providers in detail for each type +. +.TP +\-\-list +List all types +. +.TP +\-\-meta +List all metaparameters +. +.TP +\-\-short +List only parameters without detail +. +.SH "EXAMPLE" +. +.nf + +$ puppet describe \-\-list +$ puppet describe file \-\-providers +$ puppet describe user \-s \-m +. +.fi +. +.SH "AUTHOR" +David Lutterkort +. +.SH "COPYRIGHT" +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 new file mode 100644 index 000000000..e0cabd5d1 --- /dev/null +++ b/man/man8/puppet-doc.8 @@ -0,0 +1,101 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "PUPPET\-DOC" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" +. +.SH "NAME" +\fBpuppet\-doc\fR \- Generate Puppet documentation and references +. +.SH "SYNOPSIS" +Generates a reference for all Puppet types\. Largely meant for internal Puppet Labs use\. +. +.SH "USAGE" +puppet doc [\-a|\-\-all] [\-h|\-\-help] [\-o|\-\-outputdir \fIrdoc\-outputdir\fR] [\-m|\-\-mode text|pdf|rdoc] [\-r|\-\-reference \fIreference\-name\fR] [\-\-charset \fIcharset\fR] [\fImanifest\-file\fR] +. +.SH "DESCRIPTION" +If mode is not \'rdoc\', then this command generates a Markdown document describing all installed Puppet types or all allowable arguments to puppet executables\. It is largely meant for internal use and is used to generate the reference document available on the Puppet Labs web site\. +. +.P +In \'rdoc\' mode, this command generates an html RDoc hierarchy describing the manifests that are in \'manifestdir\' and \'modulepath\' configuration directives\. The generated documentation directory is doc by default but can be changed with the \'outputdir\' option\. +. +.P +If the command is run with the name of a manifest file as an argument, puppet doc will output a single manifest\'s documentation on stdout\. +. +.SH "OPTIONS" +. +.TP +\-\-all +Output the docs for all of the reference types\. In \'rdoc\' modes, this also outputs documentation for all resources +. +.TP +\-\-help +Print this help message +. +.TP +\-\-outputdir +Specifies the directory where to output the rdoc documentation in \'rdoc\' mode\. +. +.TP +\-\-mode +Determine the output mode\. Valid modes are \'text\', \'pdf\' and \'rdoc\'\. The \'pdf\' mode creates PDF formatted files in the /tmp directory\. The default mode is \'text\'\. In \'rdoc\' mode you must provide \'manifests\-path\' +. +.TP +\-\-reference +Build a particular reference\. Get a list of references by running \'puppet doc \-\-list\'\. +. +.TP +\-\-charset +Used only in \'rdoc\' mode\. It sets the charset used in the html files produced\. +. +.SH "EXAMPLE" +. +.nf + +$ puppet doc \-r type > /tmp/type_reference\.markdown +. +.fi +. +.P +or +. +.IP "" 4 +. +.nf + +$ puppet doc \-\-outputdir /tmp/rdoc \-\-mode rdoc /path/to/manifests +. +.fi +. +.IP "" 0 +. +.P +or +. +.IP "" 4 +. +.nf + +$ puppet doc /etc/puppet/manifests/site\.pp +. +.fi +. +.IP "" 0 +. +.P +or +. +.IP "" 4 +. +.nf + +$ puppet doc \-m pdf \-r configuration +. +.fi +. +.IP "" 0 +. +.SH "AUTHOR" +Luke Kanies +. +.SH "COPYRIGHT" +Copyright (c) 2005\-2007 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 new file mode 100644 index 000000000..7ff0da9af --- /dev/null +++ b/man/man8/puppet-filebucket.8 @@ -0,0 +1,81 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "PUPPET\-FILEBUCKET" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" +. +.SH "NAME" +\fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket +. +.SH "SYNOPSIS" +A stand\-alone Puppet filebucket client\. +. +.SH "USAGE" +puppet filebucket \fImode\fR [\-h|\-\-help] [\-V|\-\-version] [\-d|\-\-debug] [\-v|\-\-verbose] [\-l|\-\-local] [\-r|\-\-remote] [\-s|\-\-server \fIserver\fR] [\-b|\-\-bucket \fIdirectory\fR] \fIfile\fR \fIfile\fR \.\.\. +. +.P +Puppet filebucket can operate in three modes, with only one mode per call: +. +.P +backup: Send one or more files to the specified file bucket\. Each sent file is printed with its resulting md5 sum\. +. +.P +get: Return the text associated with an md5 sum\. The text is printed to stdout, and only one file can be retrieved at a time\. +. +.P +restore: Given a file path and an md5 sum, store the content associated with the sum into the specified file path\. You can specify an entirely new path to this argument; you are not restricted to restoring the content to its original location\. +. +.SH "DESCRIPTION" +This is a stand\-alone filebucket client for sending files to a local or central filebucket\. +. +.P +Note that \'filebucket\' defaults to using a network\-based filebucket available on the server named \'puppet\'\. To use this, you\'ll have to be running as a user with valid Puppet certificates\. Alternatively, you can use your local file bucket by specifying \'\-\-local\'\. +. +.SH "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 \fIdirectory\fR\' as an argument\. +. +.P +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\'\. +. +.TP +\-\-debug +Enable full debugging\. +. +.TP +\-\-help +Print this help message +. +.TP +\-\-local +Use the local filebucket\. This will use the default configuration information\. +. +.TP +\-\-remote +Use a remote filebucket\. This will use the default configuration information\. +. +.TP +\-\-server +The server to send the file to, instead of locally\. +. +.TP +\-\-verbose +Print extra information\. +. +.TP +\-\-version +Print version information\. +. +.SH "EXAMPLE" +. +.nf + +$ puppet filebucket backup /etc/passwd +/etc/passwd: 429b225650b912a2ee067b0a4cf1e949 +$ puppet filebucket restore /tmp/passwd 429b225650b912a2ee067b0a4cf1e949 +. +.fi +. +.SH "AUTHOR" +Luke Kanies +. +.SH "COPYRIGHT" +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppet-inspect.8 b/man/man8/puppet-inspect.8 new file mode 100644 index 000000000..ae19deede --- /dev/null +++ b/man/man8/puppet-inspect.8 @@ -0,0 +1,28 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "PUPPET\-INSPECT" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" +. +.SH "NAME" +\fBpuppet\-inspect\fR \- Send an inspection report +. +.SH "SYNOPSIS" +Prepares and submits an inspection report to the puppet master\. +. +.SH "USAGE" +puppet inspect +. +.SH "DESCRIPTION" +This command uses the cached catalog from the previous run of \'puppet agent\' to determine which attributes of which resources have been marked as auditable with the \'audit\' metaparameter\. It then examines the current state of the system, writes the state of the specified resource attributes to a report, and submits the report to the puppet master\. +. +.P +Puppet inspect does not run as a daemon, and must be run manually or from cron\. +. +.SH "OPTIONS" +Any configuration setting which is valid in the configuration file is also a valid long argument, e\.g\. \'\-\-server=master\.domain\.com\'\. See the configuration file documentation at http://docs\.puppetlabs\.com/references/latest/configuration\.html for the full list of acceptable settings\. +. +.SH "AUTHOR" +Puppet Labs +. +.SH "COPYRIGHT" +Copyright (c) 2011 Puppet Labs, LLC Licensed under the GNU General Public License version 2 diff --git a/man/man8/puppet-kick.8 b/man/man8/puppet-kick.8 new file mode 100644 index 000000000..b6a868918 --- /dev/null +++ b/man/man8/puppet-kick.8 @@ -0,0 +1,115 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "PUPPET\-KICK" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" +. +.SH "NAME" +\fBpuppet\-kick\fR \- Remotely control puppet agent +. +.SH "SYNOPSIS" +Trigger a puppet agent run on a set of hosts\. +. +.SH "USAGE" +puppet kick [\-a|\-\-all] [\-c|\-\-class \fIclass\fR] [\-d|\-\-debug] [\-f|\-\-foreground] [\-h|\-\-help] [\-\-host \fIhost\fR] [\-\-no\-fqdn] [\-\-ignoreschedules] [\-t|\-\-tag \fItag\fR] [\-\-test] [\-p|\-\-ping] \fIhost\fR [\fIhost\fR [\.\.\.]] +. +.SH "DESCRIPTION" +This script can be used to connect to a set of machines running \'puppet agent\' and trigger them to run their configurations\. The most common usage would be to specify a class of hosts and a set of tags, and \'puppet kick\' would look up in LDAP all of the hosts matching that class, then connect to each host and trigger a run of all of the objects with the specified tags\. +. +.P +If you are not storing your host configurations in LDAP, you can specify hosts manually\. +. +.P +You will most likely have to run \'puppet kick\' as root to get access to the SSL certificates\. +. +.P +\'puppet kick\' reads \'puppet master\'\'s configuration file, so that it can copy things like LDAP settings\. +. +.SH "USAGE NOTES" +\'puppet kick\' is useless unless \'puppet agent\' is listening\. See its documentation for more information, but the gist is that you must enable \'listen\' on the \'puppet agent\' daemon, either using \'\-\-listen\' on the command line or adding \'listen = true\' in its config file\. In addition, you need to set the daemons up to specifically allow connections by creating the \'namespaceauth\' file, normally at \'/etc/puppet/namespaceauth\.conf\'\. This file specifies who has access to each namespace; if you create the file you must add every namespace you want any Puppet daemon to allow \-\- it is currently global to all Puppet daemons\. +. +.P +An example file looks like this: +. +.IP "" 4 +. +.nf + +[fileserver] + allow *\.madstop\.com + +[puppetmaster] + allow *\.madstop\.com + +[puppetrunner] + allow culain\.madstop\.com +. +.fi +. +.IP "" 0 +. +.P +This is what you would install on your Puppet master; non\-master hosts could leave off the \'fileserver\' and \'puppetmaster\' namespaces\. +. +.SH "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 \fIdirectory\fR\' as an argument\. +. +.P +See the configuration file documentation at http://docs\.puppetlabs\.com/references/latest/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\'\. +. +.TP +\-\-all +Connect to all available hosts\. Requires LDAP support at this point\. +. +.TP +\-\-class +Specify a class of machines to which to connect\. This only works if you have LDAP configured, at the moment\. +. +.TP +\-\-debug +Enable full debugging\. +. +.TP +\-\-foreground +Run each configuration in the foreground; that is, when connecting to a host, do not return until the host has finished its run\. The default is false\. +. +.TP +\-\-help +Print this help message +. +.TP +\-\-host +A specific host to which to connect\. This flag can be specified more than once\. +. +.TP +\-\-ignoreschedules +Whether the client should ignore schedules when running its configuration\. This can be used to force the client to perform work it would not normally perform so soon\. The default is false\. +. +.TP +\-\-parallel +How parallel to make the connections\. Parallelization is provided by forking for each client to which to connect\. The default is 1, meaning serial execution\. +. +.TP +\-\-tag +Specify a tag for selecting the objects to apply\. Does not work with the \-\-test option\. +. +.TP +\-\-test +Print the hosts you would connect to but do not actually connect\. This option requires LDAP support at this point\. +. +.TP +\-\-ping +Do a ICMP echo against the target host\. Skip hosts that don\'t respond to ping\. +. +.SH "EXAMPLE" +. +.nf + +$ sudo puppet kick \-p 10 \-t remotefile \-t webserver host1 host2 +. +.fi +. +.SH "AUTHOR" +Luke Kanies +. +.SH "COPYRIGHT" +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppet-master.8 b/man/man8/puppet-master.8 new file mode 100644 index 000000000..9ed2a6ad6 --- /dev/null +++ b/man/man8/puppet-master.8 @@ -0,0 +1,63 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "PUPPET\-MASTER" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" +. +.SH "NAME" +\fBpuppet\-master\fR \- The puppet master daemon +. +.SH "SYNOPSIS" +The central puppet server\. Functions as a certificate authority by default\. +. +.SH "USAGE" +puppet master [\-D|\-\-daemonize|\-\-no\-daemonize] [\-d|\-\-debug] [\-h|\-\-help] [\-l|\-\-logdest \fIfile\fR|console|syslog] [\-v|\-\-verbose] [\-V|\-\-version] [\-\-compile \fInode\-name\fR] +. +.SH "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\. +. +.SH "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 \fIdirectory\fR\' as an argument\. +. +.P +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\'\. +. +.TP +\-\-daemonize +Send the process into the background\. This is the default\. +. +.TP +\-\-no\-daemonize +Do not send the process into the background\. +. +.TP +\-\-debug +Enable full debugging\. +. +.TP +\-\-help +Print this help message\. +. +.TP +\-\-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\. +. +.TP +\-\-verbose +Enable verbosity\. +. +.TP +\-\-version +Print the puppet version number and exit\. +. +.TP +\-\-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\. +. +.SH "EXAMPLE" +puppet master +. +.SH "AUTHOR" +Luke Kanies +. +.SH "COPYRIGHT" +Copyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppet-queue.8 b/man/man8/puppet-queue.8 new file mode 100644 index 000000000..7dbd683bf --- /dev/null +++ b/man/man8/puppet-queue.8 @@ -0,0 +1,55 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "PUPPET\-QUEUE" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" +. +.SH "NAME" +\fBpuppet\-queue\fR \- Queuing daemon for asynchronous storeconfigs +. +.SH "SYNOPSIS" +Retrieves serialized storeconfigs records from a queue and processes them in order\. +. +.SH "USAGE" +puppet queue [\-d|\-\-debug] [\-v|\-\-verbose] +. +.SH "DESCRIPTION" +This application runs as a daemon and processes storeconfigs data, retrieving the data from a stomp server message queue and writing it to a database\. +. +.P +For more information, including instructions for properly setting up your puppet master and message queue, see the documentation on setting up asynchronous storeconfigs at: http://projects\.puppetlabs\.com/projects/1/wiki/Using_Stored_Configuration +. +.SH "OPTIONS" +Note that any configuration parameter that\'s valid in the configuration file is also a valid long argument\. For example, \'server\' is a valid configuration parameter, so you can specify \'\-\-server \fIservername\fR\' as an argument\. +. +.P +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 queue with \'\-\-genconfig\'\. +. +.TP +\-\-debug +Enable full debugging\. +. +.TP +\-\-help +Print this help message +. +.TP +\-\-verbose +Turn on verbose reporting\. +. +.TP +\-\-version +Print the puppet version number and exit\. +. +.SH "EXAMPLE" +. +.nf + +$ puppet queue +. +.fi +. +.SH "AUTHOR" +Luke Kanies +. +.SH "COPYRIGHT" +Copyright (c) 2009 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 new file mode 100644 index 000000000..738537e84 --- /dev/null +++ b/man/man8/puppet-resource.8 @@ -0,0 +1,84 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "PUPPET\-RESOURCE" "8" "February 2011" "Puppet Labs, LLC" "Puppet manual" +. +.SH "NAME" +\fBpuppet\-resource\fR \- The resource abstraction layer shell +. +.SH "SYNOPSIS" +Uses the Puppet RAL to directly interact with the system\. +. +.SH "USAGE" +puppet resource [\-h|\-\-help] [\-d|\-\-debug] [\-v|\-\-verbose] [\-e|\-\-edit] [\-H|\-\-host \fIhost\fR] [\-p|\-\-param \fIparameter\fR] [\-t|\-\-types] \fItype\fR [\fIname\fR] [\fIattribute\fR=\fIvalue\fR \.\.\.] +. +.SH "DESCRIPTION" +This command provides simple facilities for converting current system state into Puppet code, along with some ability to modify the current state using Puppet\'s RAL\. +. +.P +By default, you must at least provide a type to list, in which case puppet resource will tell you everything it knows about all resources of that type\. You can optionally specify an instance name, and puppet resource will only describe that single instance\. +. +.P +If given a type, a name, and a series of \fIattribute\fR=\fIvalue\fR pairs, puppet resource will modify the state of the specified resource\. Alternately, if given a type, a name, and the \'\-\-edit\' flag, puppet resource will write its output to a file, open that file in an editor, and then apply the saved file as a Puppet transaction\. +. +.SH "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 \fIdirectory\fR\' as an argument\. +. +.P +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\'\. +. +.TP +\-\-debug +Enable full debugging\. +. +.TP +\-\-edit +Write the results of the query to a file, open the file in an editor, and read the file back in as an executable Puppet manifest\. +. +.TP +\-\-host +When specified, connect to the resource server on the named host and retrieve the list of resouces of the type specified\. +. +.TP +\-\-help +Print this help message\. +. +.TP +\-\-param +Add more parameters to be outputted from queries\. +. +.TP +\-\-types +List all available types\. +. +.TP +\-\-verbose +Print extra information\. +. +.SH "EXAMPLE" +This example uses \fBpuppet resource\fR to return a Puppet configuration for the user \fBluke\fR: +. +.IP "" 4 +. +.nf + +$ puppet resource user luke +user { \'luke\': + home => \'/home/luke\', + uid => \'100\', + ensure => \'present\', + comment => \'Luke Kanies,,,\', + gid => \'1000\', + shell => \'/bin/bash\', + groups => [\'sysadmin\',\'audio\',\'video\',\'puppet\'] +} +. +.fi +. +.IP "" 0 +. +.SH "AUTHOR" +Luke Kanies +. +.SH "COPYRIGHT" +Copyright (c) 2005\-2007 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/ralsh.8 b/man/man8/ralsh.8 index f1bc84954..738537e84 100644 --- a/man/man8/ralsh.8 +++ b/man/man8/ralsh.8 @@ -10,7 +10,7 @@ Uses the Puppet RAL to directly interact with the system\. . .SH "USAGE" -puppet resource [\-h|\-\-help] [\-d|\-\-debug] [\-v|\-\-verbose] [\-e|\-\-edit] [\-H|\-\-host \fIhost\fR] [\-p|\-\-param] [\-t|\-\-types] \fItype\fR [\fIname\fR] [\fIattribute\fR=\fIvalue\fR \.\.\.] +puppet resource [\-h|\-\-help] [\-d|\-\-debug] [\-v|\-\-verbose] [\-e|\-\-edit] [\-H|\-\-host \fIhost\fR] [\-p|\-\-param \fIparameter\fR] [\-t|\-\-types] \fItype\fR [\fIname\fR] [\fIattribute\fR=\fIvalue\fR \.\.\.] . .SH "DESCRIPTION" This command provides simple facilities for converting current system state into Puppet code, along with some ability to modify the current state using Puppet\'s RAL\. -- cgit From b18f045d6349e4edf5d1593285d6788203fe81ae Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Thu, 17 Feb 2011 11:56:55 -0800 Subject: (#1204) Make rake gen_manpages fail explicitly if ronn isn't present Entire series: paired-with: Daniel Pittman paired-with: Paul Berry --- tasks/rake/manpages.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/rake/manpages.rake b/tasks/rake/manpages.rake index f48e57cc7..f7275e4c3 100644 --- a/tasks/rake/manpages.rake +++ b/tasks/rake/manpages.rake @@ -7,8 +7,8 @@ task :gen_manpages do bins = Dir.glob(%w{bin/*}) applications = Dir.glob(%w{lib/puppet/application/*}) # Locate ronn - ronn = %x{which ronn} - ronn.chomp! + ronn = %x{which ronn}.chomp + unless File.executable?(ronn) then fail("Ronn does not appear to be installed.") end # Create puppet.conf.5 man page %x{RUBYLIB=./lib:$RUBYLIB bin/puppetdoc --reference configuration > ./man/man5/puppetconf.5.ronn} -- cgit From e3c59df2b246fe5e764272f21b631a5d2f28687f Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Thu, 17 Feb 2011 13:52:40 -0800 Subject: (#5935) Allow functions to accept negated values function(-1) was failing because the grammar wasn't allowing negated values in function calls. This fix makes the negation of any value which was previously legal as a function argument also now legal as a function argument. Paired-With: Max Martin Paired-With: Markus Roberts --- lib/puppet/parser/grammar.ra | 3 + lib/puppet/parser/parser.rb | 1939 ++++++++++++++++---------------- spec/integration/parser/parser_spec.rb | 13 + 3 files changed, 993 insertions(+), 962 deletions(-) mode change 100644 => 100755 lib/puppet/parser/parser.rb diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index 98b8cfcfb..6360f5064 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -139,6 +139,9 @@ funcvalues: namestring # This is *almost* an rvalue, but I couldn't get a full # rvalue to work without scads of shift/reduce conflicts. namestring: name + | MINUS namestring =UMINUS { + result = ast AST::Minus, :value => val[1] + } | variable | type | boolean diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb old mode 100644 new mode 100755 index c2fbf976d..ff05996ec --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -21,7 +21,7 @@ module Puppet module Parser class Parser < Racc::Parser -module_eval(<<'...end grammar.ra/module_eval...', 'grammar.ra', 866) +module_eval(<<'...end grammar.ra/module_eval...', 'grammar.ra', 869) # It got too annoying having code in a file that needs to be compiled. require 'puppet/parser/parser_support' @@ -36,634 +36,640 @@ require 'puppet/parser/parser_support' ##### State transition tables begin ### racc_action_table = [ - 256, 257, 228, 63, 327, 64, 156, 54, 82, 356, - -166, 245, 176, 205, 210, 254, 37, 357, 65, 244, - 38, -168, 201, 203, 206, 209, 184, 11, 255, 241, - 242, 158, 54, 251, 72, 75, 72, 75, 102, 117, - 106, -170, 62, 194, 230, 58, 204, 208, 60, 306, - 213, 196, 197, 198, 200, 202, 97, 207, 211, 72, - 75, 241, 242, 102, 199, 106, 163, 71, 59, 307, - 58, 83, 86, 60, 193, 92, 54, 162, 72, 75, - 78, 100, 169, 163, 89, 72, 75, 94, 308, 102, - 163, 106, 71, 59, 162, 59, 83, 86, 59, 169, - 92, 162, 311, 72, 75, 78, 169, 97, 181, 89, - 353, 71, 228, 352, 58, 83, 269, 60, 71, 92, - 59, 345, 83, 86, 137, 184, 92, -171, 89, 72, - 75, 78, 100, 246, 368, 89, 71, 59, 94, 59, - 83, 86, 309, 173, 92, 314, 59, 163, 76, 78, - 72, 75, -167, 89, 102, 310, 106, 37, 162, 173, - 218, 127, 71, 169, 59, 220, 83, 269, 11, 14, - 92, 63, 97, 152, 37, 137, 72, 75, 127, 89, - 102, 319, 106, 71, 218, 11, 14, 83, 86, 220, - 59, 92, 72, 75, 72, 75, 78, 100, 270, 279, - 89, 349, 278, 94, 353, 207, 211, 352, 320, 71, - -169, 59, 199, 83, 86, 197, 198, 92, 72, 75, - 207, 211, 78, -169, 37, 71, 89, 199, 38, 83, - 269, -167, 193, 92, -166, 11, 14, 59, 137, 72, - 75, 272, 89, 102, 182, 106, 37, 207, 211, -186, - 38, 71, 181, 59, 199, 83, 86, 11, 337, 92, - 231, 97, 339, 76, 78, 72, 75, 37, 89, 82, - 48, 38, 71, 48, 323, 176, 83, 86, 11, 59, - 92, 342, 46, 47, 184, 78, 100, 74, -168, 89, - 72, 75, 94, -172, 102, 346, 106, -173, 71, 175, - 59, 59, 83, 86, 240, -171, 92, -170, 241, 242, - 76, 78, 97, 197, 198, 89, 72, 75, 207, 211, - 102, 214, 106, 71, 64, 199, 59, 83, 86, 276, - 215, 92, 217, 246, 275, 173, 78, 100, 97, 82, - 89, 72, 75, 94, 155, 102, 122, 106, 152, 71, - 223, 59, -168, 83, 86, 249, 277, 92, 176, 246, - 247, 122, 78, 100, 225, -166, 89, 72, 75, 94, - 117, 102, 226, 106, 71, -169, 271, 59, 83, 86, - 246, 247, 92, -21, -21, -21, -21, 78, 226, 97, - -167, 89, 72, 75, 52, -168, 102, -166, 106, -169, - 71, -167, 59, -171, 83, 86, 366, 152, 92, -23, - -23, -23, -23, 78, 100, 228, 226, 89, 72, 75, - 94, 50, 102, 373, 106, 71, 49, 375, 59, 83, - 86, 229, -221, 92, 237, 378, 72, 75, 78, 40, - 97, 39, 89, 355, 44, 45, 41, 42, 231, 234, - nil, 71, nil, 59, nil, 83, 86, nil, nil, 92, - 44, 45, 41, 42, 78, 100, 72, 75, 89, 71, - 102, 94, 106, 83, 269, nil, nil, 92, nil, 59, - nil, nil, 137, nil, nil, nil, 89, nil, 97, nil, - nil, nil, 72, 75, nil, nil, 102, 59, 106, 71, - nil, nil, nil, 83, 86, nil, nil, 92, nil, nil, - nil, nil, 78, 100, 97, nil, 89, nil, nil, 94, - nil, nil, 72, 75, nil, 71, 102, 59, 106, 83, - 86, nil, nil, 92, nil, nil, nil, nil, 78, 100, - nil, nil, 89, nil, 97, 94, nil, nil, 72, 75, - nil, nil, 102, 59, 106, 71, nil, nil, nil, 83, - 86, nil, nil, 92, nil, nil, 72, 75, 78, 100, - 97, nil, 89, 72, 75, 94, nil, 102, nil, 106, - nil, 71, nil, 59, nil, 83, 86, 72, 75, 92, - nil, 102, nil, nil, 78, 100, nil, nil, 89, 71, - nil, 94, nil, 83, 269, nil, 71, 92, nil, 59, - 83, 86, 137, nil, 92, nil, 89, nil, nil, 78, - 71, nil, nil, 89, 83, 143, nil, 59, 92, nil, - nil, nil, nil, 137, 59, 72, 75, 89, nil, 102, - nil, 106, 213, 196, 197, 198, 200, 202, 59, 207, - 211, nil, 213, 196, 197, 198, 199, 97, nil, 207, - 211, 72, 75, nil, nil, 102, 199, 106, 71, nil, - nil, nil, 83, 86, nil, nil, 92, nil, nil, nil, - nil, 78, 100, 97, nil, 89, nil, nil, 94, nil, - nil, 72, 75, nil, 71, 102, 59, 106, 83, 86, - nil, nil, 92, nil, nil, nil, nil, 78, 100, nil, - nil, 89, nil, 97, 94, nil, nil, nil, nil, nil, - nil, nil, 59, nil, 71, nil, nil, nil, 83, 86, - 72, 75, 92, nil, 102, 189, 106, 78, 100, nil, - nil, 89, nil, nil, 94, nil, nil, nil, nil, 72, - 75, nil, 59, 102, nil, 106, 72, 75, nil, nil, - 102, nil, 106, 71, nil, nil, nil, 83, 86, nil, - nil, 92, nil, nil, nil, nil, 78, nil, 97, nil, - 89, nil, 71, nil, nil, nil, 83, 86, nil, 71, - 92, 59, nil, 83, 86, 78, nil, 92, nil, 89, - nil, nil, 78, 100, nil, nil, 89, 72, 75, 94, - 59, 102, nil, 106, nil, nil, nil, 59, nil, nil, - nil, nil, nil, nil, nil, nil, 72, 75, nil, 97, - 102, nil, 106, 72, 75, nil, nil, 102, nil, 106, - 71, nil, nil, nil, 83, 86, nil, nil, 92, nil, - nil, nil, nil, 78, 100, 97, nil, 89, nil, 71, - 94, nil, nil, 83, 86, nil, 71, 92, 59, nil, - 83, 86, 78, nil, 92, nil, 89, nil, nil, 78, - 100, nil, nil, 89, 72, 75, 94, 59, 102, nil, - 106, nil, nil, nil, 59, nil, nil, nil, nil, nil, - nil, nil, nil, 72, 75, nil, 97, nil, nil, 72, - 75, nil, nil, nil, nil, nil, nil, 71, nil, nil, - nil, 83, 86, nil, nil, 92, 340, nil, nil, nil, - 78, 100, 177, nil, 89, nil, 71, 94, nil, nil, - 83, 86, 71, nil, 92, 59, 83, 86, 76, 78, - 92, nil, nil, 89, 76, 78, 72, 75, nil, 89, - 102, nil, 106, nil, 59, nil, 213, 196, 197, 198, - 59, nil, nil, 207, 211, 72, 75, nil, 97, 102, - 199, 106, 72, 75, nil, nil, nil, nil, nil, 71, - nil, nil, nil, 83, 86, nil, nil, 92, nil, nil, - 72, 75, 78, 100, nil, nil, 89, nil, 71, 94, - nil, nil, 83, 86, nil, 71, 92, 59, nil, 83, - 269, 78, nil, 92, nil, 89, nil, nil, 137, nil, - nil, nil, 89, 71, nil, nil, 59, 83, 269, nil, - nil, 92, nil, 59, nil, nil, 137, 72, 75, nil, - 89, 102, nil, 106, nil, nil, nil, nil, nil, nil, - nil, 59, nil, nil, nil, nil, 72, 75, nil, 97, - 102, nil, 106, 72, 75, nil, nil, 102, nil, 106, - 71, nil, nil, nil, 83, 86, nil, nil, 92, nil, - nil, nil, nil, 78, 100, 72, 75, 89, nil, 71, - 94, nil, nil, 83, 86, nil, 71, 92, 59, nil, - 83, 86, 78, nil, 92, nil, 89, nil, nil, 78, - 72, 75, nil, 89, 102, nil, 106, 59, 71, nil, - nil, nil, 83, 269, 59, nil, 92, nil, 72, 75, - nil, 137, 102, nil, 106, 89, nil, nil, nil, nil, - nil, nil, nil, 71, nil, nil, 59, 83, 86, nil, - 97, 92, nil, 72, 75, nil, 78, 102, nil, 106, - 89, 71, nil, 72, 75, 83, 86, 102, nil, 92, - nil, 59, nil, nil, 78, 100, nil, nil, 89, nil, - nil, 94, nil, nil, nil, nil, 71, nil, nil, 59, - 83, 86, nil, nil, 92, nil, 71, nil, nil, 78, - 83, 269, nil, 89, 92, nil, 72, 75, nil, 137, - 102, nil, 106, 89, 59, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 59, 72, 75, nil, 97, 102, - nil, 106, 72, 75, nil, nil, 102, nil, 106, 71, - nil, nil, nil, 83, 86, nil, nil, 92, nil, nil, - nil, nil, 78, 100, 97, nil, 89, nil, 71, 94, - nil, nil, 83, 86, nil, 71, 92, 59, nil, 83, - 86, 78, nil, 92, nil, 89, nil, nil, 78, 100, - 212, nil, 89, nil, nil, 94, 59, nil, nil, 205, - 210, nil, nil, 59, nil, nil, nil, nil, 201, 203, - 206, 209, nil, nil, 205, 210, nil, nil, nil, nil, - nil, nil, 274, 201, 203, 206, 209, nil, nil, nil, - nil, nil, 204, 208, nil, nil, 213, 196, 197, 198, - 200, 202, nil, 207, 211, nil, nil, 204, 208, nil, - 199, 213, 196, 197, 198, 200, 202, nil, 207, 211, - 205, 210, nil, nil, nil, 199, nil, nil, nil, 201, - 203, 206, 209, nil, nil, 205, 210, nil, nil, nil, - nil, nil, nil, nil, 201, 203, 206, 209, nil, nil, - nil, nil, nil, nil, 208, nil, nil, 213, 196, 197, - 198, 200, 202, nil, 207, 211, nil, nil, 204, 208, - nil, 199, 213, 196, 197, 198, 200, 202, nil, 207, - 211, 205, 210, nil, nil, nil, 199, nil, nil, nil, - 201, 203, 206, 209, nil, nil, 205, 210, nil, nil, - nil, nil, nil, nil, nil, 201, 203, 206, 209, nil, - nil, nil, nil, nil, 204, 208, nil, nil, 213, 196, - 197, 198, 200, 202, nil, 207, 211, nil, nil, nil, - nil, nil, 199, 213, 196, 197, 198, 200, 202, nil, - 207, 211, 205, 210, nil, nil, nil, 199, nil, nil, - nil, 201, 203, 206, 209, nil, nil, nil, 210, nil, - 213, 196, 197, 198, 200, 202, 201, 207, 211, nil, - nil, nil, nil, nil, 199, 204, 208, 210, nil, 213, - 196, 197, 198, 200, 202, 201, 207, 211, nil, nil, - nil, nil, 210, 199, 213, 196, 197, 198, 200, 202, - 201, 207, 211, nil, nil, nil, nil, nil, 199, nil, - nil, 210, nil, 213, 196, 197, 198, 200, 202, 201, - 207, 211, nil, nil, nil, nil, nil, 199, 213, 196, - 197, 198, 200, 202, nil, 207, 211, nil, nil, 384, - nil, nil, 199, nil, nil, nil, nil, 213, 196, 197, - 198, 200, 202, nil, 207, 211, nil, nil, 297, nil, - 26, 199, 33, 1, nil, 7, 12, nil, 17, nil, + 259, 260, 231, 63, 329, 64, 157, 54, 83, 248, + 321, 358, -168, 208, 213, 231, 37, 247, 65, 359, + 38, 63, 204, 206, 209, 212, 187, 11, 187, 244, + 245, 159, 54, 254, 73, 76, 73, 76, 103, -170, + 107, 118, 62, 197, 233, 58, 207, 211, 60, -167, + 216, 199, 200, 201, 203, 205, 98, 210, 214, 73, + 76, 244, 245, 103, 202, 107, 164, 72, 59, 308, + 58, 84, 87, 60, 196, 93, 54, 163, 73, 76, + 79, 101, 170, 164, 90, 73, 76, 95, 309, 103, + 164, 107, 72, 59, 163, 59, 84, 87, 310, 170, + 93, 163, -172, 73, 76, 79, 170, 98, 257, 90, + 355, 72, 311, 354, 58, 84, 178, 60, 72, 93, + 59, 258, 84, 87, 138, 312, 93, 355, 90, 184, + 354, 79, 101, 249, 370, 90, 72, 59, 95, 59, + 84, 178, 347, 313, 93, 185, 59, 164, 37, 138, + 73, 76, 38, 90, 103, 174, 107, 316, 163, 11, + 14, 73, 76, 170, 59, -187, 174, 37, 351, 73, + 76, 128, 98, 103, 184, 107, 73, 76, 11, 14, + 103, 37, 107, 72, 221, 128, 153, 84, 87, 223, + 59, 93, 11, 14, 73, 76, 79, 101, 98, 196, + 90, 37, 72, 95, 322, 38, 84, 87, 325, 72, + 93, 59, 11, 84, 87, 79, 273, 93, -171, 90, + 249, 250, 79, 101, 73, 76, 90, 72, 83, 95, + 59, 84, 87, 281, 37, 93, 280, 59, 38, 77, + 79, 48, 73, 76, 90, 11, 75, 69, 272, 221, + 46, 47, 210, 214, 223, 59, 48, 72, 59, 202, + -169, 84, 87, 179, -169, 93, -174, 73, 76, 77, + 79, 103, 339, 107, 90, 72, 234, 69, 341, 84, + 178, 176, 243, 93, 179, 59, 244, 245, 138, 98, + 200, 201, 90, 73, 76, 210, 214, 103, 344, 107, + 72, 174, 202, 59, 84, 87, 200, 201, 93, -167, + 348, 210, 214, 79, 101, 73, 76, 90, 202, 103, + 95, 107, 73, 76, -170, -168, 72, -173, 59, -172, + 84, 87, -171, 217, 93, 64, 73, 76, 279, 79, + 103, 218, 107, 90, 156, 274, 278, 123, 72, 153, + 249, 277, 84, 87, 59, 72, 93, 73, 76, 84, + 87, 79, 220, 93, 357, 90, 252, 77, 79, 72, + 249, 250, 90, 84, 87, 69, 59, 93, 210, 214, + 123, 83, 79, 59, 226, 202, 90, 73, 76, 187, + 72, 103, 192, 107, 84, 178, 153, 59, 93, 44, + 45, 41, 42, 138, 231, 73, 76, 90, 229, 103, + 118, 107, -23, -23, -23, -23, -169, 240, 59, 179, + 72, 229, 237, 52, 84, 87, -169, 98, 93, 44, + 45, 41, 42, 79, -167, 73, 76, 90, 72, 103, + -170, 107, 84, 87, -168, -172, 93, 368, 59, 234, + 228, 79, 101, 232, 50, 90, 375, 98, 95, 49, + 377, 73, 76, -168, -222, 103, 59, 107, 72, -170, + 380, 40, 84, 87, 39, 229, 93, -21, -21, -21, + -21, 79, 101, 98, -167, 90, nil, nil, 95, nil, + nil, 73, 76, nil, 72, 103, 59, 107, 84, 87, + nil, nil, 93, nil, nil, nil, nil, 79, 101, nil, + nil, 90, nil, 98, 95, nil, nil, 73, 76, nil, + nil, 103, 59, 107, 72, nil, nil, nil, 84, 87, + nil, nil, 93, nil, nil, 73, 76, 79, 101, 98, + nil, 90, 73, 76, 95, nil, 103, nil, 107, nil, + 72, nil, 59, nil, 84, 87, 73, 76, 93, nil, + 103, nil, nil, 79, 101, nil, nil, 90, 72, nil, + 95, nil, 84, 178, nil, 72, 93, nil, 59, 84, + 87, 138, nil, 93, nil, 90, nil, nil, 79, 72, + nil, nil, 90, 84, 144, nil, 59, 93, nil, nil, + nil, nil, 138, 59, 73, 76, 90, nil, 103, nil, + 107, 216, 199, 200, 201, nil, nil, 59, 210, 214, + nil, 216, 199, 200, 201, 202, 98, nil, 210, 214, + 73, 76, nil, nil, 103, 202, 107, 72, nil, nil, + nil, 84, 87, nil, nil, 93, nil, nil, nil, nil, + 79, 101, 98, nil, 90, nil, nil, 95, nil, nil, + 73, 76, nil, 72, 103, 59, 107, 84, 87, nil, + nil, 93, nil, nil, nil, nil, 79, 101, nil, nil, + 90, nil, 98, 95, nil, nil, 73, 76, nil, nil, + 103, 59, 107, 72, nil, nil, nil, 84, 87, nil, + nil, 93, nil, nil, nil, nil, 79, 101, 73, 76, + 90, nil, 103, 95, 107, nil, nil, nil, nil, 72, + nil, 59, nil, 84, 87, nil, nil, 93, nil, 73, + 76, nil, 79, 103, nil, 107, 90, nil, nil, nil, + nil, 72, nil, nil, nil, 84, 87, 59, nil, 93, + nil, 98, nil, nil, 79, 73, 76, nil, 90, nil, + nil, nil, 72, nil, nil, nil, 84, 87, nil, 59, + 93, nil, nil, 73, 76, 79, 101, nil, 342, 90, + 73, 76, 95, nil, 103, nil, 107, nil, 72, nil, + 59, nil, 84, 87, 73, 76, 93, nil, nil, nil, + 77, 79, nil, nil, nil, 90, 72, nil, 69, nil, + 84, 178, nil, 72, 93, nil, 59, 84, 87, 138, + nil, 93, nil, 90, 73, 76, 79, 72, nil, nil, + 90, 84, 178, nil, 59, 93, nil, nil, nil, 77, + 138, 59, 73, 76, 90, nil, 103, 69, 107, nil, + nil, nil, nil, nil, nil, 59, nil, 72, nil, nil, + nil, 84, 178, nil, 98, 93, nil, 73, 76, nil, + 138, nil, nil, nil, 90, 72, nil, nil, nil, 84, + 87, nil, nil, 93, nil, 59, nil, nil, 79, 101, + 180, nil, 90, 73, 76, 95, nil, 103, nil, 107, + 72, nil, nil, 59, 84, 87, nil, nil, 93, nil, + nil, nil, 77, 79, nil, 98, nil, 90, 73, 76, + 69, nil, 103, nil, 107, nil, 72, nil, 59, nil, + 84, 87, 73, 76, 93, nil, 103, nil, 107, 79, + 101, nil, nil, 90, nil, nil, 95, nil, 73, 76, + nil, 72, 103, nil, 59, 84, 87, nil, nil, 93, + nil, nil, nil, nil, 79, 72, nil, nil, 90, 84, + 87, nil, nil, 93, nil, 73, 76, nil, 79, 59, + nil, 72, 90, nil, nil, 84, 178, nil, nil, 93, + nil, 73, 76, 59, 138, 103, nil, 107, 90, nil, + nil, 73, 76, nil, nil, 103, nil, 107, 72, 59, + nil, nil, 84, 178, nil, nil, 93, nil, nil, nil, + nil, 138, nil, 98, 72, 90, nil, nil, 84, 87, + nil, nil, 93, nil, 72, nil, 59, 79, 84, 87, + nil, 90, 93, nil, nil, nil, nil, 79, 101, 73, + 76, 90, 59, 103, 95, 107, 216, 199, 200, 201, + 203, 205, 59, 210, 214, nil, nil, nil, nil, nil, + 202, 98, nil, nil, nil, 73, 76, nil, nil, 103, + nil, 107, 72, nil, nil, nil, 84, 87, nil, nil, + 93, nil, nil, nil, nil, 79, 101, 98, nil, 90, + nil, nil, 95, nil, nil, 73, 76, nil, 72, 103, + 59, 107, 84, 87, nil, nil, 93, nil, nil, nil, + nil, 79, 101, nil, nil, 90, nil, 98, 95, nil, + nil, 73, 76, nil, nil, 103, 59, 107, 72, nil, + nil, nil, 84, 87, nil, nil, 93, nil, nil, nil, + nil, 79, 101, 98, nil, 90, nil, nil, 95, nil, + nil, 73, 76, nil, 72, 103, 59, 107, 84, 87, + nil, nil, 93, nil, nil, nil, nil, 79, 101, nil, + nil, 90, nil, 98, 95, nil, nil, 73, 76, nil, + nil, 103, 59, 107, 72, nil, nil, nil, 84, 87, + nil, nil, 93, nil, nil, nil, nil, 79, 101, 98, + nil, 90, nil, nil, 95, nil, nil, 73, 76, nil, + 72, 103, 59, 107, 84, 87, nil, nil, 93, nil, + nil, nil, nil, 79, 101, nil, nil, 90, nil, 98, + 95, nil, nil, 73, 76, nil, nil, 103, 59, 107, + 72, nil, nil, nil, 84, 87, nil, nil, 93, nil, + nil, nil, nil, 79, 101, nil, nil, 90, nil, nil, + 95, nil, nil, nil, nil, nil, 72, 215, 59, nil, + 84, 87, nil, nil, 93, nil, 208, 213, nil, 79, + nil, nil, nil, 90, nil, 204, 206, 209, 212, nil, + nil, 208, 213, nil, 59, nil, nil, nil, nil, 276, + 204, 206, 209, 212, nil, nil, nil, nil, nil, 207, + 211, nil, nil, 216, 199, 200, 201, 203, 205, nil, + 210, 214, nil, nil, 207, 211, nil, 202, 216, 199, + 200, 201, 203, 205, nil, 210, 214, 208, 213, nil, + nil, nil, 202, nil, nil, nil, 204, 206, 209, 212, + nil, nil, 208, 213, nil, nil, nil, nil, nil, nil, + nil, 204, 206, 209, 212, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 216, 199, 200, 201, 203, 205, + nil, 210, 214, nil, nil, nil, 211, nil, 202, 216, + 199, 200, 201, 203, 205, nil, 210, 214, 208, 213, + nil, nil, nil, 202, nil, nil, nil, 204, 206, 209, + 212, nil, nil, 208, 213, nil, nil, nil, nil, nil, + nil, nil, 204, 206, 209, 212, nil, nil, nil, nil, + nil, 207, 211, nil, nil, 216, 199, 200, 201, 203, + 205, nil, 210, 214, nil, nil, 207, 211, nil, 202, + 216, 199, 200, 201, 203, 205, nil, 210, 214, 208, + 213, nil, nil, nil, 202, nil, nil, nil, 204, 206, + 209, 212, nil, nil, nil, 213, nil, 216, 199, 200, + 201, 203, 205, 204, 210, 214, nil, nil, nil, nil, + nil, 202, 207, 211, 213, nil, 216, 199, 200, 201, + 203, 205, 204, 210, 214, nil, nil, nil, nil, 213, + 202, 216, 199, 200, 201, 203, 205, 204, 210, 214, + nil, nil, nil, nil, nil, 202, nil, nil, 213, nil, + 216, 199, 200, 201, 203, 205, 204, 210, 214, nil, + nil, nil, nil, nil, 202, 216, 199, 200, 201, 203, + 205, nil, 210, 214, nil, nil, 352, nil, nil, 202, + nil, nil, nil, nil, 216, 199, 200, 201, 203, 205, + nil, 210, 214, nil, nil, 360, nil, 26, 202, 33, + 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, + nil, 3, nil, nil, 11, 14, 26, 299, 33, 1, + nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, + 3, nil, nil, 11, 14, nil, 366, nil, 26, nil, + 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, + 29, nil, 3, nil, nil, 11, 14, 26, 367, 33, + 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, + nil, 3, nil, nil, 11, 14, nil, 378, nil, 26, + nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, + nil, 29, nil, 3, nil, nil, 11, 14, 26, 382, + 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, + 29, nil, 3, nil, nil, 11, 14, nil, 307, nil, + 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, 14, 26, - 305, 33, 1, nil, 7, 12, nil, 17, nil, 23, - nil, 29, nil, 3, nil, nil, 11, 14, nil, 383, + 384, 33, 1, nil, 7, 12, nil, 17, nil, 23, + nil, 29, nil, 3, nil, nil, 11, 14, nil, 385, nil, 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, 14, - 26, 325, 33, 1, nil, 7, 12, nil, 17, nil, + 26, 327, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, 14, nil, - 382, nil, 26, nil, 33, 1, nil, 7, 12, nil, + 386, nil, 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, - 14, 26, 380, 33, 1, nil, 7, 12, nil, 17, + 14, 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, 14, - nil, 376, nil, 26, nil, 33, 1, nil, 7, 12, - nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, - 11, 14, 26, 350, 33, 1, nil, 7, 12, nil, - 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, - 14, nil, 358, nil, 26, nil, 33, 1, nil, 7, - 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, - nil, 11, 14, 26, 365, 33, 1, nil, 7, 12, - nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, - 11, 14, nil, 364, nil, 26, nil, 33, 1, nil, - 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, - nil, nil, 11, 14, 26, nil, 33, 1, nil, 7, - 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, - nil, 11, 14, 26, nil, 33, 1, nil, 7, 12, - nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, - 11, 14, 26, nil, 33, 1, nil, 7, 12, nil, - 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, - 14 ] + 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, + 23, nil, 29, nil, 3, nil, nil, 11, 14, 26, + nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, + nil, 29, nil, 3, nil, nil, 11, 14 ] racc_action_check = [ - 180, 180, 152, 22, 243, 22, 55, 17, 86, 301, - 81, 165, 96, 180, 180, 178, 12, 301, 22, 165, - 12, 95, 180, 180, 180, 180, 86, 12, 178, 243, - 243, 55, 156, 174, 208, 208, 106, 106, 208, 215, - 208, 91, 22, 106, 152, 17, 180, 180, 17, 218, - 180, 180, 180, 180, 180, 180, 208, 180, 180, 176, - 176, 174, 174, 176, 180, 176, 62, 208, 17, 219, - 156, 208, 208, 156, 106, 208, 158, 62, 369, 369, - 208, 208, 62, 239, 208, 205, 205, 208, 220, 205, - 65, 205, 176, 156, 239, 208, 176, 176, 211, 239, - 176, 65, 224, 181, 181, 176, 65, 205, 273, 176, - 350, 369, 143, 350, 158, 369, 369, 158, 205, 369, - 176, 273, 205, 205, 369, 143, 205, 90, 369, 356, - 356, 205, 205, 344, 344, 205, 181, 158, 205, 369, - 181, 181, 221, 226, 181, 227, 205, 163, 181, 181, - 352, 352, 87, 181, 352, 221, 352, 120, 163, 229, - 309, 120, 356, 163, 181, 309, 356, 356, 120, 120, - 356, 85, 352, 231, 43, 356, 342, 342, 43, 356, - 342, 232, 342, 352, 122, 43, 43, 352, 352, 122, - 356, 352, 182, 182, 278, 278, 352, 352, 182, 195, - 352, 278, 195, 352, 297, 281, 281, 297, 233, 342, - 103, 352, 281, 342, 342, 280, 280, 342, 184, 184, - 280, 280, 342, 84, 30, 182, 342, 280, 30, 182, - 182, 105, 278, 182, 101, 30, 30, 342, 182, 204, - 204, 184, 182, 204, 80, 204, 1, 282, 282, 78, - 1, 184, 77, 182, 282, 184, 184, 1, 250, 184, - 252, 204, 253, 184, 184, 23, 23, 234, 184, 23, - 71, 234, 204, 7, 234, 70, 204, 204, 234, 184, - 204, 264, 7, 7, 269, 204, 204, 23, 68, 204, - 26, 26, 204, 107, 26, 275, 26, 67, 23, 66, - 204, 207, 23, 23, 160, 108, 23, 109, 160, 160, - 23, 23, 26, 298, 298, 23, 196, 196, 298, 298, - 196, 114, 196, 26, 115, 298, 23, 26, 26, 188, - 119, 26, 121, 188, 188, 64, 26, 26, 196, 127, - 26, 29, 29, 26, 52, 29, 51, 29, 50, 196, - 132, 26, 133, 196, 196, 171, 192, 196, 135, 171, - 171, 36, 196, 196, 136, 138, 196, 213, 213, 196, - 33, 213, 139, 213, 29, 140, 183, 196, 29, 29, - 183, 183, 29, 28, 28, 28, 28, 29, 316, 213, - 142, 29, 306, 306, 16, 328, 306, 329, 306, 331, - 213, 332, 29, 333, 213, 213, 338, 175, 213, 35, - 35, 35, 35, 213, 213, 173, 172, 213, 197, 197, - 213, 9, 197, 353, 197, 306, 8, 357, 213, 306, - 306, 144, 368, 306, 157, 370, 299, 299, 306, 3, - 197, 2, 306, 299, 34, 34, 34, 34, 153, 154, - nil, 197, nil, 306, nil, 197, 197, nil, nil, 197, - 4, 4, 4, 4, 197, 197, 39, 39, 197, 299, - 39, 197, 39, 299, 299, nil, nil, 299, nil, 197, - nil, nil, 299, nil, nil, nil, 299, nil, 39, nil, - nil, nil, 206, 206, nil, nil, 206, 299, 206, 39, - nil, nil, nil, 39, 39, nil, nil, 39, nil, nil, - nil, nil, 39, 39, 206, nil, 39, nil, nil, 39, - nil, nil, 46, 46, nil, 206, 46, 39, 46, 206, - 206, nil, nil, 206, nil, nil, nil, nil, 206, 206, - nil, nil, 206, nil, 46, 206, nil, nil, 47, 47, - nil, nil, 47, 206, 47, 46, nil, nil, nil, 46, - 46, nil, nil, 46, nil, nil, 270, 270, 46, 46, - 47, nil, 46, 48, 48, 46, nil, 48, nil, 48, - nil, 47, nil, 46, nil, 47, 47, 49, 49, 47, - nil, 49, nil, nil, 47, 47, nil, nil, 47, 270, - nil, 47, nil, 270, 270, nil, 48, 270, nil, 47, - 48, 48, 270, nil, 48, nil, 270, nil, nil, 48, - 49, nil, nil, 48, 49, 49, nil, 270, 49, nil, - nil, nil, nil, 49, 48, 203, 203, 49, nil, 203, - nil, 203, 294, 294, 294, 294, 294, 294, 49, 294, - 294, nil, 284, 284, 284, 284, 294, 203, nil, 284, - 284, 209, 209, nil, nil, 209, 284, 209, 203, nil, - nil, nil, 203, 203, nil, nil, 203, nil, nil, nil, - nil, 203, 203, 209, nil, 203, nil, nil, 203, nil, - nil, 210, 210, nil, 209, 210, 203, 210, 209, 209, - nil, nil, 209, nil, nil, nil, nil, 209, 209, nil, - nil, 209, nil, 210, 209, nil, nil, nil, nil, nil, - nil, nil, 209, nil, 210, nil, nil, nil, 210, 210, - 102, 102, 210, nil, 102, 102, 102, 210, 210, nil, - nil, 210, nil, nil, 210, nil, nil, nil, nil, 63, - 63, nil, 210, 63, nil, 63, 202, 202, nil, nil, - 202, nil, 202, 102, nil, nil, nil, 102, 102, nil, - nil, 102, nil, nil, nil, nil, 102, nil, 202, nil, - 102, nil, 63, nil, nil, nil, 63, 63, nil, 202, - 63, 102, nil, 202, 202, 63, nil, 202, nil, 63, - nil, nil, 202, 202, nil, nil, 202, 100, 100, 202, - 63, 100, nil, 100, nil, nil, nil, 202, nil, nil, - nil, nil, nil, nil, nil, nil, 277, 277, nil, 100, - 277, nil, 277, 198, 198, nil, nil, 198, nil, 198, - 100, nil, nil, nil, 100, 100, nil, nil, 100, nil, - nil, nil, nil, 100, 100, 198, nil, 100, nil, 277, - 100, nil, nil, 277, 277, nil, 198, 277, 100, nil, - 198, 198, 277, nil, 198, nil, 277, nil, nil, 198, - 198, nil, nil, 198, 256, 256, 198, 277, 256, nil, - 256, nil, nil, nil, 198, nil, nil, nil, nil, nil, - nil, nil, nil, 254, 254, nil, 256, nil, nil, 74, - 74, nil, nil, nil, nil, nil, nil, 256, nil, nil, - nil, 256, 256, nil, nil, 256, 254, nil, nil, nil, - 256, 256, 74, nil, 256, nil, 254, 256, nil, nil, - 254, 254, 74, nil, 254, 256, 74, 74, 254, 254, - 74, nil, nil, 254, 74, 74, 75, 75, nil, 74, - 75, nil, 75, nil, 254, nil, 286, 286, 286, 286, - 74, nil, nil, 286, 286, 248, 248, nil, 75, 248, - 286, 248, 245, 245, nil, nil, nil, nil, nil, 75, - nil, nil, nil, 75, 75, nil, nil, 75, nil, nil, - 244, 244, 75, 75, nil, nil, 75, nil, 248, 75, - nil, nil, 248, 248, nil, 245, 248, 75, nil, 245, - 245, 248, nil, 245, nil, 248, nil, nil, 245, nil, - nil, nil, 245, 244, nil, nil, 248, 244, 244, nil, - nil, 244, nil, 245, nil, nil, 244, 97, 97, nil, - 244, 97, nil, 97, nil, nil, nil, nil, nil, nil, - nil, 244, nil, nil, nil, nil, 82, 82, nil, 97, - 82, nil, 82, 199, 199, nil, nil, 199, nil, 199, - 97, nil, nil, nil, 97, 97, nil, nil, 97, nil, - nil, nil, nil, 97, 97, 214, 214, 97, nil, 82, - 97, nil, nil, 82, 82, nil, 199, 82, 97, nil, - 199, 199, 82, nil, 199, nil, 82, nil, nil, 199, - 230, 230, nil, 199, 230, nil, 230, 82, 214, nil, - nil, nil, 214, 214, 199, nil, 214, nil, 200, 200, - nil, 214, 200, nil, 200, 214, nil, nil, nil, nil, - nil, nil, nil, 230, nil, nil, 214, 230, 230, nil, - 200, 230, nil, 228, 228, nil, 230, 228, nil, 228, - 230, 200, nil, 225, 225, 200, 200, 225, nil, 200, - nil, 230, nil, nil, 200, 200, nil, nil, 200, nil, - nil, 200, nil, nil, nil, nil, 228, nil, nil, 200, - 228, 228, nil, nil, 228, nil, 225, nil, nil, 228, - 225, 225, nil, 228, 225, nil, 201, 201, nil, 225, - 201, nil, 201, 225, 228, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 225, 308, 308, nil, 201, 308, - nil, 308, 94, 94, nil, nil, 94, nil, 94, 201, - nil, nil, nil, 201, 201, nil, nil, 201, nil, nil, - nil, nil, 201, 201, 94, nil, 201, nil, 308, 201, - nil, nil, 308, 308, nil, 94, 308, 201, nil, 94, - 94, 308, nil, 94, nil, 308, nil, nil, 94, 94, - 111, nil, 94, nil, nil, 94, 308, nil, nil, 111, - 111, nil, nil, 94, nil, nil, nil, nil, 111, 111, - 111, 111, nil, nil, 186, 186, nil, nil, nil, nil, - nil, nil, 186, 186, 186, 186, 186, nil, nil, nil, - nil, nil, 111, 111, nil, nil, 111, 111, 111, 111, - 111, 111, nil, 111, 111, nil, nil, 186, 186, nil, - 111, 186, 186, 186, 186, 186, 186, nil, 186, 186, - 288, 288, nil, nil, nil, 186, nil, nil, nil, 288, - 288, 288, 288, nil, nil, 131, 131, nil, nil, nil, - nil, nil, nil, nil, 131, 131, 131, 131, nil, nil, - nil, nil, nil, nil, 288, nil, nil, 288, 288, 288, - 288, 288, 288, nil, 288, 288, nil, nil, 131, 131, - nil, 288, 131, 131, 131, 131, 131, 131, nil, 131, - 131, 130, 130, nil, nil, nil, 131, nil, nil, nil, - 130, 130, 130, 130, nil, nil, 292, 292, nil, nil, - nil, nil, nil, nil, nil, 292, 292, 292, 292, nil, - nil, nil, nil, nil, 130, 130, nil, nil, 130, 130, - 130, 130, 130, 130, nil, 130, 130, nil, nil, nil, - nil, nil, 130, 292, 292, 292, 292, 292, 292, nil, - 292, 292, 124, 124, nil, nil, nil, 292, nil, nil, - nil, 124, 124, 124, 124, nil, nil, nil, 293, nil, - 285, 285, 285, 285, 285, 285, 293, 285, 285, nil, - nil, nil, nil, nil, 285, 124, 124, 289, nil, 124, - 124, 124, 124, 124, 124, 289, 124, 124, nil, nil, - nil, nil, 287, 124, 293, 293, 293, 293, 293, 293, - 287, 293, 293, nil, nil, nil, nil, nil, 293, nil, - nil, 290, nil, 289, 289, 289, 289, 289, 289, 290, - 289, 289, nil, nil, nil, nil, nil, 289, 287, 287, - 287, 287, 287, 287, nil, 287, 287, nil, nil, 381, - nil, nil, 287, nil, nil, nil, nil, 290, 290, 290, - 290, 290, 290, nil, 290, 290, nil, nil, 212, nil, - 381, 290, 381, 381, nil, 381, 381, nil, 381, nil, - 381, nil, 381, nil, 381, nil, nil, 381, 381, 212, - 217, 212, 212, nil, 212, 212, nil, 212, nil, 212, - nil, 212, nil, 212, nil, nil, 212, 212, nil, 379, - nil, 217, nil, 217, 217, nil, 217, 217, nil, 217, - nil, 217, nil, 217, nil, 217, nil, nil, 217, 217, - 379, 237, 379, 379, nil, 379, 379, nil, 379, nil, - 379, nil, 379, nil, 379, nil, nil, 379, 379, nil, - 375, nil, 237, nil, 237, 237, nil, 237, 237, nil, - 237, nil, 237, nil, 237, nil, 237, nil, nil, 237, - 237, 375, 373, 375, 375, nil, 375, 375, nil, 375, - nil, 375, nil, 375, nil, 375, nil, nil, 375, 375, - nil, 363, nil, 373, nil, 373, 373, nil, 373, 373, - nil, 373, nil, 373, nil, 373, nil, 373, nil, nil, - 373, 373, 363, 296, 363, 363, nil, 363, 363, nil, - 363, nil, 363, nil, 363, nil, 363, nil, nil, 363, - 363, nil, 304, nil, 296, nil, 296, 296, nil, 296, - 296, nil, 296, nil, 296, nil, 296, nil, 296, nil, - nil, 296, 296, 304, 324, 304, 304, nil, 304, 304, - nil, 304, nil, 304, nil, 304, nil, 304, nil, nil, - 304, 304, nil, 320, nil, 324, nil, 324, 324, nil, - 324, 324, nil, 324, nil, 324, nil, 324, nil, 324, - nil, nil, 324, 324, 320, nil, 320, 320, nil, 320, - 320, nil, 320, nil, 320, nil, 320, nil, 320, nil, - nil, 320, 320, 19, nil, 19, 19, nil, 19, 19, - nil, 19, nil, 19, nil, 19, nil, 19, nil, nil, - 19, 19, 0, nil, 0, 0, nil, 0, 0, nil, - 0, nil, 0, nil, 0, nil, 0, nil, nil, 0, - 0 ] + 183, 183, 153, 22, 246, 22, 55, 157, 87, 166, + 235, 303, 88, 183, 183, 144, 12, 166, 22, 303, + 12, 86, 183, 183, 183, 183, 87, 12, 144, 246, + 246, 55, 17, 175, 200, 200, 107, 107, 200, 85, + 200, 218, 22, 107, 153, 157, 183, 183, 157, 82, + 183, 183, 183, 183, 183, 183, 200, 183, 183, 179, + 179, 175, 175, 179, 183, 179, 62, 200, 157, 221, + 17, 200, 200, 17, 107, 200, 159, 62, 371, 371, + 200, 200, 62, 164, 200, 205, 205, 200, 222, 205, + 242, 205, 179, 17, 164, 200, 179, 179, 223, 164, + 179, 242, 91, 358, 358, 179, 242, 205, 181, 179, + 299, 371, 224, 299, 159, 371, 371, 159, 205, 371, + 179, 181, 205, 205, 371, 224, 205, 352, 371, 275, + 352, 205, 205, 346, 346, 205, 358, 159, 205, 371, + 358, 358, 275, 227, 358, 81, 205, 65, 30, 358, + 354, 354, 30, 358, 354, 229, 354, 230, 65, 30, + 30, 280, 280, 65, 358, 79, 232, 43, 280, 344, + 344, 43, 354, 344, 78, 344, 206, 206, 43, 43, + 206, 121, 206, 354, 123, 121, 234, 354, 354, 123, + 214, 354, 121, 121, 184, 184, 354, 354, 206, 280, + 354, 237, 344, 354, 236, 237, 344, 344, 237, 206, + 344, 354, 237, 206, 206, 344, 186, 206, 92, 344, + 186, 186, 206, 206, 23, 23, 206, 184, 23, 206, + 344, 184, 184, 198, 1, 184, 198, 206, 1, 184, + 184, 7, 185, 185, 184, 1, 23, 184, 185, 311, + 7, 7, 284, 284, 311, 184, 72, 23, 210, 284, + 96, 23, 23, 71, 68, 23, 67, 26, 26, 23, + 23, 26, 253, 26, 23, 185, 255, 23, 256, 185, + 185, 66, 161, 185, 97, 23, 161, 161, 185, 26, + 282, 282, 185, 310, 310, 282, 282, 310, 267, 310, + 26, 64, 282, 185, 26, 26, 300, 300, 26, 102, + 277, 300, 300, 26, 26, 29, 29, 26, 300, 29, + 26, 29, 187, 187, 104, 106, 310, 108, 26, 109, + 310, 310, 110, 115, 310, 116, 308, 308, 195, 310, + 308, 120, 308, 310, 52, 187, 191, 51, 29, 50, + 191, 191, 29, 29, 310, 187, 29, 301, 301, 187, + 187, 29, 122, 187, 301, 29, 172, 187, 187, 308, + 172, 172, 187, 308, 308, 187, 29, 308, 283, 283, + 36, 128, 308, 187, 133, 283, 308, 103, 103, 178, + 301, 103, 103, 103, 301, 301, 176, 308, 301, 4, + 4, 4, 4, 301, 174, 199, 199, 301, 173, 199, + 33, 199, 35, 35, 35, 35, 134, 158, 301, 136, + 103, 318, 155, 16, 103, 103, 330, 199, 103, 34, + 34, 34, 34, 103, 331, 39, 39, 103, 199, 39, + 333, 39, 199, 199, 334, 335, 199, 340, 103, 154, + 137, 199, 199, 145, 9, 199, 355, 39, 199, 8, + 359, 207, 207, 143, 370, 207, 199, 207, 39, 141, + 372, 3, 39, 39, 2, 140, 39, 28, 28, 28, + 28, 39, 39, 207, 139, 39, nil, nil, 39, nil, + nil, 46, 46, nil, 207, 46, 39, 46, 207, 207, + nil, nil, 207, nil, nil, nil, nil, 207, 207, nil, + nil, 207, nil, 46, 207, nil, nil, 47, 47, nil, + nil, 47, 207, 47, 46, nil, nil, nil, 46, 46, + nil, nil, 46, nil, nil, 272, 272, 46, 46, 47, + nil, 46, 48, 48, 46, nil, 48, nil, 48, nil, + 47, nil, 46, nil, 47, 47, 49, 49, 47, nil, + 49, nil, nil, 47, 47, nil, nil, 47, 272, nil, + 47, nil, 272, 272, nil, 48, 272, nil, 47, 48, + 48, 272, nil, 48, nil, 272, nil, nil, 48, 49, + nil, nil, 48, 49, 49, nil, 272, 49, nil, nil, + nil, nil, 49, 48, 101, 101, 49, nil, 101, nil, + 101, 286, 286, 286, 286, nil, nil, 49, 286, 286, + nil, 288, 288, 288, 288, 286, 101, nil, 288, 288, + 98, 98, nil, nil, 98, 288, 98, 101, nil, nil, + nil, 101, 101, nil, nil, 101, nil, nil, nil, nil, + 101, 101, 98, nil, 101, nil, nil, 101, nil, nil, + 201, 201, nil, 98, 201, 101, 201, 98, 98, nil, + nil, 98, nil, nil, nil, nil, 98, 98, nil, nil, + 98, nil, 201, 98, nil, nil, 279, 279, nil, nil, + 279, 98, 279, 201, nil, nil, nil, 201, 201, nil, + nil, 201, nil, nil, nil, nil, 201, 201, 63, 63, + 201, nil, 63, 201, 63, nil, nil, nil, nil, 279, + nil, 201, nil, 279, 279, nil, nil, 279, nil, 259, + 259, nil, 279, 259, nil, 259, 279, nil, nil, nil, + nil, 63, nil, nil, nil, 63, 63, 279, nil, 63, + nil, 259, nil, nil, 63, 257, 257, nil, 63, nil, + nil, nil, 259, nil, nil, nil, 259, 259, nil, 63, + 259, nil, nil, 248, 248, 259, 259, nil, 257, 259, + 251, 251, 259, nil, 251, nil, 251, nil, 257, nil, + 259, nil, 257, 257, 69, 69, 257, nil, nil, nil, + 257, 257, nil, nil, nil, 257, 248, nil, 257, nil, + 248, 248, nil, 251, 248, nil, 257, 251, 251, 248, + nil, 251, nil, 248, 247, 247, 251, 69, nil, nil, + 251, 69, 69, nil, 248, 69, nil, nil, nil, 69, + 69, 251, 204, 204, 69, nil, 204, 69, 204, nil, + nil, nil, nil, nil, nil, 69, nil, 247, nil, nil, + nil, 247, 247, nil, 204, 247, nil, 75, 75, nil, + 247, nil, nil, nil, 247, 204, nil, nil, nil, 204, + 204, nil, nil, 204, nil, 247, nil, nil, 204, 204, + 75, nil, 204, 76, 76, 204, nil, 76, nil, 76, + 75, nil, nil, 204, 75, 75, nil, nil, 75, nil, + nil, nil, 75, 75, nil, 76, nil, 75, 233, 233, + 75, nil, 233, nil, 233, nil, 76, nil, 75, nil, + 76, 76, 231, 231, 76, nil, 231, nil, 231, 76, + 76, nil, nil, 76, nil, nil, 76, nil, 228, 228, + nil, 233, 228, nil, 76, 233, 233, nil, nil, 233, + nil, nil, nil, nil, 233, 231, nil, nil, 233, 231, + 231, nil, nil, 231, nil, 217, 217, nil, 231, 233, + nil, 228, 231, nil, nil, 228, 228, nil, nil, 228, + nil, 202, 202, 231, 228, 202, nil, 202, 228, nil, + nil, 208, 208, nil, nil, 208, nil, 208, 217, 228, + nil, nil, 217, 217, nil, nil, 217, nil, nil, nil, + nil, 217, nil, 208, 202, 217, nil, nil, 202, 202, + nil, nil, 202, nil, 208, nil, 217, 202, 208, 208, + nil, 202, 208, nil, nil, nil, nil, 208, 208, 216, + 216, 208, 202, 216, 208, 216, 287, 287, 287, 287, + 287, 287, 208, 287, 287, nil, nil, nil, nil, nil, + 287, 216, nil, nil, nil, 203, 203, nil, nil, 203, + nil, 203, 216, nil, nil, nil, 216, 216, nil, nil, + 216, nil, nil, nil, nil, 216, 216, 203, nil, 216, + nil, nil, 216, nil, nil, 213, 213, nil, 203, 213, + 216, 213, 203, 203, nil, nil, 203, nil, nil, nil, + nil, 203, 203, nil, nil, 203, nil, 213, 203, nil, + nil, 212, 212, nil, nil, 212, 203, 212, 213, nil, + nil, nil, 213, 213, nil, nil, 213, nil, nil, nil, + nil, 213, 213, 212, nil, 213, nil, nil, 213, nil, + nil, 211, 211, nil, 212, 211, 213, 211, 212, 212, + nil, nil, 212, nil, nil, nil, nil, 212, 212, nil, + nil, 212, nil, 211, 212, nil, nil, 95, 95, nil, + nil, 95, 212, 95, 211, nil, nil, nil, 211, 211, + nil, nil, 211, nil, nil, nil, nil, 211, 211, 95, + nil, 211, nil, nil, 211, nil, nil, 209, 209, nil, + 95, 209, 211, 209, 95, 95, nil, nil, 95, nil, + nil, nil, nil, 95, 95, nil, nil, 95, nil, 209, + 95, nil, nil, 83, 83, nil, nil, 83, 95, 83, + 209, nil, nil, nil, 209, 209, nil, nil, 209, nil, + nil, nil, nil, 209, 209, nil, nil, 209, nil, nil, + 209, nil, nil, nil, nil, nil, 83, 112, 209, nil, + 83, 83, nil, nil, 83, nil, 112, 112, nil, 83, + nil, nil, nil, 83, nil, 112, 112, 112, 112, nil, + nil, 189, 189, nil, 83, nil, nil, nil, nil, 189, + 189, 189, 189, 189, nil, nil, nil, nil, nil, 112, + 112, nil, nil, 112, 112, 112, 112, 112, 112, nil, + 112, 112, nil, nil, 189, 189, nil, 112, 189, 189, + 189, 189, 189, 189, nil, 189, 189, 294, 294, nil, + nil, nil, 189, nil, nil, nil, 294, 294, 294, 294, + nil, nil, 290, 290, nil, nil, nil, nil, nil, nil, + nil, 290, 290, 290, 290, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 294, 294, 294, 294, 294, 294, + nil, 294, 294, nil, nil, nil, 290, nil, 294, 290, + 290, 290, 290, 290, 290, nil, 290, 290, 125, 125, + nil, nil, nil, 290, nil, nil, nil, 125, 125, 125, + 125, nil, nil, 131, 131, nil, nil, nil, nil, nil, + nil, nil, 131, 131, 131, 131, nil, nil, nil, nil, + nil, 125, 125, nil, nil, 125, 125, 125, 125, 125, + 125, nil, 125, 125, nil, nil, 131, 131, nil, 125, + 131, 131, 131, 131, 131, 131, nil, 131, 131, 132, + 132, nil, nil, nil, 131, nil, nil, nil, 132, 132, + 132, 132, nil, nil, nil, 289, nil, 296, 296, 296, + 296, 296, 296, 289, 296, 296, nil, nil, nil, nil, + nil, 296, 132, 132, 292, nil, 132, 132, 132, 132, + 132, 132, 292, 132, 132, nil, nil, nil, nil, 291, + 132, 289, 289, 289, 289, 289, 289, 291, 289, 289, + nil, nil, nil, nil, nil, 289, nil, nil, 295, nil, + 292, 292, 292, 292, 292, 292, 295, 292, 292, nil, + nil, nil, nil, nil, 292, 291, 291, 291, 291, 291, + 291, nil, 291, 291, nil, nil, 298, nil, nil, 291, + nil, nil, nil, nil, 295, 295, 295, 295, 295, 295, + nil, 295, 295, nil, nil, 306, nil, 298, 295, 298, + 298, nil, 298, 298, nil, 298, nil, 298, nil, 298, + nil, 298, nil, nil, 298, 298, 306, 215, 306, 306, + nil, 306, 306, nil, 306, nil, 306, nil, 306, nil, + 306, nil, nil, 306, 306, nil, 322, nil, 215, nil, + 215, 215, nil, 215, 215, nil, 215, nil, 215, nil, + 215, nil, 215, nil, nil, 215, 215, 322, 326, 322, + 322, nil, 322, 322, nil, 322, nil, 322, nil, 322, + nil, 322, nil, nil, 322, 322, nil, 365, nil, 326, + nil, 326, 326, nil, 326, 326, nil, 326, nil, 326, + nil, 326, nil, 326, nil, nil, 326, 326, 365, 375, + 365, 365, nil, 365, 365, nil, 365, nil, 365, nil, + 365, nil, 365, nil, nil, 365, 365, nil, 220, nil, + 375, nil, 375, 375, nil, 375, 375, nil, 375, nil, + 375, nil, 375, nil, 375, nil, nil, 375, 375, 220, + 377, 220, 220, nil, 220, 220, nil, 220, nil, 220, + nil, 220, nil, 220, nil, nil, 220, 220, nil, 381, + nil, 377, nil, 377, 377, nil, 377, 377, nil, 377, + nil, 377, nil, 377, nil, 377, nil, nil, 377, 377, + 381, 240, 381, 381, nil, 381, 381, nil, 381, nil, + 381, nil, 381, nil, 381, nil, nil, 381, 381, nil, + 383, nil, 240, nil, 240, 240, nil, 240, 240, nil, + 240, nil, 240, nil, 240, nil, 240, nil, nil, 240, + 240, 383, nil, 383, 383, nil, 383, 383, nil, 383, + nil, 383, nil, 383, nil, 383, nil, nil, 383, 383, + 19, nil, 19, 19, nil, 19, 19, nil, 19, nil, + 19, nil, 19, nil, 19, nil, nil, 19, 19, 0, + nil, 0, 0, nil, 0, 0, nil, 0, nil, 0, + nil, 0, nil, 0, nil, nil, 0, 0 ] racc_action_pointer = [ - 1832, 210, 426, 395, 396, nil, nil, 267, 418, 413, - nil, nil, -20, nil, nil, nil, 394, 5, nil, 1813, - nil, nil, -3, 263, nil, nil, 288, nil, 319, 339, - 188, nil, nil, 368, 380, 345, 337, nil, nil, 464, - nil, nil, nil, 138, nil, nil, 520, 546, 571, 585, - 308, 322, 344, nil, nil, -6, nil, nil, nil, nil, - nil, nil, 42, 747, 295, 66, 291, 274, 265, nil, - 269, 264, nil, nil, 907, 954, nil, 240, 243, nil, - 221, -13, 1064, nil, 200, 165, 2, 129, nil, nil, - 104, 18, nil, nil, 1240, -2, 6, 1045, nil, nil, - 805, 211, 728, 187, nil, 208, 34, 270, 282, 284, - nil, 1282, nil, nil, 313, 316, nil, nil, nil, 318, - 121, 324, 149, nil, 1465, nil, nil, 333, nil, nil, - 1404, 1358, 343, 329, nil, 352, 323, nil, 342, 360, - 352, nil, 367, 101, 411, nil, nil, nil, nil, nil, - nil, nil, -9, 436, 412, nil, 30, 426, 74, nil, - 258, nil, nil, 123, nil, -7, nil, nil, nil, nil, - nil, 348, 404, 404, 11, 367, 57, nil, 3, nil, - -4, 101, 190, 369, 216, nil, 1297, nil, 322, nil, - nil, nil, 345, nil, nil, 190, 314, 416, 831, 1071, - 1136, 1214, 754, 633, 237, 83, 490, 238, 32, 659, - 689, 35, 1589, 365, 1093, 37, nil, 1611, 34, 44, - 73, 130, nil, nil, 93, 1171, 103, 136, 1161, 119, - 1118, 133, 172, 200, 231, nil, nil, 1652, nil, 59, - nil, nil, nil, -21, 998, 980, nil, nil, 973, nil, - 249, nil, 248, 255, 901, nil, 882, nil, nil, nil, - nil, nil, nil, nil, 270, nil, nil, nil, nil, 260, - 564, nil, nil, 96, nil, 288, nil, 824, 192, nil, - 159, 144, 186, nil, 598, 1446, 912, 1514, 1343, 1499, - 1533, nil, 1419, 1480, 588, nil, 1734, 173, 257, 434, - nil, -3, nil, nil, 1753, nil, 390, nil, 1233, 125, - nil, nil, nil, nil, nil, nil, 376, nil, nil, nil, - 1794, nil, nil, nil, 1775, nil, nil, nil, 372, 374, - nil, 376, 378, 380, nil, nil, nil, nil, 397, nil, - nil, nil, 174, nil, 122, nil, nil, nil, nil, nil, - 79, nil, 148, 415, nil, nil, 127, 419, nil, nil, - nil, nil, nil, 1712, nil, nil, nil, nil, 423, 76, - 426, nil, nil, 1693, nil, 1671, nil, nil, nil, 1630, - nil, 1570, nil, nil, nil ] + 1819, 198, 459, 427, 335, nil, nil, 235, 451, 446, + nil, nil, -20, nil, nil, nil, 423, 30, nil, 1800, + nil, nil, -3, 222, nil, nil, 265, nil, 413, 313, + 112, nil, nil, 408, 365, 348, 356, nil, nil, 433, + nil, nil, nil, 131, nil, nil, 489, 515, 540, 554, + 309, 323, 344, nil, nil, -6, nil, nil, nil, nil, + nil, nil, 42, 706, 261, 123, 273, 243, 241, 792, + nil, 257, 250, nil, nil, 865, 891, nil, 162, 159, + nil, 122, 26, 1241, nil, 16, 15, 2, -11, nil, + nil, 79, 195, nil, nil, 1185, 237, 278, 628, nil, + nil, 602, 286, 385, 301, nil, 302, 34, 304, 306, + 309, nil, 1269, nil, nil, 325, 327, nil, nil, nil, + 329, 145, 354, 149, nil, 1391, nil, nil, 375, nil, + nil, 1406, 1452, 377, 393, nil, 413, 409, nil, 461, + 463, 446, nil, 440, 4, 433, nil, nil, nil, nil, + nil, nil, nil, -9, 437, 385, nil, 5, 409, 74, + nil, 236, nil, nil, 59, nil, -9, nil, nil, nil, + nil, nil, 359, 396, 393, 11, 356, nil, 365, 57, + nil, 96, nil, -4, 192, 240, 209, 320, nil, 1284, + nil, 339, nil, nil, nil, 327, nil, nil, 224, 403, + 32, 658, 989, 1073, 840, 83, 174, 459, 999, 1215, + 195, 1159, 1129, 1103, 127, 1598, 1047, 973, 39, nil, + 1699, 54, 63, 83, 100, nil, nil, 134, 946, 115, + 148, 930, 126, 916, 146, 1, 196, 165, nil, nil, + 1762, nil, 66, nil, nil, nil, -21, 822, 771, nil, + nil, 778, nil, 263, nil, 264, 271, 753, nil, 727, + nil, nil, nil, nil, nil, nil, nil, 287, nil, nil, + nil, nil, 533, nil, nil, 117, nil, 303, nil, 684, + 159, nil, 234, 317, 191, nil, 557, 1002, 567, 1467, + 1345, 1501, 1486, nil, 1330, 1520, 1433, nil, 1557, 79, + 250, 355, nil, -1, nil, nil, 1576, nil, 334, nil, + 291, 214, nil, nil, nil, nil, nil, nil, 409, nil, + nil, nil, 1617, nil, nil, nil, 1639, nil, nil, nil, + 403, 411, nil, 417, 421, 422, nil, nil, nil, nil, + 438, nil, nil, nil, 167, nil, 122, nil, nil, nil, + nil, nil, 96, nil, 148, 448, nil, nil, 101, 452, + nil, nil, nil, nil, nil, 1658, nil, nil, nil, nil, + 455, 76, 461, nil, nil, 1680, nil, 1721, nil, nil, + nil, 1740, nil, 1781, nil, nil, nil ] racc_action_default = [ - -197, -234, -234, -50, -234, -8, -9, -234, -234, -22, - -10, -188, -189, -11, -186, -12, -234, -234, -13, -1, - -14, -2, -234, -187, -15, -3, -234, -16, -5, -234, - -234, -17, -6, -234, -18, -7, -197, -189, -187, -234, - -51, -26, -27, -234, -24, -25, -234, -234, -234, -85, - -92, -197, -234, -196, -194, -197, -190, -192, -193, -222, - -195, -4, -197, -234, -85, -197, -53, -232, -42, -175, - -43, -214, -117, -33, -234, -234, -44, -31, -74, -32, - -234, -36, -234, -122, -37, -234, -73, -38, -172, -72, - -39, -40, -174, -41, -234, -103, -111, -234, -132, -112, - -234, -104, -234, -108, -110, -105, -234, -114, -106, -113, - -109, -234, -125, -107, -234, -234, -49, -176, -177, -179, - -234, -234, -198, -199, -83, -19, -22, -187, -21, -23, - -82, -84, -234, -75, -86, -81, -70, -74, -76, -220, - -79, -68, -77, -73, -234, -171, -170, -80, -78, -90, - -91, -93, -234, -220, -197, 385, -234, -234, -234, -208, - -234, -57, -214, -197, -59, -234, -66, -65, -56, -73, - -95, -234, -220, -234, -234, -92, -234, -30, -234, -118, - -234, -234, -234, -234, -234, -142, -234, -149, -234, -217, - -230, -226, -234, -229, -225, -234, -234, -234, -234, -234, - -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, - -234, -234, -234, -234, -234, -234, -20, -234, -207, -234, - -205, -234, -202, -231, -234, -71, -221, -234, -234, -85, - -234, -221, -234, -234, -234, -210, -191, -234, -209, -234, - -54, -62, -61, -234, -234, -234, -218, -219, -234, -124, - -234, -55, -220, -234, -234, -28, -234, -120, -119, -35, - -34, -173, -168, -166, -234, -169, -160, -167, -161, -73, - -234, -123, -116, -234, -152, -219, -215, -234, -234, -223, - -137, -139, -138, -133, -140, -144, -141, -146, -151, -148, - -145, -134, -150, -147, -143, -135, -234, -128, -136, -234, - -154, -234, -158, -178, -234, -181, -234, -200, -234, -234, - -201, -45, -69, -87, -46, -88, -220, -89, -94, -48, - -234, -212, -211, -213, -234, -185, -58, -60, -97, -98, - -63, -102, -99, -100, -101, -64, -96, -47, -234, -233, - -29, -121, -234, -163, -220, -115, -216, -228, -227, -224, - -128, -127, -234, -234, -155, -153, -234, -234, -180, -206, - -204, -203, -67, -234, -183, -184, -52, -165, -219, -234, - -234, -126, -129, -234, -159, -234, -182, -164, -162, -234, - -131, -234, -157, -130, -156 ] + -198, -235, -235, -51, -235, -8, -9, -235, -235, -22, + -10, -189, -190, -11, -187, -12, -235, -235, -13, -1, + -14, -2, -235, -188, -15, -3, -235, -16, -5, -235, + -235, -17, -6, -235, -18, -7, -198, -190, -188, -235, + -52, -26, -27, -235, -24, -25, -235, -235, -235, -86, + -93, -198, -235, -197, -195, -198, -191, -193, -194, -223, + -196, -4, -198, -235, -86, -198, -54, -233, -43, -235, + -176, -44, -215, -118, -33, -235, -235, -45, -31, -75, + -32, -235, -36, -235, -123, -38, -235, -74, -39, -173, + -73, -40, -41, -175, -42, -235, -104, -112, -235, -133, + -113, -235, -105, -235, -109, -111, -106, -235, -115, -107, + -114, -110, -235, -126, -108, -235, -235, -50, -177, -178, + -180, -235, -235, -199, -200, -84, -19, -22, -188, -21, + -23, -83, -85, -235, -76, -87, -82, -71, -75, -77, + -221, -80, -69, -78, -74, -235, -172, -171, -81, -79, + -91, -92, -94, -235, -221, -198, 387, -235, -235, -235, + -209, -235, -58, -215, -198, -60, -235, -67, -66, -57, + -74, -96, -235, -221, -235, -235, -93, -37, -74, -235, + -30, -235, -119, -235, -235, -235, -235, -235, -143, -235, + -150, -235, -218, -231, -227, -235, -230, -226, -235, -235, + -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, + -235, -235, -235, -235, -235, -235, -235, -235, -235, -20, + -235, -208, -235, -206, -235, -203, -232, -235, -72, -222, + -235, -235, -86, -235, -222, -235, -235, -235, -211, -192, + -235, -210, -235, -55, -63, -62, -235, -235, -235, -219, + -220, -235, -125, -235, -56, -221, -235, -235, -28, -235, + -121, -120, -35, -34, -174, -169, -167, -235, -170, -161, + -168, -162, -235, -124, -117, -235, -153, -220, -216, -235, + -235, -224, -138, -140, -139, -134, -141, -145, -142, -147, + -152, -149, -146, -135, -151, -148, -144, -136, -235, -129, + -137, -235, -155, -235, -159, -179, -235, -182, -235, -201, + -235, -235, -202, -46, -70, -88, -47, -89, -221, -90, + -95, -49, -235, -213, -212, -214, -235, -186, -59, -61, + -98, -99, -64, -103, -100, -101, -102, -65, -97, -48, + -235, -234, -29, -122, -235, -164, -221, -116, -217, -229, + -228, -225, -129, -128, -235, -235, -156, -154, -235, -235, + -181, -207, -205, -204, -68, -235, -184, -185, -53, -166, + -220, -235, -235, -127, -130, -235, -160, -235, -183, -165, + -163, -235, -132, -235, -158, -131, -157 ] racc_goto_table = [ - 22, 9, 68, 112, 222, 264, 61, 36, 53, 179, - 268, 141, 70, 19, 2, 77, 191, 118, 51, 22, - 9, 139, 116, 21, 73, 91, 56, 147, 133, 149, - 115, 227, 153, 2, 300, 128, 172, 302, 135, 160, - 125, 129, 174, 22, 126, 232, 351, 43, 171, 299, - 260, 146, 369, 68, 121, 330, 335, 258, 266, 123, - 318, 344, 136, 70, 250, 119, 178, 183, 224, 154, - 233, 55, 157, 66, 123, 73, 91, 120, 159, 238, - 219, 221, 326, 322, 195, 190, 16, 188, nil, nil, - nil, nil, nil, 264, nil, nil, nil, nil, 343, 371, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 128, nil, nil, 88, nil, 216, 129, 354, - 22, 126, 302, 260, nil, nil, nil, nil, nil, nil, + 22, 9, 68, 113, 53, 177, 61, 36, 267, 271, + 225, 194, 230, 19, 2, 78, 154, 119, 51, 22, + 9, 56, 182, 140, 74, 150, 235, 21, 134, 142, + 116, 148, 161, 2, 117, 175, 126, 130, 173, 94, + 304, 353, 43, 22, 127, 253, 122, 129, 68, 302, + 172, 332, 337, 269, 68, 261, 137, 301, 371, 346, + 320, 155, 120, 124, 227, 149, 236, 181, 55, 158, + 186, 66, 121, 241, 222, 224, 74, 328, 124, 324, + 198, 16, 160, nil, 82, 94, 193, nil, nil, nil, + 191, 94, nil, nil, 373, 267, 345, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 243, 88, nil, nil, 338, nil, nil, 53, nil, 53, - nil, nil, nil, nil, 149, nil, nil, 252, nil, nil, - 68, 262, nil, 68, nil, 236, 88, nil, nil, nil, - 70, nil, nil, 70, nil, nil, 273, 235, nil, 374, - nil, nil, 259, 91, 146, 73, 91, 312, 348, nil, - 341, 361, 264, 262, 87, nil, 261, 377, 291, 303, - nil, 316, 295, 147, 133, 313, nil, nil, 362, nil, - 149, nil, 22, 9, 135, nil, 146, 22, 9, nil, - 142, nil, nil, 328, 328, 296, 2, 146, 261, nil, - 304, 2, nil, 68, nil, nil, 370, 22, 9, nil, - 321, nil, nil, 70, nil, 87, 146, 146, nil, 262, - 324, 2, nil, nil, nil, 259, 91, 190, 261, 261, - nil, 81, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 146, 88, 88, nil, 88, nil, 262, nil, - nil, nil, nil, 61, 261, nil, nil, 138, 84, nil, - nil, 61, nil, nil, nil, nil, 22, 9, nil, nil, - 166, 146, nil, 166, 22, 9, 88, nil, nil, nil, - 2, 61, 81, 261, 140, nil, nil, 88, 2, nil, - 22, 9, nil, nil, 22, 9, nil, 167, nil, 372, - 167, nil, nil, 363, 2, 262, 88, 88, 2, 84, - nil, 90, nil, nil, nil, nil, 88, nil, 262, nil, - 61, nil, 87, 267, nil, 87, nil, nil, 146, nil, - nil, nil, 88, 22, 9, nil, 61, 145, 61, nil, - 261, 146, nil, 22, 9, 22, 9, 2, 114, 22, - 9, 22, 9, 261, 93, 267, 379, 2, 381, 2, - nil, 88, 90, 2, nil, 2, 142, 132, nil, nil, - nil, 166, nil, nil, nil, nil, nil, nil, nil, nil, - 148, nil, 170, nil, nil, 332, 332, nil, nil, 81, - 263, nil, 81, nil, nil, 87, nil, nil, 167, nil, - nil, 170, nil, nil, nil, 93, nil, nil, nil, nil, - nil, 267, nil, nil, nil, nil, 84, 265, 88, 84, - nil, 170, 263, nil, nil, nil, nil, nil, nil, nil, - nil, 88, nil, 138, nil, nil, nil, nil, nil, nil, - 267, nil, nil, nil, nil, nil, nil, 166, 124, 265, - nil, nil, 329, 329, nil, 130, 131, nil, nil, nil, - 140, nil, 81, nil, nil, nil, nil, nil, nil, 90, - 145, nil, 90, nil, 167, nil, nil, nil, 263, 331, - 331, nil, nil, nil, 180, nil, nil, nil, nil, 84, - nil, nil, nil, nil, nil, 253, nil, 267, nil, nil, - nil, nil, 145, 185, nil, 265, 186, 263, nil, 187, - 267, nil, 93, 145, nil, 93, nil, nil, 283, nil, + 139, nil, nil, nil, 219, 130, nil, nil, nil, nil, + 263, 22, 127, 167, 304, 129, 167, 340, nil, nil, + 82, nil, nil, 356, 246, nil, 82, 115, nil, nil, + nil, nil, 255, nil, 53, nil, 53, nil, nil, nil, + nil, 150, nil, nil, nil, nil, 133, nil, nil, nil, + nil, 239, nil, 68, 265, nil, 68, nil, nil, nil, + nil, 171, nil, nil, nil, nil, nil, nil, nil, 275, + nil, 376, 238, nil, 350, 262, nil, nil, 74, nil, + 364, 171, nil, 263, 267, 379, 265, 293, 363, 264, + 94, 297, 305, 94, 315, 343, 318, 134, 314, 150, + 148, 171, nil, nil, nil, 22, 9, nil, 372, nil, + 22, 9, nil, nil, nil, 167, 330, 330, 298, 2, + nil, 264, nil, 306, 2, nil, 68, nil, nil, nil, + 22, 9, 91, 323, 149, 82, 266, nil, 82, 89, + nil, 265, nil, 326, 2, nil, nil, nil, 262, 193, + nil, 264, 264, 336, 336, 88, nil, nil, 146, nil, + nil, nil, nil, 94, nil, 89, nil, nil, 266, nil, + 265, nil, nil, nil, nil, 61, 264, 256, 91, 139, + nil, 143, nil, 61, 91, 89, nil, nil, 22, 9, + nil, 89, nil, 167, nil, nil, 22, 9, 331, 331, + 285, 88, 2, 61, nil, 264, nil, 88, 82, nil, + 2, nil, 22, 9, nil, nil, 22, 9, nil, nil, + nil, 374, nil, 266, nil, 365, 2, 265, nil, 317, + 2, 319, nil, nil, nil, nil, nil, 92, nil, nil, + 265, nil, 61, nil, nil, nil, nil, nil, nil, 338, + nil, nil, 266, nil, nil, 22, 9, nil, 61, nil, + 61, nil, 264, 147, nil, 22, 9, 22, 9, 2, + nil, 22, 9, 22, 9, 264, nil, 349, 381, 2, + 383, 2, nil, 92, nil, 2, nil, 2, 85, 92, + nil, nil, nil, 91, 146, 71, 91, nil, nil, nil, + 89, 89, nil, 89, nil, nil, 361, nil, 362, 266, + nil, nil, nil, nil, 141, nil, 88, 270, nil, 88, + nil, 136, 266, nil, nil, nil, 146, 168, nil, nil, + 168, nil, nil, 89, 85, nil, nil, 146, nil, nil, + 85, 71, 369, nil, 89, nil, nil, 71, nil, 270, + nil, nil, nil, nil, nil, nil, 335, 335, nil, nil, + 143, nil, nil, 89, 89, nil, 91, nil, nil, nil, + nil, nil, nil, 89, nil, nil, nil, nil, 125, 334, + 334, 146, nil, nil, nil, 131, 132, nil, 89, 88, + nil, nil, nil, nil, nil, nil, nil, nil, 92, 147, + nil, 92, nil, nil, 270, nil, nil, nil, nil, nil, + 146, nil, nil, nil, nil, 183, nil, 89, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, 168, + nil, 147, nil, 270, 188, nil, nil, 189, nil, nil, + 190, nil, 147, nil, nil, nil, nil, nil, nil, 85, + 268, nil, 85, nil, nil, nil, 71, nil, nil, 71, + nil, 147, 147, nil, nil, nil, nil, 146, nil, nil, + nil, 92, nil, nil, 89, nil, nil, nil, nil, nil, + 146, nil, 268, nil, nil, nil, 147, 89, nil, nil, + 270, nil, nil, 141, nil, nil, nil, nil, nil, nil, + 136, nil, nil, 270, nil, nil, nil, 168, nil, nil, + nil, nil, 333, 333, nil, 147, nil, nil, nil, nil, + nil, nil, 85, nil, nil, nil, nil, nil, nil, 71, + nil, nil, nil, nil, nil, nil, nil, 268, 282, 283, + 284, nil, 286, 287, 288, 289, 290, 291, 292, nil, + 294, 295, 296, nil, nil, 300, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 268, nil, nil, nil, + nil, nil, 147, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, 147, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 183, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 333, 333, 265, nil, nil, nil, nil, nil, - nil, nil, 90, nil, nil, nil, nil, 315, nil, 317, - nil, nil, nil, nil, nil, nil, 148, nil, 145, nil, - nil, nil, nil, nil, 263, nil, nil, 336, nil, nil, - nil, nil, nil, nil, nil, 334, 334, 263, nil, nil, - nil, nil, nil, nil, nil, 93, nil, 145, nil, nil, - nil, 265, nil, nil, nil, nil, 347, nil, nil, nil, - nil, nil, nil, nil, 265, 280, 281, 282, nil, 284, - 285, 286, 287, 288, 289, 290, nil, 292, 293, 294, - nil, nil, 298, nil, nil, 359, nil, 360, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 145, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, 145, nil, nil, - nil, 367, nil, nil, nil, 180 ] + nil, nil, nil, 268, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 268 ] racc_goto_check = [ - 37, 21, 30, 62, 82, 68, 4, 32, 64, 60, - 70, 47, 31, 2, 52, 22, 85, 72, 32, 37, - 21, 35, 5, 3, 21, 28, 78, 50, 30, 53, - 37, 36, 38, 52, 66, 5, 35, 68, 31, 41, - 19, 7, 41, 37, 21, 36, 63, 20, 57, 65, - 23, 28, 58, 30, 74, 46, 46, 61, 69, 3, - 56, 71, 33, 31, 36, 73, 22, 57, 34, 74, - 75, 76, 77, 40, 3, 21, 28, 20, 3, 79, - 80, 81, 42, 83, 84, 30, 1, 57, nil, nil, - nil, nil, nil, 68, nil, nil, nil, nil, 70, 63, + 37, 21, 30, 62, 64, 23, 4, 32, 68, 70, + 82, 85, 36, 2, 52, 22, 38, 72, 32, 37, + 21, 78, 60, 35, 21, 53, 36, 3, 30, 47, + 37, 50, 41, 52, 5, 41, 19, 7, 35, 29, + 68, 63, 20, 37, 21, 36, 74, 5, 30, 66, + 57, 46, 46, 69, 30, 61, 33, 65, 58, 71, + 56, 74, 73, 3, 34, 29, 75, 22, 76, 77, + 57, 40, 20, 79, 80, 81, 21, 42, 3, 83, + 84, 1, 3, nil, 24, 29, 30, nil, nil, nil, + 57, 29, nil, nil, 63, 68, 70, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 5, nil, nil, 49, nil, 19, 7, 66, - 37, 21, 68, 23, nil, nil, nil, nil, nil, nil, + 24, nil, nil, nil, 19, 7, nil, nil, nil, nil, + 23, 37, 21, 24, 68, 5, 24, 36, nil, nil, + 24, nil, nil, 66, 41, nil, 24, 54, nil, nil, + nil, nil, 38, nil, 64, nil, 64, nil, nil, nil, + nil, 53, nil, nil, nil, nil, 54, nil, nil, nil, + nil, 78, nil, 30, 30, nil, 30, nil, nil, nil, + nil, 54, nil, nil, nil, nil, nil, nil, nil, 22, + nil, 68, 3, nil, 85, 21, nil, nil, 21, nil, + 36, 54, nil, 23, 68, 70, 30, 64, 82, 52, + 29, 64, 72, 29, 53, 60, 35, 30, 47, 53, + 50, 54, nil, nil, nil, 37, 21, nil, 36, nil, + 37, 21, nil, nil, nil, 24, 30, 30, 2, 52, + nil, 52, nil, 2, 52, nil, 30, nil, nil, nil, + 37, 21, 27, 32, 29, 24, 24, nil, 24, 49, + nil, 30, nil, 2, 52, nil, nil, nil, 21, 30, + nil, 52, 52, 29, 29, 26, nil, nil, 27, nil, + nil, nil, nil, 29, nil, 49, nil, nil, 24, nil, + 30, nil, nil, nil, nil, 4, 52, 54, 27, 24, + nil, 26, nil, 4, 27, 49, nil, nil, 37, 21, + nil, 49, nil, 24, nil, nil, 37, 21, 24, 24, + 54, 26, 52, 4, nil, 52, nil, 26, 24, nil, + 52, nil, 37, 21, nil, nil, 37, 21, nil, nil, + nil, 62, nil, 24, nil, 2, 52, 30, nil, 54, + 52, 54, nil, nil, nil, nil, nil, 28, nil, nil, + 30, nil, 4, nil, nil, nil, nil, nil, nil, 54, + nil, nil, 24, nil, nil, 37, 21, nil, 4, nil, + 4, nil, 52, 28, nil, 37, 21, 37, 21, 52, + nil, 37, 21, 37, 21, 52, nil, 54, 2, 52, + 2, 52, nil, 28, nil, 52, nil, 52, 25, 28, + nil, nil, nil, 27, 27, 31, 27, nil, nil, nil, + 49, 49, nil, 49, nil, nil, 54, nil, 54, 24, + nil, nil, nil, nil, 25, nil, 26, 26, nil, 26, + nil, 31, 24, nil, nil, nil, 27, 25, nil, nil, + 25, nil, nil, 49, 25, nil, nil, 27, nil, nil, + 25, 31, 54, nil, 49, nil, nil, 31, nil, 26, + nil, nil, nil, nil, nil, nil, 27, 27, nil, nil, + 26, nil, nil, 49, 49, nil, 27, nil, nil, nil, + nil, nil, nil, 49, nil, nil, nil, nil, 51, 26, + 26, 27, nil, nil, nil, 51, 51, nil, 49, 26, + nil, nil, nil, nil, nil, nil, nil, nil, 28, 28, + nil, 28, nil, nil, 26, nil, nil, nil, nil, nil, + 27, nil, nil, nil, nil, 51, nil, 49, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, 25, + nil, 28, nil, 26, 51, nil, nil, 51, nil, nil, + 51, nil, 28, nil, nil, nil, nil, nil, nil, 25, + 25, nil, 25, nil, nil, nil, 31, nil, nil, 31, + nil, 28, 28, nil, nil, nil, nil, 27, nil, nil, + nil, 28, nil, nil, 49, nil, nil, nil, nil, nil, + 27, nil, 25, nil, nil, nil, 28, 49, nil, nil, + 26, nil, nil, 25, nil, nil, nil, nil, nil, nil, + 31, nil, nil, 26, nil, nil, nil, 25, nil, nil, + nil, nil, 25, 25, nil, 28, nil, nil, nil, nil, + nil, nil, 25, nil, nil, nil, nil, nil, nil, 31, + nil, nil, nil, nil, nil, nil, nil, 25, 51, 51, + 51, nil, 51, 51, 51, 51, 51, 51, 51, nil, + 51, 51, 51, nil, nil, 51, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 25, nil, nil, nil, + nil, nil, 28, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, 28, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 51, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 41, 49, nil, nil, 36, nil, nil, 64, nil, 64, - nil, nil, nil, nil, 53, nil, nil, 38, nil, nil, - 30, 30, nil, 30, nil, 78, 49, nil, nil, nil, - 31, nil, nil, 31, nil, nil, 22, 3, nil, 68, - nil, nil, 21, 28, 28, 21, 28, 47, 85, nil, - 60, 82, 68, 30, 26, nil, 52, 70, 64, 72, - nil, 35, 64, 50, 30, 53, nil, nil, 36, nil, - 53, nil, 37, 21, 31, nil, 28, 37, 21, nil, - 26, nil, nil, 30, 30, 2, 52, 28, 52, nil, - 2, 52, nil, 30, nil, nil, 36, 37, 21, nil, - 32, nil, nil, 31, nil, 26, 28, 28, nil, 30, - 2, 52, nil, nil, nil, 21, 28, 30, 52, 52, - nil, 24, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 28, 49, 49, nil, 49, nil, 30, nil, - nil, nil, nil, 4, 52, nil, nil, 24, 25, nil, - nil, 4, nil, nil, nil, nil, 37, 21, nil, nil, - 24, 28, nil, 24, 37, 21, 49, nil, nil, nil, - 52, 4, 24, 52, 25, nil, nil, 49, 52, nil, - 37, 21, nil, nil, 37, 21, nil, 25, nil, 62, - 25, nil, nil, 2, 52, 30, 49, 49, 52, 25, - nil, 27, nil, nil, nil, nil, 49, nil, 30, nil, - 4, nil, 26, 26, nil, 26, nil, nil, 28, nil, - nil, nil, 49, 37, 21, nil, 4, 27, 4, nil, - 52, 28, nil, 37, 21, 37, 21, 52, 54, 37, - 21, 37, 21, 52, 29, 26, 2, 52, 2, 52, - nil, 49, 27, 52, nil, 52, 26, 54, nil, nil, - nil, 24, nil, nil, nil, nil, nil, nil, nil, nil, - 29, nil, 54, nil, nil, 26, 26, nil, nil, 24, - 24, nil, 24, nil, nil, 26, nil, nil, 25, nil, - nil, 54, nil, nil, nil, 29, nil, nil, nil, nil, - nil, 26, nil, nil, nil, nil, 25, 25, 49, 25, - nil, 54, 24, nil, nil, nil, nil, nil, nil, nil, - nil, 49, nil, 24, nil, nil, nil, nil, nil, nil, - 26, nil, nil, nil, nil, nil, nil, 24, 51, 25, - nil, nil, 24, 24, nil, 51, 51, nil, nil, nil, - 25, nil, 24, nil, nil, nil, nil, nil, nil, 27, - 27, nil, 27, nil, 25, nil, nil, nil, 24, 25, - 25, nil, nil, nil, 51, nil, nil, nil, nil, 25, - nil, nil, nil, nil, nil, 54, nil, 26, nil, nil, - nil, nil, 27, 51, nil, 25, 51, 24, nil, 51, - 26, nil, 29, 27, nil, 29, nil, nil, 54, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 27, 27, 25, nil, nil, nil, nil, nil, - nil, nil, 27, nil, nil, nil, nil, 54, nil, 54, - nil, nil, nil, nil, nil, nil, 29, nil, 27, nil, - nil, nil, nil, nil, 24, nil, nil, 54, nil, nil, - nil, nil, nil, nil, nil, 29, 29, 24, nil, nil, - nil, nil, nil, nil, nil, 29, nil, 27, nil, nil, - nil, 25, nil, nil, nil, nil, 54, nil, nil, nil, - nil, nil, nil, nil, 25, 51, 51, 51, nil, 51, - 51, 51, 51, 51, 51, 51, nil, 51, 51, 51, - nil, nil, 51, nil, nil, 54, nil, 54, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 27, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, 27, nil, nil, - nil, 54, nil, nil, nil, 51 ] + nil, nil, nil, 25, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, 25 ] racc_goto_pointer = [ - nil, 86, 13, 23, -13, -8, nil, -2, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, -3, - 43, 1, -8, -131, 238, 265, 171, 318, 2, 361, - -21, -11, 6, 13, -68, -28, -108, 0, -18, nil, - 51, -23, -157, nil, nil, nil, -189, -38, nil, 92, - -22, 439, 14, -21, 349, nil, -171, -15, -292, nil, - -66, -123, -23, -251, -9, -165, -180, nil, -177, -124, - -172, -209, -16, 32, 18, -84, 54, 17, 9, -79, - -42, -41, -118, -151, -22, -90, nil ] + nil, 81, 13, 27, -13, 4, nil, -6, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, -7, + 38, 1, -8, -64, 61, 375, 242, 219, 324, 16, + -21, 382, 6, 7, -73, -26, -128, 0, -34, nil, + 49, -30, -165, nil, nil, nil, -196, -20, nil, 226, + -18, 449, 14, -25, 108, nil, -174, -13, -288, nil, + -54, -128, -23, -258, -13, -160, -168, nil, -177, -132, + -176, -213, -16, 29, 10, -89, 51, 14, 4, -86, + -49, -48, -113, -158, -27, -96, nil ] racc_goto_default = [ - nil, nil, nil, 168, 25, 28, 32, 35, 5, 6, + nil, nil, nil, 169, 25, 28, 32, 35, 5, 6, 10, 13, 15, 18, 20, 24, 27, 31, 34, 4, - nil, 99, nil, 79, 101, 103, 105, 108, 109, 113, - 95, 96, 8, nil, nil, nil, nil, 85, nil, 30, - nil, nil, 161, 239, 164, 165, nil, nil, 144, 107, - 110, 111, 67, 134, 98, 150, 151, nil, 248, 104, - nil, nil, nil, nil, 69, nil, nil, 301, 80, nil, + nil, 100, nil, 80, 102, 104, 106, 109, 110, 114, + 96, 97, 8, nil, nil, nil, nil, 86, nil, 30, + nil, nil, 162, 242, 165, 166, nil, nil, 145, 108, + 111, 112, 67, 135, 99, 151, 152, nil, 251, 105, + nil, nil, nil, nil, 70, nil, nil, 303, 81, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 57, - nil, nil, nil, nil, nil, nil, 192 ] + nil, nil, nil, nil, nil, nil, 195 ] racc_reduce_table = [ 0, 0, :racc_error, @@ -703,6 +709,7 @@ racc_reduce_table = [ 3, 91, :_reduce_34, 3, 91, :_reduce_35, 1, 92, :_reduce_none, + 2, 92, :_reduce_37, 1, 92, :_reduce_none, 1, 92, :_reduce_none, 1, 92, :_reduce_none, @@ -710,37 +717,37 @@ racc_reduce_table = [ 1, 92, :_reduce_none, 1, 92, :_reduce_none, 1, 92, :_reduce_none, - 1, 92, :_reduce_44, - 5, 74, :_reduce_45, + 1, 92, :_reduce_45, 5, 74, :_reduce_46, 5, 74, :_reduce_47, - 5, 85, :_reduce_48, - 2, 75, :_reduce_49, - 1, 108, :_reduce_50, - 2, 108, :_reduce_51, - 6, 76, :_reduce_52, - 2, 76, :_reduce_53, - 3, 109, :_reduce_54, + 5, 74, :_reduce_48, + 5, 85, :_reduce_49, + 2, 75, :_reduce_50, + 1, 108, :_reduce_51, + 2, 108, :_reduce_52, + 6, 76, :_reduce_53, + 2, 76, :_reduce_54, 3, 109, :_reduce_55, + 3, 109, :_reduce_56, 1, 110, :_reduce_none, 1, 110, :_reduce_none, - 3, 110, :_reduce_58, + 3, 110, :_reduce_59, 1, 111, :_reduce_none, - 3, 111, :_reduce_60, - 1, 112, :_reduce_61, + 3, 111, :_reduce_61, 1, 112, :_reduce_62, - 3, 113, :_reduce_63, + 1, 112, :_reduce_63, 3, 113, :_reduce_64, + 3, 113, :_reduce_65, 1, 114, :_reduce_none, 1, 114, :_reduce_none, - 4, 116, :_reduce_67, + 4, 116, :_reduce_68, 1, 102, :_reduce_none, - 3, 102, :_reduce_69, + 3, 102, :_reduce_70, 0, 103, :_reduce_none, 1, 103, :_reduce_none, - 1, 118, :_reduce_72, - 1, 93, :_reduce_73, - 1, 95, :_reduce_74, + 1, 118, :_reduce_73, + 1, 93, :_reduce_74, + 1, 95, :_reduce_75, 1, 117, :_reduce_none, 1, 117, :_reduce_none, 1, 117, :_reduce_none, @@ -748,21 +755,21 @@ racc_reduce_table = [ 1, 117, :_reduce_none, 1, 117, :_reduce_none, 1, 117, :_reduce_none, - 3, 77, :_reduce_82, 3, 77, :_reduce_83, - 3, 86, :_reduce_84, - 0, 104, :_reduce_85, - 1, 104, :_reduce_86, - 3, 104, :_reduce_87, - 3, 122, :_reduce_88, - 3, 124, :_reduce_89, + 3, 77, :_reduce_84, + 3, 86, :_reduce_85, + 0, 104, :_reduce_86, + 1, 104, :_reduce_87, + 3, 104, :_reduce_88, + 3, 122, :_reduce_89, + 3, 124, :_reduce_90, 1, 125, :_reduce_none, 1, 125, :_reduce_none, - 0, 107, :_reduce_92, - 1, 107, :_reduce_93, - 3, 107, :_reduce_94, + 0, 107, :_reduce_93, + 1, 107, :_reduce_94, + 3, 107, :_reduce_95, 1, 126, :_reduce_none, - 3, 126, :_reduce_96, + 3, 126, :_reduce_97, 1, 115, :_reduce_none, 1, 115, :_reduce_none, 1, 115, :_reduce_none, @@ -781,25 +788,24 @@ racc_reduce_table = [ 1, 123, :_reduce_none, 1, 123, :_reduce_none, 1, 123, :_reduce_none, - 4, 97, :_reduce_115, - 3, 97, :_reduce_116, - 1, 99, :_reduce_117, - 2, 99, :_reduce_118, - 2, 129, :_reduce_119, - 1, 130, :_reduce_120, - 2, 130, :_reduce_121, - 1, 96, :_reduce_122, - 4, 90, :_reduce_123, + 4, 97, :_reduce_116, + 3, 97, :_reduce_117, + 1, 99, :_reduce_118, + 2, 99, :_reduce_119, + 2, 129, :_reduce_120, + 1, 130, :_reduce_121, + 2, 130, :_reduce_122, + 1, 96, :_reduce_123, 4, 90, :_reduce_124, - 2, 79, :_reduce_125, - 5, 131, :_reduce_126, - 4, 131, :_reduce_127, + 4, 90, :_reduce_125, + 2, 79, :_reduce_126, + 5, 131, :_reduce_127, + 4, 131, :_reduce_128, 0, 132, :_reduce_none, - 2, 132, :_reduce_129, - 4, 132, :_reduce_130, - 3, 132, :_reduce_131, + 2, 132, :_reduce_130, + 4, 132, :_reduce_131, + 3, 132, :_reduce_132, 1, 120, :_reduce_none, - 3, 120, :_reduce_133, 3, 120, :_reduce_134, 3, 120, :_reduce_135, 3, 120, :_reduce_136, @@ -808,30 +814,31 @@ racc_reduce_table = [ 3, 120, :_reduce_139, 3, 120, :_reduce_140, 3, 120, :_reduce_141, - 2, 120, :_reduce_142, - 3, 120, :_reduce_143, + 3, 120, :_reduce_142, + 2, 120, :_reduce_143, 3, 120, :_reduce_144, 3, 120, :_reduce_145, 3, 120, :_reduce_146, 3, 120, :_reduce_147, 3, 120, :_reduce_148, - 2, 120, :_reduce_149, - 3, 120, :_reduce_150, + 3, 120, :_reduce_149, + 2, 120, :_reduce_150, 3, 120, :_reduce_151, 3, 120, :_reduce_152, - 5, 78, :_reduce_153, + 3, 120, :_reduce_153, + 5, 78, :_reduce_154, 1, 134, :_reduce_none, - 2, 134, :_reduce_155, - 5, 135, :_reduce_156, - 4, 135, :_reduce_157, + 2, 134, :_reduce_156, + 5, 135, :_reduce_157, + 4, 135, :_reduce_158, 1, 136, :_reduce_none, - 3, 136, :_reduce_159, - 3, 98, :_reduce_160, + 3, 136, :_reduce_160, + 3, 98, :_reduce_161, 1, 138, :_reduce_none, - 4, 138, :_reduce_162, + 4, 138, :_reduce_163, 1, 140, :_reduce_none, - 3, 140, :_reduce_164, - 3, 139, :_reduce_165, + 3, 140, :_reduce_165, + 3, 139, :_reduce_166, 1, 137, :_reduce_none, 1, 137, :_reduce_none, 1, 137, :_reduce_none, @@ -840,70 +847,70 @@ racc_reduce_table = [ 1, 137, :_reduce_none, 1, 137, :_reduce_none, 1, 137, :_reduce_none, - 1, 137, :_reduce_174, + 1, 137, :_reduce_175, 1, 137, :_reduce_none, - 1, 141, :_reduce_176, + 1, 141, :_reduce_177, 1, 142, :_reduce_none, - 3, 142, :_reduce_178, - 2, 80, :_reduce_179, - 6, 82, :_reduce_180, - 5, 82, :_reduce_181, - 7, 83, :_reduce_182, - 6, 83, :_reduce_183, - 6, 84, :_reduce_184, - 5, 84, :_reduce_185, - 1, 106, :_reduce_186, - 1, 101, :_reduce_187, + 3, 142, :_reduce_179, + 2, 80, :_reduce_180, + 6, 82, :_reduce_181, + 5, 82, :_reduce_182, + 7, 83, :_reduce_183, + 6, 83, :_reduce_184, + 6, 84, :_reduce_185, + 5, 84, :_reduce_186, + 1, 106, :_reduce_187, 1, 101, :_reduce_188, 1, 101, :_reduce_189, + 1, 101, :_reduce_190, 1, 145, :_reduce_none, - 3, 145, :_reduce_191, - 1, 147, :_reduce_192, - 1, 148, :_reduce_193, + 3, 145, :_reduce_192, + 1, 147, :_reduce_193, 1, 148, :_reduce_194, 1, 148, :_reduce_195, + 1, 148, :_reduce_196, 1, 148, :_reduce_none, - 0, 72, :_reduce_197, - 0, 149, :_reduce_198, + 0, 72, :_reduce_198, + 0, 149, :_reduce_199, 1, 143, :_reduce_none, - 3, 143, :_reduce_200, 3, 143, :_reduce_201, + 3, 143, :_reduce_202, 1, 150, :_reduce_none, - 3, 150, :_reduce_203, - 3, 151, :_reduce_204, - 1, 151, :_reduce_205, - 3, 151, :_reduce_206, - 1, 151, :_reduce_207, + 3, 150, :_reduce_204, + 3, 151, :_reduce_205, + 1, 151, :_reduce_206, + 3, 151, :_reduce_207, + 1, 151, :_reduce_208, 1, 146, :_reduce_none, - 2, 146, :_reduce_209, + 2, 146, :_reduce_210, 1, 144, :_reduce_none, - 2, 144, :_reduce_211, + 2, 144, :_reduce_212, 1, 152, :_reduce_none, 1, 152, :_reduce_none, - 1, 94, :_reduce_214, - 3, 119, :_reduce_215, - 4, 119, :_reduce_216, - 2, 119, :_reduce_217, + 1, 94, :_reduce_215, + 3, 119, :_reduce_216, + 4, 119, :_reduce_217, + 2, 119, :_reduce_218, 1, 127, :_reduce_none, 1, 127, :_reduce_none, 0, 105, :_reduce_none, - 1, 105, :_reduce_221, - 1, 133, :_reduce_222, - 3, 128, :_reduce_223, - 4, 128, :_reduce_224, - 2, 128, :_reduce_225, + 1, 105, :_reduce_222, + 1, 133, :_reduce_223, + 3, 128, :_reduce_224, + 4, 128, :_reduce_225, + 2, 128, :_reduce_226, 1, 153, :_reduce_none, - 3, 153, :_reduce_227, - 3, 154, :_reduce_228, - 1, 155, :_reduce_229, + 3, 153, :_reduce_228, + 3, 154, :_reduce_229, 1, 155, :_reduce_230, - 4, 121, :_reduce_231, + 1, 155, :_reduce_231, + 4, 121, :_reduce_232, 1, 100, :_reduce_none, - 4, 100, :_reduce_233 ] + 4, 100, :_reduce_234 ] -racc_reduce_n = 234 +racc_reduce_n = 235 -racc_shift_n = 385 +racc_shift_n = 387 racc_token_table = { false => 0, @@ -1342,7 +1349,13 @@ module_eval(<<'.,.,', 'grammar.ra', 129) # reduce 36 omitted -# reduce 37 omitted +module_eval(<<'.,.,', 'grammar.ra', 142) + def _reduce_37(val, _values, result) + result = ast AST::Minus, :value => val[1] + + result + end +.,., # reduce 38 omitted @@ -1356,16 +1369,18 @@ module_eval(<<'.,.,', 'grammar.ra', 129) # reduce 43 omitted -module_eval(<<'.,.,', 'grammar.ra', 149) - def _reduce_44(val, _values, result) +# reduce 44 omitted + +module_eval(<<'.,.,', 'grammar.ra', 152) + def _reduce_45(val, _values, result) result = ast AST::Name, :value => val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 153) - def _reduce_45(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 156) + def _reduce_46(val, _values, result) @lexer.commentpop array = val[2] array = [array] if array.instance_of?(AST::ResourceInstance) @@ -1389,8 +1404,8 @@ module_eval(<<'.,.,', 'grammar.ra', 153) end .,., -module_eval(<<'.,.,', 'grammar.ra', 172) - def _reduce_46(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 175) + def _reduce_47(val, _values, result) # This is a deprecated syntax. error "All resource specifications require names" @@ -1398,8 +1413,8 @@ module_eval(<<'.,.,', 'grammar.ra', 172) end .,., -module_eval(<<'.,.,', 'grammar.ra', 175) - def _reduce_47(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 178) + def _reduce_48(val, _values, result) # a defaults setting for a type @lexer.commentpop result = ast(AST::ResourceDefaults, :type => val[0], :parameters => val[2]) @@ -1408,8 +1423,8 @@ module_eval(<<'.,.,', 'grammar.ra', 175) end .,., -module_eval(<<'.,.,', 'grammar.ra', 182) - def _reduce_48(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 185) + def _reduce_49(val, _values, result) @lexer.commentpop result = ast AST::ResourceOverride, :object => val[0], :parameters => val[2] @@ -1417,8 +1432,8 @@ module_eval(<<'.,.,', 'grammar.ra', 182) end .,., -module_eval(<<'.,.,', 'grammar.ra', 189) - def _reduce_49(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 192) + def _reduce_50(val, _values, result) type = val[0] if (type == :exported and ! Puppet[:storeconfigs]) and ! Puppet[:parseonly] @@ -1444,22 +1459,22 @@ module_eval(<<'.,.,', 'grammar.ra', 189) end .,., -module_eval(<<'.,.,', 'grammar.ra', 211) - def _reduce_50(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 214) + def _reduce_51(val, _values, result) result = :virtual result end .,., -module_eval(<<'.,.,', 'grammar.ra', 212) - def _reduce_51(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 215) + def _reduce_52(val, _values, result) result = :exported result end .,., -module_eval(<<'.,.,', 'grammar.ra', 217) - def _reduce_52(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 220) + 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 @@ -1482,8 +1497,8 @@ module_eval(<<'.,.,', 'grammar.ra', 217) end .,., -module_eval(<<'.,.,', 'grammar.ra', 236) - def _reduce_53(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 239) + def _reduce_54(val, _values, result) if val[0] =~ /^[a-z]/ Puppet.warning addcontext("Collection names must now be capitalized") end @@ -1506,8 +1521,8 @@ module_eval(<<'.,.,', 'grammar.ra', 236) end .,., -module_eval(<<'.,.,', 'grammar.ra', 257) - def _reduce_54(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 260) + def _reduce_55(val, _values, result) if val[1] result = val[1] result.form = :virtual @@ -1519,8 +1534,8 @@ module_eval(<<'.,.,', 'grammar.ra', 257) end .,., -module_eval(<<'.,.,', 'grammar.ra', 265) - def _reduce_55(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 268) + def _reduce_56(val, _values, result) if val[1] result = val[1] result.form = :exported @@ -1532,22 +1547,22 @@ module_eval(<<'.,.,', 'grammar.ra', 265) end .,., -# reduce 56 omitted - # reduce 57 omitted -module_eval(<<'.,.,', 'grammar.ra', 278) - def _reduce_58(val, _values, result) +# reduce 58 omitted + +module_eval(<<'.,.,', 'grammar.ra', 281) + def _reduce_59(val, _values, result) result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2] result end .,., -# reduce 59 omitted +# reduce 60 omitted -module_eval(<<'.,.,', 'grammar.ra', 283) - def _reduce_60(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 286) + def _reduce_61(val, _values, result) result = val[1] result.parens = true @@ -1555,22 +1570,22 @@ module_eval(<<'.,.,', 'grammar.ra', 283) end .,., -module_eval(<<'.,.,', 'grammar.ra', 287) - def _reduce_61(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 290) + def _reduce_62(val, _values, result) result=val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 288) - def _reduce_62(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 291) + def _reduce_63(val, _values, result) result=val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 291) - def _reduce_63(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 294) + 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 @@ -1579,8 +1594,8 @@ module_eval(<<'.,.,', 'grammar.ra', 291) end .,., -module_eval(<<'.,.,', 'grammar.ra', 296) - def _reduce_64(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 299) + 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 @@ -1589,22 +1604,22 @@ module_eval(<<'.,.,', 'grammar.ra', 296) end .,., -# reduce 65 omitted - # reduce 66 omitted -module_eval(<<'.,.,', 'grammar.ra', 305) - def _reduce_67(val, _values, result) +# reduce 67 omitted + +module_eval(<<'.,.,', 'grammar.ra', 308) + def _reduce_68(val, _values, result) result = ast AST::ResourceInstance, :children => [val[0],val[2]] result end .,., -# reduce 68 omitted +# reduce 69 omitted -module_eval(<<'.,.,', 'grammar.ra', 310) - def _reduce_69(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 313) + def _reduce_70(val, _values, result) if val[0].instance_of?(AST::ResourceInstance) result = ast AST::ASTArray, :children => [val[0],val[2]] else @@ -1616,36 +1631,34 @@ module_eval(<<'.,.,', 'grammar.ra', 310) end .,., -# reduce 70 omitted - # reduce 71 omitted -module_eval(<<'.,.,', 'grammar.ra', 322) - def _reduce_72(val, _values, result) +# reduce 72 omitted + +module_eval(<<'.,.,', 'grammar.ra', 325) + def _reduce_73(val, _values, result) result = ast AST::Undef, :value => :undef result end .,., -module_eval(<<'.,.,', 'grammar.ra', 326) - def _reduce_73(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 329) + def _reduce_74(val, _values, result) result = ast AST::Name, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 330) - def _reduce_74(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 333) + def _reduce_75(val, _values, result) result = ast AST::Type, :value => val[0][:value], :line => val[0][:line] result end .,., -# reduce 75 omitted - # reduce 76 omitted # reduce 77 omitted @@ -1658,8 +1671,10 @@ module_eval(<<'.,.,', 'grammar.ra', 330) # reduce 81 omitted -module_eval(<<'.,.,', 'grammar.ra', 342) - def _reduce_82(val, _values, result) +# reduce 82 omitted + +module_eval(<<'.,.,', 'grammar.ra', 345) + 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] @@ -1669,16 +1684,16 @@ module_eval(<<'.,.,', 'grammar.ra', 342) end .,., -module_eval(<<'.,.,', 'grammar.ra', 348) - def _reduce_83(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 351) + def _reduce_84(val, _values, result) result = ast AST::VarDef, :name => val[0], :value => val[2] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 352) - def _reduce_84(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 355) + 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] @@ -1686,23 +1701,23 @@ module_eval(<<'.,.,', 'grammar.ra', 352) end .,., -module_eval(<<'.,.,', 'grammar.ra', 358) - def _reduce_85(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 361) + def _reduce_86(val, _values, result) result = ast AST::ASTArray result end .,., -module_eval(<<'.,.,', 'grammar.ra', 360) - def _reduce_86(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 363) + def _reduce_87(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 362) - def _reduce_87(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 365) + def _reduce_88(val, _values, result) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] @@ -1714,16 +1729,16 @@ module_eval(<<'.,.,', 'grammar.ra', 362) end .,., -module_eval(<<'.,.,', 'grammar.ra', 371) - def _reduce_88(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 374) + 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', 375) - def _reduce_89(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 378) + def _reduce_90(val, _values, result) result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2], :add => true @@ -1731,27 +1746,27 @@ module_eval(<<'.,.,', 'grammar.ra', 375) end .,., -# reduce 90 omitted - # reduce 91 omitted -module_eval(<<'.,.,', 'grammar.ra', 384) - def _reduce_92(val, _values, result) +# reduce 92 omitted + +module_eval(<<'.,.,', 'grammar.ra', 387) + def _reduce_93(val, _values, result) result = ast AST::ASTArray result end .,., -module_eval(<<'.,.,', 'grammar.ra', 386) - def _reduce_93(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 389) + def _reduce_94(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 388) - def _reduce_94(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 391) + def _reduce_95(val, _values, result) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] @@ -1763,10 +1778,10 @@ module_eval(<<'.,.,', 'grammar.ra', 388) end .,., -# reduce 95 omitted +# reduce 96 omitted -module_eval(<<'.,.,', 'grammar.ra', 398) - def _reduce_96(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 401) + def _reduce_97(val, _values, result) if val[0].instance_of?(AST::ASTArray) result = val[0].push(val[2]) else @@ -1777,8 +1792,6 @@ module_eval(<<'.,.,', 'grammar.ra', 398) end .,., -# reduce 97 omitted - # reduce 98 omitted # reduce 99 omitted @@ -1813,8 +1826,10 @@ module_eval(<<'.,.,', 'grammar.ra', 398) # reduce 114 omitted -module_eval(<<'.,.,', 'grammar.ra', 427) - def _reduce_115(val, _values, result) +# reduce 115 omitted + +module_eval(<<'.,.,', 'grammar.ra', 430) + def _reduce_116(val, _values, result) args = aryfy(val[2]) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], @@ -1825,8 +1840,8 @@ module_eval(<<'.,.,', 'grammar.ra', 427) end .,., -module_eval(<<'.,.,', 'grammar.ra', 433) - def _reduce_116(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 436) + def _reduce_117(val, _values, result) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => AST::ASTArray.new({}), @@ -1836,51 +1851,51 @@ module_eval(<<'.,.,', 'grammar.ra', 433) end .,., -module_eval(<<'.,.,', 'grammar.ra', 439) - def _reduce_117(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 442) + def _reduce_118(val, _values, result) result = ast AST::String, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 440) - def _reduce_118(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 443) + 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', 442) - def _reduce_119(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 445) + def _reduce_120(val, _values, result) result = [val[0]] + val[1] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 444) - def _reduce_120(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 447) + def _reduce_121(val, _values, result) result = [ast(AST::String,val[0])] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 445) - def _reduce_121(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 448) + def _reduce_122(val, _values, result) result = [ast(AST::String,val[0])] + val[1] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 448) - def _reduce_122(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 451) + def _reduce_123(val, _values, result) result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 452) - def _reduce_123(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 455) + 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] @@ -1888,24 +1903,24 @@ module_eval(<<'.,.,', 'grammar.ra', 452) end .,., -module_eval(<<'.,.,', 'grammar.ra', 455) - def _reduce_124(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 458) + def _reduce_125(val, _values, result) result = ast AST::ResourceReference, :type => val[0], :title => val[2] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 459) - def _reduce_125(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 462) + def _reduce_126(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 463) - def _reduce_126(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 466) + def _reduce_127(val, _values, result) @lexer.commentpop args = { :test => val[0], @@ -1920,8 +1935,8 @@ module_eval(<<'.,.,', 'grammar.ra', 463) end .,., -module_eval(<<'.,.,', 'grammar.ra', 474) - def _reduce_127(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 477) + def _reduce_128(val, _values, result) @lexer.commentpop args = { :test => val[0], @@ -1936,18 +1951,18 @@ module_eval(<<'.,.,', 'grammar.ra', 474) end .,., -# reduce 128 omitted +# reduce 129 omitted -module_eval(<<'.,.,', 'grammar.ra', 487) - def _reduce_129(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 490) + def _reduce_130(val, _values, result) result = ast AST::Else, :statements => val[1] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 490) - def _reduce_130(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 493) + def _reduce_131(val, _values, result) @lexer.commentpop result = ast AST::Else, :statements => val[2] @@ -1955,8 +1970,8 @@ module_eval(<<'.,.,', 'grammar.ra', 490) end .,., -module_eval(<<'.,.,', 'grammar.ra', 494) - def _reduce_131(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 497) + def _reduce_132(val, _values, result) @lexer.commentpop result = ast AST::Else, :statements => ast(AST::Nop) @@ -1964,19 +1979,11 @@ module_eval(<<'.,.,', 'grammar.ra', 494) end .,., -# reduce 132 omitted - -module_eval(<<'.,.,', 'grammar.ra', 512) - def _reduce_133(val, _values, result) - result = ast AST::InOperator, :lval => val[0], :rval => val[2] - - result - end -.,., +# reduce 133 omitted module_eval(<<'.,.,', 'grammar.ra', 515) def _reduce_134(val, _values, result) - result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] + result = ast AST::InOperator, :lval => val[0], :rval => val[2] result end @@ -1992,7 +1999,7 @@ module_eval(<<'.,.,', 'grammar.ra', 518) module_eval(<<'.,.,', 'grammar.ra', 521) def _reduce_136(val, _values, result) - result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] + result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end @@ -2040,7 +2047,7 @@ module_eval(<<'.,.,', 'grammar.ra', 536) module_eval(<<'.,.,', 'grammar.ra', 539) def _reduce_142(val, _values, result) - result = ast AST::Minus, :value => val[1] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end @@ -2048,7 +2055,7 @@ module_eval(<<'.,.,', 'grammar.ra', 539) module_eval(<<'.,.,', 'grammar.ra', 542) def _reduce_143(val, _values, result) - result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] + result = ast AST::Minus, :value => val[1] result end @@ -2096,7 +2103,7 @@ module_eval(<<'.,.,', 'grammar.ra', 557) module_eval(<<'.,.,', 'grammar.ra', 560) def _reduce_149(val, _values, result) - result = ast AST::Not, :value => val[1] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end @@ -2104,7 +2111,7 @@ module_eval(<<'.,.,', 'grammar.ra', 560) module_eval(<<'.,.,', 'grammar.ra', 563) def _reduce_150(val, _values, result) - result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] + result = ast AST::Not, :value => val[1] result end @@ -2120,14 +2127,22 @@ module_eval(<<'.,.,', 'grammar.ra', 566) module_eval(<<'.,.,', 'grammar.ra', 569) def _reduce_152(val, _values, result) - result = val[1] + result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 573) +module_eval(<<'.,.,', 'grammar.ra', 572) def _reduce_153(val, _values, result) + result = val[1] + + result + end +.,., + +module_eval(<<'.,.,', 'grammar.ra', 576) + def _reduce_154(val, _values, result) @lexer.commentpop options = val[3] options = ast AST::ASTArray, :children => [val[3]] unless options.instance_of?(AST::ASTArray) @@ -2137,10 +2152,10 @@ module_eval(<<'.,.,', 'grammar.ra', 573) end .,., -# reduce 154 omitted +# reduce 155 omitted -module_eval(<<'.,.,', 'grammar.ra', 581) - def _reduce_155(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 584) + def _reduce_156(val, _values, result) if val[0].instance_of?(AST::ASTArray) val[0].push val[1] result = val[0] @@ -2152,8 +2167,8 @@ module_eval(<<'.,.,', 'grammar.ra', 581) end .,., -module_eval(<<'.,.,', 'grammar.ra', 590) - def _reduce_156(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 593) + def _reduce_157(val, _values, result) @lexer.commentpop result = ast AST::CaseOpt, :value => val[0], :statements => val[3] @@ -2161,8 +2176,8 @@ module_eval(<<'.,.,', 'grammar.ra', 590) end .,., -module_eval(<<'.,.,', 'grammar.ra', 593) - def _reduce_157(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 596) + def _reduce_158(val, _values, result) @lexer.commentpop result = ast( @@ -2176,10 +2191,10 @@ module_eval(<<'.,.,', 'grammar.ra', 593) end .,., -# reduce 158 omitted +# reduce 159 omitted -module_eval(<<'.,.,', 'grammar.ra', 605) - def _reduce_159(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 608) + def _reduce_160(val, _values, result) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] @@ -2191,18 +2206,18 @@ module_eval(<<'.,.,', 'grammar.ra', 605) end .,., -module_eval(<<'.,.,', 'grammar.ra', 614) - def _reduce_160(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 617) + def _reduce_161(val, _values, result) result = ast AST::Selector, :param => val[0], :values => val[2] result end .,., -# reduce 161 omitted +# reduce 162 omitted -module_eval(<<'.,.,', 'grammar.ra', 619) - def _reduce_162(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 622) + def _reduce_163(val, _values, result) @lexer.commentpop result = val[1] @@ -2210,10 +2225,10 @@ module_eval(<<'.,.,', 'grammar.ra', 619) end .,., -# reduce 163 omitted +# reduce 164 omitted -module_eval(<<'.,.,', 'grammar.ra', 625) - def _reduce_164(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 628) + def _reduce_165(val, _values, result) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] @@ -2225,16 +2240,14 @@ module_eval(<<'.,.,', 'grammar.ra', 625) end .,., -module_eval(<<'.,.,', 'grammar.ra', 634) - def _reduce_165(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 637) + def _reduce_166(val, _values, result) result = ast AST::ResourceParam, :param => val[0], :value => val[2] result end .,., -# reduce 166 omitted - # reduce 167 omitted # reduce 168 omitted @@ -2249,34 +2262,36 @@ module_eval(<<'.,.,', 'grammar.ra', 634) # reduce 173 omitted -module_eval(<<'.,.,', 'grammar.ra', 646) - def _reduce_174(val, _values, result) +# reduce 174 omitted + +module_eval(<<'.,.,', 'grammar.ra', 649) + def _reduce_175(val, _values, result) result = ast AST::Default, :value => val[0][:value], :line => val[0][:line] result end .,., -# reduce 175 omitted +# reduce 176 omitted -module_eval(<<'.,.,', 'grammar.ra', 651) - def _reduce_176(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 654) + def _reduce_177(val, _values, result) result = [val[0][:value]] result end .,., -# reduce 177 omitted +# reduce 178 omitted -module_eval(<<'.,.,', 'grammar.ra', 653) - def _reduce_178(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 656) + def _reduce_179(val, _values, result) result = val[0] += val[2] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 656) - def _reduce_179(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 659) + def _reduce_180(val, _values, result) val[1].each do |file| import(file) end @@ -2287,8 +2302,8 @@ module_eval(<<'.,.,', 'grammar.ra', 656) end .,., -module_eval(<<'.,.,', 'grammar.ra', 666) - def _reduce_180(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 669) + def _reduce_181(val, _values, result) @lexer.commentpop newdefine classname(val[1]), :arguments => val[2], :code => val[4], :line => val[0][:line] @lexer.indefine = false @@ -2300,8 +2315,8 @@ module_eval(<<'.,.,', 'grammar.ra', 666) end .,., -module_eval(<<'.,.,', 'grammar.ra', 673) - def _reduce_181(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 676) + def _reduce_182(val, _values, result) @lexer.commentpop newdefine classname(val[1]), :arguments => val[2], :line => val[0][:line] @lexer.indefine = false @@ -2311,8 +2326,8 @@ module_eval(<<'.,.,', 'grammar.ra', 673) end .,., -module_eval(<<'.,.,', 'grammar.ra', 681) - def _reduce_182(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 684) + def _reduce_183(val, _values, result) @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop @@ -2323,8 +2338,8 @@ module_eval(<<'.,.,', 'grammar.ra', 681) end .,., -module_eval(<<'.,.,', 'grammar.ra', 687) - def _reduce_183(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 690) + def _reduce_184(val, _values, result) @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop @@ -2335,8 +2350,8 @@ module_eval(<<'.,.,', 'grammar.ra', 687) end .,., -module_eval(<<'.,.,', 'grammar.ra', 695) - def _reduce_184(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 698) + def _reduce_185(val, _values, result) @lexer.commentpop newnode val[1], :parent => val[2], :code => val[4], :line => val[0][:line] result = nil @@ -2345,8 +2360,8 @@ module_eval(<<'.,.,', 'grammar.ra', 695) end .,., -module_eval(<<'.,.,', 'grammar.ra', 699) - def _reduce_185(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 702) + def _reduce_186(val, _values, result) @lexer.commentpop newnode val[1], :parent => val[2], :line => val[0][:line] result = nil @@ -2355,38 +2370,38 @@ module_eval(<<'.,.,', 'grammar.ra', 699) end .,., -module_eval(<<'.,.,', 'grammar.ra', 704) - def _reduce_186(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 707) + def _reduce_187(val, _values, result) result = val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 706) - def _reduce_187(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 709) + def _reduce_188(val, _values, result) result = val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 707) - def _reduce_188(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 710) + def _reduce_189(val, _values, result) result = val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 708) - def _reduce_189(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 711) + def _reduce_190(val, _values, result) result = "class" result end .,., -# reduce 190 omitted +# reduce 191 omitted -module_eval(<<'.,.,', 'grammar.ra', 714) - def _reduce_191(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 717) + def _reduce_192(val, _values, result) result = val[0] result = [result] unless result.is_a?(Array) result << val[2] @@ -2395,65 +2410,65 @@ module_eval(<<'.,.,', 'grammar.ra', 714) end .,., -module_eval(<<'.,.,', 'grammar.ra', 720) - def _reduce_192(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 723) + def _reduce_193(val, _values, result) result = ast AST::HostName, :value => val[0] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 723) - def _reduce_193(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 726) + def _reduce_194(val, _values, result) result = val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 724) - def _reduce_194(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 727) + def _reduce_195(val, _values, result) result = val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 725) - def _reduce_195(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 728) + def _reduce_196(val, _values, result) result = val[0][:value] result end .,., -# reduce 196 omitted +# reduce 197 omitted -module_eval(<<'.,.,', 'grammar.ra', 729) - def _reduce_197(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 732) + def _reduce_198(val, _values, result) result = nil result end .,., -module_eval(<<'.,.,', 'grammar.ra', 733) - def _reduce_198(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 736) + def _reduce_199(val, _values, result) result = ast AST::ASTArray, :children => [] result end .,., -# reduce 199 omitted +# reduce 200 omitted -module_eval(<<'.,.,', 'grammar.ra', 738) - def _reduce_200(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 741) + def _reduce_201(val, _values, result) result = nil result end .,., -module_eval(<<'.,.,', 'grammar.ra', 741) - def _reduce_201(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 744) + def _reduce_202(val, _values, result) result = val[1] result = [result] unless result[0].is_a?(Array) @@ -2461,10 +2476,10 @@ module_eval(<<'.,.,', 'grammar.ra', 741) end .,., -# reduce 202 omitted +# reduce 203 omitted -module_eval(<<'.,.,', 'grammar.ra', 747) - def _reduce_203(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 750) + def _reduce_204(val, _values, result) result = val[0] result = [result] unless result[0].is_a?(Array) result << val[2] @@ -2473,8 +2488,8 @@ module_eval(<<'.,.,', 'grammar.ra', 747) end .,., -module_eval(<<'.,.,', 'grammar.ra', 753) - def _reduce_204(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 756) + def _reduce_205(val, _values, result) Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") result = [val[0][:value], val[2]] @@ -2482,8 +2497,8 @@ module_eval(<<'.,.,', 'grammar.ra', 753) end .,., -module_eval(<<'.,.,', 'grammar.ra', 757) - def _reduce_205(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 760) + def _reduce_206(val, _values, result) Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") result = [val[0][:value]] @@ -2491,56 +2506,56 @@ module_eval(<<'.,.,', 'grammar.ra', 757) end .,., -module_eval(<<'.,.,', 'grammar.ra', 760) - def _reduce_206(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 763) + def _reduce_207(val, _values, result) result = [val[0][:value], val[2]] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 762) - def _reduce_207(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 765) + def _reduce_208(val, _values, result) result = [val[0][:value]] result end .,., -# reduce 208 omitted +# reduce 209 omitted -module_eval(<<'.,.,', 'grammar.ra', 767) - def _reduce_209(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 770) + def _reduce_210(val, _values, result) result = val[1] result end .,., -# reduce 210 omitted +# reduce 211 omitted -module_eval(<<'.,.,', 'grammar.ra', 772) - def _reduce_211(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 775) + def _reduce_212(val, _values, result) result = val[1] result end .,., -# reduce 212 omitted - # reduce 213 omitted -module_eval(<<'.,.,', 'grammar.ra', 778) - def _reduce_214(val, _values, result) +# reduce 214 omitted + +module_eval(<<'.,.,', 'grammar.ra', 781) + def _reduce_215(val, _values, result) result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 782) - def _reduce_215(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 785) + def _reduce_216(val, _values, result) if val[1].instance_of?(AST::ASTArray) result = val[1] else @@ -2551,8 +2566,8 @@ module_eval(<<'.,.,', 'grammar.ra', 782) end .,., -module_eval(<<'.,.,', 'grammar.ra', 789) - def _reduce_216(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 792) + def _reduce_217(val, _values, result) if val[1].instance_of?(AST::ASTArray) result = val[1] else @@ -2563,37 +2578,37 @@ module_eval(<<'.,.,', 'grammar.ra', 789) end .,., -module_eval(<<'.,.,', 'grammar.ra', 795) - def _reduce_217(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 798) + def _reduce_218(val, _values, result) result = ast AST::ASTArray result end .,., -# reduce 218 omitted - # reduce 219 omitted # reduce 220 omitted -module_eval(<<'.,.,', 'grammar.ra', 802) - def _reduce_221(val, _values, result) +# reduce 221 omitted + +module_eval(<<'.,.,', 'grammar.ra', 805) + def _reduce_222(val, _values, result) result = nil result end .,., -module_eval(<<'.,.,', 'grammar.ra', 805) - def _reduce_222(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 808) + def _reduce_223(val, _values, result) result = ast AST::Regex, :value => val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 809) - def _reduce_223(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 812) + def _reduce_224(val, _values, result) if val[1].instance_of?(AST::ASTHash) result = val[1] else @@ -2604,8 +2619,8 @@ module_eval(<<'.,.,', 'grammar.ra', 809) end .,., -module_eval(<<'.,.,', 'grammar.ra', 816) - def _reduce_224(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 819) + def _reduce_225(val, _values, result) if val[1].instance_of?(AST::ASTHash) result = val[1] else @@ -2616,18 +2631,18 @@ module_eval(<<'.,.,', 'grammar.ra', 816) end .,., -module_eval(<<'.,.,', 'grammar.ra', 822) - def _reduce_225(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 825) + def _reduce_226(val, _values, result) result = ast AST::ASTHash result end .,., -# reduce 226 omitted +# reduce 227 omitted -module_eval(<<'.,.,', 'grammar.ra', 827) - def _reduce_227(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 830) + def _reduce_228(val, _values, result) if val[0].instance_of?(AST::ASTHash) result = val[0].merge(val[2]) else @@ -2639,40 +2654,40 @@ module_eval(<<'.,.,', 'grammar.ra', 827) end .,., -module_eval(<<'.,.,', 'grammar.ra', 836) - def _reduce_228(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 839) + def _reduce_229(val, _values, result) result = ast AST::ASTHash, { :value => { val[0] => val[2] } } result end .,., -module_eval(<<'.,.,', 'grammar.ra', 839) - def _reduce_229(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 842) + def _reduce_230(val, _values, result) result = val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 840) - def _reduce_230(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 843) + def _reduce_231(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 843) - def _reduce_231(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 846) + def _reduce_232(val, _values, result) result = ast AST::HashOrArrayAccess, :variable => val[0][:value], :key => val[2] result end .,., -# reduce 232 omitted +# reduce 233 omitted -module_eval(<<'.,.,', 'grammar.ra', 848) - def _reduce_233(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 851) + def _reduce_234(val, _values, result) result = ast AST::HashOrArrayAccess, :variable => val[0], :key => val[2] result diff --git a/spec/integration/parser/parser_spec.rb b/spec/integration/parser/parser_spec.rb index 20d87c228..000e68dd8 100755 --- a/spec/integration/parser/parser_spec.rb +++ b/spec/integration/parser/parser_spec.rb @@ -116,5 +116,18 @@ describe Puppet::Parser::Parser do $out = $hash['a']['b']['c'] }.should parse_with { |v| v.value.is_a?(Puppet::Parser::AST::ASTHash) } end + + it "should be able to pass numbers to functions" do + %q{ + my_function(1) + }.should parse_as(Puppet::Parser::AST::Function) + end + + it "should be able to pass negative numbers to functions" do + %q{ + my_function(-1) + }.should parse_as(Puppet::Parser::AST::Function) + end + end end -- cgit From 23fc4db954c22bce2c6cc8996d5fafb175e2b747 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Thu, 17 Feb 2011 14:59:59 -0800 Subject: (#5132) Provide a query REST interface for inventory This REST interface returns a list of nodes that match a fact query. Fact queries can use (in)equality testing as a string comparison, and >, <, >=, <= numerical comparisons. Multiple tests can be done as AND comparisons, not OR. The fact queries need to be prefixed by facts, and the comparisons other than equality are specified with a .comparison_type after the fact name. This will be better explained in the REST documentation on the website. Searches that don't match anything now return empty array instead of a 404 error. Conflicts: spec/spec_helper.rb --- lib/puppet/defaults.rb | 1 + lib/puppet/indirector/indirection.rb | 1 + lib/puppet/indirector/inventory/yaml.rb | 47 ++++++++++ lib/puppet/network/http/api/v1.rb | 3 +- lib/puppet/network/http/handler.rb | 2 +- lib/puppet/node.rb | 1 + lib/puppet/node/inventory.rb | 7 ++ spec/unit/indirector/facts/yaml_spec.rb | 4 +- spec/unit/indirector/inventory/yaml_spec.rb | 130 ++++++++++++++++++++++++++++ spec/unit/network/http/api/v1_spec.rb | 12 +++ spec/unit/network/http/handler_spec.rb | 11 ++- 11 files changed, 210 insertions(+), 9 deletions(-) create mode 100644 lib/puppet/indirector/inventory/yaml.rb create mode 100644 lib/puppet/node/inventory.rb create mode 100644 spec/unit/indirector/inventory/yaml_spec.rb diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 687ac4eb0..0b0de4324 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -120,6 +120,7 @@ module Puppet :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 => [Puppet.application_name.to_s == "master" ? 'yaml' : 'facter', "The node facts terminus."], + :inventory_terminus => [ "$facts_terminus", "Should usually be the same as the facts terminus" ], :httplog => { :default => "$logdir/http.log", :owner => "root", :mode => 0640, diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb index ec147ec69..3d17e6e47 100644 --- a/lib/puppet/indirector/indirection.rb +++ b/lib/puppet/indirector/indirection.rb @@ -248,6 +248,7 @@ class Puppet::Indirector::Indirection if result = terminus.search(request) raise Puppet::DevError, "Search results from terminus #{terminus.name} are not an array" unless result.is_a?(Array) result.each do |instance| + next unless instance.respond_to? :expiration instance.expiration ||= self.expiration end return result diff --git a/lib/puppet/indirector/inventory/yaml.rb b/lib/puppet/indirector/inventory/yaml.rb new file mode 100644 index 000000000..c6b1a14aa --- /dev/null +++ b/lib/puppet/indirector/inventory/yaml.rb @@ -0,0 +1,47 @@ +require 'puppet/node/inventory' +require 'puppet/indirector/yaml' + +class Puppet::Node::Inventory::Yaml < Puppet::Indirector::Yaml + desc "Return node names matching the fact query" + + # Return the path to a given node's file. + def yaml_dir_path + base = Puppet.run_mode.master? ? Puppet[:yamldir] : Puppet[:clientyamldir] + File.join(base, 'facts', '*.yaml') + end + + def node_matches?(facts, options) + options.each do |key, value| + type, name, operator = key.to_s.split(".") + operator ||= 'eq' + + next unless type == "facts" + return false unless facts.values[name] + + return false unless case operator + when "eq" + facts.values[name].to_s == value.to_s + when "le" + facts.values[name].to_f <= value.to_f + when "ge" + facts.values[name].to_f >= value.to_f + when "lt" + facts.values[name].to_f < value.to_f + when "gt" + facts.values[name].to_f > value.to_f + when "ne" + facts.values[name].to_s != value.to_s + end + end + return true + end + + def search(request) + node_names = [] + Dir.glob(yaml_dir_path).each do |file| + facts = YAML.load_file(file) + node_names << facts.name if node_matches?(facts, request.options) + end + node_names + end +end diff --git a/lib/puppet/network/http/api/v1.rb b/lib/puppet/network/http/api/v1.rb index 8aa1f0ee1..0a04a465f 100644 --- a/lib/puppet/network/http/api/v1.rb +++ b/lib/puppet/network/http/api/v1.rb @@ -60,9 +60,8 @@ module Puppet::Network::HTTP::API::V1 # fix to not need this, and our goal is to move away from the complication # that leads to the fix being too long. return :singular if indirection == "facts" - - # "status" really is singular return :singular if indirection == "status" + return :plural if indirection == "inventory" result = (indirection =~ /s$/) ? :plural : :singular diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb index 9e9356b2f..e192613ad 100644 --- a/lib/puppet/network/http/handler.rb +++ b/lib/puppet/network/http/handler.rb @@ -131,7 +131,7 @@ module Puppet::Network::HTTP::Handler def do_search(indirection_request, request, response) result = indirection_request.model.search(indirection_request.key, indirection_request.to_hash) - if result.nil? or (result.is_a?(Array) and result.empty?) + if result.nil? return do_exception(response, "Could not find instances in #{indirection_request.indirection_name} with '#{indirection_request.key}'", 404) end diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb index 2453cd1d5..e8d58e6be 100644 --- a/lib/puppet/node.rb +++ b/lib/puppet/node.rb @@ -3,6 +3,7 @@ require 'puppet/indirector' # A class for managing nodes, including their facts and environment. class Puppet::Node require 'puppet/node/facts' + require 'puppet/node/inventory' require 'puppet/node/environment' # Set up indirection, so that nodes can be looked for in diff --git a/lib/puppet/node/inventory.rb b/lib/puppet/node/inventory.rb new file mode 100644 index 000000000..fd99163b0 --- /dev/null +++ b/lib/puppet/node/inventory.rb @@ -0,0 +1,7 @@ +require 'puppet/node' +require 'puppet/indirector' + +class Puppet::Node::Inventory + extend Puppet::Indirector + indirects :inventory, :terminus_setting => :inventory_terminus +end diff --git a/spec/unit/indirector/facts/yaml_spec.rb b/spec/unit/indirector/facts/yaml_spec.rb index e7bac3471..37a1bcae0 100755 --- a/spec/unit/indirector/facts/yaml_spec.rb +++ b/spec/unit/indirector/facts/yaml_spec.rb @@ -10,9 +10,9 @@ describe Puppet::Node::Facts::Yaml do Puppet::Node::Facts::Yaml.superclass.should equal(Puppet::Indirector::Yaml) end - it "should have documentation" do Puppet::Node::Facts::Yaml.doc.should_not be_nil + Puppet::Node::Facts::Yaml.doc.should_not be_empty end it "should be registered with the facts indirection" do @@ -20,7 +20,7 @@ describe Puppet::Node::Facts::Yaml do Puppet::Node::Facts::Yaml.indirection.should equal(indirection) end - it "should have its name set to :facts" do + it "should have its name set to :yaml" do Puppet::Node::Facts::Yaml.name.should == :yaml end end diff --git a/spec/unit/indirector/inventory/yaml_spec.rb b/spec/unit/indirector/inventory/yaml_spec.rb new file mode 100644 index 000000000..3a7035a9e --- /dev/null +++ b/spec/unit/indirector/inventory/yaml_spec.rb @@ -0,0 +1,130 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' + +require 'puppet/node/inventory' +require 'puppet/indirector/inventory/yaml' +require 'puppet/indirector/request' + +describe Puppet::Node::Inventory::Yaml do + def setup_search_matching(matching, nonmatching, query) + request = Puppet::Indirector::Request.new(:inventory, :search, nil, query) + + Dir.stubs(:glob).returns(matching.keys + nonmatching.keys) + [matching, nonmatching].each do |examples| + examples.each do |key, value| + YAML.stubs(:load_file).with(key).returns value + end + end + return matching, request + end + + it "should return node names that match the search query options" do + matching, request = setup_search_matching({ + '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '4'), + '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "i386", 'processor_count' => '4', 'randomfact' => 'foo') + }, + { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '4'), + "/path/to/nonmatching1.yaml" => Puppet::Node::Facts.new("nonmatchingnode1", "architecture" => "powerpc", 'processor_count' => '5'), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '5'), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3", 'processor_count' => '4'), + }, + {'facts.architecture' => 'i386', 'facts.processor_count' => '4'} + ) + Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} + end + + it "should return empty array when no nodes match the search query options" do + matching, request = setup_search_matching({}, { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '10'), + "/path/to/nonmatching1.yaml" => Puppet::Node::Facts.new("nonmatchingnode1", "architecture" => "powerpc", 'processor_count' => '5'), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '5'), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3", 'processor_count' => '4'), + }, + {'facts.processor_count.lt' => '4', 'facts.processor_count.gt' => '4'} + ) + Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} + end + + + it "should return node names that match the search query options with the greater than operator" do + matching, request = setup_search_matching({ + '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), + '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '10', 'randomfact' => 'foo') + }, + { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '4'), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '3'), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.processor_count.gt' => '4'} + ) + + Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} + end + + it "should return node names that match the search query options with the less than operator" do + matching, request = setup_search_matching({ + '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), + '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '30', 'randomfact' => 'foo') + }, + { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '50' ), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '100'), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.processor_count.lt' => '50'} + ) + + Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} + end + + it "should return node names that match the search query options with the less than or equal to operator" do + matching, request = setup_search_matching({ + '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), + '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '50', 'randomfact' => 'foo') + }, + { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '100' ), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '5000'), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.processor_count.le' => '50'} + ) + + Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} + end + + it "should return node names that match the search query options with the greater than or equal to operator" do + matching, request = setup_search_matching({ + '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '100'), + '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '50', 'randomfact' => 'foo') + }, + { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '40'), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '9' ), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.processor_count.ge' => '50'} + ) + + Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} + end + + it "should return node names that match the search query options with the not equal operator" do + matching, request = setup_search_matching({ + '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => 'arm' ), + '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => 'powerpc', 'randomfact' => 'foo') + }, + { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "i386" ), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '9' ), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.architecture.ne' => 'i386'} + ) + + Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} + end +end diff --git a/spec/unit/network/http/api/v1_spec.rb b/spec/unit/network/http/api/v1_spec.rb index 23a291cf3..d47fc8d81 100644 --- a/spec/unit/network/http/api/v1_spec.rb +++ b/spec/unit/network/http/api/v1_spec.rb @@ -76,6 +76,18 @@ describe Puppet::Network::HTTP::API::V1 do @tester.uri2indirection("GET", "/env/foos/bar", {}).method.should == :search end + it "should choose 'find' as the indirection method if the http method is a GET and the indirection name is facts" do + @tester.uri2indirection("GET", "/env/facts/bar", {}).method.should == :find + end + + it "should choose 'save' as the indirection method if the http method is a PUT and the indirection name is facts" do + @tester.uri2indirection("PUT", "/env/facts/bar", {}).method.should == :save + end + + it "should choose 'search' as the indirection method if the http method is a GET and the indirection name is inventory" do + @tester.uri2indirection("GET", "/env/inventory/search", {}).method.should == :search + end + it "should choose 'delete' as the indirection method if the http method is a DELETE and the indirection name is singular" do @tester.uri2indirection("DELETE", "/env/foo/bar", {}).method.should == :destroy end diff --git a/spec/unit/network/http/handler_spec.rb b/spec/unit/network/http/handler_spec.rb index 8464ae68e..68c7b9aa3 100755 --- a/spec/unit/network/http/handler_spec.rb +++ b/spec/unit/network/http/handler_spec.rb @@ -344,17 +344,20 @@ describe Puppet::Network::HTTP::Handler do @handler.do_search(@irequest, @request, @response) end - it "should return a 404 when searching returns an empty array" do - @model_class.stubs(:name).returns "my name" - @handler.expects(:set_response).with { |response, body, status| status == 404 } + it "should return [] when searching returns an empty array" do + @handler.expects(:accept_header).with(@request).returns "one,two" @model_class.stubs(:search).returns([]) + @model_class.expects(:render_multiple).with(@oneformat, []).returns "[]" + + + @handler.expects(:set_response).with { |response, data| data == "[]" } @handler.do_search(@irequest, @request, @response) end it "should return a 404 when searching returns nil" do @model_class.stubs(:name).returns "my name" @handler.expects(:set_response).with { |response, body, status| status == 404 } - @model_class.stubs(:search).returns([]) + @model_class.stubs(:search).returns(nil) @handler.do_search(@irequest, @request, @response) end end -- cgit From 67f24e48fb100a2bd971e87669d4fb91486156dc Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 1 Nov 2010 13:26:41 -0700 Subject: Refactor Puppet::Node::Inventory::Yaml in preparation for adding freshness --- lib/puppet/indirector/inventory/yaml.rb | 46 +++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/lib/puppet/indirector/inventory/yaml.rb b/lib/puppet/indirector/inventory/yaml.rb index c6b1a14aa..5acbef60c 100644 --- a/lib/puppet/indirector/inventory/yaml.rb +++ b/lib/puppet/indirector/inventory/yaml.rb @@ -15,23 +15,7 @@ class Puppet::Node::Inventory::Yaml < Puppet::Indirector::Yaml type, name, operator = key.to_s.split(".") operator ||= 'eq' - next unless type == "facts" - return false unless facts.values[name] - - return false unless case operator - when "eq" - facts.values[name].to_s == value.to_s - when "le" - facts.values[name].to_f <= value.to_f - when "ge" - facts.values[name].to_f >= value.to_f - when "lt" - facts.values[name].to_f < value.to_f - when "gt" - facts.values[name].to_f > value.to_f - when "ne" - facts.values[name].to_s != value.to_s - end + return false unless node_matches_option?(type, name, operator, value, facts) end return true end @@ -44,4 +28,32 @@ class Puppet::Node::Inventory::Yaml < Puppet::Indirector::Yaml end node_names end + + private + + def node_matches_option?(type, name, operator, value, facts) + case type + when "facts" + compare_facts(operator, facts.values[name], value) + end + end + + def compare_facts(operator, value1, value2) + return false unless value1 + + case operator + when "eq" + value1.to_s == value2.to_s + when "le" + value1.to_f <= value2.to_f + when "ge" + value1.to_f >= value2.to_f + when "lt" + value1.to_f < value2.to_f + when "gt" + value1.to_f > value2.to_f + when "ne" + value1.to_s != value2.to_s + end + end end -- cgit From fa0ed63c321819159f54621d7799ebc1eb2102f7 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 1 Nov 2010 13:32:14 -0700 Subject: Refactored Puppet::Node::Inventory::Yaml tests in preparation for adding freshness check --- spec/unit/indirector/inventory/yaml_spec.rb | 30 +++++++++-------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/spec/unit/indirector/inventory/yaml_spec.rb b/spec/unit/indirector/inventory/yaml_spec.rb index 3a7035a9e..a595f8a43 100644 --- a/spec/unit/indirector/inventory/yaml_spec.rb +++ b/spec/unit/indirector/inventory/yaml_spec.rb @@ -7,7 +7,7 @@ require 'puppet/indirector/inventory/yaml' require 'puppet/indirector/request' describe Puppet::Node::Inventory::Yaml do - def setup_search_matching(matching, nonmatching, query) + def assert_search_matches(matching, nonmatching, query) request = Puppet::Indirector::Request.new(:inventory, :search, nil, query) Dir.stubs(:glob).returns(matching.keys + nonmatching.keys) @@ -16,11 +16,11 @@ describe Puppet::Node::Inventory::Yaml do YAML.stubs(:load_file).with(key).returns value end end - return matching, request + Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} end it "should return node names that match the search query options" do - matching, request = setup_search_matching({ + assert_search_matches({ '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '4'), '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "i386", 'processor_count' => '4', 'randomfact' => 'foo') }, @@ -32,11 +32,10 @@ describe Puppet::Node::Inventory::Yaml do }, {'facts.architecture' => 'i386', 'facts.processor_count' => '4'} ) - Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} end it "should return empty array when no nodes match the search query options" do - matching, request = setup_search_matching({}, { + assert_search_matches({}, { "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '10'), "/path/to/nonmatching1.yaml" => Puppet::Node::Facts.new("nonmatchingnode1", "architecture" => "powerpc", 'processor_count' => '5'), "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '5'), @@ -44,12 +43,11 @@ describe Puppet::Node::Inventory::Yaml do }, {'facts.processor_count.lt' => '4', 'facts.processor_count.gt' => '4'} ) - Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} end it "should return node names that match the search query options with the greater than operator" do - matching, request = setup_search_matching({ + assert_search_matches({ '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '10', 'randomfact' => 'foo') }, @@ -60,12 +58,10 @@ describe Puppet::Node::Inventory::Yaml do }, {'facts.processor_count.gt' => '4'} ) - - Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} end it "should return node names that match the search query options with the less than operator" do - matching, request = setup_search_matching({ + assert_search_matches({ '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '30', 'randomfact' => 'foo') }, @@ -76,12 +72,10 @@ describe Puppet::Node::Inventory::Yaml do }, {'facts.processor_count.lt' => '50'} ) - - Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} end it "should return node names that match the search query options with the less than or equal to operator" do - matching, request = setup_search_matching({ + assert_search_matches({ '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '50', 'randomfact' => 'foo') }, @@ -92,12 +86,10 @@ describe Puppet::Node::Inventory::Yaml do }, {'facts.processor_count.le' => '50'} ) - - Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} end it "should return node names that match the search query options with the greater than or equal to operator" do - matching, request = setup_search_matching({ + assert_search_matches({ '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '100'), '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '50', 'randomfact' => 'foo') }, @@ -108,12 +100,10 @@ describe Puppet::Node::Inventory::Yaml do }, {'facts.processor_count.ge' => '50'} ) - - Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} end it "should return node names that match the search query options with the not equal operator" do - matching, request = setup_search_matching({ + assert_search_matches({ '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => 'arm' ), '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => 'powerpc', 'randomfact' => 'foo') }, @@ -124,7 +114,5 @@ describe Puppet::Node::Inventory::Yaml do }, {'facts.architecture.ne' => 'i386'} ) - - Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} end end -- cgit From 2d2f9ab04d8d6964df99762f73d329b0e5e57d8a Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Thu, 17 Feb 2011 15:15:50 -0800 Subject: Maint: backport timestamp accessor for facts from 2.7 branch Paired-with: Jesse Wolfe --- lib/puppet/node/facts.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb index b77ad22d5..562690026 100755 --- a/lib/puppet/node/facts.rb +++ b/lib/puppet/node/facts.rb @@ -54,6 +54,14 @@ class Puppet::Node::Facts strip_internal == other.send(:strip_internal) end + def timestamp=(time) + self.values[:_timestamp] = time + end + + def timestamp + self.values[:_timestamp] + end + private # Add internal data to the facts for storage. -- cgit From e6870f6d87b354e30a537eff4a8e98120c05d693 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 1 Nov 2010 13:46:21 -0700 Subject: (#5166) Inventory service is now searchable by timestamp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is now possible to specify queries in the form “meta.timestamp.xx” where xx is eq,ne,gt,lt,ge,le when searching the inventory service. --- lib/puppet/indirector/inventory/yaml.rb | 22 ++++++ spec/unit/indirector/inventory/yaml_spec.rb | 103 ++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) diff --git a/lib/puppet/indirector/inventory/yaml.rb b/lib/puppet/indirector/inventory/yaml.rb index 5acbef60c..fe3489a95 100644 --- a/lib/puppet/indirector/inventory/yaml.rb +++ b/lib/puppet/indirector/inventory/yaml.rb @@ -33,6 +33,11 @@ class Puppet::Node::Inventory::Yaml < Puppet::Indirector::Yaml def node_matches_option?(type, name, operator, value, facts) case type + when "meta" + case name + when "timestamp" + compare_timestamp(operator, facts.timestamp, Time.parse(value)) + end when "facts" compare_facts(operator, facts.values[name], value) end @@ -56,4 +61,21 @@ class Puppet::Node::Inventory::Yaml < Puppet::Indirector::Yaml value1.to_s != value2.to_s end end + + def compare_timestamp(operator, value1, value2) + case operator + when "eq" + value1 == value2 + when "le" + value1 <= value2 + when "ge" + value1 >= value2 + when "lt" + value1 < value2 + when "gt" + value1 > value2 + when "ne" + value1 != value2 + end + end end diff --git a/spec/unit/indirector/inventory/yaml_spec.rb b/spec/unit/indirector/inventory/yaml_spec.rb index a595f8a43..9f0c54353 100644 --- a/spec/unit/indirector/inventory/yaml_spec.rb +++ b/spec/unit/indirector/inventory/yaml_spec.rb @@ -115,4 +115,107 @@ describe Puppet::Node::Inventory::Yaml do {'facts.architecture.ne' => 'i386'} ) end + + def apply_timestamp(facts, timestamp) + facts.timestamp = timestamp + facts + end + + it "should be able to query based on meta.timestamp.gt" do + assert_search_matches({ + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + }, + { + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + {'meta.timestamp.gt' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.le" do + assert_search_matches({ + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + { + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + }, + {'meta.timestamp.le' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.lt" do + assert_search_matches({ + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + { + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + {'meta.timestamp.lt' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.ge" do + assert_search_matches({ + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + { + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + {'meta.timestamp.ge' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.eq" do + assert_search_matches({ + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + { + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + {'meta.timestamp.eq' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp" do + assert_search_matches({ + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + { + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + {'meta.timestamp' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.ne" do + assert_search_matches({ + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + { + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + {'meta.timestamp.ne' => '2010-10-15'} + ) + end end -- cgit From 8a485608e2941ff8c7ecc706c21f906d59302dd6 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Fri, 5 Nov 2010 11:37:27 -0700 Subject: (#5150) Make fact REST terminus configurable to connect to inventory service Puppet masters can now set the inventory_server and inventory_port option to point to another puppet master that will function as the central inventory service. When agents connect to the puppet master, this will send fact data from the puppet master over REST to the inventory service. The puppet master itself will still store the client fact data in the local yaml dir by setting the cache class to yaml. Getting puppet masters to talk to each other using certs is difficult. Paired-with: Jesse Wolfe --- lib/puppet/defaults.rb | 19 +++++++++++++++++-- lib/puppet/indirector/facts/rest.rb | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 0b0de4324..8da104086 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -119,7 +119,16 @@ module Puppet :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 => [Puppet.application_name.to_s == "master" ? 'yaml' : 'facter', "The node facts terminus."], + :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.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", @@ -583,11 +592,17 @@ module Puppet end }, :report_server => ["$server", - "The server to which to send transaction reports." + "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 => [false, "Whether to send reports after every transaction." ], diff --git a/lib/puppet/indirector/facts/rest.rb b/lib/puppet/indirector/facts/rest.rb index 07491fc77..e2afa14b2 100644 --- a/lib/puppet/indirector/facts/rest.rb +++ b/lib/puppet/indirector/facts/rest.rb @@ -3,4 +3,6 @@ require 'puppet/indirector/rest' class Puppet::Node::Facts::Rest < Puppet::Indirector::REST desc "Find and save facts about nodes over HTTP via REST." + use_server_setting(:inventory_server) + use_port_setting(:inventory_port) end -- cgit From a7cebf80abc9e8b1b570ce7fd2e7b86cf1dd15b3 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 17 Feb 2011 18:18:44 -0800 Subject: (#6337) Fix Ruby warning on 1.8.6 about "future compatibility" Ruby 1.8.6 (but not later versions) warn about requiring parenthesis on some function calls; having one of those in our network rights checking means that we emit ... quite a few of these, and annoy anything that tracks our logs. By using the more standard form of raise we can avoid the warning entirely, and keep consistent code style across the file. Reviewed-By: Paul Berry --- lib/puppet/network/rights.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/network/rights.rb b/lib/puppet/network/rights.rb index 00ee04f8d..b1daef67c 100755 --- a/lib/puppet/network/rights.rb +++ b/lib/puppet/network/rights.rb @@ -88,7 +88,7 @@ class Rights else # there were no rights allowing/denying name # if name is not a path, let's throw - raise ArgumentError.new "Unknown namespace right '#{name}'" + raise ArgumentError, "Unknown namespace right '#{name}'" end error end -- cgit From 960890f6ac6bcf1d639c68d4fe807ac54bf3a1ba Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Fri, 18 Feb 2011 10:52:02 -0800 Subject: (#6364) Adjust mis-translated regex in mount provider for AIX The commit to simplify the regex used to parse the output from the mount command on AIX (50c12e55b6f8462f6904ae061e661d1d10c7590a) mis-translated it. The original regex was grabbing the 3rd space-separated element, not the 2nd. This mis-translation caused the provider to grab the device information instead of the mount point, and compare that to the desired mount point. This would cause Puppet to think that the mount was never actually mounted under normal circumstances. The code from 50c12e5 was passing the tests because the fixture data did not include the mandatory leading whitespace that the original regex was looking for. The updated fixture data is pulled from the mount manpage from AIX v6r1. Reviewed-by: Paul Berry --- lib/puppet/provider/mount.rb | 2 +- spec/fixtures/unit/provider/mount/mount-output.aix.txt | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/puppet/provider/mount.rb b/lib/puppet/provider/mount.rb index c979f742f..354ddb16d 100644 --- a/lib/puppet/provider/mount.rb +++ b/lib/puppet/provider/mount.rb @@ -44,7 +44,7 @@ module Puppet::Provider::Mount when "Solaris", "HP-UX" line =~ /^#{name} on / when "AIX" - line.split(/\s+/)[1] == name + line.split(/\s+/)[2] == name else line =~ / on #{name} / end diff --git a/spec/fixtures/unit/provider/mount/mount-output.aix.txt b/spec/fixtures/unit/provider/mount/mount-output.aix.txt index 54edb9c1c..380dbc5ae 100644 --- a/spec/fixtures/unit/provider/mount/mount-output.aix.txt +++ b/spec/fixtures/unit/provider/mount/mount-output.aix.txt @@ -1,7 +1,7 @@ -/dev/hd4 / jfs2 Nov 11 12:11 rw,log=/dev/hd8 -/dev/hd2 /usr jfs2 Nov 11 12:11 rw,log=/dev/hd8 -/dev/hd9var /var jfs2 Nov 11 12:11 rw,log=/dev/hd8 -/dev/hd3 /tmp jfs2 Nov 11 12:11 rw,log=/dev/hd8 -/dev/hd1 /home jfs2 Nov 11 12:11 rw,log=/dev/hd8 -/proc /proc procfs Nov 11 12:11 rw -/dev/hd10opt /opt jfs2 Nov 11 12:11 rw,log=/dev/hd8 +node mounted mounted over vfs date options +---- ------- ------------ --- ------------ ------------------- + /dev/hd0 / jfs Dec 17 08:04 rw, log =/dev/hd8 + /dev/hd3 /tmp jfs Dec 17 08:04 rw, log =/dev/hd8 + /dev/hd1 /home jfs Dec 17 08:06 rw, log =/dev/hd8 + /dev/hd2 /usr jfs Dec 17 08:06 rw, log =/dev/hd8 +sue /home/local/src /usr/code nfs Dec 17 08:06 ro, log =/dev/hd8 -- cgit From 3b41d44812eed82d41e135375df15ae0bc3b4800 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Fri, 18 Feb 2011 15:16:12 -0800 Subject: Clean up whitespace, and commented out code in parsed mount provider Paired-with: Jesse Wolfe --- lib/puppet/provider/mount/parsed.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/puppet/provider/mount/parsed.rb b/lib/puppet/provider/mount/parsed.rb index 82d1628bd..69a6fc06b 100755 --- a/lib/puppet/provider/mount/parsed.rb +++ b/lib/puppet/provider/mount/parsed.rb @@ -8,16 +8,13 @@ else fstab = "/etc/fstab" end - - Puppet::Type.type(:mount).provide( - :parsed, +Puppet::Type.type(:mount).provide( + :parsed, :parent => Puppet::Provider::ParsedFile, :default_target => fstab, - :filetype => :flat ) do include Puppet::Provider::Mount - #confine :exists => fstab commands :mountcmd => "mount", :umount => "umount" @@ -42,6 +39,4 @@ end text_line :incomplete, :match => /^(?!#{field_pattern}{#{mandatory_fields.length}})/ record_line self.name, :fields => @fields, :separator => /\s+/, :joiner => "\t", :optional => optional_fields - end - -- cgit From d1f1858ea52d3089fd2088994e80d6f49d7e0347 Mon Sep 17 00:00:00 2001 From: Max Martin Date: Fri, 18 Feb 2011 15:19:46 -0800 Subject: (#6376) Add support and testing for _search GET requests Added support for adding "_search" to the end of any indirection to 'pluralize' it, and added tests to check this functionality and to test hidden side effect of plurality method unpluralizing indirections. Paired-With:Paul Berry --- lib/puppet/network/http/api/v1.rb | 4 ++-- spec/unit/network/http/api/v1_spec.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/puppet/network/http/api/v1.rb b/lib/puppet/network/http/api/v1.rb index 0a04a465f..9e51aae36 100644 --- a/lib/puppet/network/http/api/v1.rb +++ b/lib/puppet/network/http/api/v1.rb @@ -63,9 +63,9 @@ module Puppet::Network::HTTP::API::V1 return :singular if indirection == "status" return :plural if indirection == "inventory" - result = (indirection =~ /s$/) ? :plural : :singular + result = (indirection =~ /s$|_search$/) ? :plural : :singular - indirection.sub!(/s$/, '') if result + indirection.sub!(/s$|_search$|es$/, '') result end diff --git a/spec/unit/network/http/api/v1_spec.rb b/spec/unit/network/http/api/v1_spec.rb index d47fc8d81..e7348312b 100644 --- a/spec/unit/network/http/api/v1_spec.rb +++ b/spec/unit/network/http/api/v1_spec.rb @@ -88,6 +88,18 @@ describe Puppet::Network::HTTP::API::V1 do @tester.uri2indirection("GET", "/env/inventory/search", {}).method.should == :search end + it "should choose 'search' as the indirection method if the http method is a GET and the indirection name is facts_search" do + @tester.uri2indirection("GET", "/env/facts_search/bar", {}).method.should == :search + end + + it "should change indirection name to 'facts' if the http method is a GET and the indirection name is facts_search" do + @tester.uri2indirection("GET", "/env/facts_search/bar", {}).indirection_name.should == :facts + end + + it "should change indirection name to 'status' if the http method is a GEt and the indirection name is statuses" do + @tester.uri2indirection("GET", "/env/statuses/bar", {}).indirection_name.should == :status + end + it "should choose 'delete' as the indirection method if the http method is a DELETE and the indirection name is singular" do @tester.uri2indirection("DELETE", "/env/foo/bar", {}).method.should == :destroy end -- cgit From 6cb365a887d47606bdfae0ff540038b0c49b7451 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Thu, 17 Feb 2011 11:52:45 -0800 Subject: (#6309) Ensure the correct device is mounted when managing mounts Previously the mount type would only check if anything was mounted at the desired point, when 'ensure => mounted' was specified. Now we check not only whether something is mounted at the desired point, but also that it is the thing we wish to be mounted there. There is also a chance that the mount point directory could be "automagically" removed for us, when unmounting incorrect devices, so we attempt to re-create the directory after unmounting to give the mount of the correct device a better chance at succeeding. Paired-with: Matt Robinson Paired-with: Nick Lewis Paired-with: Jesse Wolfe --- lib/puppet/provider/mount.rb | 48 +++++- lib/puppet/type/mount.rb | 15 +- .../unit/provider/mount/mount-output.darwin.txt | 5 + .../unit/provider/mount/mount-output.hp-ux.txt | 16 ++ .../unit/provider/mount/mount-output.other.txt | 14 ++ .../unit/provider/mount/mount-output.solaris.txt | 16 ++ spec/unit/provider/mount/parsed_spec.rb | 4 +- spec/unit/provider/mount_spec.rb | 185 ++++++++++++++------- spec/unit/type/mount_spec.rb | 56 ++----- 9 files changed, 241 insertions(+), 118 deletions(-) create mode 100644 spec/fixtures/unit/provider/mount/mount-output.darwin.txt create mode 100644 spec/fixtures/unit/provider/mount/mount-output.hp-ux.txt create mode 100644 spec/fixtures/unit/provider/mount/mount-output.other.txt create mode 100644 spec/fixtures/unit/provider/mount/mount-output.solaris.txt diff --git a/lib/puppet/provider/mount.rb b/lib/puppet/provider/mount.rb index 354ddb16d..81d93b5c1 100644 --- a/lib/puppet/provider/mount.rb +++ b/lib/puppet/provider/mount.rb @@ -6,8 +6,28 @@ require 'puppet' # A module just to store the mount/unmount methods. Individual providers # still need to add the mount commands manually. module Puppet::Provider::Mount - # This only works when the mount point is synced to the fstab. def mount + # Make sure the fstab file & entry exists + create + + if correctly_mounted? + # Nothing to do! + else + if anything_mounted? + unmount + + # We attempt to create the mount point here, because unmounting + # certain file systems/devices can cause the mount point to be + # deleted + ::FileUtils.mkdir_p(resource[:name]) + end + + mount! + end + end + + # This only works when the mount point is synced to the fstab. + def mount! # Manually pass the mount options in, since some OSes *cough*OS X*cough* don't # read from /etc/fstab but still want to use this type. args = [] @@ -33,8 +53,8 @@ module Puppet::Provider::Mount umount resource[:name] end - # Is the mount currently mounted? - def mounted? + # Is anything currently mounted at this point? + def anything_mounted? platform = Facter.value("operatingsystem") name = resource[:name] mounts = mountcmd.split("\n").find do |line| @@ -42,6 +62,7 @@ module Puppet::Provider::Mount when "Darwin" line =~ / on #{name} / or line =~ %r{ on /private/var/automount#{name}} when "Solaris", "HP-UX" + # Yes, Solaris does list mounts as "mount_point on device" line =~ /^#{name} on / when "AIX" line.split(/\s+/)[2] == name @@ -50,4 +71,25 @@ module Puppet::Provider::Mount end end end + + # Is the desired thing mounted at this point? + def correctly_mounted? + platform = Facter.value("operatingsystem") + name = resource[:name] + device = resource[:device] + mounts = mountcmd.split("\n").find do |line| + case platform + when "Darwin" + line =~ /^#{device} on #{name} / or line =~ %r{^#{device} on /private/var/automount#{name}} + when "Solaris", "HP-UX" + # Yes, Solaris does list mounts as "mount_point on device" + line =~ /^#{name} on #{device}/ + when "AIX" + line.split(/\s+/)[2] == name && + line.split(/\s+/)[1] == device + else + line =~ /^#{device} on #{name} / + end + end + end end diff --git a/lib/puppet/type/mount.rb b/lib/puppet/type/mount.rb index da9a70bdf..10eed5373 100755 --- a/lib/puppet/type/mount.rb +++ b/lib/puppet/type/mount.rb @@ -29,7 +29,7 @@ module Puppet aliasvalue :present, :defined newvalue(:unmounted) do - if provider.mounted? + if provider.anything_mounted? syncothers provider.unmount return :mount_unmounted @@ -40,20 +40,15 @@ module Puppet end newvalue(:absent, :event => :mount_deleted) do - provider.unmount if provider.mounted? + provider.unmount if provider.anything_mounted? provider.destroy end newvalue(:mounted, :event => :mount_mounted) do - # Create the mount point if it does not already exist. - current_value = self.retrieve - provider.create if current_value.nil? or current_value == :absent - syncothers - # The fs can be already mounted if it was absent but mounted - provider.mount unless provider.mounted? + provider.mount end def insync?(is) @@ -70,7 +65,7 @@ module Puppet curval = super() if curval == :absent return :absent - elsif provider.mounted? + elsif provider.correctly_mounted? return :mounted else return :unmounted @@ -210,7 +205,7 @@ module Puppet def refresh # Only remount if we're supposed to be mounted. - provider.remount if self.should(:fstype) != "swap" and provider.mounted? + provider.remount if self.should(:fstype) != "swap" and provider.anything_mounted? end def value(name) diff --git a/spec/fixtures/unit/provider/mount/mount-output.darwin.txt b/spec/fixtures/unit/provider/mount/mount-output.darwin.txt new file mode 100644 index 000000000..fbb9d9832 --- /dev/null +++ b/spec/fixtures/unit/provider/mount/mount-output.darwin.txt @@ -0,0 +1,5 @@ +/dev/disk0s2 on / (hfs, local, journaled) +devfs on /dev (devfs, local, nobrowse) +map -hosts on /net (autofs, nosuid, automounted, nobrowse) +map auto_home on /home (autofs, automounted, nobrowse) +/dev/disk0s3 on /usr (hfs, local, journaled) diff --git a/spec/fixtures/unit/provider/mount/mount-output.hp-ux.txt b/spec/fixtures/unit/provider/mount/mount-output.hp-ux.txt new file mode 100644 index 000000000..477926138 --- /dev/null +++ b/spec/fixtures/unit/provider/mount/mount-output.hp-ux.txt @@ -0,0 +1,16 @@ +/ on rpool/ROOT/opensolaris read/write/setuid/devices/dev=2d90002 on Wed Dec 31 16:00:00 1969 +/devices on /devices read/write/setuid/devices/dev=4a00000 on Thu Feb 17 14:34:02 2011 +/dev on /dev read/write/setuid/devices/dev=4a40000 on Thu Feb 17 14:34:02 2011 +/system/contract on ctfs read/write/setuid/devices/dev=4ac0001 on Thu Feb 17 14:34:02 2011 +/proc on proc read/write/setuid/devices/dev=4b00000 on Thu Feb 17 14:34:02 2011 +/etc/mnttab on mnttab read/write/setuid/devices/dev=4b40001 on Thu Feb 17 14:34:02 2011 +/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4b80001 on Thu Feb 17 14:34:02 2011 +/system/object on objfs read/write/setuid/devices/dev=4bc0001 on Thu Feb 17 14:34:02 2011 +/etc/dfs/sharetab on sharefs read/write/setuid/devices/dev=4c00001 on Thu Feb 17 14:34:02 2011 +/lib/libc.so.1 on /usr/lib/libc/libc_hwcap1.so.1 read/write/setuid/devices/dev=2d90002 on Thu Feb 17 14:34:14 2011 +/dev/fd on fd read/write/setuid/devices/dev=4d00001 on Thu Feb 17 14:34:18 2011 +/tmp on swap read/write/setuid/devices/xattr/dev=4b80002 on Thu Feb 17 14:34:19 2011 +/var/run on swap read/write/setuid/devices/xattr/dev=4b80003 on Thu Feb 17 14:34:19 2011 +/export on rpool/export read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90006 on Thu Feb 17 14:37:48 2011 +/export/home on rpool/export/home read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90007 on Thu Feb 17 14:37:48 2011 +/rpool on rpool read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90009 on Thu Feb 17 14:37:48 2011 diff --git a/spec/fixtures/unit/provider/mount/mount-output.other.txt b/spec/fixtures/unit/provider/mount/mount-output.other.txt new file mode 100644 index 000000000..0e4dff0c5 --- /dev/null +++ b/spec/fixtures/unit/provider/mount/mount-output.other.txt @@ -0,0 +1,14 @@ +/dev/sda1 on / type ext4 (rw,errors=remount-ro,commit=0) +proc on /proc type proc (rw,noexec,nosuid,nodev) +none on /sys type sysfs (rw,noexec,nosuid,nodev) +fusectl on /sys/fs/fuse/connections type fusectl (rw) +none on /sys/kernel/debug type debugfs (rw) +none on /sys/kernel/security type securityfs (rw) +none on /dev type devtmpfs (rw,mode=0755) +none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) +none on /dev/shm type tmpfs (rw,nosuid,nodev) +none on /var/run type tmpfs (rw,nosuid,mode=0755) +none on /var/lock type tmpfs (rw,noexec,nosuid,nodev) +none on /proc/fs/vmblock/mountPoint type vmblock (rw) +binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev) +/dev/sda2 on /usr type ext4 (rw,errors=remount-ro,commit=0) diff --git a/spec/fixtures/unit/provider/mount/mount-output.solaris.txt b/spec/fixtures/unit/provider/mount/mount-output.solaris.txt new file mode 100644 index 000000000..477926138 --- /dev/null +++ b/spec/fixtures/unit/provider/mount/mount-output.solaris.txt @@ -0,0 +1,16 @@ +/ on rpool/ROOT/opensolaris read/write/setuid/devices/dev=2d90002 on Wed Dec 31 16:00:00 1969 +/devices on /devices read/write/setuid/devices/dev=4a00000 on Thu Feb 17 14:34:02 2011 +/dev on /dev read/write/setuid/devices/dev=4a40000 on Thu Feb 17 14:34:02 2011 +/system/contract on ctfs read/write/setuid/devices/dev=4ac0001 on Thu Feb 17 14:34:02 2011 +/proc on proc read/write/setuid/devices/dev=4b00000 on Thu Feb 17 14:34:02 2011 +/etc/mnttab on mnttab read/write/setuid/devices/dev=4b40001 on Thu Feb 17 14:34:02 2011 +/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4b80001 on Thu Feb 17 14:34:02 2011 +/system/object on objfs read/write/setuid/devices/dev=4bc0001 on Thu Feb 17 14:34:02 2011 +/etc/dfs/sharetab on sharefs read/write/setuid/devices/dev=4c00001 on Thu Feb 17 14:34:02 2011 +/lib/libc.so.1 on /usr/lib/libc/libc_hwcap1.so.1 read/write/setuid/devices/dev=2d90002 on Thu Feb 17 14:34:14 2011 +/dev/fd on fd read/write/setuid/devices/dev=4d00001 on Thu Feb 17 14:34:18 2011 +/tmp on swap read/write/setuid/devices/xattr/dev=4b80002 on Thu Feb 17 14:34:19 2011 +/var/run on swap read/write/setuid/devices/xattr/dev=4b80003 on Thu Feb 17 14:34:19 2011 +/export on rpool/export read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90006 on Thu Feb 17 14:37:48 2011 +/export/home on rpool/export/home read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90007 on Thu Feb 17 14:37:48 2011 +/rpool on rpool read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90009 on Thu Feb 17 14:37:48 2011 diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index 5a1c986b1..78a44322e 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -130,7 +130,7 @@ describe provider_class do mount.stubs(:mountcmd) # just so we don't actually try to mount anything mount.expects(:flush) - mount.mount + mount.mount! end end @@ -176,7 +176,7 @@ describe provider_class do it "should determine that the root fs is mounted" do @provider_class.prefetch("/" => @mount) - @mount.provider.should be_mounted + @mount.provider.should be_anything_mounted end end diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb index f567a4a40..1f2501765 100755 --- a/spec/unit/provider/mount_spec.rb +++ b/spec/unit/provider/mount_spec.rb @@ -2,28 +2,30 @@ require File.dirname(__FILE__) + '/../../spec_helper' +require 'puppet_spec/files' require 'puppet/provider/mount' describe Puppet::Provider::Mount do - before :each do - @mounter = Object.new - @mounter.extend(Puppet::Provider::Mount) + include PuppetSpec::Files + before :each do @name = "/" - @resource = stub 'resource' - @resource.stubs(:[]).with(:name).returns(@name) + @resource = Puppet::Type.type(:mount).new( + :name => '/', + :device => '/dev/sda1', + :target => tmpfile("mount_provider") + ) - @mounter.stubs(:resource).returns(@resource) + @mounter = Puppet::Type.type(:mount).defaultprovider().new(@resource) end - describe Puppet::Provider::Mount, " when mounting" do - + describe "when calling mount!" do it "should use the 'mountcmd' method to mount" do @mounter.stubs(:options).returns(nil) @mounter.expects(:mountcmd) - @mounter.mount + @mounter.mount! end it "should flush before mounting if a flush method exists" do @@ -32,114 +34,169 @@ describe Puppet::Provider::Mount do @mounter.stubs(:mountcmd) @mounter.stubs(:options).returns(nil) - @mounter.mount + @mounter.mount! end it "should add the options following '-o' if they exist and are not set to :absent" do @mounter.stubs(:options).returns("ro") @mounter.expects(:mountcmd).with { |*ary| ary[0] == "-o" and ary[1] == "ro" } - @mounter.mount + @mounter.mount! end it "should specify the filesystem name to the mount command" do @mounter.stubs(:options).returns(nil) @mounter.expects(:mountcmd).with { |*ary| ary[-1] == @name } - @mounter.mount + @mounter.mount! end end - describe Puppet::Provider::Mount, " when remounting" do - + describe "when remounting" do it "should use '-o remount' if the resource specifies it supports remounting" do @mounter.stubs(:info) - @resource.stubs(:[]).with(:remounts).returns(:true) + @resource[:remounts] = true @mounter.expects(:mountcmd).with("-o", "remount", @name) @mounter.remount end it "should unmount and mount if the resource does not specify it supports remounting" do @mounter.stubs(:info) - @resource.stubs(:[]).with(:remounts).returns(false) + @resource[:remounts] = false @mounter.expects(:unmount) @mounter.expects(:mount) @mounter.remount end it "should log that it is remounting" do - @resource.stubs(:[]).with(:remounts).returns(:true) + @resource[:remounts] = true @mounter.stubs(:mountcmd) @mounter.expects(:info).with("Remounting") @mounter.remount end end - describe Puppet::Provider::Mount, " when unmounting" do - + describe "when unmounting" do it "should call the :umount command with the resource name" do @mounter.expects(:umount).with(@name) @mounter.unmount end end - describe Puppet::Provider::Mount, " when determining if it is mounted" do - - it "should parse the results of running the mount command with no arguments" do - Facter.stubs(:value).returns("whatever") - @mounter.expects(:mountcmd).returns("") - - @mounter.mounted? - end - - it "should match ' on /private/var/automount' if the operating system is Darwin" do - Facter.stubs(:value).with("operatingsystem").returns("Darwin") - @mounter.expects(:mountcmd).returns("/dev/whatever on /private/var/automount/\ndevfs on /dev") - - @mounter.should be_mounted + %w{Darwin Solaris HP-UX AIX Other}.each do |platform| + describe "on #{platform}" do + before :each do + case platform + when 'Darwin' + mount_fixture = 'mount-output.darwin.txt' + @mount_device = '/dev/disk0s3' + @mount_point = '/usr' + when 'Solaris' + mount_fixture = 'mount-output.solaris.txt' + @mount_device = 'swap' + @mount_point = '/tmp' + when 'HP-UX' + mount_fixture = 'mount-output.hp-ux.txt' + @mount_device = 'swap' + @mount_point = '/tmp' + when 'AIX' + mount_fixture = 'mount-output.aix.txt' + @mount_device = '/dev/hd2' + @mount_point = '/usr' + when 'Other' + mount_fixture = 'mount-output.other.txt' + @mount_device = '/dev/sda2' + @mount_point = '/usr' + end + @mount_data = File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'unit', 'provider', 'mount', mount_fixture)) + Facter.stubs(:value).with("operatingsystem").returns(platform) + end + + describe "when the correct thing is mounted" do + before :each do + @mounter.expects(:mountcmd).returns(@mount_data) + @resource.stubs(:[]).with(:name).returns(@mount_point) + @resource.stubs(:[]).with(:device).returns(@mount_device) + end + + it "should say anything_mounted?" do + @mounter.should be_anything_mounted + end + + it "should say correctly_mounted?" do + @mounter.should be_correctly_mounted + end + end + + describe "when the wrong thing is mounted" do + before :each do + @mounter.expects(:mountcmd).returns(@mount_data) + @resource.stubs(:[]).with(:name).returns(@mount_point) + @resource.stubs(:[]).with(:device).returns('/dev/bogus/thing') + end + + it "should say anything_mounted?" do + @mounter.should be_anything_mounted + end + + it "should not say correctly_mounted?" do + @mounter.should_not be_correctly_mounted + end + end + + describe "when nothing is mounted" do + before :each do + @mounter.expects(:mountcmd).returns(@mount_data) + @resource.stubs(:[]).with(:name).returns('/bogus/location') + @resource.stubs(:[]).with(:device).returns(@mount_device) + end + + it "should not say anything_mounted?" do + @mounter.should_not be_anything_mounted + end + + it "should not say correctly_mounted?" do + @mounter.should_not be_correctly_mounted + end + end end + end - it "should match ' on ' if the operating system is Darwin" do - Facter.stubs(:value).with("operatingsystem").returns("Darwin") - @mounter.expects(:mountcmd).returns("/dev/disk03 on / (local, journaled)\ndevfs on /dev") - - @mounter.should be_mounted - end + describe "when mounting a device" do + it "should not mount! or unmount anything when the correct device is mounted" do + @mounter.stubs(:correctly_mounted?).returns(true) - it "should match '^ on' if the operating system is Solaris" do - Facter.stubs(:value).with("operatingsystem").returns("Solaris") - @mounter.expects(:mountcmd).returns("/ on /dev/dsk/whatever\n/var on /dev/dsk/other") + @mounter.expects(:anything_mounted?).never + @mounter.expects(:create).once + @mounter.expects(:mount!).never + @mounter.expects(:unmount).never + FileUtils.expects(:mkdir_p).never - @mounter.should be_mounted + @mounter.mount end - it "should match '^ on' if the operating system is HP-UX" do - Facter.stubs(:value).with("operatingsystem").returns("HP-UX") - @mounter.expects(:mountcmd).returns("/ on /dev/dsk/whatever\n/var on /dev/dsk/other") + it "should mount the device when nothing is mounted at the desired point" do + @mounter.stubs(:correctly_mounted?).returns(false) + @mounter.stubs(:anything_mounted?).returns(false) - @mounter.should be_mounted - end - - it "should match mounted devices if the operating system is AIX" do - Facter.stubs(:value).with("operatingsystem").returns("AIX") - mount_data = File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'unit', 'provider', 'mount', 'mount-output.aix.txt')) - @mounter.expects(:mountcmd).returns(mount_data) + @mounter.expects(:create).once + @mounter.expects(:mount!).once + @mounter.expects(:unmount).never + FileUtils.expects(:mkdir_p).never - @mounter.should be_mounted + @mounter.mount end - it "should match ' on ' if the operating system is not Darwin, Solaris, or HP-UX" do - Facter.stubs(:value).with("operatingsystem").returns("Debian") - @mounter.expects(:mountcmd).returns("/dev/dsk/whatever on / and stuff\n/dev/other/disk on /var and stuff") + it "should unmount the incorrect device and mount the correct device" do + @mounter.stubs(:correctly_mounted?).returns(false) + @mounter.stubs(:anything_mounted?).returns(true) - @mounter.should be_mounted - end - - it "should not be considered mounted if it did not match the mount output" do - Facter.stubs(:value).with("operatingsystem").returns("Debian") - @mounter.expects(:mountcmd).returns("/dev/dsk/whatever on /something/else and stuff\n/dev/other/disk on /var and stuff") + @mounter.expects(:create).once + @mounter.expects(:mount!).once + @mounter.expects(:unmount).once + FileUtils.expects(:mkdir_p).with(@name).returns(true) - @mounter.should_not be_mounted + @mounter.mount end end end diff --git a/spec/unit/type/mount_spec.rb b/spec/unit/type/mount_spec.rb index 0d74042e3..c6d2b5ba0 100755 --- a/spec/unit/type/mount_spec.rb +++ b/spec/unit/type/mount_spec.rb @@ -74,8 +74,7 @@ describe Puppet::Type.type(:mount)::Ensure do end end - describe Puppet::Type.type(:mount)::Ensure, "when retrieving its current state" do - + describe "when retrieving its current state" do it "should return the provider's value if it is :absent" do @provider.expects(:ensure).returns(:absent) @ensure.retrieve.should == :absent @@ -83,28 +82,27 @@ describe Puppet::Type.type(:mount)::Ensure do it "should return :mounted if the provider indicates it is mounted and the value is not :absent" do @provider.expects(:ensure).returns(:present) - @provider.expects(:mounted?).returns(true) + @provider.expects(:correctly_mounted?).returns(true) @ensure.retrieve.should == :mounted end it "should return :unmounted if the provider indicates it is not mounted and the value is not :absent" do @provider.expects(:ensure).returns(:present) - @provider.expects(:mounted?).returns(false) + @provider.expects(:correctly_mounted?).returns(false) @ensure.retrieve.should == :unmounted end end - describe Puppet::Type.type(:mount)::Ensure, "when changing the host" do - + describe "when changing the host" do it "should destroy itself if it should be absent" do - @provider.stubs(:mounted?).returns(false) + @provider.stubs(:anything_mounted?).returns(false) @provider.expects(:destroy) @ensure.should = :absent @ensure.sync end it "should unmount itself before destroying if it is mounted and should be absent" do - @provider.expects(:mounted?).returns(true) + @provider.expects(:anything_mounted?).returns(true) @provider.expects(:unmount) @provider.expects(:destroy) @ensure.should = :absent @@ -113,9 +111,9 @@ describe Puppet::Type.type(:mount)::Ensure do it "should create itself if it is absent and should be defined" do @provider.stubs(:ensure).returns(:absent) - @provider.stubs(:mounted?).returns(true) + @provider.stubs(:anything_mounted?).returns(true) - @provider.stubs(:mounted?).returns(false) + @provider.stubs(:anything_mounted?).returns(false) @provider.expects(:create) @ensure.should = :defined @ensure.sync @@ -123,7 +121,7 @@ describe Puppet::Type.type(:mount)::Ensure do it "should not unmount itself if it is mounted and should be defined" do @provider.stubs(:ensure).returns(:mounted) - @provider.stubs(:mounted?).returns(true) + @provider.stubs(:anything_mounted?).returns(true) @provider.stubs(:create) @provider.expects(:mount).never @@ -134,7 +132,7 @@ describe Puppet::Type.type(:mount)::Ensure do it "should not mount itself if it is unmounted and should be defined" do @provider.stubs(:ensure).returns(:unmounted) - @provider.stubs(:mounted?).returns(false) + @provider.stubs(:anything_mounted?).returns(false) @ensure.stubs(:syncothers) @provider.stubs(:create) @@ -146,7 +144,7 @@ describe Puppet::Type.type(:mount)::Ensure do it "should unmount itself if it is mounted and should be unmounted" do @provider.stubs(:ensure).returns(:present) - @provider.stubs(:mounted?).returns(true) + @provider.stubs(:anything_mounted?).returns(true) @ensure.stubs(:syncothers) @provider.expects(:unmount) @@ -154,34 +152,14 @@ describe Puppet::Type.type(:mount)::Ensure do @ensure.sync end - it "should create and mount itself if it does not exist and should be mounted" do - @provider.stubs(:ensure).returns(:absent) - @provider.stubs(:mounted?).returns(false) - @provider.expects(:create) - @ensure.stubs(:syncothers) - @provider.expects(:mount) - @ensure.should = :mounted - @ensure.sync - end - - it "should mount itself if it is present and should be mounted" do + it "should ask the provider to mount itself" do @provider.stubs(:ensure).returns(:present) - @provider.stubs(:mounted?).returns(false) @ensure.stubs(:syncothers) @provider.expects(:mount) @ensure.should = :mounted @ensure.sync end - it "should create but not mount itself if it is absent and mounted and should be mounted" do - @provider.stubs(:ensure).returns(:absent) - @provider.stubs(:mounted?).returns(true) - @ensure.stubs(:syncothers) - @provider.expects(:create) - @ensure.should = :mounted - @ensure.sync - end - it "should be insync if it is mounted and should be defined" do @ensure.should = :defined @ensure.safe_insync?(:mounted).should == true @@ -203,17 +181,16 @@ describe Puppet::Type.type(:mount)::Ensure do end end - describe Puppet::Type.type(:mount), "when responding to events" do - + describe "when responding to events" do it "should remount if it is currently mounted" do - @provider.expects(:mounted?).returns(true) + @provider.expects(:anything_mounted?).returns(true) @provider.expects(:remount) @mount.refresh end it "should not remount if it is not currently mounted" do - @provider.expects(:mounted?).returns(false) + @provider.expects(:anything_mounted?).returns(false) @provider.expects(:remount).never @mount.refresh @@ -241,7 +218,8 @@ describe Puppet::Type.type(:mount), "when modifying an existing mount entry" do @mount[param] = value end - @mount.provider.stubs(:mounted?).returns true + @mount.provider.stubs(:anything_mounted?).returns true + @mount.provider.stubs(:correctly_mounted?).returns true # stub this to not try to create state.yaml Puppet::Util::Storage.stubs(:store) -- cgit From e85420585158ab1a74727efcff449190f6d84899 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Fri, 18 Feb 2011 15:26:58 -0800 Subject: Remove pending tests from parsed mount provider Paired-with: Jesse Wolfe --- spec/unit/provider/mount/parsed_spec.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index 78a44322e..069d9495a 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -179,14 +179,4 @@ describe provider_class do @mount.provider.should be_anything_mounted end end - - describe provider_class, " when mounting and unmounting" do - include ParsedMountTesting - - it "should call the 'mount' command to mount the filesystem" - - it "should call the 'unmount' command to unmount the filesystem" - - it "should specify the filesystem when remounting a filesystem" - end end -- cgit From 04501976f898f886b81a67bdf0dabae1ba11571f Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Fri, 18 Feb 2011 16:01:00 -0800 Subject: (#6126) Puppet inspect now reports status after run completes. We now emit timing and output a status message at the end of a successful inspect run. Paired-With: Nick Lewis Signed-Off-By: Daniel Pittman --- lib/puppet/application/inspect.rb | 116 +++++++++++++++++----------------- spec/unit/application/inspect_spec.rb | 2 +- 2 files changed, 60 insertions(+), 58 deletions(-) mode change 100644 => 100755 spec/unit/application/inspect_spec.rb diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb index 52ef97530..764c8c4c0 100644 --- a/lib/puppet/application/inspect.rb +++ b/lib/puppet/application/inspect.rb @@ -98,79 +98,81 @@ Licensed under the GNU General Public License version 2 end def run_command - retrieval_starttime = Time.now + benchmark(:notice, "Finished inspection") do + retrieval_starttime = Time.now - unless catalog = Puppet::Resource::Catalog.find(Puppet[:certname]) - raise "Could not find catalog for #{Puppet[:certname]}" - end + unless catalog = Puppet::Resource::Catalog.find(Puppet[:certname]) + raise "Could not find catalog for #{Puppet[:certname]}" + end - @report.configuration_version = catalog.version + @report.configuration_version = catalog.version - inspect_starttime = Time.now - @report.add_times("config_retrieval", inspect_starttime - retrieval_starttime) + inspect_starttime = Time.now + @report.add_times("config_retrieval", inspect_starttime - retrieval_starttime) - if Puppet[:archive_files] - dipper = Puppet::FileBucket::Dipper.new(:Server => Puppet[:archive_file_server]) - end + if Puppet[:archive_files] + dipper = Puppet::FileBucket::Dipper.new(:Server => Puppet[:archive_file_server]) + end - catalog.to_ral.resources.each do |ral_resource| - audited_attributes = ral_resource[:audit] - next unless audited_attributes + catalog.to_ral.resources.each do |ral_resource| + audited_attributes = ral_resource[:audit] + next unless audited_attributes - status = Puppet::Resource::Status.new(ral_resource) + status = Puppet::Resource::Status.new(ral_resource) - begin - audited_resource = ral_resource.to_resource - rescue StandardError => detail - puts detail.backtrace if Puppet[:trace] - ral_resource.err "Could not inspect #{ral_resource}; skipping: #{detail}" - audited_attributes.each do |name| - event = ral_resource.event( - :property => name, - :status => "failure", - :audited => true, - :message => "failed to inspect #{name}" - ) - status.add_event(event) - end - else - audited_attributes.each do |name| - next if audited_resource[name].nil? - # Skip :absent properties of :absent resources. Really, it would be nicer if the RAL returned nil for those, but it doesn't. ~JW - if name == :ensure or audited_resource[:ensure] != :absent or audited_resource[name] != :absent + begin + audited_resource = ral_resource.to_resource + rescue StandardError => detail + puts detail.backtrace if Puppet[:trace] + ral_resource.err "Could not inspect #{ral_resource}; skipping: #{detail}" + audited_attributes.each do |name| event = ral_resource.event( - :previous_value => audited_resource[name], - :property => name, - :status => "audit", - :audited => true, - :message => "inspected value is #{audited_resource[name].inspect}" - ) + :property => name, + :status => "failure", + :audited => true, + :message => "failed to inspect #{name}" + ) status.add_event(event) end + else + audited_attributes.each do |name| + next if audited_resource[name].nil? + # Skip :absent properties of :absent resources. Really, it would be nicer if the RAL returned nil for those, but it doesn't. ~JW + if name == :ensure or audited_resource[:ensure] != :absent or audited_resource[name] != :absent + event = ral_resource.event( + :previous_value => audited_resource[name], + :property => name, + :status => "audit", + :audited => true, + :message => "inspected value is #{audited_resource[name].inspect}" + ) + status.add_event(event) + end + end end - end - if Puppet[:archive_files] and ral_resource.type == :file and audited_attributes.include?(:content) - path = ral_resource[:path] - if File.readable?(path) - begin - dipper.backup(path) - rescue StandardError => detail - Puppet.warning detail + if Puppet[:archive_files] and ral_resource.type == :file and audited_attributes.include?(:content) + path = ral_resource[:path] + if File.readable?(path) + begin + dipper.backup(path) + rescue StandardError => detail + Puppet.warning detail + end end end + @report.add_resource_status(status) end - @report.add_resource_status(status) - end - finishtime = Time.now - @report.add_times("inspect", finishtime - inspect_starttime) - @report.finalize_report + finishtime = Time.now + @report.add_times("inspect", finishtime - inspect_starttime) + @report.finalize_report - begin - @report.save - rescue => detail - puts detail.backtrace if Puppet[:trace] - Puppet.err "Could not send report: #{detail}" + begin + @report.save + rescue => detail + puts detail.backtrace if Puppet[:trace] + Puppet.err "Could not send report: #{detail}" + end end end end diff --git a/spec/unit/application/inspect_spec.rb b/spec/unit/application/inspect_spec.rb old mode 100644 new mode 100755 index 1d99c6ca9..d334a87ee --- a/spec/unit/application/inspect_spec.rb +++ b/spec/unit/application/inspect_spec.rb @@ -174,7 +174,7 @@ describe Puppet::Application::Inspect do @inspect.run_command - @report.logs.count.should == 1 + @report.logs.first.should_not == nil @report.logs.first.message.should =~ /Could not back up/ end end -- cgit From ec33a09cc4b2caf391e07f21603e86d81c861b78 Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Sun, 20 Feb 2011 11:08:34 +0100 Subject: (#4914) Remove mount specs Remove mount specs that seem to only test if the parsedfile provider is working correctly or are obsolete specs. --- spec/unit/provider/mount/parsed_spec.rb | 83 ++------------------------------- 1 file changed, 3 insertions(+), 80 deletions(-) diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index 5a1c986b1..94e731bec 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -5,15 +5,17 @@ require File.dirname(__FILE__) + '/../../../spec_helper' +require 'puppet_spec/files' require 'puppettest/support/utils' require 'puppettest/fileparsing' module ParsedMountTesting include PuppetTest::Support::Utils include PuppetTest::FileParsing + include PuppetSpec::Files def fake_fstab - os = Facter['operatingsystem'] + os = Facter.value(:operatingsystem) if os == "Solaris" name = "solaris.fstab" elsif os == "FreeBSD" @@ -22,51 +24,10 @@ module ParsedMountTesting # Catchall for other fstabs name = "linux.fstab" end - oldpath = @provider_class.default_target fakefile(File::join("data/types/mount", name)) end - def mkmountargs - mount = nil - if defined?(@pcount) - @pcount += 1 - else - @pcount = 1 - end - args = { - :name => "/fspuppet#{@pcount}", - :device => "/dev/dsk#{@pcount}", - } - - @provider_class.fields(:parsed).each do |field| - args[field] = "fake#{field}#{@pcount}" unless args.include? field - end - - args - end - - def mkmount - hash = mkmountargs - #hash[:provider] = @provider_class.name - - fakeresource = stub :type => :mount, :name => hash[:name] - fakeresource.stubs(:[]).with(:name).returns(hash[:name]) - fakeresource.stubs(:should).with(:target).returns(nil) - - mount = @provider_class.new(fakeresource) - hash[:record_type] = :parsed - hash[:ensure] = :present - mount.property_hash = hash - - mount - end - - # Here we just create a fake host type that answers to all of the methods - # but does not modify our actual system. - def mkfaketype - @provider.stubs(:filetype).returns(Puppet::Util::FileType.filetype(:ram)) - end end provider_class = Puppet::Type.type(:mount).provider(:parsed) @@ -117,45 +78,7 @@ describe provider_class do end end - describe provider_class, " when mounting an absent filesystem" do - include ParsedMountTesting - - # #730 - Make sure 'flush' is called when a mount is moving from absent to mounted - it "should flush the fstab to disk" do - mount = mkmount - - # Mark the mount as absent - mount.property_hash[:ensure] = :absent - - mount.stubs(:mountcmd) # just so we don't actually try to mount anything - - mount.expects(:flush) - mount.mount - end - end - - describe provider_class, " when modifying the filesystem tab" do - include ParsedMountTesting - before do - Puppet.settings.stubs(:use) - # Never write to disk, only to RAM. - #@provider_class.stubs(:filetype).returns(Puppet::Util::FileType.filetype(:ram)) - @provider_class.stubs(:target_object).returns(Puppet::Util::FileType.filetype(:ram).new("eh")) - @provider_class.clear - - @mount = mkmount - @target = @provider_class.default_target - end - - it "should write the mount to disk when :flush is called" do - old_text = @provider_class.target_object(@provider_class.default_target).read - @mount.flush - - text = @provider_class.target_object(@provider_class.default_target).read - text.should == old_text + @mount.class.to_line(@mount.property_hash) + "\n" - end - end describe provider_class, " when parsing information about the root filesystem", :if => Facter["operatingsystem"].value != "Darwin" do include ParsedMountTesting -- cgit From c57c508e938083115bbc00037901f652505288b0 Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Sun, 20 Feb 2011 11:18:19 +0100 Subject: (#4914) Improved parsed_spec for mount Add specs for the new prefetching and the correct parsing of vfstab on Solaris and fstab on other systems --- lib/puppet/provider/mount/parsed.rb | 2 +- spec/unit/provider/mount/parsed_spec.rb | 239 ++++++++++++++++++++----- test/data/providers/mount/parsed/darwin.mount | 6 + test/data/providers/mount/parsed/hpux.mount | 17 ++ test/data/providers/mount/parsed/linux.mount | 5 + test/data/providers/mount/parsed/solaris.mount | 6 + test/data/types/mount/linux.fstab | 1 + test/data/types/mount/solaris.fstab | 1 + 8 files changed, 229 insertions(+), 48 deletions(-) create mode 100644 test/data/providers/mount/parsed/darwin.mount create mode 100644 test/data/providers/mount/parsed/hpux.mount create mode 100644 test/data/providers/mount/parsed/linux.mount create mode 100644 test/data/providers/mount/parsed/solaris.mount diff --git a/lib/puppet/provider/mount/parsed.rb b/lib/puppet/provider/mount/parsed.rb index 9422ca6bb..4a64ca29d 100755 --- a/lib/puppet/provider/mount/parsed.rb +++ b/lib/puppet/provider/mount/parsed.rb @@ -67,7 +67,7 @@ Puppet::Type.type(:mount).provide(:parsed,:parent => Puppet::Provider::ParsedFil def self.mountinstances # XXX: Will not work for mount points that have spaces in path (does fstab support this anyways?) - regex = case Facter.value("operatingsystem") + regex = case Facter.value(:operatingsystem) when "Darwin" / on (?:\/private\/var\/automount)?(\S*)/ when "Solaris", "HP-UX" diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index 94e731bec..2a305b905 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -27,89 +27,234 @@ module ParsedMountTesting fakefile(File::join("data/types/mount", name)) end + def fake_mountoutput + os = Facter.value(:operatingsystem) + if os == "Darwin" + name = "darwin.mount" + elsif os == "HP-UX" + name = "hpux.mount" + elsif os == "Solaris" + name = "solaris.mount" + else + # Catchall for other fstabs + name = "linux.mount" + end + fakefile(File::join("data/providers/mount/parsed", name)) + end end provider_class = Puppet::Type.type(:mount).provider(:parsed) describe provider_class do + before :each do @mount_class = Puppet::Type.type(:mount) - @provider_class = @mount_class.provider(:parsed) + @provider = @mount_class.provider(:parsed) end + # LAK:FIXME I can't mock Facter because this test happens at parse-time. + it "should default to /etc/vfstab on Solaris" do + pending "This test only works on Solaris" unless Facter.value(:operatingsystem) == 'Solaris' + Puppet::Type.type(:mount).provider(:parsed).default_target.should == '/etc/vfstab' + end - describe provider_class do - include ParsedMountTesting + it "should default to /etc/fstab on anything else" do + pending "This test does not work on Solaris" if Facter.value(:operatingsystem) == 'Solaris' + Puppet::Type.type(:mount).provider(:parsed).default_target.should == '/etc/fstab' + end - it "should be able to parse all of the example mount tabs" do - tab = fake_fstab - @provider = @provider_class + describe "when parsing a line" do - # LAK:FIXME Again, a relatively bad test, but I don't know how to rspec-ify this. - # I suppose this is more of an integration test? I dunno. - fakedataparse(tab) do - # Now just make we've got some mounts we know will be there - hashes = @provider_class.target_records(tab).find_all { |i| i.is_a? Hash } - (hashes.length > 0).should be_true - root = hashes.find { |i| i[:name] == "/" } + it "should not crash on incomplete lines in fstab" do + parse = @provider.parse <<-FSTAB +/dev/incomplete +/dev/device name +FSTAB + lambda{ @provider.to_line(parse[0]) }.should_not raise_error + end - proc { @provider_class.to_file(hashes) }.should_not raise_error + + describe "on Solaris", :if => Facter.value(:operatingsystem) == 'Solaris' do + + before :each do + @example_line = "/dev/dsk/c0d0s0 /dev/rdsk/c0d0s0 \t\t / \t ufs 1 no\t-" end - end - # LAK:FIXME I can't mock Facter because this test happens at parse-time. - it "should default to /etc/vfstab on Solaris and /etc/fstab everywhere else" do - should = case Facter.value(:operatingsystem) - when "Solaris"; "/etc/vfstab" - else - "/etc/fstab" - end - Puppet::Type.type(:mount).provider(:parsed).default_target.should == should - end + it "should extract device from the first field" do + @provider.parse_line(@example_line)[:device].should == '/dev/dsk/c0d0s0' + end - it "should not crash on incomplete lines in fstab" do - parse = @provider_class.parse <<-FSTAB -/dev/incomplete -/dev/device name - FSTAB + it "should extract blockdevice from second field" do + @provider.parse_line(@example_line)[:blockdevice].should == "/dev/rdsk/c0d0s0" + end + + it "should extract name from third field" do + @provider.parse_line(@example_line)[:name].should == "/" + end + + it "should extract fstype from fourth field" do + @provider.parse_line(@example_line)[:fstype].should == "ufs" + end + + it "should extract pass from fifth field" do + @provider.parse_line(@example_line)[:pass].should == "1" + end + + it "should extract atboot from sixth field" do + @provider.parse_line(@example_line)[:atboot].should == "no" + end + + it "should extract options from seventh field" do + @provider.parse_line(@example_line)[:options].should == "-" + end - lambda{ @provider_class.to_line(parse[0]) }.should_not raise_error end - end + describe "on other platforms than Solaris", :if => Facter.value(:operatingsystem) != 'Solaris' do + before :each do + @example_line = "/dev/vg00/lv01\t/spare \t \t ext3 defaults\t1 2" + end + + it "should extract device from the first field" do + @provider.parse_line(@example_line)[:device].should == '/dev/vg00/lv01' + end + + it "should extract name from second field" do + @provider.parse_line(@example_line)[:name].should == "/spare" + end + + it "should extract fstype from third field" do + @provider.parse_line(@example_line)[:fstype].should == "ext3" + end + + it "should extract options from fourth field" do + @provider.parse_line(@example_line)[:options].should == "defaults" + end + + it "should extract dump from fifth field" do + @provider.parse_line(@example_line)[:dump].should == "1" + end + + it "should extract options from sixth field" do + @provider.parse_line(@example_line)[:pass].should == "2" + end + + end + + end - describe provider_class, " when parsing information about the root filesystem", :if => Facter["operatingsystem"].value != "Darwin" do + describe "mountinstances" do include ParsedMountTesting - before do - @mount = @mount_class.new :name => "/" - @provider = @mount.provider + it "should get name from mountoutput found on Solaris" do + Facter.stubs(:value).with(:operatingsystem).returns 'Solaris' + @provider.stubs(:mountcmd).returns(File.read(fake_mountoutput)) + mounts = @provider.mountinstances + mounts.size.should == 6 + mounts[0].should == { :name => '/', :mounted => :yes } + mounts[1].should == { :name => '/proc', :mounted => :yes } + mounts[2].should == { :name => '/etc/mnttab', :mounted => :yes } + mounts[3].should == { :name => '/tmp', :mounted => :yes } + mounts[4].should == { :name => '/export/home', :mounted => :yes } + mounts[5].should == { :name => '/ghost', :mounted => :yes } + end + + it "should get name from mountoutput found on HP-UX" do + Facter.stubs(:value).with(:operatingsystem).returns 'HP-UX' + @provider.stubs(:mountcmd).returns(File.read(fake_mountoutput)) + mounts = @provider.mountinstances + mounts.size.should == 17 + mounts[0].should == { :name => '/', :mounted => :yes } + mounts[1].should == { :name => '/devices', :mounted => :yes } + mounts[2].should == { :name => '/dev', :mounted => :yes } + mounts[3].should == { :name => '/system/contract', :mounted => :yes } + mounts[4].should == { :name => '/proc', :mounted => :yes } + mounts[5].should == { :name => '/etc/mnttab', :mounted => :yes } + mounts[6].should == { :name => '/etc/svc/volatile', :mounted => :yes } + mounts[7].should == { :name => '/system/object', :mounted => :yes } + mounts[8].should == { :name => '/etc/dfs/sharetab', :mounted => :yes } + mounts[9].should == { :name => '/lib/libc.so.1', :mounted => :yes } + mounts[10].should == { :name => '/dev/fd', :mounted => :yes } + mounts[11].should == { :name => '/tmp', :mounted => :yes } + mounts[12].should == { :name => '/var/run', :mounted => :yes } + mounts[13].should == { :name => '/export', :mounted => :yes } + mounts[14].should == { :name => '/export/home', :mounted => :yes } + mounts[15].should == { :name => '/rpool', :mounted => :yes } + mounts[16].should == { :name => '/ghost', :mounted => :yes } end - it "should have a filesystem tab" do - FileTest.should be_exist(@provider_class.default_target) + it "should get name from mountoutput found on Darwin" do + Facter.stubs(:value).with(:operatingsystem).returns 'Darwin' + @provider.stubs(:mountcmd).returns(File.read(fake_mountoutput)) + mounts = @provider.mountinstances + mounts.size.should == 6 + mounts[0].should == { :name => '/', :mounted => :yes } + mounts[1].should == { :name => '/dev', :mounted => :yes } + mounts[2].should == { :name => '/net', :mounted => :yes } + mounts[3].should == { :name => '/home', :mounted => :yes } + mounts[4].should == { :name => '/usr', :mounted => :yes } + mounts[5].should == { :name => '/ghost', :mounted => :yes } end - it "should find the root filesystem" do - @provider_class.prefetch("/" => @mount) - @mount.provider.property_hash[:ensure].should == :present + it "should get name from mountoutput found on Linux" do + Facter.stubs(:value).with(:operatingsystem).returns 'Gentoo' + @provider.stubs(:mountcmd).returns(File.read(fake_mountoutput)) + mounts = @provider.mountinstances + mounts[0].should == { :name => '/', :mounted => :yes } + mounts[1].should == { :name => '/lib64/rc/init.d', :mounted => :yes } + mounts[2].should == { :name => '/sys', :mounted => :yes } + mounts[3].should == { :name => '/usr/portage', :mounted => :yes } + mounts[4].should == { :name => '/ghost', :mounted => :yes } end - it "should determine that the root fs is mounted" do - @provider_class.prefetch("/" => @mount) - @mount.provider.should be_mounted + it "should raise an error if a line is not understandable" do + @provider.stubs(:mountcmd).returns("bazinga!") + lambda { @provider.mountinstances }.should raise_error Puppet::Error end + end - describe provider_class, " when mounting and unmounting" do + describe "when prefetching" do include ParsedMountTesting - it "should call the 'mount' command to mount the filesystem" + before :each do + @res_ghost = Puppet::Type::Mount.new(:name => '/ghost') # in no fake fstab + @res_mounted = Puppet::Type::Mount.new(:name => '/') # in every fake fstab + @res_unmounted = Puppet::Type::Mount.new(:name => '/boot') # in every fake fstab + @res_absent = Puppet::Type::Mount.new(:name => '/absent') # in no fake fstab + + # Simulate transaction.rb:prefetch + @resource_hash = {} + [@res_ghost, @res_mounted, @res_unmounted, @res_absent].each do |resource| + @resource_hash[resource.name] = resource + end + + @provider.stubs(:mountcmd).returns File.read(fake_mountoutput) + @provider.stubs(:default_target).returns fake_fstab + end + + it "should set :ensure to :unmounted if found in fstab but not mounted" do + @provider.prefetch(@resource_hash) + @res_unmounted.provider.get(:ensure).should == :unmounted + end + + it "should set :ensure to :mounted if found in fstab and mounted" do + @provider.prefetch(@resource_hash) + @res_ghost.provider.get(:ensure).should == :ghost + end + + it "should set :ensure to :ghost if not found in fstab but mounted" do + @provider.prefetch(@resource_hash) + @res_mounted.provider.get(:ensure).should == :mounted + end - it "should call the 'unmount' command to unmount the filesystem" + it "should set :ensure to :absent if not found in fstab and not mounted" do + @provider.prefetch(@resource_hash) + @res_absent.provider.get(:ensure).should == :absent + end - it "should specify the filesystem when remounting a filesystem" end + end diff --git a/test/data/providers/mount/parsed/darwin.mount b/test/data/providers/mount/parsed/darwin.mount new file mode 100644 index 000000000..1bdfcf89a --- /dev/null +++ b/test/data/providers/mount/parsed/darwin.mount @@ -0,0 +1,6 @@ +/dev/disk0s2 on / (hfs, local, journaled) +devfs on /dev (devfs, local, nobrowse) +map -hosts on /net (autofs, nosuid, automounted, nobrowse) +map auto_home on /home (autofs, automounted, nobrowse) +/dev/disk0s3 on /usr (hfs, local, journaled) +/dev/fake on /ghost (hfs, local, journaled) diff --git a/test/data/providers/mount/parsed/hpux.mount b/test/data/providers/mount/parsed/hpux.mount new file mode 100644 index 000000000..d414fa47a --- /dev/null +++ b/test/data/providers/mount/parsed/hpux.mount @@ -0,0 +1,17 @@ +/ on rpool/ROOT/opensolaris read/write/setuid/devices/dev=2d90002 on Wed Dec 31 16:00:00 1969 +/devices on /devices read/write/setuid/devices/dev=4a00000 on Thu Feb 17 14:34:02 2011 +/dev on /dev read/write/setuid/devices/dev=4a40000 on Thu Feb 17 14:34:02 2011 +/system/contract on ctfs read/write/setuid/devices/dev=4ac0001 on Thu Feb 17 14:34:02 2011 +/proc on proc read/write/setuid/devices/dev=4b00000 on Thu Feb 17 14:34:02 2011 +/etc/mnttab on mnttab read/write/setuid/devices/dev=4b40001 on Thu Feb 17 14:34:02 2011 +/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4b80001 on Thu Feb 17 14:34:02 2011 +/system/object on objfs read/write/setuid/devices/dev=4bc0001 on Thu Feb 17 14:34:02 2011 +/etc/dfs/sharetab on sharefs read/write/setuid/devices/dev=4c00001 on Thu Feb 17 14:34:02 2011 +/lib/libc.so.1 on /usr/lib/libc/libc_hwcap1.so.1 read/write/setuid/devices/dev=2d90002 on Thu Feb 17 14:34:14 2011 +/dev/fd on fd read/write/setuid/devices/dev=4d00001 on Thu Feb 17 14:34:18 2011 +/tmp on swap read/write/setuid/devices/xattr/dev=4b80002 on Thu Feb 17 14:34:19 2011 +/var/run on swap read/write/setuid/devices/xattr/dev=4b80003 on Thu Feb 17 14:34:19 2011 +/export on rpool/export read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90006 on Thu Feb 17 14:37:48 2011 +/export/home on rpool/export/home read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90007 on Thu Feb 17 14:37:48 2011 +/rpool on rpool read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90009 on Thu Feb 17 14:37:48 2011 +/ghost on /dev/fake read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90009 on Thu Feb 17 14:37:48 2011 diff --git a/test/data/providers/mount/parsed/linux.mount b/test/data/providers/mount/parsed/linux.mount new file mode 100644 index 000000000..75dd71fd4 --- /dev/null +++ b/test/data/providers/mount/parsed/linux.mount @@ -0,0 +1,5 @@ +/dev/root on / type jfs (rw,noatime) +rc-svcdir on /lib64/rc/init.d type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1024k,mode=755) +sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) +/dev/sda9 on /usr/portage type jfs (rw) +/dev/fake on /ghost type jfs (rw) diff --git a/test/data/providers/mount/parsed/solaris.mount b/test/data/providers/mount/parsed/solaris.mount new file mode 100644 index 000000000..26fabc575 --- /dev/null +++ b/test/data/providers/mount/parsed/solaris.mount @@ -0,0 +1,6 @@ +/ on /dev/dsk/c0t0d0s0 read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200000 on Mon Mar 18 08:48:45 2002 +/proc on /proc read/write/setuid/dev=4300000 on Mon Mar 18 08:48:44 2002 +/etc/mnttab on mnttab read/write/setuid/dev=43c0000 on Mon Mar 18 08:48:44 2002 +/tmp on swap read/write/setuid/xattr/dev=2 on Mon Mar 18 08:48:52 2002 +/export/home on /dev/dsk/c0t0d0s7 read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Mon Mar 18 +/ghost on /dev/dsk/c0t1d0s7 read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Mon Mar 18 diff --git a/test/data/types/mount/linux.fstab b/test/data/types/mount/linux.fstab index b1debff9c..c94ec7fa8 100644 --- a/test/data/types/mount/linux.fstab +++ b/test/data/types/mount/linux.fstab @@ -9,3 +9,4 @@ proc /proc proc defaults 0 0 /dev/vg00/lv01 /spare ext3 defaults 1 2 sysfs /sys sysfs defaults 0 0 LABEL=SWAP-hda6 swap swap defaults 0 0 +/dev/sda1 /usr xfs noatime 0 0 diff --git a/test/data/types/mount/solaris.fstab b/test/data/types/mount/solaris.fstab index 54afc898c..348b9d50b 100644 --- a/test/data/types/mount/solaris.fstab +++ b/test/data/types/mount/solaris.fstab @@ -9,3 +9,4 @@ fd - /dev/fd fd - no - ctfs - /system/contract ctfs - no - objfs - /system/object objfs - no - #swap - /tmp tmpfs - yes - +/dev/dsk/c0d0s2 /dev/rdsk/c0d0s2 /usr ufs 1 no - -- cgit From 2ecf91367c911a87dc5680108222dcc48ecca888 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Mon, 21 Feb 2011 09:39:19 -0800 Subject: Revert "(#5935) Allow functions to accept negated values" This reverts commit e3c59df2b246fe5e764272f21b631a5d2f28687f. This commit is being reverted because the solution is incomplete, and a better solution is out of scope for this release. A more complete solution will be implemented in the future. --- lib/puppet/parser/grammar.ra | 3 - lib/puppet/parser/parser.rb | 1939 ++++++++++++++++---------------- spec/integration/parser/parser_spec.rb | 13 - 3 files changed, 962 insertions(+), 993 deletions(-) mode change 100755 => 100644 lib/puppet/parser/parser.rb diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index 6360f5064..98b8cfcfb 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -139,9 +139,6 @@ funcvalues: namestring # This is *almost* an rvalue, but I couldn't get a full # rvalue to work without scads of shift/reduce conflicts. namestring: name - | MINUS namestring =UMINUS { - result = ast AST::Minus, :value => val[1] - } | variable | type | boolean diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb old mode 100755 new mode 100644 index ff05996ec..c2fbf976d --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -21,7 +21,7 @@ module Puppet module Parser class Parser < Racc::Parser -module_eval(<<'...end grammar.ra/module_eval...', 'grammar.ra', 869) +module_eval(<<'...end grammar.ra/module_eval...', 'grammar.ra', 866) # It got too annoying having code in a file that needs to be compiled. require 'puppet/parser/parser_support' @@ -36,640 +36,634 @@ require 'puppet/parser/parser_support' ##### State transition tables begin ### racc_action_table = [ - 259, 260, 231, 63, 329, 64, 157, 54, 83, 248, - 321, 358, -168, 208, 213, 231, 37, 247, 65, 359, - 38, 63, 204, 206, 209, 212, 187, 11, 187, 244, - 245, 159, 54, 254, 73, 76, 73, 76, 103, -170, - 107, 118, 62, 197, 233, 58, 207, 211, 60, -167, - 216, 199, 200, 201, 203, 205, 98, 210, 214, 73, - 76, 244, 245, 103, 202, 107, 164, 72, 59, 308, - 58, 84, 87, 60, 196, 93, 54, 163, 73, 76, - 79, 101, 170, 164, 90, 73, 76, 95, 309, 103, - 164, 107, 72, 59, 163, 59, 84, 87, 310, 170, - 93, 163, -172, 73, 76, 79, 170, 98, 257, 90, - 355, 72, 311, 354, 58, 84, 178, 60, 72, 93, - 59, 258, 84, 87, 138, 312, 93, 355, 90, 184, - 354, 79, 101, 249, 370, 90, 72, 59, 95, 59, - 84, 178, 347, 313, 93, 185, 59, 164, 37, 138, - 73, 76, 38, 90, 103, 174, 107, 316, 163, 11, - 14, 73, 76, 170, 59, -187, 174, 37, 351, 73, - 76, 128, 98, 103, 184, 107, 73, 76, 11, 14, - 103, 37, 107, 72, 221, 128, 153, 84, 87, 223, - 59, 93, 11, 14, 73, 76, 79, 101, 98, 196, - 90, 37, 72, 95, 322, 38, 84, 87, 325, 72, - 93, 59, 11, 84, 87, 79, 273, 93, -171, 90, - 249, 250, 79, 101, 73, 76, 90, 72, 83, 95, - 59, 84, 87, 281, 37, 93, 280, 59, 38, 77, - 79, 48, 73, 76, 90, 11, 75, 69, 272, 221, - 46, 47, 210, 214, 223, 59, 48, 72, 59, 202, - -169, 84, 87, 179, -169, 93, -174, 73, 76, 77, - 79, 103, 339, 107, 90, 72, 234, 69, 341, 84, - 178, 176, 243, 93, 179, 59, 244, 245, 138, 98, - 200, 201, 90, 73, 76, 210, 214, 103, 344, 107, - 72, 174, 202, 59, 84, 87, 200, 201, 93, -167, - 348, 210, 214, 79, 101, 73, 76, 90, 202, 103, - 95, 107, 73, 76, -170, -168, 72, -173, 59, -172, - 84, 87, -171, 217, 93, 64, 73, 76, 279, 79, - 103, 218, 107, 90, 156, 274, 278, 123, 72, 153, - 249, 277, 84, 87, 59, 72, 93, 73, 76, 84, - 87, 79, 220, 93, 357, 90, 252, 77, 79, 72, - 249, 250, 90, 84, 87, 69, 59, 93, 210, 214, - 123, 83, 79, 59, 226, 202, 90, 73, 76, 187, - 72, 103, 192, 107, 84, 178, 153, 59, 93, 44, - 45, 41, 42, 138, 231, 73, 76, 90, 229, 103, - 118, 107, -23, -23, -23, -23, -169, 240, 59, 179, - 72, 229, 237, 52, 84, 87, -169, 98, 93, 44, - 45, 41, 42, 79, -167, 73, 76, 90, 72, 103, - -170, 107, 84, 87, -168, -172, 93, 368, 59, 234, - 228, 79, 101, 232, 50, 90, 375, 98, 95, 49, - 377, 73, 76, -168, -222, 103, 59, 107, 72, -170, - 380, 40, 84, 87, 39, 229, 93, -21, -21, -21, - -21, 79, 101, 98, -167, 90, nil, nil, 95, nil, - nil, 73, 76, nil, 72, 103, 59, 107, 84, 87, - nil, nil, 93, nil, nil, nil, nil, 79, 101, nil, - nil, 90, nil, 98, 95, nil, nil, 73, 76, nil, - nil, 103, 59, 107, 72, nil, nil, nil, 84, 87, - nil, nil, 93, nil, nil, 73, 76, 79, 101, 98, - nil, 90, 73, 76, 95, nil, 103, nil, 107, nil, - 72, nil, 59, nil, 84, 87, 73, 76, 93, nil, - 103, nil, nil, 79, 101, nil, nil, 90, 72, nil, - 95, nil, 84, 178, nil, 72, 93, nil, 59, 84, - 87, 138, nil, 93, nil, 90, nil, nil, 79, 72, - nil, nil, 90, 84, 144, nil, 59, 93, nil, nil, - nil, nil, 138, 59, 73, 76, 90, nil, 103, nil, - 107, 216, 199, 200, 201, nil, nil, 59, 210, 214, - nil, 216, 199, 200, 201, 202, 98, nil, 210, 214, - 73, 76, nil, nil, 103, 202, 107, 72, nil, nil, - nil, 84, 87, nil, nil, 93, nil, nil, nil, nil, - 79, 101, 98, nil, 90, nil, nil, 95, nil, nil, - 73, 76, nil, 72, 103, 59, 107, 84, 87, nil, - nil, 93, nil, nil, nil, nil, 79, 101, nil, nil, - 90, nil, 98, 95, nil, nil, 73, 76, nil, nil, - 103, 59, 107, 72, nil, nil, nil, 84, 87, nil, - nil, 93, nil, nil, nil, nil, 79, 101, 73, 76, - 90, nil, 103, 95, 107, nil, nil, nil, nil, 72, - nil, 59, nil, 84, 87, nil, nil, 93, nil, 73, - 76, nil, 79, 103, nil, 107, 90, nil, nil, nil, - nil, 72, nil, nil, nil, 84, 87, 59, nil, 93, - nil, 98, nil, nil, 79, 73, 76, nil, 90, nil, - nil, nil, 72, nil, nil, nil, 84, 87, nil, 59, - 93, nil, nil, 73, 76, 79, 101, nil, 342, 90, - 73, 76, 95, nil, 103, nil, 107, nil, 72, nil, - 59, nil, 84, 87, 73, 76, 93, nil, nil, nil, - 77, 79, nil, nil, nil, 90, 72, nil, 69, nil, - 84, 178, nil, 72, 93, nil, 59, 84, 87, 138, - nil, 93, nil, 90, 73, 76, 79, 72, nil, nil, - 90, 84, 178, nil, 59, 93, nil, nil, nil, 77, - 138, 59, 73, 76, 90, nil, 103, 69, 107, nil, - nil, nil, nil, nil, nil, 59, nil, 72, nil, nil, - nil, 84, 178, nil, 98, 93, nil, 73, 76, nil, - 138, nil, nil, nil, 90, 72, nil, nil, nil, 84, - 87, nil, nil, 93, nil, 59, nil, nil, 79, 101, - 180, nil, 90, 73, 76, 95, nil, 103, nil, 107, - 72, nil, nil, 59, 84, 87, nil, nil, 93, nil, - nil, nil, 77, 79, nil, 98, nil, 90, 73, 76, - 69, nil, 103, nil, 107, nil, 72, nil, 59, nil, - 84, 87, 73, 76, 93, nil, 103, nil, 107, 79, - 101, nil, nil, 90, nil, nil, 95, nil, 73, 76, - nil, 72, 103, nil, 59, 84, 87, nil, nil, 93, - nil, nil, nil, nil, 79, 72, nil, nil, 90, 84, - 87, nil, nil, 93, nil, 73, 76, nil, 79, 59, - nil, 72, 90, nil, nil, 84, 178, nil, nil, 93, - nil, 73, 76, 59, 138, 103, nil, 107, 90, nil, - nil, 73, 76, nil, nil, 103, nil, 107, 72, 59, - nil, nil, 84, 178, nil, nil, 93, nil, nil, nil, - nil, 138, nil, 98, 72, 90, nil, nil, 84, 87, - nil, nil, 93, nil, 72, nil, 59, 79, 84, 87, - nil, 90, 93, nil, nil, nil, nil, 79, 101, 73, - 76, 90, 59, 103, 95, 107, 216, 199, 200, 201, - 203, 205, 59, 210, 214, nil, nil, nil, nil, nil, - 202, 98, nil, nil, nil, 73, 76, nil, nil, 103, - nil, 107, 72, nil, nil, nil, 84, 87, nil, nil, - 93, nil, nil, nil, nil, 79, 101, 98, nil, 90, - nil, nil, 95, nil, nil, 73, 76, nil, 72, 103, - 59, 107, 84, 87, nil, nil, 93, nil, nil, nil, - nil, 79, 101, nil, nil, 90, nil, 98, 95, nil, - nil, 73, 76, nil, nil, 103, 59, 107, 72, nil, - nil, nil, 84, 87, nil, nil, 93, nil, nil, nil, - nil, 79, 101, 98, nil, 90, nil, nil, 95, nil, - nil, 73, 76, nil, 72, 103, 59, 107, 84, 87, - nil, nil, 93, nil, nil, nil, nil, 79, 101, nil, - nil, 90, nil, 98, 95, nil, nil, 73, 76, nil, - nil, 103, 59, 107, 72, nil, nil, nil, 84, 87, - nil, nil, 93, nil, nil, nil, nil, 79, 101, 98, - nil, 90, nil, nil, 95, nil, nil, 73, 76, nil, - 72, 103, 59, 107, 84, 87, nil, nil, 93, nil, - nil, nil, nil, 79, 101, nil, nil, 90, nil, 98, - 95, nil, nil, 73, 76, nil, nil, 103, 59, 107, - 72, nil, nil, nil, 84, 87, nil, nil, 93, nil, - nil, nil, nil, 79, 101, nil, nil, 90, nil, nil, - 95, nil, nil, nil, nil, nil, 72, 215, 59, nil, - 84, 87, nil, nil, 93, nil, 208, 213, nil, 79, - nil, nil, nil, 90, nil, 204, 206, 209, 212, nil, - nil, 208, 213, nil, 59, nil, nil, nil, nil, 276, - 204, 206, 209, 212, nil, nil, nil, nil, nil, 207, - 211, nil, nil, 216, 199, 200, 201, 203, 205, nil, - 210, 214, nil, nil, 207, 211, nil, 202, 216, 199, - 200, 201, 203, 205, nil, 210, 214, 208, 213, nil, - nil, nil, 202, nil, nil, nil, 204, 206, 209, 212, - nil, nil, 208, 213, nil, nil, nil, nil, nil, nil, - nil, 204, 206, 209, 212, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 216, 199, 200, 201, 203, 205, - nil, 210, 214, nil, nil, nil, 211, nil, 202, 216, - 199, 200, 201, 203, 205, nil, 210, 214, 208, 213, - nil, nil, nil, 202, nil, nil, nil, 204, 206, 209, - 212, nil, nil, 208, 213, nil, nil, nil, nil, nil, - nil, nil, 204, 206, 209, 212, nil, nil, nil, nil, - nil, 207, 211, nil, nil, 216, 199, 200, 201, 203, - 205, nil, 210, 214, nil, nil, 207, 211, nil, 202, - 216, 199, 200, 201, 203, 205, nil, 210, 214, 208, - 213, nil, nil, nil, 202, nil, nil, nil, 204, 206, - 209, 212, nil, nil, nil, 213, nil, 216, 199, 200, - 201, 203, 205, 204, 210, 214, nil, nil, nil, nil, - nil, 202, 207, 211, 213, nil, 216, 199, 200, 201, - 203, 205, 204, 210, 214, nil, nil, nil, nil, 213, - 202, 216, 199, 200, 201, 203, 205, 204, 210, 214, - nil, nil, nil, nil, nil, 202, nil, nil, 213, nil, - 216, 199, 200, 201, 203, 205, 204, 210, 214, nil, - nil, nil, nil, nil, 202, 216, 199, 200, 201, 203, - 205, nil, 210, 214, nil, nil, 352, nil, nil, 202, - nil, nil, nil, nil, 216, 199, 200, 201, 203, 205, - nil, 210, 214, nil, nil, 360, nil, 26, 202, 33, - 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, - nil, 3, nil, nil, 11, 14, 26, 299, 33, 1, - nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, - 3, nil, nil, 11, 14, nil, 366, nil, 26, nil, - 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, - 29, nil, 3, nil, nil, 11, 14, 26, 367, 33, - 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, - nil, 3, nil, nil, 11, 14, nil, 378, nil, 26, - nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, - nil, 29, nil, 3, nil, nil, 11, 14, 26, 382, - 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, - 29, nil, 3, nil, nil, 11, 14, nil, 307, nil, - 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, + 256, 257, 228, 63, 327, 64, 156, 54, 82, 356, + -166, 245, 176, 205, 210, 254, 37, 357, 65, 244, + 38, -168, 201, 203, 206, 209, 184, 11, 255, 241, + 242, 158, 54, 251, 72, 75, 72, 75, 102, 117, + 106, -170, 62, 194, 230, 58, 204, 208, 60, 306, + 213, 196, 197, 198, 200, 202, 97, 207, 211, 72, + 75, 241, 242, 102, 199, 106, 163, 71, 59, 307, + 58, 83, 86, 60, 193, 92, 54, 162, 72, 75, + 78, 100, 169, 163, 89, 72, 75, 94, 308, 102, + 163, 106, 71, 59, 162, 59, 83, 86, 59, 169, + 92, 162, 311, 72, 75, 78, 169, 97, 181, 89, + 353, 71, 228, 352, 58, 83, 269, 60, 71, 92, + 59, 345, 83, 86, 137, 184, 92, -171, 89, 72, + 75, 78, 100, 246, 368, 89, 71, 59, 94, 59, + 83, 86, 309, 173, 92, 314, 59, 163, 76, 78, + 72, 75, -167, 89, 102, 310, 106, 37, 162, 173, + 218, 127, 71, 169, 59, 220, 83, 269, 11, 14, + 92, 63, 97, 152, 37, 137, 72, 75, 127, 89, + 102, 319, 106, 71, 218, 11, 14, 83, 86, 220, + 59, 92, 72, 75, 72, 75, 78, 100, 270, 279, + 89, 349, 278, 94, 353, 207, 211, 352, 320, 71, + -169, 59, 199, 83, 86, 197, 198, 92, 72, 75, + 207, 211, 78, -169, 37, 71, 89, 199, 38, 83, + 269, -167, 193, 92, -166, 11, 14, 59, 137, 72, + 75, 272, 89, 102, 182, 106, 37, 207, 211, -186, + 38, 71, 181, 59, 199, 83, 86, 11, 337, 92, + 231, 97, 339, 76, 78, 72, 75, 37, 89, 82, + 48, 38, 71, 48, 323, 176, 83, 86, 11, 59, + 92, 342, 46, 47, 184, 78, 100, 74, -168, 89, + 72, 75, 94, -172, 102, 346, 106, -173, 71, 175, + 59, 59, 83, 86, 240, -171, 92, -170, 241, 242, + 76, 78, 97, 197, 198, 89, 72, 75, 207, 211, + 102, 214, 106, 71, 64, 199, 59, 83, 86, 276, + 215, 92, 217, 246, 275, 173, 78, 100, 97, 82, + 89, 72, 75, 94, 155, 102, 122, 106, 152, 71, + 223, 59, -168, 83, 86, 249, 277, 92, 176, 246, + 247, 122, 78, 100, 225, -166, 89, 72, 75, 94, + 117, 102, 226, 106, 71, -169, 271, 59, 83, 86, + 246, 247, 92, -21, -21, -21, -21, 78, 226, 97, + -167, 89, 72, 75, 52, -168, 102, -166, 106, -169, + 71, -167, 59, -171, 83, 86, 366, 152, 92, -23, + -23, -23, -23, 78, 100, 228, 226, 89, 72, 75, + 94, 50, 102, 373, 106, 71, 49, 375, 59, 83, + 86, 229, -221, 92, 237, 378, 72, 75, 78, 40, + 97, 39, 89, 355, 44, 45, 41, 42, 231, 234, + nil, 71, nil, 59, nil, 83, 86, nil, nil, 92, + 44, 45, 41, 42, 78, 100, 72, 75, 89, 71, + 102, 94, 106, 83, 269, nil, nil, 92, nil, 59, + nil, nil, 137, nil, nil, nil, 89, nil, 97, nil, + nil, nil, 72, 75, nil, nil, 102, 59, 106, 71, + nil, nil, nil, 83, 86, nil, nil, 92, nil, nil, + nil, nil, 78, 100, 97, nil, 89, nil, nil, 94, + nil, nil, 72, 75, nil, 71, 102, 59, 106, 83, + 86, nil, nil, 92, nil, nil, nil, nil, 78, 100, + nil, nil, 89, nil, 97, 94, nil, nil, 72, 75, + nil, nil, 102, 59, 106, 71, nil, nil, nil, 83, + 86, nil, nil, 92, nil, nil, 72, 75, 78, 100, + 97, nil, 89, 72, 75, 94, nil, 102, nil, 106, + nil, 71, nil, 59, nil, 83, 86, 72, 75, 92, + nil, 102, nil, nil, 78, 100, nil, nil, 89, 71, + nil, 94, nil, 83, 269, nil, 71, 92, nil, 59, + 83, 86, 137, nil, 92, nil, 89, nil, nil, 78, + 71, nil, nil, 89, 83, 143, nil, 59, 92, nil, + nil, nil, nil, 137, 59, 72, 75, 89, nil, 102, + nil, 106, 213, 196, 197, 198, 200, 202, 59, 207, + 211, nil, 213, 196, 197, 198, 199, 97, nil, 207, + 211, 72, 75, nil, nil, 102, 199, 106, 71, nil, + nil, nil, 83, 86, nil, nil, 92, nil, nil, nil, + nil, 78, 100, 97, nil, 89, nil, nil, 94, nil, + nil, 72, 75, nil, 71, 102, 59, 106, 83, 86, + nil, nil, 92, nil, nil, nil, nil, 78, 100, nil, + nil, 89, nil, 97, 94, nil, nil, nil, nil, nil, + nil, nil, 59, nil, 71, nil, nil, nil, 83, 86, + 72, 75, 92, nil, 102, 189, 106, 78, 100, nil, + nil, 89, nil, nil, 94, nil, nil, nil, nil, 72, + 75, nil, 59, 102, nil, 106, 72, 75, nil, nil, + 102, nil, 106, 71, nil, nil, nil, 83, 86, nil, + nil, 92, nil, nil, nil, nil, 78, nil, 97, nil, + 89, nil, 71, nil, nil, nil, 83, 86, nil, 71, + 92, 59, nil, 83, 86, 78, nil, 92, nil, 89, + nil, nil, 78, 100, nil, nil, 89, 72, 75, 94, + 59, 102, nil, 106, nil, nil, nil, 59, nil, nil, + nil, nil, nil, nil, nil, nil, 72, 75, nil, 97, + 102, nil, 106, 72, 75, nil, nil, 102, nil, 106, + 71, nil, nil, nil, 83, 86, nil, nil, 92, nil, + nil, nil, nil, 78, 100, 97, nil, 89, nil, 71, + 94, nil, nil, 83, 86, nil, 71, 92, 59, nil, + 83, 86, 78, nil, 92, nil, 89, nil, nil, 78, + 100, nil, nil, 89, 72, 75, 94, 59, 102, nil, + 106, nil, nil, nil, 59, nil, nil, nil, nil, nil, + nil, nil, nil, 72, 75, nil, 97, nil, nil, 72, + 75, nil, nil, nil, nil, nil, nil, 71, nil, nil, + nil, 83, 86, nil, nil, 92, 340, nil, nil, nil, + 78, 100, 177, nil, 89, nil, 71, 94, nil, nil, + 83, 86, 71, nil, 92, 59, 83, 86, 76, 78, + 92, nil, nil, 89, 76, 78, 72, 75, nil, 89, + 102, nil, 106, nil, 59, nil, 213, 196, 197, 198, + 59, nil, nil, 207, 211, 72, 75, nil, 97, 102, + 199, 106, 72, 75, nil, nil, nil, nil, nil, 71, + nil, nil, nil, 83, 86, nil, nil, 92, nil, nil, + 72, 75, 78, 100, nil, nil, 89, nil, 71, 94, + nil, nil, 83, 86, nil, 71, 92, 59, nil, 83, + 269, 78, nil, 92, nil, 89, nil, nil, 137, nil, + nil, nil, 89, 71, nil, nil, 59, 83, 269, nil, + nil, 92, nil, 59, nil, nil, 137, 72, 75, nil, + 89, 102, nil, 106, nil, nil, nil, nil, nil, nil, + nil, 59, nil, nil, nil, nil, 72, 75, nil, 97, + 102, nil, 106, 72, 75, nil, nil, 102, nil, 106, + 71, nil, nil, nil, 83, 86, nil, nil, 92, nil, + nil, nil, nil, 78, 100, 72, 75, 89, nil, 71, + 94, nil, nil, 83, 86, nil, 71, 92, 59, nil, + 83, 86, 78, nil, 92, nil, 89, nil, nil, 78, + 72, 75, nil, 89, 102, nil, 106, 59, 71, nil, + nil, nil, 83, 269, 59, nil, 92, nil, 72, 75, + nil, 137, 102, nil, 106, 89, nil, nil, nil, nil, + nil, nil, nil, 71, nil, nil, 59, 83, 86, nil, + 97, 92, nil, 72, 75, nil, 78, 102, nil, 106, + 89, 71, nil, 72, 75, 83, 86, 102, nil, 92, + nil, 59, nil, nil, 78, 100, nil, nil, 89, nil, + nil, 94, nil, nil, nil, nil, 71, nil, nil, 59, + 83, 86, nil, nil, 92, nil, 71, nil, nil, 78, + 83, 269, nil, 89, 92, nil, 72, 75, nil, 137, + 102, nil, 106, 89, 59, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 59, 72, 75, nil, 97, 102, + nil, 106, 72, 75, nil, nil, 102, nil, 106, 71, + nil, nil, nil, 83, 86, nil, nil, 92, nil, nil, + nil, nil, 78, 100, 97, nil, 89, nil, 71, 94, + nil, nil, 83, 86, nil, 71, 92, 59, nil, 83, + 86, 78, nil, 92, nil, 89, nil, nil, 78, 100, + 212, nil, 89, nil, nil, 94, 59, nil, nil, 205, + 210, nil, nil, 59, nil, nil, nil, nil, 201, 203, + 206, 209, nil, nil, 205, 210, nil, nil, nil, nil, + nil, nil, 274, 201, 203, 206, 209, nil, nil, nil, + nil, nil, 204, 208, nil, nil, 213, 196, 197, 198, + 200, 202, nil, 207, 211, nil, nil, 204, 208, nil, + 199, 213, 196, 197, 198, 200, 202, nil, 207, 211, + 205, 210, nil, nil, nil, 199, nil, nil, nil, 201, + 203, 206, 209, nil, nil, 205, 210, nil, nil, nil, + nil, nil, nil, nil, 201, 203, 206, 209, nil, nil, + nil, nil, nil, nil, 208, nil, nil, 213, 196, 197, + 198, 200, 202, nil, 207, 211, nil, nil, 204, 208, + nil, 199, 213, 196, 197, 198, 200, 202, nil, 207, + 211, 205, 210, nil, nil, nil, 199, nil, nil, nil, + 201, 203, 206, 209, nil, nil, 205, 210, nil, nil, + nil, nil, nil, nil, nil, 201, 203, 206, 209, nil, + nil, nil, nil, nil, 204, 208, nil, nil, 213, 196, + 197, 198, 200, 202, nil, 207, 211, nil, nil, nil, + nil, nil, 199, 213, 196, 197, 198, 200, 202, nil, + 207, 211, 205, 210, nil, nil, nil, 199, nil, nil, + nil, 201, 203, 206, 209, nil, nil, nil, 210, nil, + 213, 196, 197, 198, 200, 202, 201, 207, 211, nil, + nil, nil, nil, nil, 199, 204, 208, 210, nil, 213, + 196, 197, 198, 200, 202, 201, 207, 211, nil, nil, + nil, nil, 210, 199, 213, 196, 197, 198, 200, 202, + 201, 207, 211, nil, nil, nil, nil, nil, 199, nil, + nil, 210, nil, 213, 196, 197, 198, 200, 202, 201, + 207, 211, nil, nil, nil, nil, nil, 199, 213, 196, + 197, 198, 200, 202, nil, 207, 211, nil, nil, 384, + nil, nil, 199, nil, nil, nil, nil, 213, 196, 197, + 198, 200, 202, nil, 207, 211, nil, nil, 297, nil, + 26, 199, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, 14, 26, - 384, 33, 1, nil, 7, 12, nil, 17, nil, 23, - nil, 29, nil, 3, nil, nil, 11, 14, nil, 385, + 305, 33, 1, nil, 7, 12, nil, 17, nil, 23, + nil, 29, nil, 3, nil, nil, 11, 14, nil, 383, nil, 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, 14, - 26, 327, 33, 1, nil, 7, 12, nil, 17, nil, + 26, 325, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, 14, nil, - 386, nil, 26, nil, 33, 1, nil, 7, 12, nil, + 382, nil, 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, - 14, 26, nil, 33, 1, nil, 7, 12, nil, 17, + 14, 26, 380, 33, 1, nil, 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, 14, - 26, nil, 33, 1, nil, 7, 12, nil, 17, nil, - 23, nil, 29, nil, 3, nil, nil, 11, 14, 26, - nil, 33, 1, nil, 7, 12, nil, 17, nil, 23, - nil, 29, nil, 3, nil, nil, 11, 14 ] + nil, 376, nil, 26, nil, 33, 1, nil, 7, 12, + nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, + 11, 14, 26, 350, 33, 1, nil, 7, 12, nil, + 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, + 14, nil, 358, nil, 26, nil, 33, 1, nil, 7, + 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, + nil, 11, 14, 26, 365, 33, 1, nil, 7, 12, + nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, + 11, 14, nil, 364, nil, 26, nil, 33, 1, nil, + 7, 12, nil, 17, nil, 23, nil, 29, nil, 3, + nil, nil, 11, 14, 26, nil, 33, 1, nil, 7, + 12, nil, 17, nil, 23, nil, 29, nil, 3, nil, + nil, 11, 14, 26, nil, 33, 1, nil, 7, 12, + nil, 17, nil, 23, nil, 29, nil, 3, nil, nil, + 11, 14, 26, nil, 33, 1, nil, 7, 12, nil, + 17, nil, 23, nil, 29, nil, 3, nil, nil, 11, + 14 ] racc_action_check = [ - 183, 183, 153, 22, 246, 22, 55, 157, 87, 166, - 235, 303, 88, 183, 183, 144, 12, 166, 22, 303, - 12, 86, 183, 183, 183, 183, 87, 12, 144, 246, - 246, 55, 17, 175, 200, 200, 107, 107, 200, 85, - 200, 218, 22, 107, 153, 157, 183, 183, 157, 82, - 183, 183, 183, 183, 183, 183, 200, 183, 183, 179, - 179, 175, 175, 179, 183, 179, 62, 200, 157, 221, - 17, 200, 200, 17, 107, 200, 159, 62, 371, 371, - 200, 200, 62, 164, 200, 205, 205, 200, 222, 205, - 242, 205, 179, 17, 164, 200, 179, 179, 223, 164, - 179, 242, 91, 358, 358, 179, 242, 205, 181, 179, - 299, 371, 224, 299, 159, 371, 371, 159, 205, 371, - 179, 181, 205, 205, 371, 224, 205, 352, 371, 275, - 352, 205, 205, 346, 346, 205, 358, 159, 205, 371, - 358, 358, 275, 227, 358, 81, 205, 65, 30, 358, - 354, 354, 30, 358, 354, 229, 354, 230, 65, 30, - 30, 280, 280, 65, 358, 79, 232, 43, 280, 344, - 344, 43, 354, 344, 78, 344, 206, 206, 43, 43, - 206, 121, 206, 354, 123, 121, 234, 354, 354, 123, - 214, 354, 121, 121, 184, 184, 354, 354, 206, 280, - 354, 237, 344, 354, 236, 237, 344, 344, 237, 206, - 344, 354, 237, 206, 206, 344, 186, 206, 92, 344, - 186, 186, 206, 206, 23, 23, 206, 184, 23, 206, - 344, 184, 184, 198, 1, 184, 198, 206, 1, 184, - 184, 7, 185, 185, 184, 1, 23, 184, 185, 311, - 7, 7, 284, 284, 311, 184, 72, 23, 210, 284, - 96, 23, 23, 71, 68, 23, 67, 26, 26, 23, - 23, 26, 253, 26, 23, 185, 255, 23, 256, 185, - 185, 66, 161, 185, 97, 23, 161, 161, 185, 26, - 282, 282, 185, 310, 310, 282, 282, 310, 267, 310, - 26, 64, 282, 185, 26, 26, 300, 300, 26, 102, - 277, 300, 300, 26, 26, 29, 29, 26, 300, 29, - 26, 29, 187, 187, 104, 106, 310, 108, 26, 109, - 310, 310, 110, 115, 310, 116, 308, 308, 195, 310, - 308, 120, 308, 310, 52, 187, 191, 51, 29, 50, - 191, 191, 29, 29, 310, 187, 29, 301, 301, 187, - 187, 29, 122, 187, 301, 29, 172, 187, 187, 308, - 172, 172, 187, 308, 308, 187, 29, 308, 283, 283, - 36, 128, 308, 187, 133, 283, 308, 103, 103, 178, - 301, 103, 103, 103, 301, 301, 176, 308, 301, 4, - 4, 4, 4, 301, 174, 199, 199, 301, 173, 199, - 33, 199, 35, 35, 35, 35, 134, 158, 301, 136, - 103, 318, 155, 16, 103, 103, 330, 199, 103, 34, - 34, 34, 34, 103, 331, 39, 39, 103, 199, 39, - 333, 39, 199, 199, 334, 335, 199, 340, 103, 154, - 137, 199, 199, 145, 9, 199, 355, 39, 199, 8, - 359, 207, 207, 143, 370, 207, 199, 207, 39, 141, - 372, 3, 39, 39, 2, 140, 39, 28, 28, 28, - 28, 39, 39, 207, 139, 39, nil, nil, 39, nil, - nil, 46, 46, nil, 207, 46, 39, 46, 207, 207, - nil, nil, 207, nil, nil, nil, nil, 207, 207, nil, - nil, 207, nil, 46, 207, nil, nil, 47, 47, nil, - nil, 47, 207, 47, 46, nil, nil, nil, 46, 46, - nil, nil, 46, nil, nil, 272, 272, 46, 46, 47, - nil, 46, 48, 48, 46, nil, 48, nil, 48, nil, - 47, nil, 46, nil, 47, 47, 49, 49, 47, nil, - 49, nil, nil, 47, 47, nil, nil, 47, 272, nil, - 47, nil, 272, 272, nil, 48, 272, nil, 47, 48, - 48, 272, nil, 48, nil, 272, nil, nil, 48, 49, - nil, nil, 48, 49, 49, nil, 272, 49, nil, nil, - nil, nil, 49, 48, 101, 101, 49, nil, 101, nil, - 101, 286, 286, 286, 286, nil, nil, 49, 286, 286, - nil, 288, 288, 288, 288, 286, 101, nil, 288, 288, - 98, 98, nil, nil, 98, 288, 98, 101, nil, nil, - nil, 101, 101, nil, nil, 101, nil, nil, nil, nil, - 101, 101, 98, nil, 101, nil, nil, 101, nil, nil, - 201, 201, nil, 98, 201, 101, 201, 98, 98, nil, - nil, 98, nil, nil, nil, nil, 98, 98, nil, nil, - 98, nil, 201, 98, nil, nil, 279, 279, nil, nil, - 279, 98, 279, 201, nil, nil, nil, 201, 201, nil, - nil, 201, nil, nil, nil, nil, 201, 201, 63, 63, - 201, nil, 63, 201, 63, nil, nil, nil, nil, 279, - nil, 201, nil, 279, 279, nil, nil, 279, nil, 259, - 259, nil, 279, 259, nil, 259, 279, nil, nil, nil, - nil, 63, nil, nil, nil, 63, 63, 279, nil, 63, - nil, 259, nil, nil, 63, 257, 257, nil, 63, nil, - nil, nil, 259, nil, nil, nil, 259, 259, nil, 63, - 259, nil, nil, 248, 248, 259, 259, nil, 257, 259, - 251, 251, 259, nil, 251, nil, 251, nil, 257, nil, - 259, nil, 257, 257, 69, 69, 257, nil, nil, nil, - 257, 257, nil, nil, nil, 257, 248, nil, 257, nil, - 248, 248, nil, 251, 248, nil, 257, 251, 251, 248, - nil, 251, nil, 248, 247, 247, 251, 69, nil, nil, - 251, 69, 69, nil, 248, 69, nil, nil, nil, 69, - 69, 251, 204, 204, 69, nil, 204, 69, 204, nil, - nil, nil, nil, nil, nil, 69, nil, 247, nil, nil, - nil, 247, 247, nil, 204, 247, nil, 75, 75, nil, - 247, nil, nil, nil, 247, 204, nil, nil, nil, 204, - 204, nil, nil, 204, nil, 247, nil, nil, 204, 204, - 75, nil, 204, 76, 76, 204, nil, 76, nil, 76, - 75, nil, nil, 204, 75, 75, nil, nil, 75, nil, - nil, nil, 75, 75, nil, 76, nil, 75, 233, 233, - 75, nil, 233, nil, 233, nil, 76, nil, 75, nil, - 76, 76, 231, 231, 76, nil, 231, nil, 231, 76, - 76, nil, nil, 76, nil, nil, 76, nil, 228, 228, - nil, 233, 228, nil, 76, 233, 233, nil, nil, 233, - nil, nil, nil, nil, 233, 231, nil, nil, 233, 231, - 231, nil, nil, 231, nil, 217, 217, nil, 231, 233, - nil, 228, 231, nil, nil, 228, 228, nil, nil, 228, - nil, 202, 202, 231, 228, 202, nil, 202, 228, nil, - nil, 208, 208, nil, nil, 208, nil, 208, 217, 228, - nil, nil, 217, 217, nil, nil, 217, nil, nil, nil, - nil, 217, nil, 208, 202, 217, nil, nil, 202, 202, - nil, nil, 202, nil, 208, nil, 217, 202, 208, 208, - nil, 202, 208, nil, nil, nil, nil, 208, 208, 216, - 216, 208, 202, 216, 208, 216, 287, 287, 287, 287, - 287, 287, 208, 287, 287, nil, nil, nil, nil, nil, - 287, 216, nil, nil, nil, 203, 203, nil, nil, 203, - nil, 203, 216, nil, nil, nil, 216, 216, nil, nil, - 216, nil, nil, nil, nil, 216, 216, 203, nil, 216, - nil, nil, 216, nil, nil, 213, 213, nil, 203, 213, - 216, 213, 203, 203, nil, nil, 203, nil, nil, nil, - nil, 203, 203, nil, nil, 203, nil, 213, 203, nil, - nil, 212, 212, nil, nil, 212, 203, 212, 213, nil, - nil, nil, 213, 213, nil, nil, 213, nil, nil, nil, - nil, 213, 213, 212, nil, 213, nil, nil, 213, nil, - nil, 211, 211, nil, 212, 211, 213, 211, 212, 212, - nil, nil, 212, nil, nil, nil, nil, 212, 212, nil, - nil, 212, nil, 211, 212, nil, nil, 95, 95, nil, - nil, 95, 212, 95, 211, nil, nil, nil, 211, 211, - nil, nil, 211, nil, nil, nil, nil, 211, 211, 95, - nil, 211, nil, nil, 211, nil, nil, 209, 209, nil, - 95, 209, 211, 209, 95, 95, nil, nil, 95, nil, - nil, nil, nil, 95, 95, nil, nil, 95, nil, 209, - 95, nil, nil, 83, 83, nil, nil, 83, 95, 83, - 209, nil, nil, nil, 209, 209, nil, nil, 209, nil, - nil, nil, nil, 209, 209, nil, nil, 209, nil, nil, - 209, nil, nil, nil, nil, nil, 83, 112, 209, nil, - 83, 83, nil, nil, 83, nil, 112, 112, nil, 83, - nil, nil, nil, 83, nil, 112, 112, 112, 112, nil, - nil, 189, 189, nil, 83, nil, nil, nil, nil, 189, - 189, 189, 189, 189, nil, nil, nil, nil, nil, 112, - 112, nil, nil, 112, 112, 112, 112, 112, 112, nil, - 112, 112, nil, nil, 189, 189, nil, 112, 189, 189, - 189, 189, 189, 189, nil, 189, 189, 294, 294, nil, - nil, nil, 189, nil, nil, nil, 294, 294, 294, 294, - nil, nil, 290, 290, nil, nil, nil, nil, nil, nil, - nil, 290, 290, 290, 290, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 294, 294, 294, 294, 294, 294, - nil, 294, 294, nil, nil, nil, 290, nil, 294, 290, - 290, 290, 290, 290, 290, nil, 290, 290, 125, 125, - nil, nil, nil, 290, nil, nil, nil, 125, 125, 125, - 125, nil, nil, 131, 131, nil, nil, nil, nil, nil, - nil, nil, 131, 131, 131, 131, nil, nil, nil, nil, - nil, 125, 125, nil, nil, 125, 125, 125, 125, 125, - 125, nil, 125, 125, nil, nil, 131, 131, nil, 125, - 131, 131, 131, 131, 131, 131, nil, 131, 131, 132, - 132, nil, nil, nil, 131, nil, nil, nil, 132, 132, - 132, 132, nil, nil, nil, 289, nil, 296, 296, 296, - 296, 296, 296, 289, 296, 296, nil, nil, nil, nil, - nil, 296, 132, 132, 292, nil, 132, 132, 132, 132, - 132, 132, 292, 132, 132, nil, nil, nil, nil, 291, - 132, 289, 289, 289, 289, 289, 289, 291, 289, 289, - nil, nil, nil, nil, nil, 289, nil, nil, 295, nil, - 292, 292, 292, 292, 292, 292, 295, 292, 292, nil, - nil, nil, nil, nil, 292, 291, 291, 291, 291, 291, - 291, nil, 291, 291, nil, nil, 298, nil, nil, 291, - nil, nil, nil, nil, 295, 295, 295, 295, 295, 295, - nil, 295, 295, nil, nil, 306, nil, 298, 295, 298, - 298, nil, 298, 298, nil, 298, nil, 298, nil, 298, - nil, 298, nil, nil, 298, 298, 306, 215, 306, 306, - nil, 306, 306, nil, 306, nil, 306, nil, 306, nil, - 306, nil, nil, 306, 306, nil, 322, nil, 215, nil, - 215, 215, nil, 215, 215, nil, 215, nil, 215, nil, - 215, nil, 215, nil, nil, 215, 215, 322, 326, 322, - 322, nil, 322, 322, nil, 322, nil, 322, nil, 322, - nil, 322, nil, nil, 322, 322, nil, 365, nil, 326, - nil, 326, 326, nil, 326, 326, nil, 326, nil, 326, - nil, 326, nil, 326, nil, nil, 326, 326, 365, 375, - 365, 365, nil, 365, 365, nil, 365, nil, 365, nil, - 365, nil, 365, nil, nil, 365, 365, nil, 220, nil, - 375, nil, 375, 375, nil, 375, 375, nil, 375, nil, - 375, nil, 375, nil, 375, nil, nil, 375, 375, 220, - 377, 220, 220, nil, 220, 220, nil, 220, nil, 220, - nil, 220, nil, 220, nil, nil, 220, 220, nil, 381, - nil, 377, nil, 377, 377, nil, 377, 377, nil, 377, - nil, 377, nil, 377, nil, 377, nil, nil, 377, 377, - 381, 240, 381, 381, nil, 381, 381, nil, 381, nil, - 381, nil, 381, nil, 381, nil, nil, 381, 381, nil, - 383, nil, 240, nil, 240, 240, nil, 240, 240, nil, - 240, nil, 240, nil, 240, nil, 240, nil, nil, 240, - 240, 383, nil, 383, 383, nil, 383, 383, nil, 383, - nil, 383, nil, 383, nil, 383, nil, nil, 383, 383, - 19, nil, 19, 19, nil, 19, 19, nil, 19, nil, - 19, nil, 19, nil, 19, nil, nil, 19, 19, 0, - nil, 0, 0, nil, 0, 0, nil, 0, nil, 0, - nil, 0, nil, 0, nil, nil, 0, 0 ] + 180, 180, 152, 22, 243, 22, 55, 17, 86, 301, + 81, 165, 96, 180, 180, 178, 12, 301, 22, 165, + 12, 95, 180, 180, 180, 180, 86, 12, 178, 243, + 243, 55, 156, 174, 208, 208, 106, 106, 208, 215, + 208, 91, 22, 106, 152, 17, 180, 180, 17, 218, + 180, 180, 180, 180, 180, 180, 208, 180, 180, 176, + 176, 174, 174, 176, 180, 176, 62, 208, 17, 219, + 156, 208, 208, 156, 106, 208, 158, 62, 369, 369, + 208, 208, 62, 239, 208, 205, 205, 208, 220, 205, + 65, 205, 176, 156, 239, 208, 176, 176, 211, 239, + 176, 65, 224, 181, 181, 176, 65, 205, 273, 176, + 350, 369, 143, 350, 158, 369, 369, 158, 205, 369, + 176, 273, 205, 205, 369, 143, 205, 90, 369, 356, + 356, 205, 205, 344, 344, 205, 181, 158, 205, 369, + 181, 181, 221, 226, 181, 227, 205, 163, 181, 181, + 352, 352, 87, 181, 352, 221, 352, 120, 163, 229, + 309, 120, 356, 163, 181, 309, 356, 356, 120, 120, + 356, 85, 352, 231, 43, 356, 342, 342, 43, 356, + 342, 232, 342, 352, 122, 43, 43, 352, 352, 122, + 356, 352, 182, 182, 278, 278, 352, 352, 182, 195, + 352, 278, 195, 352, 297, 281, 281, 297, 233, 342, + 103, 352, 281, 342, 342, 280, 280, 342, 184, 184, + 280, 280, 342, 84, 30, 182, 342, 280, 30, 182, + 182, 105, 278, 182, 101, 30, 30, 342, 182, 204, + 204, 184, 182, 204, 80, 204, 1, 282, 282, 78, + 1, 184, 77, 182, 282, 184, 184, 1, 250, 184, + 252, 204, 253, 184, 184, 23, 23, 234, 184, 23, + 71, 234, 204, 7, 234, 70, 204, 204, 234, 184, + 204, 264, 7, 7, 269, 204, 204, 23, 68, 204, + 26, 26, 204, 107, 26, 275, 26, 67, 23, 66, + 204, 207, 23, 23, 160, 108, 23, 109, 160, 160, + 23, 23, 26, 298, 298, 23, 196, 196, 298, 298, + 196, 114, 196, 26, 115, 298, 23, 26, 26, 188, + 119, 26, 121, 188, 188, 64, 26, 26, 196, 127, + 26, 29, 29, 26, 52, 29, 51, 29, 50, 196, + 132, 26, 133, 196, 196, 171, 192, 196, 135, 171, + 171, 36, 196, 196, 136, 138, 196, 213, 213, 196, + 33, 213, 139, 213, 29, 140, 183, 196, 29, 29, + 183, 183, 29, 28, 28, 28, 28, 29, 316, 213, + 142, 29, 306, 306, 16, 328, 306, 329, 306, 331, + 213, 332, 29, 333, 213, 213, 338, 175, 213, 35, + 35, 35, 35, 213, 213, 173, 172, 213, 197, 197, + 213, 9, 197, 353, 197, 306, 8, 357, 213, 306, + 306, 144, 368, 306, 157, 370, 299, 299, 306, 3, + 197, 2, 306, 299, 34, 34, 34, 34, 153, 154, + nil, 197, nil, 306, nil, 197, 197, nil, nil, 197, + 4, 4, 4, 4, 197, 197, 39, 39, 197, 299, + 39, 197, 39, 299, 299, nil, nil, 299, nil, 197, + nil, nil, 299, nil, nil, nil, 299, nil, 39, nil, + nil, nil, 206, 206, nil, nil, 206, 299, 206, 39, + nil, nil, nil, 39, 39, nil, nil, 39, nil, nil, + nil, nil, 39, 39, 206, nil, 39, nil, nil, 39, + nil, nil, 46, 46, nil, 206, 46, 39, 46, 206, + 206, nil, nil, 206, nil, nil, nil, nil, 206, 206, + nil, nil, 206, nil, 46, 206, nil, nil, 47, 47, + nil, nil, 47, 206, 47, 46, nil, nil, nil, 46, + 46, nil, nil, 46, nil, nil, 270, 270, 46, 46, + 47, nil, 46, 48, 48, 46, nil, 48, nil, 48, + nil, 47, nil, 46, nil, 47, 47, 49, 49, 47, + nil, 49, nil, nil, 47, 47, nil, nil, 47, 270, + nil, 47, nil, 270, 270, nil, 48, 270, nil, 47, + 48, 48, 270, nil, 48, nil, 270, nil, nil, 48, + 49, nil, nil, 48, 49, 49, nil, 270, 49, nil, + nil, nil, nil, 49, 48, 203, 203, 49, nil, 203, + nil, 203, 294, 294, 294, 294, 294, 294, 49, 294, + 294, nil, 284, 284, 284, 284, 294, 203, nil, 284, + 284, 209, 209, nil, nil, 209, 284, 209, 203, nil, + nil, nil, 203, 203, nil, nil, 203, nil, nil, nil, + nil, 203, 203, 209, nil, 203, nil, nil, 203, nil, + nil, 210, 210, nil, 209, 210, 203, 210, 209, 209, + nil, nil, 209, nil, nil, nil, nil, 209, 209, nil, + nil, 209, nil, 210, 209, nil, nil, nil, nil, nil, + nil, nil, 209, nil, 210, nil, nil, nil, 210, 210, + 102, 102, 210, nil, 102, 102, 102, 210, 210, nil, + nil, 210, nil, nil, 210, nil, nil, nil, nil, 63, + 63, nil, 210, 63, nil, 63, 202, 202, nil, nil, + 202, nil, 202, 102, nil, nil, nil, 102, 102, nil, + nil, 102, nil, nil, nil, nil, 102, nil, 202, nil, + 102, nil, 63, nil, nil, nil, 63, 63, nil, 202, + 63, 102, nil, 202, 202, 63, nil, 202, nil, 63, + nil, nil, 202, 202, nil, nil, 202, 100, 100, 202, + 63, 100, nil, 100, nil, nil, nil, 202, nil, nil, + nil, nil, nil, nil, nil, nil, 277, 277, nil, 100, + 277, nil, 277, 198, 198, nil, nil, 198, nil, 198, + 100, nil, nil, nil, 100, 100, nil, nil, 100, nil, + nil, nil, nil, 100, 100, 198, nil, 100, nil, 277, + 100, nil, nil, 277, 277, nil, 198, 277, 100, nil, + 198, 198, 277, nil, 198, nil, 277, nil, nil, 198, + 198, nil, nil, 198, 256, 256, 198, 277, 256, nil, + 256, nil, nil, nil, 198, nil, nil, nil, nil, nil, + nil, nil, nil, 254, 254, nil, 256, nil, nil, 74, + 74, nil, nil, nil, nil, nil, nil, 256, nil, nil, + nil, 256, 256, nil, nil, 256, 254, nil, nil, nil, + 256, 256, 74, nil, 256, nil, 254, 256, nil, nil, + 254, 254, 74, nil, 254, 256, 74, 74, 254, 254, + 74, nil, nil, 254, 74, 74, 75, 75, nil, 74, + 75, nil, 75, nil, 254, nil, 286, 286, 286, 286, + 74, nil, nil, 286, 286, 248, 248, nil, 75, 248, + 286, 248, 245, 245, nil, nil, nil, nil, nil, 75, + nil, nil, nil, 75, 75, nil, nil, 75, nil, nil, + 244, 244, 75, 75, nil, nil, 75, nil, 248, 75, + nil, nil, 248, 248, nil, 245, 248, 75, nil, 245, + 245, 248, nil, 245, nil, 248, nil, nil, 245, nil, + nil, nil, 245, 244, nil, nil, 248, 244, 244, nil, + nil, 244, nil, 245, nil, nil, 244, 97, 97, nil, + 244, 97, nil, 97, nil, nil, nil, nil, nil, nil, + nil, 244, nil, nil, nil, nil, 82, 82, nil, 97, + 82, nil, 82, 199, 199, nil, nil, 199, nil, 199, + 97, nil, nil, nil, 97, 97, nil, nil, 97, nil, + nil, nil, nil, 97, 97, 214, 214, 97, nil, 82, + 97, nil, nil, 82, 82, nil, 199, 82, 97, nil, + 199, 199, 82, nil, 199, nil, 82, nil, nil, 199, + 230, 230, nil, 199, 230, nil, 230, 82, 214, nil, + nil, nil, 214, 214, 199, nil, 214, nil, 200, 200, + nil, 214, 200, nil, 200, 214, nil, nil, nil, nil, + nil, nil, nil, 230, nil, nil, 214, 230, 230, nil, + 200, 230, nil, 228, 228, nil, 230, 228, nil, 228, + 230, 200, nil, 225, 225, 200, 200, 225, nil, 200, + nil, 230, nil, nil, 200, 200, nil, nil, 200, nil, + nil, 200, nil, nil, nil, nil, 228, nil, nil, 200, + 228, 228, nil, nil, 228, nil, 225, nil, nil, 228, + 225, 225, nil, 228, 225, nil, 201, 201, nil, 225, + 201, nil, 201, 225, 228, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 225, 308, 308, nil, 201, 308, + nil, 308, 94, 94, nil, nil, 94, nil, 94, 201, + nil, nil, nil, 201, 201, nil, nil, 201, nil, nil, + nil, nil, 201, 201, 94, nil, 201, nil, 308, 201, + nil, nil, 308, 308, nil, 94, 308, 201, nil, 94, + 94, 308, nil, 94, nil, 308, nil, nil, 94, 94, + 111, nil, 94, nil, nil, 94, 308, nil, nil, 111, + 111, nil, nil, 94, nil, nil, nil, nil, 111, 111, + 111, 111, nil, nil, 186, 186, nil, nil, nil, nil, + nil, nil, 186, 186, 186, 186, 186, nil, nil, nil, + nil, nil, 111, 111, nil, nil, 111, 111, 111, 111, + 111, 111, nil, 111, 111, nil, nil, 186, 186, nil, + 111, 186, 186, 186, 186, 186, 186, nil, 186, 186, + 288, 288, nil, nil, nil, 186, nil, nil, nil, 288, + 288, 288, 288, nil, nil, 131, 131, nil, nil, nil, + nil, nil, nil, nil, 131, 131, 131, 131, nil, nil, + nil, nil, nil, nil, 288, nil, nil, 288, 288, 288, + 288, 288, 288, nil, 288, 288, nil, nil, 131, 131, + nil, 288, 131, 131, 131, 131, 131, 131, nil, 131, + 131, 130, 130, nil, nil, nil, 131, nil, nil, nil, + 130, 130, 130, 130, nil, nil, 292, 292, nil, nil, + nil, nil, nil, nil, nil, 292, 292, 292, 292, nil, + nil, nil, nil, nil, 130, 130, nil, nil, 130, 130, + 130, 130, 130, 130, nil, 130, 130, nil, nil, nil, + nil, nil, 130, 292, 292, 292, 292, 292, 292, nil, + 292, 292, 124, 124, nil, nil, nil, 292, nil, nil, + nil, 124, 124, 124, 124, nil, nil, nil, 293, nil, + 285, 285, 285, 285, 285, 285, 293, 285, 285, nil, + nil, nil, nil, nil, 285, 124, 124, 289, nil, 124, + 124, 124, 124, 124, 124, 289, 124, 124, nil, nil, + nil, nil, 287, 124, 293, 293, 293, 293, 293, 293, + 287, 293, 293, nil, nil, nil, nil, nil, 293, nil, + nil, 290, nil, 289, 289, 289, 289, 289, 289, 290, + 289, 289, nil, nil, nil, nil, nil, 289, 287, 287, + 287, 287, 287, 287, nil, 287, 287, nil, nil, 381, + nil, nil, 287, nil, nil, nil, nil, 290, 290, 290, + 290, 290, 290, nil, 290, 290, nil, nil, 212, nil, + 381, 290, 381, 381, nil, 381, 381, nil, 381, nil, + 381, nil, 381, nil, 381, nil, nil, 381, 381, 212, + 217, 212, 212, nil, 212, 212, nil, 212, nil, 212, + nil, 212, nil, 212, nil, nil, 212, 212, nil, 379, + nil, 217, nil, 217, 217, nil, 217, 217, nil, 217, + nil, 217, nil, 217, nil, 217, nil, nil, 217, 217, + 379, 237, 379, 379, nil, 379, 379, nil, 379, nil, + 379, nil, 379, nil, 379, nil, nil, 379, 379, nil, + 375, nil, 237, nil, 237, 237, nil, 237, 237, nil, + 237, nil, 237, nil, 237, nil, 237, nil, nil, 237, + 237, 375, 373, 375, 375, nil, 375, 375, nil, 375, + nil, 375, nil, 375, nil, 375, nil, nil, 375, 375, + nil, 363, nil, 373, nil, 373, 373, nil, 373, 373, + nil, 373, nil, 373, nil, 373, nil, 373, nil, nil, + 373, 373, 363, 296, 363, 363, nil, 363, 363, nil, + 363, nil, 363, nil, 363, nil, 363, nil, nil, 363, + 363, nil, 304, nil, 296, nil, 296, 296, nil, 296, + 296, nil, 296, nil, 296, nil, 296, nil, 296, nil, + nil, 296, 296, 304, 324, 304, 304, nil, 304, 304, + nil, 304, nil, 304, nil, 304, nil, 304, nil, nil, + 304, 304, nil, 320, nil, 324, nil, 324, 324, nil, + 324, 324, nil, 324, nil, 324, nil, 324, nil, 324, + nil, nil, 324, 324, 320, nil, 320, 320, nil, 320, + 320, nil, 320, nil, 320, nil, 320, nil, 320, nil, + nil, 320, 320, 19, nil, 19, 19, nil, 19, 19, + nil, 19, nil, 19, nil, 19, nil, 19, nil, nil, + 19, 19, 0, nil, 0, 0, nil, 0, 0, nil, + 0, nil, 0, nil, 0, nil, 0, nil, nil, 0, + 0 ] racc_action_pointer = [ - 1819, 198, 459, 427, 335, nil, nil, 235, 451, 446, - nil, nil, -20, nil, nil, nil, 423, 30, nil, 1800, - nil, nil, -3, 222, nil, nil, 265, nil, 413, 313, - 112, nil, nil, 408, 365, 348, 356, nil, nil, 433, - nil, nil, nil, 131, nil, nil, 489, 515, 540, 554, - 309, 323, 344, nil, nil, -6, nil, nil, nil, nil, - nil, nil, 42, 706, 261, 123, 273, 243, 241, 792, - nil, 257, 250, nil, nil, 865, 891, nil, 162, 159, - nil, 122, 26, 1241, nil, 16, 15, 2, -11, nil, - nil, 79, 195, nil, nil, 1185, 237, 278, 628, nil, - nil, 602, 286, 385, 301, nil, 302, 34, 304, 306, - 309, nil, 1269, nil, nil, 325, 327, nil, nil, nil, - 329, 145, 354, 149, nil, 1391, nil, nil, 375, nil, - nil, 1406, 1452, 377, 393, nil, 413, 409, nil, 461, - 463, 446, nil, 440, 4, 433, nil, nil, nil, nil, - nil, nil, nil, -9, 437, 385, nil, 5, 409, 74, - nil, 236, nil, nil, 59, nil, -9, nil, nil, nil, - nil, nil, 359, 396, 393, 11, 356, nil, 365, 57, - nil, 96, nil, -4, 192, 240, 209, 320, nil, 1284, - nil, 339, nil, nil, nil, 327, nil, nil, 224, 403, - 32, 658, 989, 1073, 840, 83, 174, 459, 999, 1215, - 195, 1159, 1129, 1103, 127, 1598, 1047, 973, 39, nil, - 1699, 54, 63, 83, 100, nil, nil, 134, 946, 115, - 148, 930, 126, 916, 146, 1, 196, 165, nil, nil, - 1762, nil, 66, nil, nil, nil, -21, 822, 771, nil, - nil, 778, nil, 263, nil, 264, 271, 753, nil, 727, - nil, nil, nil, nil, nil, nil, nil, 287, nil, nil, - nil, nil, 533, nil, nil, 117, nil, 303, nil, 684, - 159, nil, 234, 317, 191, nil, 557, 1002, 567, 1467, - 1345, 1501, 1486, nil, 1330, 1520, 1433, nil, 1557, 79, - 250, 355, nil, -1, nil, nil, 1576, nil, 334, nil, - 291, 214, nil, nil, nil, nil, nil, nil, 409, nil, - nil, nil, 1617, nil, nil, nil, 1639, nil, nil, nil, - 403, 411, nil, 417, 421, 422, nil, nil, nil, nil, - 438, nil, nil, nil, 167, nil, 122, nil, nil, nil, - nil, nil, 96, nil, 148, 448, nil, nil, 101, 452, - nil, nil, nil, nil, nil, 1658, nil, nil, nil, nil, - 455, 76, 461, nil, nil, 1680, nil, 1721, nil, nil, - nil, 1740, nil, 1781, nil, nil, nil ] + 1832, 210, 426, 395, 396, nil, nil, 267, 418, 413, + nil, nil, -20, nil, nil, nil, 394, 5, nil, 1813, + nil, nil, -3, 263, nil, nil, 288, nil, 319, 339, + 188, nil, nil, 368, 380, 345, 337, nil, nil, 464, + nil, nil, nil, 138, nil, nil, 520, 546, 571, 585, + 308, 322, 344, nil, nil, -6, nil, nil, nil, nil, + nil, nil, 42, 747, 295, 66, 291, 274, 265, nil, + 269, 264, nil, nil, 907, 954, nil, 240, 243, nil, + 221, -13, 1064, nil, 200, 165, 2, 129, nil, nil, + 104, 18, nil, nil, 1240, -2, 6, 1045, nil, nil, + 805, 211, 728, 187, nil, 208, 34, 270, 282, 284, + nil, 1282, nil, nil, 313, 316, nil, nil, nil, 318, + 121, 324, 149, nil, 1465, nil, nil, 333, nil, nil, + 1404, 1358, 343, 329, nil, 352, 323, nil, 342, 360, + 352, nil, 367, 101, 411, nil, nil, nil, nil, nil, + nil, nil, -9, 436, 412, nil, 30, 426, 74, nil, + 258, nil, nil, 123, nil, -7, nil, nil, nil, nil, + nil, 348, 404, 404, 11, 367, 57, nil, 3, nil, + -4, 101, 190, 369, 216, nil, 1297, nil, 322, nil, + nil, nil, 345, nil, nil, 190, 314, 416, 831, 1071, + 1136, 1214, 754, 633, 237, 83, 490, 238, 32, 659, + 689, 35, 1589, 365, 1093, 37, nil, 1611, 34, 44, + 73, 130, nil, nil, 93, 1171, 103, 136, 1161, 119, + 1118, 133, 172, 200, 231, nil, nil, 1652, nil, 59, + nil, nil, nil, -21, 998, 980, nil, nil, 973, nil, + 249, nil, 248, 255, 901, nil, 882, nil, nil, nil, + nil, nil, nil, nil, 270, nil, nil, nil, nil, 260, + 564, nil, nil, 96, nil, 288, nil, 824, 192, nil, + 159, 144, 186, nil, 598, 1446, 912, 1514, 1343, 1499, + 1533, nil, 1419, 1480, 588, nil, 1734, 173, 257, 434, + nil, -3, nil, nil, 1753, nil, 390, nil, 1233, 125, + nil, nil, nil, nil, nil, nil, 376, nil, nil, nil, + 1794, nil, nil, nil, 1775, nil, nil, nil, 372, 374, + nil, 376, 378, 380, nil, nil, nil, nil, 397, nil, + nil, nil, 174, nil, 122, nil, nil, nil, nil, nil, + 79, nil, 148, 415, nil, nil, 127, 419, nil, nil, + nil, nil, nil, 1712, nil, nil, nil, nil, 423, 76, + 426, nil, nil, 1693, nil, 1671, nil, nil, nil, 1630, + nil, 1570, nil, nil, nil ] racc_action_default = [ - -198, -235, -235, -51, -235, -8, -9, -235, -235, -22, - -10, -189, -190, -11, -187, -12, -235, -235, -13, -1, - -14, -2, -235, -188, -15, -3, -235, -16, -5, -235, - -235, -17, -6, -235, -18, -7, -198, -190, -188, -235, - -52, -26, -27, -235, -24, -25, -235, -235, -235, -86, - -93, -198, -235, -197, -195, -198, -191, -193, -194, -223, - -196, -4, -198, -235, -86, -198, -54, -233, -43, -235, - -176, -44, -215, -118, -33, -235, -235, -45, -31, -75, - -32, -235, -36, -235, -123, -38, -235, -74, -39, -173, - -73, -40, -41, -175, -42, -235, -104, -112, -235, -133, - -113, -235, -105, -235, -109, -111, -106, -235, -115, -107, - -114, -110, -235, -126, -108, -235, -235, -50, -177, -178, - -180, -235, -235, -199, -200, -84, -19, -22, -188, -21, - -23, -83, -85, -235, -76, -87, -82, -71, -75, -77, - -221, -80, -69, -78, -74, -235, -172, -171, -81, -79, - -91, -92, -94, -235, -221, -198, 387, -235, -235, -235, - -209, -235, -58, -215, -198, -60, -235, -67, -66, -57, - -74, -96, -235, -221, -235, -235, -93, -37, -74, -235, - -30, -235, -119, -235, -235, -235, -235, -235, -143, -235, - -150, -235, -218, -231, -227, -235, -230, -226, -235, -235, - -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, - -235, -235, -235, -235, -235, -235, -235, -235, -235, -20, - -235, -208, -235, -206, -235, -203, -232, -235, -72, -222, - -235, -235, -86, -235, -222, -235, -235, -235, -211, -192, - -235, -210, -235, -55, -63, -62, -235, -235, -235, -219, - -220, -235, -125, -235, -56, -221, -235, -235, -28, -235, - -121, -120, -35, -34, -174, -169, -167, -235, -170, -161, - -168, -162, -235, -124, -117, -235, -153, -220, -216, -235, - -235, -224, -138, -140, -139, -134, -141, -145, -142, -147, - -152, -149, -146, -135, -151, -148, -144, -136, -235, -129, - -137, -235, -155, -235, -159, -179, -235, -182, -235, -201, - -235, -235, -202, -46, -70, -88, -47, -89, -221, -90, - -95, -49, -235, -213, -212, -214, -235, -186, -59, -61, - -98, -99, -64, -103, -100, -101, -102, -65, -97, -48, - -235, -234, -29, -122, -235, -164, -221, -116, -217, -229, - -228, -225, -129, -128, -235, -235, -156, -154, -235, -235, - -181, -207, -205, -204, -68, -235, -184, -185, -53, -166, - -220, -235, -235, -127, -130, -235, -160, -235, -183, -165, - -163, -235, -132, -235, -158, -131, -157 ] + -197, -234, -234, -50, -234, -8, -9, -234, -234, -22, + -10, -188, -189, -11, -186, -12, -234, -234, -13, -1, + -14, -2, -234, -187, -15, -3, -234, -16, -5, -234, + -234, -17, -6, -234, -18, -7, -197, -189, -187, -234, + -51, -26, -27, -234, -24, -25, -234, -234, -234, -85, + -92, -197, -234, -196, -194, -197, -190, -192, -193, -222, + -195, -4, -197, -234, -85, -197, -53, -232, -42, -175, + -43, -214, -117, -33, -234, -234, -44, -31, -74, -32, + -234, -36, -234, -122, -37, -234, -73, -38, -172, -72, + -39, -40, -174, -41, -234, -103, -111, -234, -132, -112, + -234, -104, -234, -108, -110, -105, -234, -114, -106, -113, + -109, -234, -125, -107, -234, -234, -49, -176, -177, -179, + -234, -234, -198, -199, -83, -19, -22, -187, -21, -23, + -82, -84, -234, -75, -86, -81, -70, -74, -76, -220, + -79, -68, -77, -73, -234, -171, -170, -80, -78, -90, + -91, -93, -234, -220, -197, 385, -234, -234, -234, -208, + -234, -57, -214, -197, -59, -234, -66, -65, -56, -73, + -95, -234, -220, -234, -234, -92, -234, -30, -234, -118, + -234, -234, -234, -234, -234, -142, -234, -149, -234, -217, + -230, -226, -234, -229, -225, -234, -234, -234, -234, -234, + -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, + -234, -234, -234, -234, -234, -234, -20, -234, -207, -234, + -205, -234, -202, -231, -234, -71, -221, -234, -234, -85, + -234, -221, -234, -234, -234, -210, -191, -234, -209, -234, + -54, -62, -61, -234, -234, -234, -218, -219, -234, -124, + -234, -55, -220, -234, -234, -28, -234, -120, -119, -35, + -34, -173, -168, -166, -234, -169, -160, -167, -161, -73, + -234, -123, -116, -234, -152, -219, -215, -234, -234, -223, + -137, -139, -138, -133, -140, -144, -141, -146, -151, -148, + -145, -134, -150, -147, -143, -135, -234, -128, -136, -234, + -154, -234, -158, -178, -234, -181, -234, -200, -234, -234, + -201, -45, -69, -87, -46, -88, -220, -89, -94, -48, + -234, -212, -211, -213, -234, -185, -58, -60, -97, -98, + -63, -102, -99, -100, -101, -64, -96, -47, -234, -233, + -29, -121, -234, -163, -220, -115, -216, -228, -227, -224, + -128, -127, -234, -234, -155, -153, -234, -234, -180, -206, + -204, -203, -67, -234, -183, -184, -52, -165, -219, -234, + -234, -126, -129, -234, -159, -234, -182, -164, -162, -234, + -131, -234, -157, -130, -156 ] racc_goto_table = [ - 22, 9, 68, 113, 53, 177, 61, 36, 267, 271, - 225, 194, 230, 19, 2, 78, 154, 119, 51, 22, - 9, 56, 182, 140, 74, 150, 235, 21, 134, 142, - 116, 148, 161, 2, 117, 175, 126, 130, 173, 94, - 304, 353, 43, 22, 127, 253, 122, 129, 68, 302, - 172, 332, 337, 269, 68, 261, 137, 301, 371, 346, - 320, 155, 120, 124, 227, 149, 236, 181, 55, 158, - 186, 66, 121, 241, 222, 224, 74, 328, 124, 324, - 198, 16, 160, nil, 82, 94, 193, nil, nil, nil, - 191, 94, nil, nil, 373, 267, 345, nil, nil, nil, + 22, 9, 68, 112, 222, 264, 61, 36, 53, 179, + 268, 141, 70, 19, 2, 77, 191, 118, 51, 22, + 9, 139, 116, 21, 73, 91, 56, 147, 133, 149, + 115, 227, 153, 2, 300, 128, 172, 302, 135, 160, + 125, 129, 174, 22, 126, 232, 351, 43, 171, 299, + 260, 146, 369, 68, 121, 330, 335, 258, 266, 123, + 318, 344, 136, 70, 250, 119, 178, 183, 224, 154, + 233, 55, 157, 66, 123, 73, 91, 120, 159, 238, + 219, 221, 326, 322, 195, 190, 16, 188, nil, nil, + nil, nil, nil, 264, nil, nil, nil, nil, 343, 371, + nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 128, nil, nil, 88, nil, 216, 129, 354, + 22, 126, 302, 260, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 139, nil, nil, nil, 219, 130, nil, nil, nil, nil, - 263, 22, 127, 167, 304, 129, 167, 340, nil, nil, - 82, nil, nil, 356, 246, nil, 82, 115, nil, nil, - nil, nil, 255, nil, 53, nil, 53, nil, nil, nil, - nil, 150, nil, nil, nil, nil, 133, nil, nil, nil, - nil, 239, nil, 68, 265, nil, 68, nil, nil, nil, - nil, 171, nil, nil, nil, nil, nil, nil, nil, 275, - nil, 376, 238, nil, 350, 262, nil, nil, 74, nil, - 364, 171, nil, 263, 267, 379, 265, 293, 363, 264, - 94, 297, 305, 94, 315, 343, 318, 134, 314, 150, - 148, 171, nil, nil, nil, 22, 9, nil, 372, nil, - 22, 9, nil, nil, nil, 167, 330, 330, 298, 2, - nil, 264, nil, 306, 2, nil, 68, nil, nil, nil, - 22, 9, 91, 323, 149, 82, 266, nil, 82, 89, - nil, 265, nil, 326, 2, nil, nil, nil, 262, 193, - nil, 264, 264, 336, 336, 88, nil, nil, 146, nil, - nil, nil, nil, 94, nil, 89, nil, nil, 266, nil, - 265, nil, nil, nil, nil, 61, 264, 256, 91, 139, - nil, 143, nil, 61, 91, 89, nil, nil, 22, 9, - nil, 89, nil, 167, nil, nil, 22, 9, 331, 331, - 285, 88, 2, 61, nil, 264, nil, 88, 82, nil, - 2, nil, 22, 9, nil, nil, 22, 9, nil, nil, - nil, 374, nil, 266, nil, 365, 2, 265, nil, 317, - 2, 319, nil, nil, nil, nil, nil, 92, nil, nil, - 265, nil, 61, nil, nil, nil, nil, nil, nil, 338, - nil, nil, 266, nil, nil, 22, 9, nil, 61, nil, - 61, nil, 264, 147, nil, 22, 9, 22, 9, 2, - nil, 22, 9, 22, 9, 264, nil, 349, 381, 2, - 383, 2, nil, 92, nil, 2, nil, 2, 85, 92, - nil, nil, nil, 91, 146, 71, 91, nil, nil, nil, - 89, 89, nil, 89, nil, nil, 361, nil, 362, 266, - nil, nil, nil, nil, 141, nil, 88, 270, nil, 88, - nil, 136, 266, nil, nil, nil, 146, 168, nil, nil, - 168, nil, nil, 89, 85, nil, nil, 146, nil, nil, - 85, 71, 369, nil, 89, nil, nil, 71, nil, 270, - nil, nil, nil, nil, nil, nil, 335, 335, nil, nil, - 143, nil, nil, 89, 89, nil, 91, nil, nil, nil, - nil, nil, nil, 89, nil, nil, nil, nil, 125, 334, - 334, 146, nil, nil, nil, 131, 132, nil, 89, 88, - nil, nil, nil, nil, nil, nil, nil, nil, 92, 147, - nil, 92, nil, nil, 270, nil, nil, nil, nil, nil, - 146, nil, nil, nil, nil, 183, nil, 89, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 168, - nil, 147, nil, 270, 188, nil, nil, 189, nil, nil, - 190, nil, 147, nil, nil, nil, nil, nil, nil, 85, - 268, nil, 85, nil, nil, nil, 71, nil, nil, 71, - nil, 147, 147, nil, nil, nil, nil, 146, nil, nil, - nil, 92, nil, nil, 89, nil, nil, nil, nil, nil, - 146, nil, 268, nil, nil, nil, 147, 89, nil, nil, - 270, nil, nil, 141, nil, nil, nil, nil, nil, nil, - 136, nil, nil, 270, nil, nil, nil, 168, nil, nil, - nil, nil, 333, 333, nil, 147, nil, nil, nil, nil, - nil, nil, 85, nil, nil, nil, nil, nil, nil, 71, - nil, nil, nil, nil, nil, nil, nil, 268, 282, 283, - 284, nil, 286, 287, 288, 289, 290, 291, 292, nil, - 294, 295, 296, nil, nil, 300, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 268, nil, nil, nil, - nil, nil, 147, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 147, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 183, nil, + 243, 88, nil, nil, 338, nil, nil, 53, nil, 53, + nil, nil, nil, nil, 149, nil, nil, 252, nil, nil, + 68, 262, nil, 68, nil, 236, 88, nil, nil, nil, + 70, nil, nil, 70, nil, nil, 273, 235, nil, 374, + nil, nil, 259, 91, 146, 73, 91, 312, 348, nil, + 341, 361, 264, 262, 87, nil, 261, 377, 291, 303, + nil, 316, 295, 147, 133, 313, nil, nil, 362, nil, + 149, nil, 22, 9, 135, nil, 146, 22, 9, nil, + 142, nil, nil, 328, 328, 296, 2, 146, 261, nil, + 304, 2, nil, 68, nil, nil, 370, 22, 9, nil, + 321, nil, nil, 70, nil, 87, 146, 146, nil, 262, + 324, 2, nil, nil, nil, 259, 91, 190, 261, 261, + nil, 81, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 146, 88, 88, nil, 88, nil, 262, nil, + nil, nil, nil, 61, 261, nil, nil, 138, 84, nil, + nil, 61, nil, nil, nil, nil, 22, 9, nil, nil, + 166, 146, nil, 166, 22, 9, 88, nil, nil, nil, + 2, 61, 81, 261, 140, nil, nil, 88, 2, nil, + 22, 9, nil, nil, 22, 9, nil, 167, nil, 372, + 167, nil, nil, 363, 2, 262, 88, 88, 2, 84, + nil, 90, nil, nil, nil, nil, 88, nil, 262, nil, + 61, nil, 87, 267, nil, 87, nil, nil, 146, nil, + nil, nil, 88, 22, 9, nil, 61, 145, 61, nil, + 261, 146, nil, 22, 9, 22, 9, 2, 114, 22, + 9, 22, 9, 261, 93, 267, 379, 2, 381, 2, + nil, 88, 90, 2, nil, 2, 142, 132, nil, nil, + nil, 166, nil, nil, nil, nil, nil, nil, nil, nil, + 148, nil, 170, nil, nil, 332, 332, nil, nil, 81, + 263, nil, 81, nil, nil, 87, nil, nil, 167, nil, + nil, 170, nil, nil, nil, 93, nil, nil, nil, nil, + nil, 267, nil, nil, nil, nil, 84, 265, 88, 84, + nil, 170, 263, nil, nil, nil, nil, nil, nil, nil, + nil, 88, nil, 138, nil, nil, nil, nil, nil, nil, + 267, nil, nil, nil, nil, nil, nil, 166, 124, 265, + nil, nil, 329, 329, nil, 130, 131, nil, nil, nil, + 140, nil, 81, nil, nil, nil, nil, nil, nil, 90, + 145, nil, 90, nil, 167, nil, nil, nil, 263, 331, + 331, nil, nil, nil, 180, nil, nil, nil, nil, 84, + nil, nil, nil, nil, nil, 253, nil, 267, nil, nil, + nil, nil, 145, 185, nil, 265, 186, 263, nil, 187, + 267, nil, 93, 145, nil, 93, nil, nil, 283, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 333, 333, 265, nil, nil, nil, nil, nil, + nil, nil, 90, nil, nil, nil, nil, 315, nil, 317, + nil, nil, nil, nil, nil, nil, 148, nil, 145, nil, + nil, nil, nil, nil, 263, nil, nil, 336, nil, nil, + nil, nil, nil, nil, nil, 334, 334, 263, nil, nil, + nil, nil, nil, nil, nil, 93, nil, 145, nil, nil, + nil, 265, nil, nil, nil, nil, 347, nil, nil, nil, + nil, nil, nil, nil, 265, 280, 281, 282, nil, 284, + 285, 286, 287, 288, 289, 290, nil, 292, 293, 294, + nil, nil, 298, nil, nil, 359, nil, 360, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, 268, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 268 ] + nil, nil, nil, nil, 145, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, 145, nil, nil, + nil, 367, nil, nil, nil, 180 ] racc_goto_check = [ - 37, 21, 30, 62, 64, 23, 4, 32, 68, 70, - 82, 85, 36, 2, 52, 22, 38, 72, 32, 37, - 21, 78, 60, 35, 21, 53, 36, 3, 30, 47, - 37, 50, 41, 52, 5, 41, 19, 7, 35, 29, - 68, 63, 20, 37, 21, 36, 74, 5, 30, 66, - 57, 46, 46, 69, 30, 61, 33, 65, 58, 71, - 56, 74, 73, 3, 34, 29, 75, 22, 76, 77, - 57, 40, 20, 79, 80, 81, 21, 42, 3, 83, - 84, 1, 3, nil, 24, 29, 30, nil, nil, nil, - 57, 29, nil, nil, 63, 68, 70, nil, nil, nil, + 37, 21, 30, 62, 82, 68, 4, 32, 64, 60, + 70, 47, 31, 2, 52, 22, 85, 72, 32, 37, + 21, 35, 5, 3, 21, 28, 78, 50, 30, 53, + 37, 36, 38, 52, 66, 5, 35, 68, 31, 41, + 19, 7, 41, 37, 21, 36, 63, 20, 57, 65, + 23, 28, 58, 30, 74, 46, 46, 61, 69, 3, + 56, 71, 33, 31, 36, 73, 22, 57, 34, 74, + 75, 76, 77, 40, 3, 21, 28, 20, 3, 79, + 80, 81, 42, 83, 84, 30, 1, 57, nil, nil, + nil, nil, nil, 68, nil, nil, nil, nil, 70, 63, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 24, nil, nil, nil, 19, 7, nil, nil, nil, nil, - 23, 37, 21, 24, 68, 5, 24, 36, nil, nil, - 24, nil, nil, 66, 41, nil, 24, 54, nil, nil, - nil, nil, 38, nil, 64, nil, 64, nil, nil, nil, - nil, 53, nil, nil, nil, nil, 54, nil, nil, nil, - nil, 78, nil, 30, 30, nil, 30, nil, nil, nil, - nil, 54, nil, nil, nil, nil, nil, nil, nil, 22, - nil, 68, 3, nil, 85, 21, nil, nil, 21, nil, - 36, 54, nil, 23, 68, 70, 30, 64, 82, 52, - 29, 64, 72, 29, 53, 60, 35, 30, 47, 53, - 50, 54, nil, nil, nil, 37, 21, nil, 36, nil, - 37, 21, nil, nil, nil, 24, 30, 30, 2, 52, - nil, 52, nil, 2, 52, nil, 30, nil, nil, nil, - 37, 21, 27, 32, 29, 24, 24, nil, 24, 49, - nil, 30, nil, 2, 52, nil, nil, nil, 21, 30, - nil, 52, 52, 29, 29, 26, nil, nil, 27, nil, - nil, nil, nil, 29, nil, 49, nil, nil, 24, nil, - 30, nil, nil, nil, nil, 4, 52, 54, 27, 24, - nil, 26, nil, 4, 27, 49, nil, nil, 37, 21, - nil, 49, nil, 24, nil, nil, 37, 21, 24, 24, - 54, 26, 52, 4, nil, 52, nil, 26, 24, nil, - 52, nil, 37, 21, nil, nil, 37, 21, nil, nil, - nil, 62, nil, 24, nil, 2, 52, 30, nil, 54, - 52, 54, nil, nil, nil, nil, nil, 28, nil, nil, - 30, nil, 4, nil, nil, nil, nil, nil, nil, 54, - nil, nil, 24, nil, nil, 37, 21, nil, 4, nil, - 4, nil, 52, 28, nil, 37, 21, 37, 21, 52, - nil, 37, 21, 37, 21, 52, nil, 54, 2, 52, - 2, 52, nil, 28, nil, 52, nil, 52, 25, 28, - nil, nil, nil, 27, 27, 31, 27, nil, nil, nil, - 49, 49, nil, 49, nil, nil, 54, nil, 54, 24, - nil, nil, nil, nil, 25, nil, 26, 26, nil, 26, - nil, 31, 24, nil, nil, nil, 27, 25, nil, nil, - 25, nil, nil, 49, 25, nil, nil, 27, nil, nil, - 25, 31, 54, nil, 49, nil, nil, 31, nil, 26, - nil, nil, nil, nil, nil, nil, 27, 27, nil, nil, - 26, nil, nil, 49, 49, nil, 27, nil, nil, nil, - nil, nil, nil, 49, nil, nil, nil, nil, 51, 26, - 26, 27, nil, nil, nil, 51, 51, nil, 49, 26, - nil, nil, nil, nil, nil, nil, nil, nil, 28, 28, - nil, 28, nil, nil, 26, nil, nil, nil, nil, nil, - 27, nil, nil, nil, nil, 51, nil, 49, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 25, - nil, 28, nil, 26, 51, nil, nil, 51, nil, nil, - 51, nil, 28, nil, nil, nil, nil, nil, nil, 25, - 25, nil, 25, nil, nil, nil, 31, nil, nil, 31, - nil, 28, 28, nil, nil, nil, nil, 27, nil, nil, - nil, 28, nil, nil, 49, nil, nil, nil, nil, nil, - 27, nil, 25, nil, nil, nil, 28, 49, nil, nil, - 26, nil, nil, 25, nil, nil, nil, nil, nil, nil, - 31, nil, nil, 26, nil, nil, nil, 25, nil, nil, - nil, nil, 25, 25, nil, 28, nil, nil, nil, nil, - nil, nil, 25, nil, nil, nil, nil, nil, nil, 31, - nil, nil, nil, nil, nil, nil, nil, 25, 51, 51, - 51, nil, 51, 51, 51, 51, 51, 51, 51, nil, - 51, 51, 51, nil, nil, 51, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 25, nil, nil, nil, - nil, nil, 28, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 28, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 51, nil, + nil, nil, 5, nil, nil, 49, nil, 19, 7, 66, + 37, 21, 68, 23, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + 41, 49, nil, nil, 36, nil, nil, 64, nil, 64, + nil, nil, nil, nil, 53, nil, nil, 38, nil, nil, + 30, 30, nil, 30, nil, 78, 49, nil, nil, nil, + 31, nil, nil, 31, nil, nil, 22, 3, nil, 68, + nil, nil, 21, 28, 28, 21, 28, 47, 85, nil, + 60, 82, 68, 30, 26, nil, 52, 70, 64, 72, + nil, 35, 64, 50, 30, 53, nil, nil, 36, nil, + 53, nil, 37, 21, 31, nil, 28, 37, 21, nil, + 26, nil, nil, 30, 30, 2, 52, 28, 52, nil, + 2, 52, nil, 30, nil, nil, 36, 37, 21, nil, + 32, nil, nil, 31, nil, 26, 28, 28, nil, 30, + 2, 52, nil, nil, nil, 21, 28, 30, 52, 52, + nil, 24, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 28, 49, 49, nil, 49, nil, 30, nil, + nil, nil, nil, 4, 52, nil, nil, 24, 25, nil, + nil, 4, nil, nil, nil, nil, 37, 21, nil, nil, + 24, 28, nil, 24, 37, 21, 49, nil, nil, nil, + 52, 4, 24, 52, 25, nil, nil, 49, 52, nil, + 37, 21, nil, nil, 37, 21, nil, 25, nil, 62, + 25, nil, nil, 2, 52, 30, 49, 49, 52, 25, + nil, 27, nil, nil, nil, nil, 49, nil, 30, nil, + 4, nil, 26, 26, nil, 26, nil, nil, 28, nil, + nil, nil, 49, 37, 21, nil, 4, 27, 4, nil, + 52, 28, nil, 37, 21, 37, 21, 52, 54, 37, + 21, 37, 21, 52, 29, 26, 2, 52, 2, 52, + nil, 49, 27, 52, nil, 52, 26, 54, nil, nil, + nil, 24, nil, nil, nil, nil, nil, nil, nil, nil, + 29, nil, 54, nil, nil, 26, 26, nil, nil, 24, + 24, nil, 24, nil, nil, 26, nil, nil, 25, nil, + nil, 54, nil, nil, nil, 29, nil, nil, nil, nil, + nil, 26, nil, nil, nil, nil, 25, 25, 49, 25, + nil, 54, 24, nil, nil, nil, nil, nil, nil, nil, + nil, 49, nil, 24, nil, nil, nil, nil, nil, nil, + 26, nil, nil, nil, nil, nil, nil, 24, 51, 25, + nil, nil, 24, 24, nil, 51, 51, nil, nil, nil, + 25, nil, 24, nil, nil, nil, nil, nil, nil, 27, + 27, nil, 27, nil, 25, nil, nil, nil, 24, 25, + 25, nil, nil, nil, 51, nil, nil, nil, nil, 25, + nil, nil, nil, nil, nil, 54, nil, 26, nil, nil, + nil, nil, 27, 51, nil, 25, 51, 24, nil, 51, + 26, nil, 29, 27, nil, 29, nil, nil, 54, 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, nil, 25 ] + nil, nil, 27, 27, 25, nil, nil, nil, nil, nil, + nil, nil, 27, nil, nil, nil, nil, 54, nil, 54, + nil, nil, nil, nil, nil, nil, 29, nil, 27, nil, + nil, nil, nil, nil, 24, nil, nil, 54, nil, nil, + nil, nil, nil, nil, nil, 29, 29, 24, nil, nil, + nil, nil, nil, nil, nil, 29, nil, 27, nil, nil, + nil, 25, nil, nil, nil, nil, 54, nil, nil, nil, + nil, nil, nil, nil, 25, 51, 51, 51, nil, 51, + 51, 51, 51, 51, 51, 51, nil, 51, 51, 51, + nil, nil, 51, nil, nil, 54, nil, 54, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 27, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, 27, nil, nil, + nil, 54, nil, nil, nil, 51 ] racc_goto_pointer = [ - nil, 81, 13, 27, -13, 4, nil, -6, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, -7, - 38, 1, -8, -64, 61, 375, 242, 219, 324, 16, - -21, 382, 6, 7, -73, -26, -128, 0, -34, nil, - 49, -30, -165, nil, nil, nil, -196, -20, nil, 226, - -18, 449, 14, -25, 108, nil, -174, -13, -288, nil, - -54, -128, -23, -258, -13, -160, -168, nil, -177, -132, - -176, -213, -16, 29, 10, -89, 51, 14, 4, -86, - -49, -48, -113, -158, -27, -96, nil ] + nil, 86, 13, 23, -13, -8, nil, -2, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, -3, + 43, 1, -8, -131, 238, 265, 171, 318, 2, 361, + -21, -11, 6, 13, -68, -28, -108, 0, -18, nil, + 51, -23, -157, nil, nil, nil, -189, -38, nil, 92, + -22, 439, 14, -21, 349, nil, -171, -15, -292, nil, + -66, -123, -23, -251, -9, -165, -180, nil, -177, -124, + -172, -209, -16, 32, 18, -84, 54, 17, 9, -79, + -42, -41, -118, -151, -22, -90, nil ] racc_goto_default = [ - nil, nil, nil, 169, 25, 28, 32, 35, 5, 6, + nil, nil, nil, 168, 25, 28, 32, 35, 5, 6, 10, 13, 15, 18, 20, 24, 27, 31, 34, 4, - nil, 100, nil, 80, 102, 104, 106, 109, 110, 114, - 96, 97, 8, nil, nil, nil, nil, 86, nil, 30, - nil, nil, 162, 242, 165, 166, nil, nil, 145, 108, - 111, 112, 67, 135, 99, 151, 152, nil, 251, 105, - nil, nil, nil, nil, 70, nil, nil, 303, 81, nil, + nil, 99, nil, 79, 101, 103, 105, 108, 109, 113, + 95, 96, 8, nil, nil, nil, nil, 85, nil, 30, + nil, nil, 161, 239, 164, 165, nil, nil, 144, 107, + 110, 111, 67, 134, 98, 150, 151, nil, 248, 104, + nil, nil, nil, nil, 69, nil, nil, 301, 80, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 57, - nil, nil, nil, nil, nil, nil, 195 ] + nil, nil, nil, nil, nil, nil, 192 ] racc_reduce_table = [ 0, 0, :racc_error, @@ -709,7 +703,6 @@ racc_reduce_table = [ 3, 91, :_reduce_34, 3, 91, :_reduce_35, 1, 92, :_reduce_none, - 2, 92, :_reduce_37, 1, 92, :_reduce_none, 1, 92, :_reduce_none, 1, 92, :_reduce_none, @@ -717,37 +710,37 @@ racc_reduce_table = [ 1, 92, :_reduce_none, 1, 92, :_reduce_none, 1, 92, :_reduce_none, - 1, 92, :_reduce_45, + 1, 92, :_reduce_44, + 5, 74, :_reduce_45, 5, 74, :_reduce_46, 5, 74, :_reduce_47, - 5, 74, :_reduce_48, - 5, 85, :_reduce_49, - 2, 75, :_reduce_50, - 1, 108, :_reduce_51, - 2, 108, :_reduce_52, - 6, 76, :_reduce_53, - 2, 76, :_reduce_54, + 5, 85, :_reduce_48, + 2, 75, :_reduce_49, + 1, 108, :_reduce_50, + 2, 108, :_reduce_51, + 6, 76, :_reduce_52, + 2, 76, :_reduce_53, + 3, 109, :_reduce_54, 3, 109, :_reduce_55, - 3, 109, :_reduce_56, 1, 110, :_reduce_none, 1, 110, :_reduce_none, - 3, 110, :_reduce_59, + 3, 110, :_reduce_58, 1, 111, :_reduce_none, - 3, 111, :_reduce_61, + 3, 111, :_reduce_60, + 1, 112, :_reduce_61, 1, 112, :_reduce_62, - 1, 112, :_reduce_63, + 3, 113, :_reduce_63, 3, 113, :_reduce_64, - 3, 113, :_reduce_65, 1, 114, :_reduce_none, 1, 114, :_reduce_none, - 4, 116, :_reduce_68, + 4, 116, :_reduce_67, 1, 102, :_reduce_none, - 3, 102, :_reduce_70, + 3, 102, :_reduce_69, 0, 103, :_reduce_none, 1, 103, :_reduce_none, - 1, 118, :_reduce_73, - 1, 93, :_reduce_74, - 1, 95, :_reduce_75, + 1, 118, :_reduce_72, + 1, 93, :_reduce_73, + 1, 95, :_reduce_74, 1, 117, :_reduce_none, 1, 117, :_reduce_none, 1, 117, :_reduce_none, @@ -755,21 +748,21 @@ racc_reduce_table = [ 1, 117, :_reduce_none, 1, 117, :_reduce_none, 1, 117, :_reduce_none, + 3, 77, :_reduce_82, 3, 77, :_reduce_83, - 3, 77, :_reduce_84, - 3, 86, :_reduce_85, - 0, 104, :_reduce_86, - 1, 104, :_reduce_87, - 3, 104, :_reduce_88, - 3, 122, :_reduce_89, - 3, 124, :_reduce_90, + 3, 86, :_reduce_84, + 0, 104, :_reduce_85, + 1, 104, :_reduce_86, + 3, 104, :_reduce_87, + 3, 122, :_reduce_88, + 3, 124, :_reduce_89, 1, 125, :_reduce_none, 1, 125, :_reduce_none, - 0, 107, :_reduce_93, - 1, 107, :_reduce_94, - 3, 107, :_reduce_95, + 0, 107, :_reduce_92, + 1, 107, :_reduce_93, + 3, 107, :_reduce_94, 1, 126, :_reduce_none, - 3, 126, :_reduce_97, + 3, 126, :_reduce_96, 1, 115, :_reduce_none, 1, 115, :_reduce_none, 1, 115, :_reduce_none, @@ -788,24 +781,25 @@ racc_reduce_table = [ 1, 123, :_reduce_none, 1, 123, :_reduce_none, 1, 123, :_reduce_none, - 4, 97, :_reduce_116, - 3, 97, :_reduce_117, - 1, 99, :_reduce_118, - 2, 99, :_reduce_119, - 2, 129, :_reduce_120, - 1, 130, :_reduce_121, - 2, 130, :_reduce_122, - 1, 96, :_reduce_123, + 4, 97, :_reduce_115, + 3, 97, :_reduce_116, + 1, 99, :_reduce_117, + 2, 99, :_reduce_118, + 2, 129, :_reduce_119, + 1, 130, :_reduce_120, + 2, 130, :_reduce_121, + 1, 96, :_reduce_122, + 4, 90, :_reduce_123, 4, 90, :_reduce_124, - 4, 90, :_reduce_125, - 2, 79, :_reduce_126, - 5, 131, :_reduce_127, - 4, 131, :_reduce_128, + 2, 79, :_reduce_125, + 5, 131, :_reduce_126, + 4, 131, :_reduce_127, 0, 132, :_reduce_none, - 2, 132, :_reduce_130, - 4, 132, :_reduce_131, - 3, 132, :_reduce_132, + 2, 132, :_reduce_129, + 4, 132, :_reduce_130, + 3, 132, :_reduce_131, 1, 120, :_reduce_none, + 3, 120, :_reduce_133, 3, 120, :_reduce_134, 3, 120, :_reduce_135, 3, 120, :_reduce_136, @@ -814,31 +808,30 @@ racc_reduce_table = [ 3, 120, :_reduce_139, 3, 120, :_reduce_140, 3, 120, :_reduce_141, - 3, 120, :_reduce_142, - 2, 120, :_reduce_143, + 2, 120, :_reduce_142, + 3, 120, :_reduce_143, 3, 120, :_reduce_144, 3, 120, :_reduce_145, 3, 120, :_reduce_146, 3, 120, :_reduce_147, 3, 120, :_reduce_148, - 3, 120, :_reduce_149, - 2, 120, :_reduce_150, + 2, 120, :_reduce_149, + 3, 120, :_reduce_150, 3, 120, :_reduce_151, 3, 120, :_reduce_152, - 3, 120, :_reduce_153, - 5, 78, :_reduce_154, + 5, 78, :_reduce_153, 1, 134, :_reduce_none, - 2, 134, :_reduce_156, - 5, 135, :_reduce_157, - 4, 135, :_reduce_158, + 2, 134, :_reduce_155, + 5, 135, :_reduce_156, + 4, 135, :_reduce_157, 1, 136, :_reduce_none, - 3, 136, :_reduce_160, - 3, 98, :_reduce_161, + 3, 136, :_reduce_159, + 3, 98, :_reduce_160, 1, 138, :_reduce_none, - 4, 138, :_reduce_163, + 4, 138, :_reduce_162, 1, 140, :_reduce_none, - 3, 140, :_reduce_165, - 3, 139, :_reduce_166, + 3, 140, :_reduce_164, + 3, 139, :_reduce_165, 1, 137, :_reduce_none, 1, 137, :_reduce_none, 1, 137, :_reduce_none, @@ -847,70 +840,70 @@ racc_reduce_table = [ 1, 137, :_reduce_none, 1, 137, :_reduce_none, 1, 137, :_reduce_none, - 1, 137, :_reduce_175, + 1, 137, :_reduce_174, 1, 137, :_reduce_none, - 1, 141, :_reduce_177, + 1, 141, :_reduce_176, 1, 142, :_reduce_none, - 3, 142, :_reduce_179, - 2, 80, :_reduce_180, - 6, 82, :_reduce_181, - 5, 82, :_reduce_182, - 7, 83, :_reduce_183, - 6, 83, :_reduce_184, - 6, 84, :_reduce_185, - 5, 84, :_reduce_186, - 1, 106, :_reduce_187, + 3, 142, :_reduce_178, + 2, 80, :_reduce_179, + 6, 82, :_reduce_180, + 5, 82, :_reduce_181, + 7, 83, :_reduce_182, + 6, 83, :_reduce_183, + 6, 84, :_reduce_184, + 5, 84, :_reduce_185, + 1, 106, :_reduce_186, + 1, 101, :_reduce_187, 1, 101, :_reduce_188, 1, 101, :_reduce_189, - 1, 101, :_reduce_190, 1, 145, :_reduce_none, - 3, 145, :_reduce_192, - 1, 147, :_reduce_193, + 3, 145, :_reduce_191, + 1, 147, :_reduce_192, + 1, 148, :_reduce_193, 1, 148, :_reduce_194, 1, 148, :_reduce_195, - 1, 148, :_reduce_196, 1, 148, :_reduce_none, - 0, 72, :_reduce_198, - 0, 149, :_reduce_199, + 0, 72, :_reduce_197, + 0, 149, :_reduce_198, 1, 143, :_reduce_none, + 3, 143, :_reduce_200, 3, 143, :_reduce_201, - 3, 143, :_reduce_202, 1, 150, :_reduce_none, - 3, 150, :_reduce_204, - 3, 151, :_reduce_205, - 1, 151, :_reduce_206, - 3, 151, :_reduce_207, - 1, 151, :_reduce_208, + 3, 150, :_reduce_203, + 3, 151, :_reduce_204, + 1, 151, :_reduce_205, + 3, 151, :_reduce_206, + 1, 151, :_reduce_207, 1, 146, :_reduce_none, - 2, 146, :_reduce_210, + 2, 146, :_reduce_209, 1, 144, :_reduce_none, - 2, 144, :_reduce_212, + 2, 144, :_reduce_211, 1, 152, :_reduce_none, 1, 152, :_reduce_none, - 1, 94, :_reduce_215, - 3, 119, :_reduce_216, - 4, 119, :_reduce_217, - 2, 119, :_reduce_218, + 1, 94, :_reduce_214, + 3, 119, :_reduce_215, + 4, 119, :_reduce_216, + 2, 119, :_reduce_217, 1, 127, :_reduce_none, 1, 127, :_reduce_none, 0, 105, :_reduce_none, - 1, 105, :_reduce_222, - 1, 133, :_reduce_223, - 3, 128, :_reduce_224, - 4, 128, :_reduce_225, - 2, 128, :_reduce_226, + 1, 105, :_reduce_221, + 1, 133, :_reduce_222, + 3, 128, :_reduce_223, + 4, 128, :_reduce_224, + 2, 128, :_reduce_225, 1, 153, :_reduce_none, - 3, 153, :_reduce_228, - 3, 154, :_reduce_229, + 3, 153, :_reduce_227, + 3, 154, :_reduce_228, + 1, 155, :_reduce_229, 1, 155, :_reduce_230, - 1, 155, :_reduce_231, - 4, 121, :_reduce_232, + 4, 121, :_reduce_231, 1, 100, :_reduce_none, - 4, 100, :_reduce_234 ] + 4, 100, :_reduce_233 ] -racc_reduce_n = 235 +racc_reduce_n = 234 -racc_shift_n = 387 +racc_shift_n = 385 racc_token_table = { false => 0, @@ -1349,13 +1342,7 @@ module_eval(<<'.,.,', 'grammar.ra', 129) # reduce 36 omitted -module_eval(<<'.,.,', 'grammar.ra', 142) - def _reduce_37(val, _values, result) - result = ast AST::Minus, :value => val[1] - - result - end -.,., +# reduce 37 omitted # reduce 38 omitted @@ -1369,18 +1356,16 @@ module_eval(<<'.,.,', 'grammar.ra', 142) # reduce 43 omitted -# reduce 44 omitted - -module_eval(<<'.,.,', 'grammar.ra', 152) - def _reduce_45(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 149) + def _reduce_44(val, _values, result) result = ast AST::Name, :value => val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 156) - def _reduce_46(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 153) + def _reduce_45(val, _values, result) @lexer.commentpop array = val[2] array = [array] if array.instance_of?(AST::ResourceInstance) @@ -1404,8 +1389,8 @@ module_eval(<<'.,.,', 'grammar.ra', 156) end .,., -module_eval(<<'.,.,', 'grammar.ra', 175) - def _reduce_47(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 172) + def _reduce_46(val, _values, result) # This is a deprecated syntax. error "All resource specifications require names" @@ -1413,8 +1398,8 @@ module_eval(<<'.,.,', 'grammar.ra', 175) end .,., -module_eval(<<'.,.,', 'grammar.ra', 178) - def _reduce_48(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 175) + def _reduce_47(val, _values, result) # a defaults setting for a type @lexer.commentpop result = ast(AST::ResourceDefaults, :type => val[0], :parameters => val[2]) @@ -1423,8 +1408,8 @@ module_eval(<<'.,.,', 'grammar.ra', 178) end .,., -module_eval(<<'.,.,', 'grammar.ra', 185) - def _reduce_49(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 182) + def _reduce_48(val, _values, result) @lexer.commentpop result = ast AST::ResourceOverride, :object => val[0], :parameters => val[2] @@ -1432,8 +1417,8 @@ module_eval(<<'.,.,', 'grammar.ra', 185) end .,., -module_eval(<<'.,.,', 'grammar.ra', 192) - def _reduce_50(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 189) + def _reduce_49(val, _values, result) type = val[0] if (type == :exported and ! Puppet[:storeconfigs]) and ! Puppet[:parseonly] @@ -1459,22 +1444,22 @@ module_eval(<<'.,.,', 'grammar.ra', 192) end .,., -module_eval(<<'.,.,', 'grammar.ra', 214) - def _reduce_51(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 211) + def _reduce_50(val, _values, result) result = :virtual result end .,., -module_eval(<<'.,.,', 'grammar.ra', 215) - def _reduce_52(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 212) + def _reduce_51(val, _values, result) result = :exported result end .,., -module_eval(<<'.,.,', 'grammar.ra', 220) - def _reduce_53(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 217) + def _reduce_52(val, _values, result) @lexer.commentpop Puppet.warning addcontext("Collection names must now be capitalized") if val[0] =~ /^[a-z]/ type = val[0].downcase @@ -1497,8 +1482,8 @@ module_eval(<<'.,.,', 'grammar.ra', 220) end .,., -module_eval(<<'.,.,', 'grammar.ra', 239) - def _reduce_54(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 236) + def _reduce_53(val, _values, result) if val[0] =~ /^[a-z]/ Puppet.warning addcontext("Collection names must now be capitalized") end @@ -1521,8 +1506,8 @@ module_eval(<<'.,.,', 'grammar.ra', 239) end .,., -module_eval(<<'.,.,', 'grammar.ra', 260) - def _reduce_55(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 257) + def _reduce_54(val, _values, result) if val[1] result = val[1] result.form = :virtual @@ -1534,8 +1519,8 @@ module_eval(<<'.,.,', 'grammar.ra', 260) end .,., -module_eval(<<'.,.,', 'grammar.ra', 268) - def _reduce_56(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 265) + def _reduce_55(val, _values, result) if val[1] result = val[1] result.form = :exported @@ -1547,22 +1532,22 @@ module_eval(<<'.,.,', 'grammar.ra', 268) end .,., -# reduce 57 omitted +# reduce 56 omitted -# reduce 58 omitted +# reduce 57 omitted -module_eval(<<'.,.,', 'grammar.ra', 281) - def _reduce_59(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 278) + def _reduce_58(val, _values, result) result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2] result end .,., -# reduce 60 omitted +# reduce 59 omitted -module_eval(<<'.,.,', 'grammar.ra', 286) - def _reduce_61(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 283) + def _reduce_60(val, _values, result) result = val[1] result.parens = true @@ -1570,22 +1555,22 @@ module_eval(<<'.,.,', 'grammar.ra', 286) end .,., -module_eval(<<'.,.,', 'grammar.ra', 290) - def _reduce_62(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 287) + def _reduce_61(val, _values, result) result=val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 291) - def _reduce_63(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 288) + def _reduce_62(val, _values, result) result=val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 294) - def _reduce_64(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 291) + def _reduce_63(val, _values, result) result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2] #result = ast AST::CollExpr #result.push *val @@ -1594,8 +1579,8 @@ module_eval(<<'.,.,', 'grammar.ra', 294) end .,., -module_eval(<<'.,.,', 'grammar.ra', 299) - def _reduce_65(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 296) + 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 @@ -1604,22 +1589,22 @@ module_eval(<<'.,.,', 'grammar.ra', 299) end .,., -# reduce 66 omitted +# reduce 65 omitted -# reduce 67 omitted +# reduce 66 omitted -module_eval(<<'.,.,', 'grammar.ra', 308) - def _reduce_68(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 305) + def _reduce_67(val, _values, result) result = ast AST::ResourceInstance, :children => [val[0],val[2]] result end .,., -# reduce 69 omitted +# reduce 68 omitted -module_eval(<<'.,.,', 'grammar.ra', 313) - def _reduce_70(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 310) + def _reduce_69(val, _values, result) if val[0].instance_of?(AST::ResourceInstance) result = ast AST::ASTArray, :children => [val[0],val[2]] else @@ -1631,34 +1616,36 @@ module_eval(<<'.,.,', 'grammar.ra', 313) end .,., -# reduce 71 omitted +# reduce 70 omitted -# reduce 72 omitted +# reduce 71 omitted -module_eval(<<'.,.,', 'grammar.ra', 325) - def _reduce_73(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 322) + def _reduce_72(val, _values, result) result = ast AST::Undef, :value => :undef result end .,., -module_eval(<<'.,.,', 'grammar.ra', 329) - def _reduce_74(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 326) + def _reduce_73(val, _values, result) result = ast AST::Name, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 333) - def _reduce_75(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 330) + def _reduce_74(val, _values, result) result = ast AST::Type, :value => val[0][:value], :line => val[0][:line] result end .,., +# reduce 75 omitted + # reduce 76 omitted # reduce 77 omitted @@ -1671,10 +1658,8 @@ module_eval(<<'.,.,', 'grammar.ra', 333) # reduce 81 omitted -# reduce 82 omitted - -module_eval(<<'.,.,', 'grammar.ra', 345) - def _reduce_83(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 342) + def _reduce_82(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] @@ -1684,16 +1669,16 @@ module_eval(<<'.,.,', 'grammar.ra', 345) end .,., -module_eval(<<'.,.,', 'grammar.ra', 351) - def _reduce_84(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 348) + def _reduce_83(val, _values, result) result = ast AST::VarDef, :name => val[0], :value => val[2] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 355) - def _reduce_85(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 352) + def _reduce_84(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] @@ -1701,23 +1686,23 @@ module_eval(<<'.,.,', 'grammar.ra', 355) end .,., -module_eval(<<'.,.,', 'grammar.ra', 361) - def _reduce_86(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 358) + def _reduce_85(val, _values, result) result = ast AST::ASTArray result end .,., -module_eval(<<'.,.,', 'grammar.ra', 363) - def _reduce_87(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 360) + def _reduce_86(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 365) - def _reduce_88(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 362) + def _reduce_87(val, _values, result) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] @@ -1729,16 +1714,16 @@ module_eval(<<'.,.,', 'grammar.ra', 365) end .,., -module_eval(<<'.,.,', 'grammar.ra', 374) - def _reduce_89(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 371) + def _reduce_88(val, _values, result) result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 378) - def _reduce_90(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 375) + def _reduce_89(val, _values, result) result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2], :add => true @@ -1746,27 +1731,27 @@ module_eval(<<'.,.,', 'grammar.ra', 378) end .,., -# reduce 91 omitted +# reduce 90 omitted -# reduce 92 omitted +# reduce 91 omitted -module_eval(<<'.,.,', 'grammar.ra', 387) - def _reduce_93(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 384) + def _reduce_92(val, _values, result) result = ast AST::ASTArray result end .,., -module_eval(<<'.,.,', 'grammar.ra', 389) - def _reduce_94(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 386) + def _reduce_93(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 391) - def _reduce_95(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 388) + def _reduce_94(val, _values, result) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] @@ -1778,10 +1763,10 @@ module_eval(<<'.,.,', 'grammar.ra', 391) end .,., -# reduce 96 omitted +# reduce 95 omitted -module_eval(<<'.,.,', 'grammar.ra', 401) - def _reduce_97(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 398) + def _reduce_96(val, _values, result) if val[0].instance_of?(AST::ASTArray) result = val[0].push(val[2]) else @@ -1792,6 +1777,8 @@ module_eval(<<'.,.,', 'grammar.ra', 401) end .,., +# reduce 97 omitted + # reduce 98 omitted # reduce 99 omitted @@ -1826,10 +1813,8 @@ module_eval(<<'.,.,', 'grammar.ra', 401) # reduce 114 omitted -# reduce 115 omitted - -module_eval(<<'.,.,', 'grammar.ra', 430) - def _reduce_116(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 427) + def _reduce_115(val, _values, result) args = aryfy(val[2]) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], @@ -1840,8 +1825,8 @@ module_eval(<<'.,.,', 'grammar.ra', 430) end .,., -module_eval(<<'.,.,', 'grammar.ra', 436) - def _reduce_117(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 433) + def _reduce_116(val, _values, result) result = ast AST::Function, :name => val[0][:value], :line => val[0][:line], :arguments => AST::ASTArray.new({}), @@ -1851,51 +1836,51 @@ module_eval(<<'.,.,', 'grammar.ra', 436) end .,., -module_eval(<<'.,.,', 'grammar.ra', 442) - def _reduce_118(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 439) + def _reduce_117(val, _values, result) result = ast AST::String, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 443) - def _reduce_119(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 440) + def _reduce_118(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', 445) - def _reduce_120(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 442) + def _reduce_119(val, _values, result) result = [val[0]] + val[1] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 447) - def _reduce_121(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 444) + def _reduce_120(val, _values, result) result = [ast(AST::String,val[0])] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 448) - def _reduce_122(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 445) + def _reduce_121(val, _values, result) result = [ast(AST::String,val[0])] + val[1] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 451) - def _reduce_123(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 448) + def _reduce_122(val, _values, result) result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 455) - def _reduce_124(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 452) + def _reduce_123(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] @@ -1903,24 +1888,24 @@ module_eval(<<'.,.,', 'grammar.ra', 455) end .,., -module_eval(<<'.,.,', 'grammar.ra', 458) - def _reduce_125(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 455) + def _reduce_124(val, _values, result) result = ast AST::ResourceReference, :type => val[0], :title => val[2] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 462) - def _reduce_126(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 459) + def _reduce_125(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 466) - def _reduce_127(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 463) + def _reduce_126(val, _values, result) @lexer.commentpop args = { :test => val[0], @@ -1935,8 +1920,8 @@ module_eval(<<'.,.,', 'grammar.ra', 466) end .,., -module_eval(<<'.,.,', 'grammar.ra', 477) - def _reduce_128(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 474) + def _reduce_127(val, _values, result) @lexer.commentpop args = { :test => val[0], @@ -1951,18 +1936,18 @@ module_eval(<<'.,.,', 'grammar.ra', 477) end .,., -# reduce 129 omitted +# reduce 128 omitted -module_eval(<<'.,.,', 'grammar.ra', 490) - def _reduce_130(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 487) + def _reduce_129(val, _values, result) result = ast AST::Else, :statements => val[1] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 493) - def _reduce_131(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 490) + def _reduce_130(val, _values, result) @lexer.commentpop result = ast AST::Else, :statements => val[2] @@ -1970,8 +1955,8 @@ module_eval(<<'.,.,', 'grammar.ra', 493) end .,., -module_eval(<<'.,.,', 'grammar.ra', 497) - def _reduce_132(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 494) + def _reduce_131(val, _values, result) @lexer.commentpop result = ast AST::Else, :statements => ast(AST::Nop) @@ -1979,11 +1964,19 @@ module_eval(<<'.,.,', 'grammar.ra', 497) end .,., -# reduce 133 omitted +# reduce 132 omitted + +module_eval(<<'.,.,', 'grammar.ra', 512) + def _reduce_133(val, _values, result) + result = ast AST::InOperator, :lval => val[0], :rval => val[2] + + result + end +.,., module_eval(<<'.,.,', 'grammar.ra', 515) def _reduce_134(val, _values, result) - result = ast AST::InOperator, :lval => val[0], :rval => val[2] + result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end @@ -1999,7 +1992,7 @@ module_eval(<<'.,.,', 'grammar.ra', 518) module_eval(<<'.,.,', 'grammar.ra', 521) def _reduce_136(val, _values, result) - result = ast AST::MatchOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end @@ -2047,7 +2040,7 @@ module_eval(<<'.,.,', 'grammar.ra', 536) module_eval(<<'.,.,', 'grammar.ra', 539) def _reduce_142(val, _values, result) - result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] + result = ast AST::Minus, :value => val[1] result end @@ -2055,7 +2048,7 @@ module_eval(<<'.,.,', 'grammar.ra', 539) module_eval(<<'.,.,', 'grammar.ra', 542) def _reduce_143(val, _values, result) - result = ast AST::Minus, :value => val[1] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end @@ -2103,7 +2096,7 @@ module_eval(<<'.,.,', 'grammar.ra', 557) module_eval(<<'.,.,', 'grammar.ra', 560) def _reduce_149(val, _values, result) - result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] + result = ast AST::Not, :value => val[1] result end @@ -2111,7 +2104,7 @@ module_eval(<<'.,.,', 'grammar.ra', 560) module_eval(<<'.,.,', 'grammar.ra', 563) def _reduce_150(val, _values, result) - result = ast AST::Not, :value => val[1] + result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end @@ -2127,22 +2120,14 @@ module_eval(<<'.,.,', 'grammar.ra', 566) module_eval(<<'.,.,', 'grammar.ra', 569) 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', 572) - def _reduce_153(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 576) - def _reduce_154(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 573) + def _reduce_153(val, _values, result) @lexer.commentpop options = val[3] options = ast AST::ASTArray, :children => [val[3]] unless options.instance_of?(AST::ASTArray) @@ -2152,10 +2137,10 @@ module_eval(<<'.,.,', 'grammar.ra', 576) end .,., -# reduce 155 omitted +# reduce 154 omitted -module_eval(<<'.,.,', 'grammar.ra', 584) - def _reduce_156(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 581) + def _reduce_155(val, _values, result) if val[0].instance_of?(AST::ASTArray) val[0].push val[1] result = val[0] @@ -2167,8 +2152,8 @@ module_eval(<<'.,.,', 'grammar.ra', 584) end .,., -module_eval(<<'.,.,', 'grammar.ra', 593) - def _reduce_157(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 590) + def _reduce_156(val, _values, result) @lexer.commentpop result = ast AST::CaseOpt, :value => val[0], :statements => val[3] @@ -2176,8 +2161,8 @@ module_eval(<<'.,.,', 'grammar.ra', 593) end .,., -module_eval(<<'.,.,', 'grammar.ra', 596) - def _reduce_158(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 593) + def _reduce_157(val, _values, result) @lexer.commentpop result = ast( @@ -2191,10 +2176,10 @@ module_eval(<<'.,.,', 'grammar.ra', 596) end .,., -# reduce 159 omitted +# reduce 158 omitted -module_eval(<<'.,.,', 'grammar.ra', 608) - def _reduce_160(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 605) + def _reduce_159(val, _values, result) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] @@ -2206,18 +2191,18 @@ module_eval(<<'.,.,', 'grammar.ra', 608) end .,., -module_eval(<<'.,.,', 'grammar.ra', 617) - def _reduce_161(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 614) + def _reduce_160(val, _values, result) result = ast AST::Selector, :param => val[0], :values => val[2] result end .,., -# reduce 162 omitted +# reduce 161 omitted -module_eval(<<'.,.,', 'grammar.ra', 622) - def _reduce_163(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 619) + def _reduce_162(val, _values, result) @lexer.commentpop result = val[1] @@ -2225,10 +2210,10 @@ module_eval(<<'.,.,', 'grammar.ra', 622) end .,., -# reduce 164 omitted +# reduce 163 omitted -module_eval(<<'.,.,', 'grammar.ra', 628) - def _reduce_165(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 625) + def _reduce_164(val, _values, result) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] @@ -2240,14 +2225,16 @@ module_eval(<<'.,.,', 'grammar.ra', 628) end .,., -module_eval(<<'.,.,', 'grammar.ra', 637) - def _reduce_166(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 634) + def _reduce_165(val, _values, result) result = ast AST::ResourceParam, :param => val[0], :value => val[2] result end .,., +# reduce 166 omitted + # reduce 167 omitted # reduce 168 omitted @@ -2262,36 +2249,34 @@ module_eval(<<'.,.,', 'grammar.ra', 637) # reduce 173 omitted -# reduce 174 omitted - -module_eval(<<'.,.,', 'grammar.ra', 649) - def _reduce_175(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 646) + def _reduce_174(val, _values, result) result = ast AST::Default, :value => val[0][:value], :line => val[0][:line] result end .,., -# reduce 176 omitted +# reduce 175 omitted -module_eval(<<'.,.,', 'grammar.ra', 654) - def _reduce_177(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 651) + def _reduce_176(val, _values, result) result = [val[0][:value]] result end .,., -# reduce 178 omitted +# reduce 177 omitted -module_eval(<<'.,.,', 'grammar.ra', 656) - def _reduce_179(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 653) + def _reduce_178(val, _values, result) result = val[0] += val[2] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 659) - def _reduce_180(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 656) + def _reduce_179(val, _values, result) val[1].each do |file| import(file) end @@ -2302,8 +2287,8 @@ module_eval(<<'.,.,', 'grammar.ra', 659) end .,., -module_eval(<<'.,.,', 'grammar.ra', 669) - def _reduce_181(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 666) + def _reduce_180(val, _values, result) @lexer.commentpop newdefine classname(val[1]), :arguments => val[2], :code => val[4], :line => val[0][:line] @lexer.indefine = false @@ -2315,8 +2300,8 @@ module_eval(<<'.,.,', 'grammar.ra', 669) end .,., -module_eval(<<'.,.,', 'grammar.ra', 676) - def _reduce_182(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 673) + def _reduce_181(val, _values, result) @lexer.commentpop newdefine classname(val[1]), :arguments => val[2], :line => val[0][:line] @lexer.indefine = false @@ -2326,8 +2311,8 @@ module_eval(<<'.,.,', 'grammar.ra', 676) end .,., -module_eval(<<'.,.,', 'grammar.ra', 684) - def _reduce_183(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 681) + def _reduce_182(val, _values, result) @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop @@ -2338,8 +2323,8 @@ module_eval(<<'.,.,', 'grammar.ra', 684) end .,., -module_eval(<<'.,.,', 'grammar.ra', 690) - def _reduce_184(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 687) + def _reduce_183(val, _values, result) @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop @@ -2350,8 +2335,8 @@ module_eval(<<'.,.,', 'grammar.ra', 690) end .,., -module_eval(<<'.,.,', 'grammar.ra', 698) - def _reduce_185(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 695) + def _reduce_184(val, _values, result) @lexer.commentpop newnode val[1], :parent => val[2], :code => val[4], :line => val[0][:line] result = nil @@ -2360,8 +2345,8 @@ module_eval(<<'.,.,', 'grammar.ra', 698) end .,., -module_eval(<<'.,.,', 'grammar.ra', 702) - def _reduce_186(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 699) + def _reduce_185(val, _values, result) @lexer.commentpop newnode val[1], :parent => val[2], :line => val[0][:line] result = nil @@ -2370,38 +2355,38 @@ module_eval(<<'.,.,', 'grammar.ra', 702) end .,., -module_eval(<<'.,.,', 'grammar.ra', 707) - def _reduce_187(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 704) + def _reduce_186(val, _values, result) result = val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 709) - def _reduce_188(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 706) + def _reduce_187(val, _values, result) result = val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 710) - def _reduce_189(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 707) + def _reduce_188(val, _values, result) result = val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 711) - def _reduce_190(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 708) + def _reduce_189(val, _values, result) result = "class" result end .,., -# reduce 191 omitted +# reduce 190 omitted -module_eval(<<'.,.,', 'grammar.ra', 717) - def _reduce_192(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 714) + def _reduce_191(val, _values, result) result = val[0] result = [result] unless result.is_a?(Array) result << val[2] @@ -2410,65 +2395,65 @@ module_eval(<<'.,.,', 'grammar.ra', 717) end .,., -module_eval(<<'.,.,', 'grammar.ra', 723) - def _reduce_193(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 720) + def _reduce_192(val, _values, result) result = ast AST::HostName, :value => val[0] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 726) - def _reduce_194(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 723) + def _reduce_193(val, _values, result) result = val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 727) - def _reduce_195(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 724) + def _reduce_194(val, _values, result) result = val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 728) - def _reduce_196(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 725) + def _reduce_195(val, _values, result) result = val[0][:value] result end .,., -# reduce 197 omitted +# reduce 196 omitted -module_eval(<<'.,.,', 'grammar.ra', 732) - def _reduce_198(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 729) + def _reduce_197(val, _values, result) result = nil result end .,., -module_eval(<<'.,.,', 'grammar.ra', 736) - def _reduce_199(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 733) + def _reduce_198(val, _values, result) result = ast AST::ASTArray, :children => [] result end .,., -# reduce 200 omitted +# reduce 199 omitted -module_eval(<<'.,.,', 'grammar.ra', 741) - def _reduce_201(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 738) + def _reduce_200(val, _values, result) result = nil result end .,., -module_eval(<<'.,.,', 'grammar.ra', 744) - def _reduce_202(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 741) + def _reduce_201(val, _values, result) result = val[1] result = [result] unless result[0].is_a?(Array) @@ -2476,10 +2461,10 @@ module_eval(<<'.,.,', 'grammar.ra', 744) end .,., -# reduce 203 omitted +# reduce 202 omitted -module_eval(<<'.,.,', 'grammar.ra', 750) - def _reduce_204(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 747) + def _reduce_203(val, _values, result) result = val[0] result = [result] unless result[0].is_a?(Array) result << val[2] @@ -2488,8 +2473,8 @@ module_eval(<<'.,.,', 'grammar.ra', 750) end .,., -module_eval(<<'.,.,', 'grammar.ra', 756) - def _reduce_205(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 753) + def _reduce_204(val, _values, result) Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") result = [val[0][:value], val[2]] @@ -2497,8 +2482,8 @@ module_eval(<<'.,.,', 'grammar.ra', 756) end .,., -module_eval(<<'.,.,', 'grammar.ra', 760) - def _reduce_206(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 757) + def _reduce_205(val, _values, result) Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") result = [val[0][:value]] @@ -2506,56 +2491,56 @@ module_eval(<<'.,.,', 'grammar.ra', 760) end .,., -module_eval(<<'.,.,', 'grammar.ra', 763) - def _reduce_207(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 760) + def _reduce_206(val, _values, result) result = [val[0][:value], val[2]] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 765) - def _reduce_208(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 762) + def _reduce_207(val, _values, result) result = [val[0][:value]] result end .,., -# reduce 209 omitted +# reduce 208 omitted -module_eval(<<'.,.,', 'grammar.ra', 770) - def _reduce_210(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 767) + def _reduce_209(val, _values, result) result = val[1] result end .,., -# reduce 211 omitted +# reduce 210 omitted -module_eval(<<'.,.,', 'grammar.ra', 775) - def _reduce_212(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 772) + def _reduce_211(val, _values, result) result = val[1] result end .,., -# reduce 213 omitted +# reduce 212 omitted -# reduce 214 omitted +# reduce 213 omitted -module_eval(<<'.,.,', 'grammar.ra', 781) - def _reduce_215(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 778) + def _reduce_214(val, _values, result) result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 785) - def _reduce_216(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 782) + def _reduce_215(val, _values, result) if val[1].instance_of?(AST::ASTArray) result = val[1] else @@ -2566,8 +2551,8 @@ module_eval(<<'.,.,', 'grammar.ra', 785) end .,., -module_eval(<<'.,.,', 'grammar.ra', 792) - def _reduce_217(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 789) + def _reduce_216(val, _values, result) if val[1].instance_of?(AST::ASTArray) result = val[1] else @@ -2578,37 +2563,37 @@ module_eval(<<'.,.,', 'grammar.ra', 792) end .,., -module_eval(<<'.,.,', 'grammar.ra', 798) - def _reduce_218(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 795) + def _reduce_217(val, _values, result) result = ast AST::ASTArray result end .,., +# reduce 218 omitted + # reduce 219 omitted # reduce 220 omitted -# reduce 221 omitted - -module_eval(<<'.,.,', 'grammar.ra', 805) - def _reduce_222(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 802) + def _reduce_221(val, _values, result) result = nil result end .,., -module_eval(<<'.,.,', 'grammar.ra', 808) - def _reduce_223(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 805) + def _reduce_222(val, _values, result) result = ast AST::Regex, :value => val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 812) - def _reduce_224(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 809) + def _reduce_223(val, _values, result) if val[1].instance_of?(AST::ASTHash) result = val[1] else @@ -2619,8 +2604,8 @@ module_eval(<<'.,.,', 'grammar.ra', 812) end .,., -module_eval(<<'.,.,', 'grammar.ra', 819) - def _reduce_225(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 816) + def _reduce_224(val, _values, result) if val[1].instance_of?(AST::ASTHash) result = val[1] else @@ -2631,18 +2616,18 @@ module_eval(<<'.,.,', 'grammar.ra', 819) end .,., -module_eval(<<'.,.,', 'grammar.ra', 825) - def _reduce_226(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 822) + def _reduce_225(val, _values, result) result = ast AST::ASTHash result end .,., -# reduce 227 omitted +# reduce 226 omitted -module_eval(<<'.,.,', 'grammar.ra', 830) - def _reduce_228(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 827) + def _reduce_227(val, _values, result) if val[0].instance_of?(AST::ASTHash) result = val[0].merge(val[2]) else @@ -2654,40 +2639,40 @@ module_eval(<<'.,.,', 'grammar.ra', 830) end .,., -module_eval(<<'.,.,', 'grammar.ra', 839) - def _reduce_229(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 836) + def _reduce_228(val, _values, result) result = ast AST::ASTHash, { :value => { val[0] => val[2] } } result end .,., -module_eval(<<'.,.,', 'grammar.ra', 842) - def _reduce_230(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 839) + def _reduce_229(val, _values, result) result = val[0][:value] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 843) - def _reduce_231(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 840) + def _reduce_230(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.ra', 846) - def _reduce_232(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 843) + def _reduce_231(val, _values, result) result = ast AST::HashOrArrayAccess, :variable => val[0][:value], :key => val[2] result end .,., -# reduce 233 omitted +# reduce 232 omitted -module_eval(<<'.,.,', 'grammar.ra', 851) - def _reduce_234(val, _values, result) +module_eval(<<'.,.,', 'grammar.ra', 848) + def _reduce_233(val, _values, result) result = ast AST::HashOrArrayAccess, :variable => val[0], :key => val[2] result diff --git a/spec/integration/parser/parser_spec.rb b/spec/integration/parser/parser_spec.rb index 000e68dd8..20d87c228 100755 --- a/spec/integration/parser/parser_spec.rb +++ b/spec/integration/parser/parser_spec.rb @@ -116,18 +116,5 @@ describe Puppet::Parser::Parser do $out = $hash['a']['b']['c'] }.should parse_with { |v| v.value.is_a?(Puppet::Parser::AST::ASTHash) } end - - it "should be able to pass numbers to functions" do - %q{ - my_function(1) - }.should parse_as(Puppet::Parser::AST::Function) - end - - it "should be able to pass negative numbers to functions" do - %q{ - my_function(-1) - }.should parse_as(Puppet::Parser::AST::Function) - end - end end -- cgit From dcce45cfcbf77d576237ae8ff0ffa6ef98dcb722 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 21 Feb 2011 12:50:53 -0800 Subject: (#6353) Restore the ability to store paths in the filebucket Commit 2274d5104f6e413a2b8899a3c3111a17bbb2f4d7 optimized network usage for the case where a file is already in the filebucket. However, it took away the ability to store paths. This change restores the ability to store paths while maintaining optimal network usage for the case where the file is already in the filebucket with the given path. This is expected to be the most common case. Paired-with: Jesse Wolfe --- lib/puppet/file_bucket/dipper.rb | 5 +- lib/puppet/indirector/file_bucket_file/file.rb | 55 ++++++++--- spec/unit/file_bucket/dipper_spec.rb | 2 +- spec/unit/file_bucket/file_spec.rb | 35 ------- spec/unit/indirector/file_bucket_file/file_spec.rb | 109 +++++++++++++++++++-- 5 files changed, 145 insertions(+), 61 deletions(-) diff --git a/lib/puppet/file_bucket/dipper.rb b/lib/puppet/file_bucket/dipper.rb index f4bef28a8..de4c01b78 100644 --- a/lib/puppet/file_bucket/dipper.rb +++ b/lib/puppet/file_bucket/dipper.rb @@ -34,11 +34,12 @@ class Puppet::FileBucket::Dipper contents = ::File.read(file) begin file_bucket_file = Puppet::FileBucket::File.new(contents, :bucket_path => @local_path) - dest_path = "#{@rest_path}#{file_bucket_file.name}" + files_original_path = absolutize_path(file) + dest_path = "#{@rest_path}#{file_bucket_file.name}#{files_original_path}" # Make a HEAD request for the file so that we don't waste time # uploading it if it already exists in the bucket. - unless Puppet::FileBucket::File.head("#{@rest_path}#{file_bucket_file.checksum_type}/#{file_bucket_file.checksum_data}") + unless Puppet::FileBucket::File.head("#{@rest_path}#{file_bucket_file.checksum_type}/#{file_bucket_file.checksum_data}#{files_original_path}") file_bucket_file.save(dest_path) end diff --git a/lib/puppet/indirector/file_bucket_file/file.rb b/lib/puppet/indirector/file_bucket_file/file.rb index 8bea2d767..0fd8a914f 100644 --- a/lib/puppet/indirector/file_bucket_file/file.rb +++ b/lib/puppet/indirector/file_bucket_file/file.rb @@ -14,10 +14,12 @@ module Puppet::FileBucketFile end def find( request ) - checksum = request_to_checksum( request ) - file_path = path_for(request.options[:bucket_path], checksum, 'contents') + checksum, files_original_path = request_to_checksum_and_path( request ) + dir_path = path_for(request.options[:bucket_path], checksum) + file_path = ::File.join(dir_path, 'contents') return nil unless ::File.exists?(file_path) + return nil unless path_match(dir_path, files_original_path) if request.options[:diff_with] hash_protocol = sumtype(checksum) @@ -32,32 +34,47 @@ module Puppet::FileBucketFile end def head(request) - checksum = request_to_checksum(request) - file_path = path_for(request.options[:bucket_path], checksum, 'contents') - ::File.exists?(file_path) + checksum, files_original_path = request_to_checksum_and_path(request) + dir_path = path_for(request.options[:bucket_path], checksum) + + ::File.exists?(::File.join(dir_path, 'contents')) and path_match(dir_path, files_original_path) end def save( request ) instance = request.instance + checksum, files_original_path = request_to_checksum_and_path(request) - save_to_disk(instance) + save_to_disk(instance, files_original_path) instance.to_s end private - def save_to_disk( bucket_file ) + def path_match(dir_path, files_original_path) + return true unless files_original_path # if no path was provided, it's a match + paths_path = ::File.join(dir_path, 'paths') + return false unless ::File.exists?(paths_path) + ::File.open(paths_path) do |f| + f.each do |line| + return true if line.chomp == files_original_path + end + end + return false + end + + def save_to_disk( bucket_file, files_original_path ) filename = path_for(bucket_file.bucket_path, bucket_file.checksum_data, 'contents') - dirname = path_for(bucket_file.bucket_path, bucket_file.checksum_data) + dir_path = path_for(bucket_file.bucket_path, bucket_file.checksum_data) + paths_path = ::File.join(dir_path, 'paths') # If the file already exists, do nothing. if ::File.exist?(filename) verify_identical_file!(bucket_file) else # Make the directories if necessary. - unless ::File.directory?(dirname) + unless ::File.directory?(dir_path) Puppet::Util.withumask(0007) do - ::FileUtils.mkdir_p(dirname) + ::FileUtils.mkdir_p(dir_path) end end @@ -68,15 +85,27 @@ module Puppet::FileBucketFile ::File.open(filename, ::File::WRONLY|::File::CREAT, 0440) do |of| of.print bucket_file.contents end + ::File.open(paths_path, ::File::WRONLY|::File::CREAT, 0640) do |of| + # path will be written below + end + end + end + + unless path_match(dir_path, files_original_path) + ::File.open(paths_path, 'a') do |f| + f.puts(files_original_path) end end end - def request_to_checksum( request ) - checksum_type, checksum, path = request.key.split(/\//, 3) # Note: we ignore path if present. + def request_to_checksum_and_path( request ) + checksum_type, checksum, path = request.key.split(/\//, 3) + if path == '' # Treat "md5//" like "md5/" + path = nil + end raise "Unsupported checksum type #{checksum_type.inspect}" if checksum_type != 'md5' raise "Invalid checksum #{checksum.inspect}" if checksum !~ /^[0-9a-f]{32}$/ - checksum + [checksum, path] end def path_for(bucket_path, digest, subfile = nil) diff --git a/spec/unit/file_bucket/dipper_spec.rb b/spec/unit/file_bucket/dipper_spec.rb index db40c6296..c40d79589 100755 --- a/spec/unit/file_bucket/dipper_spec.rb +++ b/spec/unit/file_bucket/dipper_spec.rb @@ -92,7 +92,7 @@ describe Puppet::FileBucket::Dipper do [request1, request2].each do |r| r.server.should == 'puppetmaster' r.port.should == 31337 - r.key.should == "md5/#{checksum}" + r.key.should == "md5/#{checksum}#{real_path}" end end diff --git a/spec/unit/file_bucket/file_spec.rb b/spec/unit/file_bucket/file_spec.rb index 82063c2e3..f80b16238 100644 --- a/spec/unit/file_bucket/file_spec.rb +++ b/spec/unit/file_bucket/file_spec.rb @@ -64,30 +64,6 @@ describe Puppet::FileBucket::File do end end - describe "when saving files" do - it "should save the contents to the calculated path" do - ::File.stubs(:directory?).with(@dir).returns(true) - ::File.expects(:exist?).with("#{@dir}/contents").returns false - - mockfile = mock "file" - mockfile.expects(:print).with(@contents) - ::File.expects(:open).with("#{@dir}/contents", ::File::WRONLY|::File::CREAT, 0440).yields(mockfile) - - Puppet::FileBucket::File.new(@contents).save - end - - it "should make any directories necessary for storage" do - FileUtils.expects(:mkdir_p).with do |arg| - ::File.umask == 0007 and arg == @dir - end - ::File.expects(:directory?).with(@dir).returns(false) - ::File.expects(:open).with("#{@dir}/contents", ::File::WRONLY|::File::CREAT, 0440) - ::File.expects(:exist?).with("#{@dir}/contents").returns false - - Puppet::FileBucket::File.new(@contents).save - end - end - it "should return a url-ish name" do Puppet::FileBucket::File.new(@contents).name.should == "md5/4a8ec4fa5f01b4ab1a0ab8cbccb709f0" end @@ -105,17 +81,6 @@ describe Puppet::FileBucket::File do Puppet::FileBucket::File.from_pson({"contents"=>"file contents"}).contents.should == "file contents" end - it "should save a file" do - ::File.expects(:exist?).with("#{@dir}/contents").returns false - ::File.expects(:directory?).with(@dir).returns false - ::FileUtils.expects(:mkdir_p).with(@dir) - ::File.expects(:open).with("#{@dir}/contents", ::File::WRONLY|::File::CREAT, 0440) - - bucketfile = Puppet::FileBucket::File.new(@contents) - bucketfile.save - - end - def make_bucketed_file FileUtils.mkdir_p(@dir) File.open("#{@dir}/contents", 'w') { |f| f.write @contents } diff --git a/spec/unit/indirector/file_bucket_file/file_spec.rb b/spec/unit/indirector/file_bucket_file/file_spec.rb index 9187f4da0..0c33593d7 100755 --- a/spec/unit/indirector/file_bucket_file/file_spec.rb +++ b/spec/unit/indirector/file_bucket_file/file_spec.rb @@ -22,13 +22,97 @@ describe Puppet::FileBucketFile::File do Puppet[:bucketdir] = tmpdir('bucketdir') end - describe "when diffing files" do - def save_bucket_file(contents) - bucket_file = Puppet::FileBucket::File.new(contents) - bucket_file.save - bucket_file.checksum_data + def save_bucket_file(contents, path = "/who_cares") + bucket_file = Puppet::FileBucket::File.new(contents) + bucket_file.save("md5/#{Digest::MD5.hexdigest(contents)}#{path}") + bucket_file.checksum_data + end + + describe "when servicing a save request" do + describe "when supplying a path" do + it "should store the path if not already stored" do + checksum = save_bucket_file("stuff", "/foo/bar") + dir_path = "#{Puppet[:bucketdir]}/c/1/3/d/8/8/c/b/c13d88cb4cb02003daedb8a84e5d272a" + File.read("#{dir_path}/contents").should == "stuff" + File.read("#{dir_path}/paths").should == "foo/bar\n" + end + + it "should leave the paths file alone if the path is already stored" do + checksum = save_bucket_file("stuff", "/foo/bar") + checksum = save_bucket_file("stuff", "/foo/bar") + dir_path = "#{Puppet[:bucketdir]}/c/1/3/d/8/8/c/b/c13d88cb4cb02003daedb8a84e5d272a" + File.read("#{dir_path}/contents").should == "stuff" + File.read("#{dir_path}/paths").should == "foo/bar\n" + end + + it "should store an additional path if the new path differs from those already stored" do + checksum = save_bucket_file("stuff", "/foo/bar") + checksum = save_bucket_file("stuff", "/foo/baz") + dir_path = "#{Puppet[:bucketdir]}/c/1/3/d/8/8/c/b/c13d88cb4cb02003daedb8a84e5d272a" + File.read("#{dir_path}/contents").should == "stuff" + File.read("#{dir_path}/paths").should == "foo/bar\nfoo/baz\n" + end + end + + describe "when not supplying a path" do + it "should save the file and create an empty paths file" do + checksum = save_bucket_file("stuff", "") + dir_path = "#{Puppet[:bucketdir]}/c/1/3/d/8/8/c/b/c13d88cb4cb02003daedb8a84e5d272a" + File.read("#{dir_path}/contents").should == "stuff" + File.read("#{dir_path}/paths").should == "" + end + end + end + + describe "when servicing a head/find request" do + describe "when supplying a path" do + it "should return false/nil if the file isn't bucketed" do + Puppet::FileBucket::File.head("md5/0ae2ec1980410229885fe72f7b44fe55/foo/bar").should == false + Puppet::FileBucket::File.find("md5/0ae2ec1980410229885fe72f7b44fe55/foo/bar").should == nil + end + + it "should return false/nil if the file is bucketed but with a different path" do + checksum = save_bucket_file("I'm the contents of a file", '/foo/bar') + Puppet::FileBucket::File.head("md5/#{checksum}/foo/baz").should == false + Puppet::FileBucket::File.find("md5/#{checksum}/foo/baz").should == nil + end + + it "should return true/file if the file is already bucketed with the given path" do + contents = "I'm the contents of a file" + checksum = save_bucket_file(contents, '/foo/bar') + Puppet::FileBucket::File.head("md5/#{checksum}/foo/bar").should == true + find_result = Puppet::FileBucket::File.find("md5/#{checksum}/foo/bar") + find_result.should be_a(Puppet::FileBucket::File) + find_result.checksum.should == "{md5}#{checksum}" + find_result.to_s.should == contents + end + end + + describe "when not supplying a path" do + [false, true].each do |trailing_slash| + describe "#{trailing_slash ? 'with' : 'without'} a trailing slash" do + trailing_string = trailing_slash ? '/' : '' + + it "should return false/nil if the file isn't bucketed" do + Puppet::FileBucket::File.head("md5/0ae2ec1980410229885fe72f7b44fe55#{trailing_string}").should == false + Puppet::FileBucket::File.find("md5/0ae2ec1980410229885fe72f7b44fe55#{trailing_string}").should == nil + end + + it "should return true/file if the file is already bucketed" do + contents = "I'm the contents of a file" + checksum = save_bucket_file(contents, '/foo/bar') + Puppet::FileBucket::File.head("md5/#{checksum}#{trailing_string}").should == true + find_result = Puppet::FileBucket::File.find("md5/#{checksum}#{trailing_string}") + find_result.should be_a(Puppet::FileBucket::File) + find_result.checksum.should == "{md5}#{checksum}" + find_result.to_s.should == contents + end + end + end end + end + describe "when diffing files" do it "should generate an empty string if there is no diff" do checksum = save_bucket_file("I'm the contents of a file") Puppet::FileBucket::File.find("md5/#{checksum}", :diff_with => checksum).should == '' @@ -102,7 +186,7 @@ HERE key = "md5/#{@digest}" if supply_path - key += "//path/to/file" + key += "/path/to/file" end @request = Puppet::Indirector::Request.new(:indirection_name, :find, key, request_options) @@ -116,10 +200,15 @@ HERE it "should return an instance of Puppet::FileBucket::File created with the content if the file exists" do make_bucketed_file - bucketfile = @store.find(@request) - bucketfile.should be_a(Puppet::FileBucket::File) - bucketfile.contents.should == @contents - @store.head(@request).should == true + if supply_path + @store.find(@request).should == nil + @store.head(@request).should == false # because path didn't match + else + bucketfile = @store.find(@request) + bucketfile.should be_a(Puppet::FileBucket::File) + bucketfile.contents.should == @contents + @store.head(@request).should == true + end end it "should return nil if no file is found" do -- cgit From b4813213afbe085b63317fbc2d1e37f799d21dd4 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 17 Feb 2011 18:18:44 -0800 Subject: (#6337) Fix Ruby warning on 1.8.6 about "future compatibility" Ruby 1.8.6 (but not later versions) warn about requiring parenthesis on some function calls; having one of those in our network rights checking means that we emit ... quite a few of these, and annoy anything that tracks our logs. By using the more standard form of raise we can avoid the warning entirely, and keep consistent code style across the file. Reviewed-By: Paul Berry --- lib/puppet/network/rights.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/network/rights.rb b/lib/puppet/network/rights.rb index 00ee04f8d..b1daef67c 100755 --- a/lib/puppet/network/rights.rb +++ b/lib/puppet/network/rights.rb @@ -88,7 +88,7 @@ class Rights else # there were no rights allowing/denying name # if name is not a path, let's throw - raise ArgumentError.new "Unknown namespace right '#{name}'" + raise ArgumentError, "Unknown namespace right '#{name}'" end error end -- cgit From 30fa41ddc3796e62a5bd1d0cf5116e14323992a3 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Mon, 21 Feb 2011 14:37:09 -0800 Subject: Updated CHANGELOG for 2.6.5rc5 --- CHANGELOG | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 683d92deb..d12918c98 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +2.6.5rc5 +======== +b481321 (#6337) Fix Ruby warning on 1.8.6 about "future compatibility" +dcce45c (#6353) Restore the ability to store paths in the filebucket +0450197 (#6126) Puppet inspect now reports status after run completes. +960890f (#6364) Adjust mis-translated regex in mount provider for AIX + 2.6.5rc4 ======== 664ef67 (#3646) Fix the documentation fix for `puppet apply --apply` -- cgit From bb31c3d82f58ed192efa1bd8b85958ffa50d1d73 Mon Sep 17 00:00:00 2001 From: Max Martin Date: Mon, 21 Feb 2011 16:40:10 -0800 Subject: (#6376) Add test case for facts find request Added test case to ensure indirection name is not changed from "facts" when making an HTTP GET request. Reviewed-by:Paul Berry --- spec/unit/network/http/api/v1_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/unit/network/http/api/v1_spec.rb b/spec/unit/network/http/api/v1_spec.rb index e7348312b..9a8780c62 100644 --- a/spec/unit/network/http/api/v1_spec.rb +++ b/spec/unit/network/http/api/v1_spec.rb @@ -96,7 +96,11 @@ describe Puppet::Network::HTTP::API::V1 do @tester.uri2indirection("GET", "/env/facts_search/bar", {}).indirection_name.should == :facts end - it "should change indirection name to 'status' if the http method is a GEt and the indirection name is statuses" do + it "should not change indirection name from 'facts' if the http method is a GET and the indirection name is facts" do + @tester.uri2indirection("GET", "/env/facts/bar", {}).indirection_name.should == :facts + end + + it "should change indirection name to 'status' if the http method is a GET and the indirection name is statuses" do @tester.uri2indirection("GET", "/env/statuses/bar", {}).indirection_name.should == :status end -- cgit From de6a2052c2aeda1cd76ba828936a9d6f0ac7e907 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 22 Feb 2011 11:18:19 -0800 Subject: (#5552) Clean up subcommand handling inside puppet cert. We now have a regular, testable mechanism for handling the legacy '--' version of subcommands, as well as a modern bareword subcommand pattern. This makes it sensible to test command handling and avoid regressions. We identified a few quirks in the command line as part of this process. Pair-With: Jesse Wolfe Signed-off-by: Daniel Pittman --- lib/puppet/application/cert.rb | 32 +++++++++++++-------- spec/unit/application/cert_spec.rb | 58 +++++++++++++++++++++++++++++--------- 2 files changed, 65 insertions(+), 25 deletions(-) diff --git a/lib/puppet/application/cert.rb b/lib/puppet/application/cert.rb index 467b0c859..c8aad1833 100644 --- a/lib/puppet/application/cert.rb +++ b/lib/puppet/application/cert.rb @@ -5,17 +5,19 @@ class Puppet::Application::Cert < Puppet::Application should_parse_config run_mode :master - attr_accessor :cert_mode, :all, :ca, :digest, :signed + attr_accessor :all, :ca, :digest, :signed - def find_mode(opt) - require 'puppet/ssl/certificate_authority' - modes = Puppet::SSL::CertificateAuthority::Interface::INTERFACE_METHODS - tmp = opt.sub("--", '').to_sym - @cert_mode = modes.include?(tmp) ? tmp : nil + def subcommand + @subcommand + end + def subcommand=(name) + # Handle the nasty, legacy mapping of "clean" to "destroy". + sub = name.to_sym + @subcommand = (sub == :clean ? :destroy : sub) end option("--clean", "-c") do - @cert_mode = :destroy + self.subcommand = "destroy" end option("--all", "-a") do @@ -37,7 +39,7 @@ class Puppet::Application::Cert < Puppet::Application require 'puppet/ssl/certificate_authority/interface' Puppet::SSL::CertificateAuthority::Interface::INTERFACE_METHODS.reject {|m| m == :destroy }.each do |method| option("--#{method}", "-#{method.to_s[0,1]}") do - find_mode("--#{method}") + self.subcommand = method end end @@ -54,8 +56,8 @@ class Puppet::Application::Cert < Puppet::Application hosts = command_line.args.collect { |h| h.downcase } end begin - @ca.apply(:revoke, :to => hosts) if @cert_mode == :destroy - @ca.apply(@cert_mode, :to => hosts, :digest => @digest) + @ca.apply(:revoke, :to => hosts) if subcommand == :destroy + @ca.apply(subcommand, :to => hosts, :digest => @digest) rescue => detail puts detail.backtrace if Puppet[:trace] puts detail.to_s @@ -64,11 +66,12 @@ class Puppet::Application::Cert < Puppet::Application end def setup + require 'puppet/ssl/certificate_authority' exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs? Puppet::Util::Log.newdestination :console - if [:generate, :destroy].include? @cert_mode + if [:generate, :destroy].include? subcommand Puppet::SSL::Host.ca_location = :local else Puppet::SSL::Host.ca_location = :only @@ -82,4 +85,11 @@ class Puppet::Application::Cert < Puppet::Application exit(23) end end + + def parse_options + # handle the bareword subcommand pattern. + result = super + self.subcommand ||= self.command_line.args.shift + result + end end diff --git a/spec/unit/application/cert_spec.rb b/spec/unit/application/cert_spec.rb index 4663fc938..2f57d07a9 100755 --- a/spec/unit/application/cert_spec.rb +++ b/spec/unit/application/cert_spec.rb @@ -51,7 +51,7 @@ describe Puppet::Application::Cert do it "should set cert_mode to :destroy for --clean" do @cert_app.handle_clean(0) - @cert_app.cert_mode.should == :destroy + @cert_app.subcommand.should == :destroy end it "should set all to true for --all" do @@ -68,7 +68,7 @@ describe Puppet::Application::Cert do it "should set cert_mode to #{method} with option --#{method}" do @cert_app.send("handle_#{method}".to_sym, nil) - @cert_app.cert_mode.should == method + @cert_app.subcommand.should == method end end @@ -114,19 +114,19 @@ describe Puppet::Application::Cert do end it "should set the ca_location to :local if the cert_mode is generate" do - @cert_app.find_mode('--generate') + @cert_app.subcommand = 'generate' Puppet::SSL::Host.expects(:ca_location=).with(:local) @cert_app.setup end it "should set the ca_location to :local if the cert_mode is destroy" do - @cert_app.find_mode('--destroy') + @cert_app.subcommand = 'destroy' Puppet::SSL::Host.expects(:ca_location=).with(:local) @cert_app.setup end it "should set the ca_location to :only if the cert_mode is print" do - @cert_app.find_mode('--print') + @cert_app.subcommand = 'print' Puppet::SSL::Host.expects(:ca_location=).with(:only) @cert_app.setup end @@ -171,24 +171,54 @@ describe Puppet::Application::Cert do @cert_app.main end - it "should delegate to ca.apply with current set cert_mode" do - @cert_app.cert_mode = "currentmode" + it "should revoke cert if cert_mode is clean" do + @cert_app.subcommand = :destroy @cert_app.command_line.stubs(:args).returns(["host"]) - @ca.expects(:apply).with { |cert_mode,to| cert_mode == "currentmode" } + @ca.expects(:apply).with { |cert_mode,to| cert_mode == :revoke } + @ca.expects(:apply).with { |cert_mode,to| cert_mode == :destroy } @cert_app.main end + end - it "should revoke cert if cert_mode is clean" do - @cert_app.cert_mode = :destroy - @cert_app.command_line.stubs(:args).returns(["host"]) + describe "when identifying subcommands" do + before :each do + @cert_app.all = false + @ca = stub_everything 'ca' + @cert_app.ca = @ca + end - @ca.expects(:apply).with { |cert_mode,to| cert_mode == :revoke } - @ca.expects(:apply).with { |cert_mode,to| cert_mode == :destroy } + %w{list revoke generate sign print verify fingerprint}.each do |cmd| + short = cmd[0,1] + [cmd, "--#{cmd}", "-#{short}"].each do |option| + # In our command line '-v' was eaten by 'verbose', so we can't consume + # it here; this is a special case from our otherwise standard + # processing. --daniel 2011-02-22 + next if option == "-v" - @cert_app.main + it "should recognise '#{option}'" do + args = [option, "fun.example.com"] + + @cert_app.command_line.stubs(:args).returns(args) + @cert_app.parse_options + @cert_app.subcommand.should == cmd.to_sym + + args.should == ["fun.example.com"] + end + end end + %w{clean --clean -c}.each do |ugly| + it "should recognise the '#{ugly}' option as destroy" do + args = [ugly, "fun.example.com"] + + @cert_app.command_line.stubs(:args).returns(args) + @cert_app.parse_options + @cert_app.subcommand.should == :destroy + + args.should == ["fun.example.com"] + end + end end end -- cgit From 309b9320feef3e1a9459c7a26d10955b4d6b549c Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 22 Feb 2011 11:25:03 -0800 Subject: (#5552) Display help when no subcommand is given. Previously, when the command line was empty we would try and invoke an empty method; this was less helpful than telling people what they could actually do, so we adapt our code to do precisely that. Paired-With: Jesse Wolfe Signed-off-by: Daniel Pittman --- lib/puppet/application/cert.rb | 8 +++++++- spec/unit/application/cert_spec.rb | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/puppet/application/cert.rb b/lib/puppet/application/cert.rb index c8aad1833..ee59b7e56 100644 --- a/lib/puppet/application/cert.rb +++ b/lib/puppet/application/cert.rb @@ -89,7 +89,13 @@ class Puppet::Application::Cert < Puppet::Application def parse_options # handle the bareword subcommand pattern. result = super - self.subcommand ||= self.command_line.args.shift + unless self.subcommand then + if sub = self.command_line.args.shift then + self.subcommand = sub + else + help + end + end result end end diff --git a/spec/unit/application/cert_spec.rb b/spec/unit/application/cert_spec.rb index 2f57d07a9..b3257916b 100755 --- a/spec/unit/application/cert_spec.rb +++ b/spec/unit/application/cert_spec.rb @@ -189,6 +189,16 @@ describe Puppet::Application::Cert do @cert_app.ca = @ca end + it "should not fail when no command is given" do + # Make the help method silent for testing; this is a bit nasty, but we + # can't identify a cleaner method. Help welcome. --daniel 2011-02-22 + Puppet.features.stubs(:usage?).returns(false) + @cert_app.stubs(:puts) + + @cert_app.command_line.stubs(:args).returns([]) + expect { @cert_app.parse_options }.should raise_error SystemExit + end + %w{list revoke generate sign print verify fingerprint}.each do |cmd| short = cmd[0,1] [cmd, "--#{cmd}", "-#{short}"].each do |option| -- cgit From 0e9858f19d9d2e021a9d0aa43b69c6ddee229352 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 22 Feb 2011 14:18:57 -0800 Subject: (#6407) Fix spec test hang with Mocha >= 0.9.11 in zlib testing We had a combination of bad logic, and bad testing, and a nasty behaviour of Mocha <= 0.9.10 that would result in a false pass for one of our tests. This not only falsely passed, but hid an infinite loop retrying decompression on an invalid data stream; it could be triggered by anything that sent an HTTP request with an invalid compressed body, resulting in a livelock. Paired-with: Jesse Wolfe Signed-off-by: Daniel Pittman --- lib/puppet/network/http/compression.rb | 5 ++++- spec/unit/network/http/compression_spec.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) mode change 100644 => 100755 spec/unit/network/http/compression_spec.rb diff --git a/lib/puppet/network/http/compression.rb b/lib/puppet/network/http/compression.rb index d9b56f184..c8d001169 100644 --- a/lib/puppet/network/http/compression.rb +++ b/lib/puppet/network/http/compression.rb @@ -75,7 +75,10 @@ module Puppet::Network::HTTP::Compression # in this case, we try with a verbatim (no header) # deflater. @uncompressor = Zlib::Inflate.new - retry if @first + if @first then + @first = false + retry + end raise end diff --git a/spec/unit/network/http/compression_spec.rb b/spec/unit/network/http/compression_spec.rb old mode 100644 new mode 100755 index c5bbbb064..3828ec59c --- a/spec/unit/network/http/compression_spec.rb +++ b/spec/unit/network/http/compression_spec.rb @@ -178,7 +178,7 @@ describe "http compression" do end it "should raise the error the second time" do - @inflater.expects(:inflate).raises(Zlib::DataError.new("not a zlib stream")) + @inflater.stubs(:inflate).raises(Zlib::DataError.new("not a zlib stream")) Zlib::Inflate.expects(:new).with.returns(@inflater) lambda { @adapter.uncompress("chunk") }.should raise_error end -- cgit From e3dfe41ce7da108fc345e58c7df8c1576ea951a0 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Tue, 22 Feb 2011 16:51:39 -0800 Subject: (#6418) Recursive files shouldn't be audited A vestigial codepath was accidentally made live again when 2.6.0's audit parameter was added. This patch removes that code. As it's very difficult to write a meaningful unit test of a negative case, a test will be added to the acceptance test project to confirm before & after behavior for this fix. Reviewed-By: Markus Roberts --- lib/puppet/type/file/source.rb | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb index bc464e1c3..6dda7957c 100755 --- a/lib/puppet/type/file/source.rb +++ b/lib/puppet/type/file/source.rb @@ -132,10 +132,6 @@ module Puppet end end - def pinparams - [:mode, :type, :owner, :group, :content] - end - def found? ! (metadata.nil? or metadata.ftype.nil?) end @@ -161,16 +157,6 @@ module Puppet result end - # Make sure we're also checking the checksum - def value=(value) - super - - checks = (pinparams + [:ensure]) - checks.delete(:checksum) - - resource[:audit] = checks - end - def local? found? and uri and (uri.scheme || "file") == "file" end -- cgit From 23b711954b1c1ba8deb4035503797c2f38a8ce12 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Wed, 23 Feb 2011 14:59:13 -0800 Subject: Maint: Add an assertion mechanism to Puppet This patch allows us to make C-style "assertions" in Puppet code, e.g.: assert_that { condition } assert_that(message) { condition } These methods will raise an exception if the environment variable PUPPET_ENABLE_ASSERTIONS is set to a non-empty value, and the the condition evaluates to false. If the environment variable PUPPET_ENABLE_ASSERTIONS is not set, then the condition is not even checked. Switching the assertions on with PUPPET_ENABLE_ASSERTIONS carries three advantages: 1. It makes it possible to put potentially expensive checks in assertions without degrading the performance of the code in production environments. 2. It allows strict assertions to catch Puppet bugs early in development, without increasing the risk of a crash in production environments. 3. It allows a simple command-line mechanism to run any Puppet command with assertions enabled. --- lib/puppet/util/monkey_patches.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index 6b5af8350..85854a04c 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -48,3 +48,21 @@ if RUBY_VERSION == '1.8.7' end end +class Object + # The following code allows callers to make assertions that are only + # checked when the environment variable PUPPET_ENABLE_ASSERTIONS is + # set to a non-empty string. For example: + # + # assert_that { condition } + # assert_that(message) { condition } + if ENV["PUPPET_ENABLE_ASSERTIONS"].to_s != '' + def assert_that(message = nil) + unless yield + raise Exception.new("Assertion failure: #{message}") + end + end + else + def assert_that(message = nil) + end + end +end -- cgit From 439115e34c16be27549ee9aa122c418ae6992d76 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Fri, 25 Feb 2011 11:19:34 -0800 Subject: (#6499) Make puppet respond identically to -h and --help lib/puppet/util/command_line.rb had a special case for puppet --help to return generic help instead of the puppet apply help, but it would return puppet apply help when you gave it -h. --- lib/puppet/util/command_line.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb index 4aff0a8cb..7f74d266a 100644 --- a/lib/puppet/util/command_line.rb +++ b/lib/puppet/util/command_line.rb @@ -85,7 +85,7 @@ module Puppet if zero == 'puppet' case argv.first when nil; [ stdin.tty? ? nil : "apply", argv] # ttys get usage info - when "--help"; [nil, argv] # help should give you usage, not the help for `puppet apply` + when "--help", "-h"; [nil, argv] # help should give you usage, not the help for `puppet apply` when /^-|\.pp$|\.rb$/; ["apply", argv] else [ argv.first, argv[1..-1] ] end -- cgit From 23eb77d999acb73021547c5ef86adf609e202605 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 25 Feb 2011 11:45:38 -0800 Subject: (#6322) --noop should not suppress error codes The noop option has been suppressing exit statuses. This is counterintuitive, as per discussion at http://projects.puppetlabs.com/issues/6322 This patch causes noop runs to return the same exit codes as real runs. Reviewed-By: Daniel Pittman --- lib/puppet/application/agent.rb | 2 +- lib/puppet/application/apply.rb | 2 +- spec/unit/application/agent_spec.rb | 4 ++-- spec/unit/application/apply_spec.rb | 16 ++++++++++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb index 895156f11..3749241f8 100644 --- a/lib/puppet/application/agent.rb +++ b/lib/puppet/application/agent.rb @@ -119,7 +119,7 @@ class Puppet::Application::Agent < Puppet::Application if not report exit(1) - elsif not Puppet[:noop] and options[:detailed_exitcodes] then + elsif options[:detailed_exitcodes] then exit(report.exit_status) else exit(0) diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index 8f5aa86d0..cc733e1f5 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -125,7 +125,7 @@ class Puppet::Application::Apply < Puppet::Application configurer = Puppet::Configurer.new report = configurer.run(:skip_plugin_download => true, :catalog => catalog) - exit( Puppet[:noop] ? 0 : options[:detailed_exitcodes] ? report.exit_status : 0 ) + exit( options[:detailed_exitcodes] ? report.exit_status : 0 ) rescue => detail puts detail.backtrace if Puppet[:trace] $stderr.puts detail.message diff --git a/spec/unit/application/agent_spec.rb b/spec/unit/application/agent_spec.rb index 9fc7879c9..8f498d4ba 100755 --- a/spec/unit/application/agent_spec.rb +++ b/spec/unit/application/agent_spec.rb @@ -526,11 +526,11 @@ describe Puppet::Application::Agent do @puppetd.onetime end - it "should always exit with 0 if --noop" do + it "should exit with the report's computer exit status, even if --noop is set." do Puppet.stubs(:[]).with(:noop).returns(true) report = stub 'report', :exit_status => 666 @agent.stubs(:run).returns(report) - @puppetd.expects(:exit).with(0) + @puppetd.expects(:exit).with(666) @puppetd.onetime end diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb index ceba4a333..d4f39abe0 100755 --- a/spec/unit/application/apply_spec.rb +++ b/spec/unit/application/apply_spec.rb @@ -166,6 +166,13 @@ describe Puppet::Application::Apply do @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 + @collection.stubs(:perform_initial_import).raises(Puppet::ParseError) + @apply.expects(:exit).with(1) + @apply.parseonly + end end describe "the main command" do @@ -327,6 +334,15 @@ describe Puppet::Application::Apply do @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) -- cgit From ac2262d071cc2c9841843354585980696c689ca3 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 25 Feb 2011 13:45:10 -0800 Subject: (#3999) Allow disabling of default SELinux context detection for files In most cases on a system with SELinux, it is preferred to use the SELinux matchpathcon call to determine the default context that a file should have to make sure that files Puppet modifies are labeled with the correct SELinux security context. In the event that you wanted to override some or all of the default context, you can use the SELinux attributes Puppet provides to do that. If left unspecified the defaults will apply if matchpathcon has defaults. This patch adds a new selinux_ignore_defaults parameter which will cause Puppet to assume no defaults, allowing the file's SELinux label to be left unmodified, if desired. Originally-by: Sean Millichamp Signed-off-by: Jesse Wolfe --- lib/puppet/type/file/selcontext.rb | 16 ++++++++++++++++ spec/unit/type/file/selinux_spec.rb | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/lib/puppet/type/file/selcontext.rb b/lib/puppet/type/file/selcontext.rb index a33c6a000..ea385eec0 100644 --- a/lib/puppet/type/file/selcontext.rb +++ b/lib/puppet/type/file/selcontext.rb @@ -32,9 +32,14 @@ module Puppet end def retrieve_default_context(property) + if @resource[:selinux_ignore_defaults] == :true + return nil + end + unless context = self.get_selinux_default_context(@resource[:path]) return nil end + property_default = self.parse_selinux_context(property, context) self.debug "Found #{property} default '#{property_default}' for #{@resource[:path]}" if not property_default.nil? property_default @@ -54,6 +59,17 @@ module Puppet end end + Puppet::Type.type(:file).newparam(:selinux_ignore_defaults) do + desc "If this is set then Puppet will not ask SELinux (via matchpathcon) to + supply defaults for the SELinux attributes (seluser, selrole, + seltype, and selrange). In general, you should leave this set at its + default and only set it to true when you need Puppet to not try to fix + SELinux labels automatically." + newvalues(:true, :false) + + defaultto :false + end + Puppet::Type.type(:file).newproperty(:seluser, :parent => Puppet::SELFileContext) do desc "What the SELinux user component of the context of the file should be. Any valid SELinux user component is accepted. For example `user_u`. diff --git a/spec/unit/type/file/selinux_spec.rb b/spec/unit/type/file/selinux_spec.rb index 043471dec..a2444acd9 100644 --- a/spec/unit/type/file/selinux_spec.rb +++ b/spec/unit/type/file/selinux_spec.rb @@ -66,6 +66,11 @@ Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f @sel.default.must == expectedresult end + it "should return nil for defaults if selinux_ignore_defaults is true" do + @resource[:selinux_ignore_defaults] = :true + @sel.default.must be_nil + end + it "should be able to set a new context" do stat = stub 'stat', :ftype => "foo" @sel.should = %w{newone} -- cgit From 23a510a321e47a98768dc47f95cfa0bd8c1a314c Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Fri, 25 Feb 2011 14:56:58 -0800 Subject: (#4914) Improved stubbing in mount/parsed_spec tests. A few of the spec tests were attempting to stub Puppet::Type::Mount#default_target so that it pointed to a temporary file rather than /etc/fstab, but they were creating the stub after the first call to default_target, so both /etc/fstab and the temporary file were being read. This caused errors when running spec tests on platforms where /etc/fstab is unreadable by non-privileged users. Fixed the problem by moving the stub declaration earlier in the test. --- spec/unit/provider/mount/parsed_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index 2a305b905..4d654fa72 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -220,6 +220,11 @@ FSTAB include ParsedMountTesting before :each do + # Note: we have to stub default_target before creating resources + # because it is used by Puppet::Type::Mount.new to populate the + # :target property. + @provider.stubs(:default_target).returns fake_fstab + @res_ghost = Puppet::Type::Mount.new(:name => '/ghost') # in no fake fstab @res_mounted = Puppet::Type::Mount.new(:name => '/') # in every fake fstab @res_unmounted = Puppet::Type::Mount.new(:name => '/boot') # in every fake fstab @@ -232,7 +237,6 @@ FSTAB end @provider.stubs(:mountcmd).returns File.read(fake_mountoutput) - @provider.stubs(:default_target).returns fake_fstab end it "should set :ensure to :unmounted if found in fstab but not mounted" do -- cgit From a949a83c4f100be0254fadcb915f418f73705861 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Fri, 25 Feb 2011 15:14:26 -0800 Subject: Revert "(#6309) Ensure the correct device is mounted when managing mounts" This reverts commit 6cb365a887d47606bdfae0ff540038b0c49b7451, which fixed bug #6309 but introduced bug #6411. In addition, it conflicts with a significant patch to the mount provider that addresses #4914. After merging in the fix for #4914 I will determine whether bug #6309 still exists, and if so work on an improved fix for it. --- lib/puppet/provider/mount.rb | 48 +----- lib/puppet/type/mount.rb | 15 +- .../unit/provider/mount/mount-output.darwin.txt | 5 - .../unit/provider/mount/mount-output.hp-ux.txt | 16 -- .../unit/provider/mount/mount-output.other.txt | 14 -- .../unit/provider/mount/mount-output.solaris.txt | 16 -- spec/unit/provider/mount/parsed_spec.rb | 4 +- spec/unit/provider/mount_spec.rb | 185 +++++++-------------- spec/unit/type/mount_spec.rb | 56 +++++-- 9 files changed, 118 insertions(+), 241 deletions(-) delete mode 100644 spec/fixtures/unit/provider/mount/mount-output.darwin.txt delete mode 100644 spec/fixtures/unit/provider/mount/mount-output.hp-ux.txt delete mode 100644 spec/fixtures/unit/provider/mount/mount-output.other.txt delete mode 100644 spec/fixtures/unit/provider/mount/mount-output.solaris.txt diff --git a/lib/puppet/provider/mount.rb b/lib/puppet/provider/mount.rb index 81d93b5c1..354ddb16d 100644 --- a/lib/puppet/provider/mount.rb +++ b/lib/puppet/provider/mount.rb @@ -6,28 +6,8 @@ require 'puppet' # A module just to store the mount/unmount methods. Individual providers # still need to add the mount commands manually. module Puppet::Provider::Mount - def mount - # Make sure the fstab file & entry exists - create - - if correctly_mounted? - # Nothing to do! - else - if anything_mounted? - unmount - - # We attempt to create the mount point here, because unmounting - # certain file systems/devices can cause the mount point to be - # deleted - ::FileUtils.mkdir_p(resource[:name]) - end - - mount! - end - end - # This only works when the mount point is synced to the fstab. - def mount! + def mount # Manually pass the mount options in, since some OSes *cough*OS X*cough* don't # read from /etc/fstab but still want to use this type. args = [] @@ -53,8 +33,8 @@ module Puppet::Provider::Mount umount resource[:name] end - # Is anything currently mounted at this point? - def anything_mounted? + # Is the mount currently mounted? + def mounted? platform = Facter.value("operatingsystem") name = resource[:name] mounts = mountcmd.split("\n").find do |line| @@ -62,7 +42,6 @@ module Puppet::Provider::Mount when "Darwin" line =~ / on #{name} / or line =~ %r{ on /private/var/automount#{name}} when "Solaris", "HP-UX" - # Yes, Solaris does list mounts as "mount_point on device" line =~ /^#{name} on / when "AIX" line.split(/\s+/)[2] == name @@ -71,25 +50,4 @@ module Puppet::Provider::Mount end end end - - # Is the desired thing mounted at this point? - def correctly_mounted? - platform = Facter.value("operatingsystem") - name = resource[:name] - device = resource[:device] - mounts = mountcmd.split("\n").find do |line| - case platform - when "Darwin" - line =~ /^#{device} on #{name} / or line =~ %r{^#{device} on /private/var/automount#{name}} - when "Solaris", "HP-UX" - # Yes, Solaris does list mounts as "mount_point on device" - line =~ /^#{name} on #{device}/ - when "AIX" - line.split(/\s+/)[2] == name && - line.split(/\s+/)[1] == device - else - line =~ /^#{device} on #{name} / - end - end - end end diff --git a/lib/puppet/type/mount.rb b/lib/puppet/type/mount.rb index 10eed5373..da9a70bdf 100755 --- a/lib/puppet/type/mount.rb +++ b/lib/puppet/type/mount.rb @@ -29,7 +29,7 @@ module Puppet aliasvalue :present, :defined newvalue(:unmounted) do - if provider.anything_mounted? + if provider.mounted? syncothers provider.unmount return :mount_unmounted @@ -40,15 +40,20 @@ module Puppet end newvalue(:absent, :event => :mount_deleted) do - provider.unmount if provider.anything_mounted? + provider.unmount if provider.mounted? provider.destroy end newvalue(:mounted, :event => :mount_mounted) do + # Create the mount point if it does not already exist. + current_value = self.retrieve + provider.create if current_value.nil? or current_value == :absent + syncothers - provider.mount + # The fs can be already mounted if it was absent but mounted + provider.mount unless provider.mounted? end def insync?(is) @@ -65,7 +70,7 @@ module Puppet curval = super() if curval == :absent return :absent - elsif provider.correctly_mounted? + elsif provider.mounted? return :mounted else return :unmounted @@ -205,7 +210,7 @@ module Puppet def refresh # Only remount if we're supposed to be mounted. - provider.remount if self.should(:fstype) != "swap" and provider.anything_mounted? + provider.remount if self.should(:fstype) != "swap" and provider.mounted? end def value(name) diff --git a/spec/fixtures/unit/provider/mount/mount-output.darwin.txt b/spec/fixtures/unit/provider/mount/mount-output.darwin.txt deleted file mode 100644 index fbb9d9832..000000000 --- a/spec/fixtures/unit/provider/mount/mount-output.darwin.txt +++ /dev/null @@ -1,5 +0,0 @@ -/dev/disk0s2 on / (hfs, local, journaled) -devfs on /dev (devfs, local, nobrowse) -map -hosts on /net (autofs, nosuid, automounted, nobrowse) -map auto_home on /home (autofs, automounted, nobrowse) -/dev/disk0s3 on /usr (hfs, local, journaled) diff --git a/spec/fixtures/unit/provider/mount/mount-output.hp-ux.txt b/spec/fixtures/unit/provider/mount/mount-output.hp-ux.txt deleted file mode 100644 index 477926138..000000000 --- a/spec/fixtures/unit/provider/mount/mount-output.hp-ux.txt +++ /dev/null @@ -1,16 +0,0 @@ -/ on rpool/ROOT/opensolaris read/write/setuid/devices/dev=2d90002 on Wed Dec 31 16:00:00 1969 -/devices on /devices read/write/setuid/devices/dev=4a00000 on Thu Feb 17 14:34:02 2011 -/dev on /dev read/write/setuid/devices/dev=4a40000 on Thu Feb 17 14:34:02 2011 -/system/contract on ctfs read/write/setuid/devices/dev=4ac0001 on Thu Feb 17 14:34:02 2011 -/proc on proc read/write/setuid/devices/dev=4b00000 on Thu Feb 17 14:34:02 2011 -/etc/mnttab on mnttab read/write/setuid/devices/dev=4b40001 on Thu Feb 17 14:34:02 2011 -/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4b80001 on Thu Feb 17 14:34:02 2011 -/system/object on objfs read/write/setuid/devices/dev=4bc0001 on Thu Feb 17 14:34:02 2011 -/etc/dfs/sharetab on sharefs read/write/setuid/devices/dev=4c00001 on Thu Feb 17 14:34:02 2011 -/lib/libc.so.1 on /usr/lib/libc/libc_hwcap1.so.1 read/write/setuid/devices/dev=2d90002 on Thu Feb 17 14:34:14 2011 -/dev/fd on fd read/write/setuid/devices/dev=4d00001 on Thu Feb 17 14:34:18 2011 -/tmp on swap read/write/setuid/devices/xattr/dev=4b80002 on Thu Feb 17 14:34:19 2011 -/var/run on swap read/write/setuid/devices/xattr/dev=4b80003 on Thu Feb 17 14:34:19 2011 -/export on rpool/export read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90006 on Thu Feb 17 14:37:48 2011 -/export/home on rpool/export/home read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90007 on Thu Feb 17 14:37:48 2011 -/rpool on rpool read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90009 on Thu Feb 17 14:37:48 2011 diff --git a/spec/fixtures/unit/provider/mount/mount-output.other.txt b/spec/fixtures/unit/provider/mount/mount-output.other.txt deleted file mode 100644 index 0e4dff0c5..000000000 --- a/spec/fixtures/unit/provider/mount/mount-output.other.txt +++ /dev/null @@ -1,14 +0,0 @@ -/dev/sda1 on / type ext4 (rw,errors=remount-ro,commit=0) -proc on /proc type proc (rw,noexec,nosuid,nodev) -none on /sys type sysfs (rw,noexec,nosuid,nodev) -fusectl on /sys/fs/fuse/connections type fusectl (rw) -none on /sys/kernel/debug type debugfs (rw) -none on /sys/kernel/security type securityfs (rw) -none on /dev type devtmpfs (rw,mode=0755) -none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) -none on /dev/shm type tmpfs (rw,nosuid,nodev) -none on /var/run type tmpfs (rw,nosuid,mode=0755) -none on /var/lock type tmpfs (rw,noexec,nosuid,nodev) -none on /proc/fs/vmblock/mountPoint type vmblock (rw) -binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev) -/dev/sda2 on /usr type ext4 (rw,errors=remount-ro,commit=0) diff --git a/spec/fixtures/unit/provider/mount/mount-output.solaris.txt b/spec/fixtures/unit/provider/mount/mount-output.solaris.txt deleted file mode 100644 index 477926138..000000000 --- a/spec/fixtures/unit/provider/mount/mount-output.solaris.txt +++ /dev/null @@ -1,16 +0,0 @@ -/ on rpool/ROOT/opensolaris read/write/setuid/devices/dev=2d90002 on Wed Dec 31 16:00:00 1969 -/devices on /devices read/write/setuid/devices/dev=4a00000 on Thu Feb 17 14:34:02 2011 -/dev on /dev read/write/setuid/devices/dev=4a40000 on Thu Feb 17 14:34:02 2011 -/system/contract on ctfs read/write/setuid/devices/dev=4ac0001 on Thu Feb 17 14:34:02 2011 -/proc on proc read/write/setuid/devices/dev=4b00000 on Thu Feb 17 14:34:02 2011 -/etc/mnttab on mnttab read/write/setuid/devices/dev=4b40001 on Thu Feb 17 14:34:02 2011 -/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4b80001 on Thu Feb 17 14:34:02 2011 -/system/object on objfs read/write/setuid/devices/dev=4bc0001 on Thu Feb 17 14:34:02 2011 -/etc/dfs/sharetab on sharefs read/write/setuid/devices/dev=4c00001 on Thu Feb 17 14:34:02 2011 -/lib/libc.so.1 on /usr/lib/libc/libc_hwcap1.so.1 read/write/setuid/devices/dev=2d90002 on Thu Feb 17 14:34:14 2011 -/dev/fd on fd read/write/setuid/devices/dev=4d00001 on Thu Feb 17 14:34:18 2011 -/tmp on swap read/write/setuid/devices/xattr/dev=4b80002 on Thu Feb 17 14:34:19 2011 -/var/run on swap read/write/setuid/devices/xattr/dev=4b80003 on Thu Feb 17 14:34:19 2011 -/export on rpool/export read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90006 on Thu Feb 17 14:37:48 2011 -/export/home on rpool/export/home read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90007 on Thu Feb 17 14:37:48 2011 -/rpool on rpool read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90009 on Thu Feb 17 14:37:48 2011 diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index 069d9495a..b4c2249fd 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -130,7 +130,7 @@ describe provider_class do mount.stubs(:mountcmd) # just so we don't actually try to mount anything mount.expects(:flush) - mount.mount! + mount.mount end end @@ -176,7 +176,7 @@ describe provider_class do it "should determine that the root fs is mounted" do @provider_class.prefetch("/" => @mount) - @mount.provider.should be_anything_mounted + @mount.provider.should be_mounted end end end diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb index 1f2501765..f567a4a40 100755 --- a/spec/unit/provider/mount_spec.rb +++ b/spec/unit/provider/mount_spec.rb @@ -2,30 +2,28 @@ require File.dirname(__FILE__) + '/../../spec_helper' -require 'puppet_spec/files' require 'puppet/provider/mount' describe Puppet::Provider::Mount do - include PuppetSpec::Files - before :each do + @mounter = Object.new + @mounter.extend(Puppet::Provider::Mount) + @name = "/" - @resource = Puppet::Type.type(:mount).new( - :name => '/', - :device => '/dev/sda1', - :target => tmpfile("mount_provider") - ) + @resource = stub 'resource' + @resource.stubs(:[]).with(:name).returns(@name) - @mounter = Puppet::Type.type(:mount).defaultprovider().new(@resource) + @mounter.stubs(:resource).returns(@resource) end - describe "when calling mount!" do + describe Puppet::Provider::Mount, " when mounting" do + it "should use the 'mountcmd' method to mount" do @mounter.stubs(:options).returns(nil) @mounter.expects(:mountcmd) - @mounter.mount! + @mounter.mount end it "should flush before mounting if a flush method exists" do @@ -34,169 +32,114 @@ describe Puppet::Provider::Mount do @mounter.stubs(:mountcmd) @mounter.stubs(:options).returns(nil) - @mounter.mount! + @mounter.mount end it "should add the options following '-o' if they exist and are not set to :absent" do @mounter.stubs(:options).returns("ro") @mounter.expects(:mountcmd).with { |*ary| ary[0] == "-o" and ary[1] == "ro" } - @mounter.mount! + @mounter.mount end it "should specify the filesystem name to the mount command" do @mounter.stubs(:options).returns(nil) @mounter.expects(:mountcmd).with { |*ary| ary[-1] == @name } - @mounter.mount! + @mounter.mount end end - describe "when remounting" do + describe Puppet::Provider::Mount, " when remounting" do + it "should use '-o remount' if the resource specifies it supports remounting" do @mounter.stubs(:info) - @resource[:remounts] = true + @resource.stubs(:[]).with(:remounts).returns(:true) @mounter.expects(:mountcmd).with("-o", "remount", @name) @mounter.remount end it "should unmount and mount if the resource does not specify it supports remounting" do @mounter.stubs(:info) - @resource[:remounts] = false + @resource.stubs(:[]).with(:remounts).returns(false) @mounter.expects(:unmount) @mounter.expects(:mount) @mounter.remount end it "should log that it is remounting" do - @resource[:remounts] = true + @resource.stubs(:[]).with(:remounts).returns(:true) @mounter.stubs(:mountcmd) @mounter.expects(:info).with("Remounting") @mounter.remount end end - describe "when unmounting" do + describe Puppet::Provider::Mount, " when unmounting" do + it "should call the :umount command with the resource name" do @mounter.expects(:umount).with(@name) @mounter.unmount end end - %w{Darwin Solaris HP-UX AIX Other}.each do |platform| - describe "on #{platform}" do - before :each do - case platform - when 'Darwin' - mount_fixture = 'mount-output.darwin.txt' - @mount_device = '/dev/disk0s3' - @mount_point = '/usr' - when 'Solaris' - mount_fixture = 'mount-output.solaris.txt' - @mount_device = 'swap' - @mount_point = '/tmp' - when 'HP-UX' - mount_fixture = 'mount-output.hp-ux.txt' - @mount_device = 'swap' - @mount_point = '/tmp' - when 'AIX' - mount_fixture = 'mount-output.aix.txt' - @mount_device = '/dev/hd2' - @mount_point = '/usr' - when 'Other' - mount_fixture = 'mount-output.other.txt' - @mount_device = '/dev/sda2' - @mount_point = '/usr' - end - @mount_data = File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'unit', 'provider', 'mount', mount_fixture)) - Facter.stubs(:value).with("operatingsystem").returns(platform) - end - - describe "when the correct thing is mounted" do - before :each do - @mounter.expects(:mountcmd).returns(@mount_data) - @resource.stubs(:[]).with(:name).returns(@mount_point) - @resource.stubs(:[]).with(:device).returns(@mount_device) - end - - it "should say anything_mounted?" do - @mounter.should be_anything_mounted - end - - it "should say correctly_mounted?" do - @mounter.should be_correctly_mounted - end - end - - describe "when the wrong thing is mounted" do - before :each do - @mounter.expects(:mountcmd).returns(@mount_data) - @resource.stubs(:[]).with(:name).returns(@mount_point) - @resource.stubs(:[]).with(:device).returns('/dev/bogus/thing') - end - - it "should say anything_mounted?" do - @mounter.should be_anything_mounted - end - - it "should not say correctly_mounted?" do - @mounter.should_not be_correctly_mounted - end - end - - describe "when nothing is mounted" do - before :each do - @mounter.expects(:mountcmd).returns(@mount_data) - @resource.stubs(:[]).with(:name).returns('/bogus/location') - @resource.stubs(:[]).with(:device).returns(@mount_device) - end - - it "should not say anything_mounted?" do - @mounter.should_not be_anything_mounted - end - - it "should not say correctly_mounted?" do - @mounter.should_not be_correctly_mounted - end - end + describe Puppet::Provider::Mount, " when determining if it is mounted" do + + it "should parse the results of running the mount command with no arguments" do + Facter.stubs(:value).returns("whatever") + @mounter.expects(:mountcmd).returns("") + + @mounter.mounted? end - end - describe "when mounting a device" do - it "should not mount! or unmount anything when the correct device is mounted" do - @mounter.stubs(:correctly_mounted?).returns(true) + it "should match ' on /private/var/automount' if the operating system is Darwin" do + Facter.stubs(:value).with("operatingsystem").returns("Darwin") + @mounter.expects(:mountcmd).returns("/dev/whatever on /private/var/automount/\ndevfs on /dev") - @mounter.expects(:anything_mounted?).never - @mounter.expects(:create).once - @mounter.expects(:mount!).never - @mounter.expects(:unmount).never - FileUtils.expects(:mkdir_p).never + @mounter.should be_mounted + end - @mounter.mount + it "should match ' on ' if the operating system is Darwin" do + Facter.stubs(:value).with("operatingsystem").returns("Darwin") + @mounter.expects(:mountcmd).returns("/dev/disk03 on / (local, journaled)\ndevfs on /dev") + + @mounter.should be_mounted end - it "should mount the device when nothing is mounted at the desired point" do - @mounter.stubs(:correctly_mounted?).returns(false) - @mounter.stubs(:anything_mounted?).returns(false) + it "should match '^ on' if the operating system is Solaris" do + Facter.stubs(:value).with("operatingsystem").returns("Solaris") + @mounter.expects(:mountcmd).returns("/ on /dev/dsk/whatever\n/var on /dev/dsk/other") - @mounter.expects(:create).once - @mounter.expects(:mount!).once - @mounter.expects(:unmount).never - FileUtils.expects(:mkdir_p).never + @mounter.should be_mounted + end - @mounter.mount + it "should match '^ on' if the operating system is HP-UX" do + Facter.stubs(:value).with("operatingsystem").returns("HP-UX") + @mounter.expects(:mountcmd).returns("/ on /dev/dsk/whatever\n/var on /dev/dsk/other") + + @mounter.should be_mounted end - it "should unmount the incorrect device and mount the correct device" do - @mounter.stubs(:correctly_mounted?).returns(false) - @mounter.stubs(:anything_mounted?).returns(true) + it "should match mounted devices if the operating system is AIX" do + Facter.stubs(:value).with("operatingsystem").returns("AIX") + mount_data = File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'unit', 'provider', 'mount', 'mount-output.aix.txt')) + @mounter.expects(:mountcmd).returns(mount_data) - @mounter.expects(:create).once - @mounter.expects(:mount!).once - @mounter.expects(:unmount).once - FileUtils.expects(:mkdir_p).with(@name).returns(true) + @mounter.should be_mounted + end - @mounter.mount + it "should match ' on ' if the operating system is not Darwin, Solaris, or HP-UX" do + Facter.stubs(:value).with("operatingsystem").returns("Debian") + @mounter.expects(:mountcmd).returns("/dev/dsk/whatever on / and stuff\n/dev/other/disk on /var and stuff") + + @mounter.should be_mounted + end + + it "should not be considered mounted if it did not match the mount output" do + Facter.stubs(:value).with("operatingsystem").returns("Debian") + @mounter.expects(:mountcmd).returns("/dev/dsk/whatever on /something/else and stuff\n/dev/other/disk on /var and stuff") + + @mounter.should_not be_mounted end end end diff --git a/spec/unit/type/mount_spec.rb b/spec/unit/type/mount_spec.rb index c6d2b5ba0..0d74042e3 100755 --- a/spec/unit/type/mount_spec.rb +++ b/spec/unit/type/mount_spec.rb @@ -74,7 +74,8 @@ describe Puppet::Type.type(:mount)::Ensure do end end - describe "when retrieving its current state" do + describe Puppet::Type.type(:mount)::Ensure, "when retrieving its current state" do + it "should return the provider's value if it is :absent" do @provider.expects(:ensure).returns(:absent) @ensure.retrieve.should == :absent @@ -82,27 +83,28 @@ describe Puppet::Type.type(:mount)::Ensure do it "should return :mounted if the provider indicates it is mounted and the value is not :absent" do @provider.expects(:ensure).returns(:present) - @provider.expects(:correctly_mounted?).returns(true) + @provider.expects(:mounted?).returns(true) @ensure.retrieve.should == :mounted end it "should return :unmounted if the provider indicates it is not mounted and the value is not :absent" do @provider.expects(:ensure).returns(:present) - @provider.expects(:correctly_mounted?).returns(false) + @provider.expects(:mounted?).returns(false) @ensure.retrieve.should == :unmounted end end - describe "when changing the host" do + describe Puppet::Type.type(:mount)::Ensure, "when changing the host" do + it "should destroy itself if it should be absent" do - @provider.stubs(:anything_mounted?).returns(false) + @provider.stubs(:mounted?).returns(false) @provider.expects(:destroy) @ensure.should = :absent @ensure.sync end it "should unmount itself before destroying if it is mounted and should be absent" do - @provider.expects(:anything_mounted?).returns(true) + @provider.expects(:mounted?).returns(true) @provider.expects(:unmount) @provider.expects(:destroy) @ensure.should = :absent @@ -111,9 +113,9 @@ describe Puppet::Type.type(:mount)::Ensure do it "should create itself if it is absent and should be defined" do @provider.stubs(:ensure).returns(:absent) - @provider.stubs(:anything_mounted?).returns(true) + @provider.stubs(:mounted?).returns(true) - @provider.stubs(:anything_mounted?).returns(false) + @provider.stubs(:mounted?).returns(false) @provider.expects(:create) @ensure.should = :defined @ensure.sync @@ -121,7 +123,7 @@ describe Puppet::Type.type(:mount)::Ensure do it "should not unmount itself if it is mounted and should be defined" do @provider.stubs(:ensure).returns(:mounted) - @provider.stubs(:anything_mounted?).returns(true) + @provider.stubs(:mounted?).returns(true) @provider.stubs(:create) @provider.expects(:mount).never @@ -132,7 +134,7 @@ describe Puppet::Type.type(:mount)::Ensure do it "should not mount itself if it is unmounted and should be defined" do @provider.stubs(:ensure).returns(:unmounted) - @provider.stubs(:anything_mounted?).returns(false) + @provider.stubs(:mounted?).returns(false) @ensure.stubs(:syncothers) @provider.stubs(:create) @@ -144,7 +146,7 @@ describe Puppet::Type.type(:mount)::Ensure do it "should unmount itself if it is mounted and should be unmounted" do @provider.stubs(:ensure).returns(:present) - @provider.stubs(:anything_mounted?).returns(true) + @provider.stubs(:mounted?).returns(true) @ensure.stubs(:syncothers) @provider.expects(:unmount) @@ -152,14 +154,34 @@ describe Puppet::Type.type(:mount)::Ensure do @ensure.sync end - it "should ask the provider to mount itself" do + it "should create and mount itself if it does not exist and should be mounted" do + @provider.stubs(:ensure).returns(:absent) + @provider.stubs(:mounted?).returns(false) + @provider.expects(:create) + @ensure.stubs(:syncothers) + @provider.expects(:mount) + @ensure.should = :mounted + @ensure.sync + end + + it "should mount itself if it is present and should be mounted" do @provider.stubs(:ensure).returns(:present) + @provider.stubs(:mounted?).returns(false) @ensure.stubs(:syncothers) @provider.expects(:mount) @ensure.should = :mounted @ensure.sync end + it "should create but not mount itself if it is absent and mounted and should be mounted" do + @provider.stubs(:ensure).returns(:absent) + @provider.stubs(:mounted?).returns(true) + @ensure.stubs(:syncothers) + @provider.expects(:create) + @ensure.should = :mounted + @ensure.sync + end + it "should be insync if it is mounted and should be defined" do @ensure.should = :defined @ensure.safe_insync?(:mounted).should == true @@ -181,16 +203,17 @@ describe Puppet::Type.type(:mount)::Ensure do end end - describe "when responding to events" do + describe Puppet::Type.type(:mount), "when responding to events" do + it "should remount if it is currently mounted" do - @provider.expects(:anything_mounted?).returns(true) + @provider.expects(:mounted?).returns(true) @provider.expects(:remount) @mount.refresh end it "should not remount if it is not currently mounted" do - @provider.expects(:anything_mounted?).returns(false) + @provider.expects(:mounted?).returns(false) @provider.expects(:remount).never @mount.refresh @@ -218,8 +241,7 @@ describe Puppet::Type.type(:mount), "when modifying an existing mount entry" do @mount[param] = value end - @mount.provider.stubs(:anything_mounted?).returns true - @mount.provider.stubs(:correctly_mounted?).returns true + @mount.provider.stubs(:mounted?).returns true # stub this to not try to create state.yaml Puppet::Util::Storage.stubs(:store) -- cgit From 6f6c4b5f55d00df370f7d00a2499551e36aa880b Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Mon, 28 Feb 2011 09:55:19 -0800 Subject: (#6509) Inline docs: Fix broken code block in file type (content attribute) --- lib/puppet/type/file/content.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb index 63c0aaf4d..0e31f3099 100755 --- a/lib/puppet/type/file/content.rb +++ b/lib/puppet/type/file/content.rb @@ -17,19 +17,19 @@ module Puppet desc "Specify the contents of a file as a string. Newlines, tabs, and spaces can be specified using the escaped syntax (e.g., \\n for a newline). The primary purpose of this parameter is to provide a - kind of limited templating:: - - define resolve(nameserver1, nameserver2, domain, search) { - $str = \"search $search - domain $domain - nameserver $nameserver1 - nameserver $nameserver2 - \" - - file { \"/etc/resolv.conf\": - content => $str + kind of limited templating: + + define resolve(nameserver1, nameserver2, domain, search) { + $str = \"search $search + domain $domain + nameserver $nameserver1 + nameserver $nameserver2 + \" + + file { \"/etc/resolv.conf\": + content => $str + } } - } This attribute is especially useful when used with templating." -- cgit From f4034f76892b25b4a2e162f9229f2871c0a9d37c Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Mon, 28 Feb 2011 09:58:58 -0800 Subject: (#6509) Inline docs: fix broken code blocks in schedule.rb. --- lib/puppet/type/schedule.rb | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/puppet/type/schedule.rb b/lib/puppet/type/schedule.rb index 82f17e533..5fb008f6f 100755 --- a/lib/puppet/type/schedule.rb +++ b/lib/puppet/type/schedule.rb @@ -18,11 +18,11 @@ module Puppet wanted to restrict certain resources to only running once, between the hours of two and 4 AM, then you would use this schedule: - schedule { maint: - range => \"2 - 4\", - period => daily, - repeat => 1 - } + schedule { maint: + range => \"2 - 4\", + period => daily, + repeat => 1 + } With this schedule, the first time that Puppet runs between 2 and 4 AM, all resources with this schedule will get applied, but they won't @@ -35,10 +35,10 @@ module Puppet a schedule named *puppet* is created and used as the default, with the following attributes: - schedule { puppet: - period => hourly, - repeat => 2 - } + schedule { puppet: + period => hourly, + repeat => 2 + } This will cause resources to be applied every 30 minutes by default. " @@ -47,14 +47,14 @@ module Puppet desc "The name of the schedule. This name is used to retrieve the schedule when assigning it to an object: - schedule { daily: - period => daily, - range => \"2 - 4\", - } - - exec { \"/usr/bin/apt-get update\": - schedule => daily - } + schedule { daily: + period => daily, + range => \"2 - 4\", + } + + exec { \"/usr/bin/apt-get update\": + schedule => daily + } " isnamevar @@ -67,9 +67,9 @@ module Puppet seconds can be provided, using the normal colon as a separator. For instance: - schedule { maintenance: - range => \"1:30 - 4:30\" - } + schedule { maintenance: + range => \"1:30 - 4:30\" + } This is mostly useful for restricting certain resources to being applied in maintenance windows or during off-peak hours." -- cgit From 27863c3ab6d54bfa5d647770f35ef7ce10e1ac20 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Mon, 28 Feb 2011 10:21:03 -0800 Subject: (#6509) Inline docs: Fix code blocks in service type. --- lib/puppet/provider/service/daemontools.rb | 12 ++++++------ lib/puppet/provider/service/runit.rb | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/puppet/provider/service/daemontools.rb b/lib/puppet/provider/service/daemontools.rb index 65abf7728..bbb962a71 100644 --- a/lib/puppet/provider/service/daemontools.rb +++ b/lib/puppet/provider/service/daemontools.rb @@ -19,10 +19,10 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do or this can be overriden in the service resource parameters:: - service { - \"myservice\": - provider => \"daemontools\", path => \"/path/to/daemons\"; - } + service { \"myservice\": + provider => \"daemontools\", + path => \"/path/to/daemons\", + } This provider supports out of the box: @@ -31,10 +31,10 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do * restart * status - If a service has ensure => \"running\", it will link /path/to/daemon to + If a service has `ensure => \"running\"`, it will link /path/to/daemon to /path/to/service, which will automatically enable the service. - If a service has ensure => \"stopped\", it will only down the service, not + If a service has `ensure => \"stopped\"`, it will only down the service, not remove the /path/to/service link. " diff --git a/lib/puppet/provider/service/runit.rb b/lib/puppet/provider/service/runit.rb index 0315b9597..736e3db71 100644 --- a/lib/puppet/provider/service/runit.rb +++ b/lib/puppet/provider/service/runit.rb @@ -18,10 +18,10 @@ Puppet::Type.type(:service).provide :runit, :parent => :daemontools do or this can be overriden in the service resource parameters:: - service { - \"myservice\": - provider => \"runit\", path => \"/path/to/daemons\"; - } + service { \"myservice\": + provider => \"runit\", + path => \"/path/to/daemons\", + } This provider supports out of the box: -- cgit From c80a77d0d141cd933db3f4b124b992d767577f08 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Mon, 28 Feb 2011 10:30:19 -0800 Subject: (#6509) Inline docs: Fix broken code blocks in zpool type This one was subtle. If the first paragraph of a Markdown string embedded in a type isn't multiple lines, a code block immediately following it will not be recognized. So, hard-wrap or die, I guess. --- lib/puppet/type/zpool.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/puppet/type/zpool.rb b/lib/puppet/type/zpool.rb index df06522e8..40ee8f286 100755 --- a/lib/puppet/type/zpool.rb +++ b/lib/puppet/type/zpool.rb @@ -40,9 +40,10 @@ module Puppet end newproperty(:mirror, :array_matching => :all, :parent => Puppet::Property::MultiVDev) do - desc "List of all the devices to mirror for this pool. Each mirror should be a space separated string: + desc "List of all the devices to mirror for this pool. Each mirror should be a + space separated string: - mirror => [\"disk1 disk2\", \"disk3 disk4\"] + mirror => [\"disk1 disk2\", \"disk3 disk4\"], " @@ -52,9 +53,10 @@ module Puppet end newproperty(:raidz, :array_matching => :all, :parent => Puppet::Property::MultiVDev) do - desc "List of all the devices to raid for this pool. Should be an array of space separated strings: - - raidz => [\"disk1 disk2\", \"disk3 disk4\"] + desc "List of all the devices to raid for this pool. Should be an array of + space separated strings: + + raidz => [\"disk1 disk2\", \"disk3 disk4\"], " -- cgit From 94f8ead4efbd5909f1bb4f7e62cb5d705d55d381 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Mon, 28 Feb 2011 10:37:46 -0800 Subject: (#6509) Inline docs: Fix broken lists in Launchd provider. Lists need a leading linebreak. --- lib/puppet/provider/service/launchd.rb | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/puppet/provider/service/launchd.rb b/lib/puppet/provider/service/launchd.rb index 1632edabf..07c549a8b 100644 --- a/lib/puppet/provider/service/launchd.rb +++ b/lib/puppet/provider/service/launchd.rb @@ -3,33 +3,36 @@ require 'facter/util/plist' Puppet::Type.type(:service).provide :launchd, :parent => :base do desc "launchd service management framework. - This provider manages launchd jobs, the default service framework for - Mac OS X, that has also been open sourced by Apple for possible use on - other platforms. + This provider manages jobs with launchd, which is the default service framework for + Mac OS X and is potentially available for use on other platforms. See: + * http://developer.apple.com/macosx/launchd.html * http://launchd.macosforge.org/ This provider reads plists out of the following directories: + * /System/Library/LaunchDaemons * /System/Library/LaunchAgents * /Library/LaunchDaemons * /Library/LaunchAgents - and builds up a list of services based upon each plists \"Label\" entry. + ...and builds up a list of services based upon each plist's \"Label\" entry. This provider supports: + * ensure => running/stopped, * enable => true/false * status * restart Here is how the Puppet states correspond to launchd states: - * stopped => job unloaded - * started => job loaded - * enabled => 'Disable' removed from job plist file - * disabled => 'Disable' added to job plist file + + * stopped --- job unloaded + * started --- job loaded + * enabled --- 'Disable' removed from job plist file + * disabled --- 'Disable' added to job plist file Note that this allows you to do something launchctl can't do, which is to be in a state of \"stopped/enabled\ or \"running/disabled\". -- cgit From ea9f1f05934403b8d70e903efbb941ce74961b86 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Mon, 28 Feb 2011 10:58:53 -0800 Subject: Maint: Rewrite comments about symlinks to reflect best practice. Don't use ensure => 'path/to/file', because it's hard to read. Use ensure => link and specify a target =>. --- lib/puppet/type/file/ensure.rb | 28 +++++++++++----------------- lib/puppet/type/file/target.rb | 15 ++++++++++++++- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/lib/puppet/type/file/ensure.rb b/lib/puppet/type/file/ensure.rb index 4a68551ee..99652ecc6 100755 --- a/lib/puppet/type/file/ensure.rb +++ b/lib/puppet/type/file/ensure.rb @@ -7,29 +7,23 @@ module Puppet if the file is missing will create an empty file. Specifying `absent` will delete the file (and directory if recurse => true). - Anything other than those values will be considered to be a symlink. - For instance, the following text creates a link: + Anything other than those values will create a symlink. In the interest of readability and clarity, you should use `ensure => link` and explicitly specify a + target; however, if a `target` attribute isn't provided, the value of the `ensure` + attribute will be used as the symlink target: - # Useful on solaris + # (Useful on Solaris) + # Less maintainable: file { \"/etc/inetd.conf\": - ensure => \"/etc/inet/inetd.conf\" + ensure => \"/etc/inet/inetd.conf\", } - You can make relative links: - - # Useful on solaris + # More maintainable: file { \"/etc/inetd.conf\": - ensure => \"inet/inetd.conf\" + ensure => link, + target => \"/etc/inet/inetd.conf\", } - - If you need to make a relative link to a file named the same - as one of the valid values, you must prefix it with `./` or - something similar. - - You can also make recursive symlinks, which will create a - directory structure that maps to the target directory, - with directories corresponding to each directory - and links corresponding to each file." + + These two declarations are equivalent." # Most 'ensure' properties have a default, but with files we, um, don't. nodefault diff --git a/lib/puppet/type/file/target.rb b/lib/puppet/type/file/target.rb index b9fe9213b..7d391e672 100644 --- a/lib/puppet/type/file/target.rb +++ b/lib/puppet/type/file/target.rb @@ -1,7 +1,20 @@ module Puppet Puppet::Type.type(:file).newproperty(:target) do desc "The target for creating a link. Currently, symlinks are the - only type supported." + only type supported. + + You can make relative links: + + # (Useful on Solaris) + file { \"/etc/inetd.conf\": + ensure => link, + target => \"inet/inetd.conf\", + } + + You can also make recursive symlinks, which will create a + directory structure that maps to the target directory, + with directories corresponding to each directory + and links corresponding to each file." newvalue(:notlink) do # We do nothing if the value is absent -- cgit From 65a5496754fcdf938bda96a42b83255a310d193b Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Mon, 28 Feb 2011 11:05:37 -0800 Subject: (#6509) Inline docs: Fix erroneous code block in directoryservice provider for computer type --- lib/puppet/provider/computer/computer.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/puppet/provider/computer/computer.rb b/lib/puppet/provider/computer/computer.rb index a6be6bdfe..dd055beb3 100644 --- a/lib/puppet/provider/computer/computer.rb +++ b/lib/puppet/provider/computer/computer.rb @@ -10,9 +10,7 @@ Puppet::Type.type(:computer).provide :directoryservice, :parent => Puppet::Provi domain, not in remote directories. If you wish to manage /etc/hosts on Mac OS X, then simply use the host - type as per other platforms. - - " + type as per other platforms." confine :operatingsystem => :darwin defaultfor :operatingsystem => :darwin -- cgit From e2a50858aa05b63a6573ed534f18942cea47e44d Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Mon, 28 Feb 2011 11:09:15 -0800 Subject: Maint: Align tabs in a code block in the Augeas type. --- lib/puppet/type/augeas.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/puppet/type/augeas.rb b/lib/puppet/type/augeas.rb index d29bda648..a8fb1f15f 100644 --- a/lib/puppet/type/augeas.rb +++ b/lib/puppet/type/augeas.rb @@ -98,10 +98,10 @@ Puppet::Type.newtype(:augeas) do can be either a string which contains a command or an array of commands. Commands supported are: - set [PATH] [VALUE] Sets the value VALUE at loction PATH - rm [PATH] Removes the node at location PATH - remove [PATH] Synonym for rm - clear [PATH] Keeps the node at PATH, but removes the value. + set [PATH] [VALUE] Sets the value VALUE at loction PATH + rm [PATH] Removes the node at location PATH + remove [PATH] Synonym for rm + clear [PATH] Keeps the node at PATH, but removes the value. ins [LABEL] [WHERE] [PATH] Inserts an empty node LABEL either [WHERE={before|after}] PATH. insert [LABEL] [WHERE] [PATH] Synonym for ins -- cgit From bb69011d7042454f6a2ee668a036ac373b4ff1eb Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Thu, 24 Feb 2011 11:43:02 -0800 Subject: (#6338) Remove unused version control tags Older version control systems like CVS and SVN used to use these $Id$ tags for version information. Paired-with: Nick Lewis --- conf/solaris/smf/svc-puppetd | 2 -- conf/solaris/smf/svc-puppetmasterd | 2 -- examples/etc/init.d/sleeper | 2 -- lib/puppet/external/nagios.rb | 2 -- lib/puppet/external/nagios/base.rb | 2 -- lib/puppet/parser/grammar.ra | 3 --- lib/puppet/provider/service/gentoo.rb | 2 -- lib/puppet/rails/fact_name.rb | 2 -- lib/puppet/rails/fact_value.rb | 2 -- lib/puppet/type/k5login.rb | 2 -- test/Rakefile | 2 -- 11 files changed, 23 deletions(-) diff --git a/conf/solaris/smf/svc-puppetd b/conf/solaris/smf/svc-puppetd index b6cf05736..8acc19cfa 100755 --- a/conf/solaris/smf/svc-puppetd +++ b/conf/solaris/smf/svc-puppetd @@ -62,5 +62,3 @@ status) fi esac exit 0 - -# $Id$ diff --git a/conf/solaris/smf/svc-puppetmasterd b/conf/solaris/smf/svc-puppetmasterd index 80e3d464a..683324dec 100755 --- a/conf/solaris/smf/svc-puppetmasterd +++ b/conf/solaris/smf/svc-puppetmasterd @@ -58,5 +58,3 @@ status) fi esac exit 0 - -# $Id$ diff --git a/examples/etc/init.d/sleeper b/examples/etc/init.d/sleeper index 63f7e9c2e..c60a5555c 100755 --- a/examples/etc/init.d/sleeper +++ b/examples/etc/init.d/sleeper @@ -1,7 +1,5 @@ #!/bin/bash -# $Id$ - script=$0 path=`echo $script | sed 's/etc..*/bin/'` diff --git a/lib/puppet/external/nagios.rb b/lib/puppet/external/nagios.rb index 6b8852ee5..2ed829198 100755 --- a/lib/puppet/external/nagios.rb +++ b/lib/puppet/external/nagios.rb @@ -3,8 +3,6 @@ #-------------------- # A script to retrieve hosts from ldap and create an importable # cfservd file from them -# -# $Id: nagios.rb,v 1.3 2004/06/09 20:32:46 luke Exp $ require 'digest/md5' #require 'ldap' diff --git a/lib/puppet/external/nagios/base.rb b/lib/puppet/external/nagios/base.rb index ac1d25e2e..e98760e01 100755 --- a/lib/puppet/external/nagios/base.rb +++ b/lib/puppet/external/nagios/base.rb @@ -470,5 +470,3 @@ class Nagios::Base end end - -# $Id$ diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index 6360f5064..5e25b9d6c 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -874,6 +874,3 @@ require 'puppet/parser/parser_support' # Local Variables: # mode: ruby # End: - -# $Id$ - diff --git a/lib/puppet/provider/service/gentoo.rb b/lib/puppet/provider/service/gentoo.rb index 382c74267..20f5d77e6 100644 --- a/lib/puppet/provider/service/gentoo.rb +++ b/lib/puppet/provider/service/gentoo.rb @@ -48,5 +48,3 @@ Puppet::Type.type(:service).provide :gentoo, :parent => :init do raise Puppet::Error, "Could not enable #{self.name}: #{output}" end end - -# $Id $ diff --git a/lib/puppet/rails/fact_name.rb b/lib/puppet/rails/fact_name.rb index fb40ec48f..4273399e5 100644 --- a/lib/puppet/rails/fact_name.rb +++ b/lib/puppet/rails/fact_name.rb @@ -3,5 +3,3 @@ require 'puppet/rails/fact_value' class Puppet::Rails::FactName < ActiveRecord::Base has_many :fact_values, :dependent => :destroy end - -# $Id: fact_name.rb 1952 2006-12-19 05:47:57Z luke $ diff --git a/lib/puppet/rails/fact_value.rb b/lib/puppet/rails/fact_value.rb index 45a88b2dc..9fd81ae1c 100644 --- a/lib/puppet/rails/fact_value.rb +++ b/lib/puppet/rails/fact_value.rb @@ -6,5 +6,3 @@ class Puppet::Rails::FactValue < ActiveRecord::Base "#{self.fact_name.name}" end end - -# $Id: fact_value.rb 1952 2006-12-19 05:47:57Z luke $ diff --git a/lib/puppet/type/k5login.rb b/lib/puppet/type/k5login.rb index a343e9e5c..eac142ff7 100644 --- a/lib/puppet/type/k5login.rb +++ b/lib/puppet/type/k5login.rb @@ -1,5 +1,3 @@ -# $Id: k5login.rb 2468 2007-08-07 23:30:20Z digant $ -# # Plug-in type for handling k5login files Puppet::Type.newtype(:k5login) do diff --git a/test/Rakefile b/test/Rakefile index 47be213d9..7cde050f6 100644 --- a/test/Rakefile +++ b/test/Rakefile @@ -94,5 +94,3 @@ filemap.each do |dir, files| # And alias it with a slash on the end task(dir + "/" => dir) end - -# $Id$ -- cgit From 743e03930758d17ed35fc6b73f7c2c68d8212137 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Mon, 28 Feb 2011 13:40:18 -0800 Subject: (#4922) Don't truncate remotely-sourced files on 404 We were 'handling' 404's on remote file content retrieval by returning nil rather than raising an exception. This caused no content to be written to the temporary file, but still appeared successful, so the destination file was overwritten, instead of preserved. Now we just handle 404 like any other error. Note that the root cause of these 404s seems to have been #4319, which has been fixed. However, in the event we do happen to get a 404 here, it's better not to have code to specifically handle it incorrectly. Paired-With: Max Martin Reviewed-By: Matt Robinson --- lib/puppet/type/file/content.rb | 1 - spec/unit/type/file/content_spec.rb | 175 ++++++++---------------------------- 2 files changed, 38 insertions(+), 138 deletions(-) diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb index 63c0aaf4d..1b36acb54 100755 --- a/lib/puppet/type/file/content.rb +++ b/lib/puppet/type/file/content.rb @@ -194,7 +194,6 @@ module Puppet connection = Puppet::Network::HttpPool.http_instance(source_or_content.server, source_or_content.port) connection.request_get(indirection2uri(request), add_accept_encoding({"Accept" => "raw"})) do |response| case response.code - when "404"; nil when /^2/; uncompress(response) { |uncompressor| response.read_body { |chunk| yield uncompressor.uncompress(chunk) } } else # Raise the http error if we didn't get a 'success' of some kind. diff --git a/spec/unit/type/file/content_spec.rb b/spec/unit/type/file/content_spec.rb index 9178c94bf..7d23399cf 100755 --- a/spec/unit/type/file/content_spec.rb +++ b/spec/unit/type/file/content_spec.rb @@ -4,15 +4,14 @@ Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f content = Puppet::Type.type(:file).attrclass(:content) describe content do + include PuppetSpec::Files before do - @resource = Puppet::Type.type(:file).new :path => "/foo/bar" + @filename = tmpfile('testfile') + @resource = Puppet::Type.type(:file).new :path => @filename + File.open(@filename, 'w') {|f| f.write "initial file content"} content.stubs(:standalone?).returns(false) end - it "should be a subclass of Property" do - content.superclass.must == Puppet::Property - end - describe "when determining the checksum type" do it "should use the type specified in the source checksum if a source is set" do @resource[:source] = "/foo" @@ -249,10 +248,10 @@ describe content do describe "when writing" do before do @content = content.new(:resource => @resource) - @fh = stub_everything end it "should attempt to read from the filebucket if no actual content nor source exists" do + @fh = File.open(@filename, 'w') @content.should = "{md5}foo" @content.resource.bucket.class.any_instance.stubs(:getfile).returns "foo" @content.write(@fh) @@ -302,166 +301,68 @@ describe content do describe "from local source" do before(:each) do - @content.stubs(:actual_content).returns(nil) - @source = stub_everything 'source', :local? => true, :full_path => "/path/to/source" - @resource.stubs(:parameter).with(:source).returns @source - - @sum = stub_everything 'sum' - @resource.stubs(:parameter).with(:checksum).returns(@sum) - - @digest = stub_everything 'digest' - @sum.stubs(:sum_stream).yields(@digest) - - @file = stub_everything 'file' - File.stubs(:open).yields(@file) - @file.stubs(:read).with(8192).returns("chunk1").then.returns("chunk2").then.returns(nil) - end - - it "should open the local file" do - File.expects(:open).with("/path/to/source", "r") - @content.write(@fh) - end + @resource = Puppet::Type.type(:file).new :path => @filename, :backup => false + @sourcename = tmpfile('source') + @source_content = "source file content"*10000 + @sourcefile = File.open(@sourcename, 'w') {|f| f.write @source_content} - it "should read the local file by chunks" do - @file.expects(:read).with(8192).returns("chunk1").then.returns(nil) - @content.write(@fh) + @content = @resource.newattr(:content) + @source = @resource.newattr(:source) + @source.stubs(:metadata).returns stub_everything('metadata', :source => @sourcename, :ftype => 'file') end - it "should write each chunk to the file" do - @fh.expects(:print).with("chunk1").then.with("chunk2") - @content.write(@fh) - end - - it "should pass each chunk to the current sum stream" do - @digest.expects(:<<).with("chunk1").then.with("chunk2") - @content.write(@fh) + it "should copy content from the source to the file" do + @resource.write(@source) + File.read(@filename).should == @source_content end it "should return the checksum computed" do - @sum.stubs(:sum_stream).yields(@digest).returns("checksum") - @content.write(@fh).should == "checksum" + File.open(@filename, 'w') do |file| + @content.write(file).should == "{md5}#{Digest::MD5.hexdigest(@source_content)}" + end end end describe "from remote source" do before(:each) do - @response = stub_everything 'mock response', :code => "404" + @resource = Puppet::Type.type(:file).new :path => @filename, :backup => false + @response = stub_everything 'response', :code => "200" + @source_content = "source file content"*10000 + @response.stubs(:read_body).multiple_yields(*(["source file content"]*10000)) + @conn = stub_everything 'connection' @conn.stubs(:request_get).yields(@response) Puppet::Network::HttpPool.stubs(:http_instance).returns @conn - @content.stubs(:actual_content).returns(nil) - @source = stub_everything 'source', :local? => false, :full_path => "/path/to/source", :server => "server", :port => 1234 - @resource.stubs(:parameter).with(:source).returns @source - - @sum = stub_everything 'sum' - @resource.stubs(:parameter).with(:checksum).returns(@sum) - - @digest = stub_everything 'digest' - @sum.stubs(:sum_stream).yields(@digest) - end - - it "should open a network connection to source server and port" do - Puppet::Network::HttpPool.expects(:http_instance).with("server", 1234).returns @conn - @content.write(@fh) - end - - it "should send the correct indirection uri" do - @conn.expects(:request_get).with { |uri,headers| uri == "/production/file_content/path/to/source" }.yields(@response) - @content.write(@fh) + @content = @resource.newattr(:content) + @sourcename = "puppet:///test/foo" + @source = @resource.newattr(:source) + @source.stubs(:metadata).returns stub_everything('metadata', :source => @sourcename, :ftype => 'file') end - it "should return nil if source is not found" do - @response.expects(:code).returns("404") - @content.write(@fh).should == nil + it "should write the contents to the file" do + @resource.write(@source) + File.read(@filename).should == @source_content end it "should not write anything if source is not found" do - @response.expects(:code).returns("404") - @fh.expects(:print).never - @content.write(@fh).should == nil + @response.stubs(:code).returns("404") + lambda {@resource.write(@source)}.should raise_error(Net::HTTPError) { |e| e.message =~ /404/ } + File.read(@filename).should == "initial file content" end it "should raise an HTTP error in case of server error" do - @response.expects(:code).returns("500") - lambda { @content.write(@fh) }.should raise_error - end - - it "should write content by chunks" do - @response.expects(:code).returns("200") - @response.expects(:read_body).multiple_yields("chunk1","chunk2") - @fh.expects(:print).with("chunk1").then.with("chunk2") - @content.write(@fh) - end - - it "should pass each chunk to the current sum stream" do - @response.expects(:code).returns("200") - @response.expects(:read_body).multiple_yields("chunk1","chunk2") - @digest.expects(:<<).with("chunk1").then.with("chunk2") - @content.write(@fh) + @response.stubs(:code).returns("500") + lambda { @content.write(@fh) }.should raise_error { |e| e.message.include? @source_content } end it "should return the checksum computed" do - @response.expects(:code).returns("200") - @response.expects(:read_body).multiple_yields("chunk1","chunk2") - @sum.expects(:sum_stream).yields(@digest).returns("checksum") - @content.write(@fh).should == "checksum" - end - - it "should get the current accept encoding header value" do - @content.expects(:add_accept_encoding) - @content.write(@fh) - end - - it "should uncompress body on error" do - @response.expects(:code).returns("500") - @response.expects(:body).returns("compressed body") - @content.expects(:uncompress_body).with(@response).returns("uncompressed") - lambda { @content.write(@fh) }.should raise_error { |e| e.message =~ /uncompressed/ } - end - - it "should uncompress chunk by chunk" do - uncompressor = stub_everything 'uncompressor' - @content.expects(:uncompress).with(@response).yields(uncompressor) - @response.expects(:code).returns("200") - @response.expects(:read_body).multiple_yields("chunk1","chunk2") - - uncompressor.expects(:uncompress).with("chunk1").then.with("chunk2") - @content.write(@fh) - end - - it "should write uncompressed chunks to the file" do - uncompressor = stub_everything 'uncompressor' - @content.expects(:uncompress).with(@response).yields(uncompressor) - @response.expects(:code).returns("200") - @response.expects(:read_body).multiple_yields("chunk1","chunk2") - - uncompressor.expects(:uncompress).with("chunk1").returns("uncompressed1") - uncompressor.expects(:uncompress).with("chunk2").returns("uncompressed2") - - @fh.expects(:print).with("uncompressed1") - @fh.expects(:print).with("uncompressed2") - - @content.write(@fh) - end - - it "should pass each uncompressed chunk to the current sum stream" do - uncompressor = stub_everything 'uncompressor' - @content.expects(:uncompress).with(@response).yields(uncompressor) - @response.expects(:code).returns("200") - @response.expects(:read_body).multiple_yields("chunk1","chunk2") - - uncompressor.expects(:uncompress).with("chunk1").returns("uncompressed1") - uncompressor.expects(:uncompress).with("chunk2").returns("uncompressed2") - - @digest.expects(:<<).with("uncompressed1").then.with("uncompressed2") - @content.write(@fh) + File.open(@filename, 'w') do |file| + @content.write(file).should == "{md5}#{Digest::MD5.hexdigest(@source_content)}" + end end end - describe "from a filebucket" do - end - # These are testing the implementation rather than the desired behaviour; while that bites, there are a whole # pile of other methods in the File type that depend on intimate details of this implementation and vice-versa. # If these blow up, you are gonna have to review the callers to make sure they don't explode! --daniel 2011-02-01 -- cgit From 0eeeb5159f8c5130ce5090203283cb8ef5d68b94 Mon Sep 17 00:00:00 2001 From: Nigel Kersten Date: Mon, 28 Feb 2011 15:56:19 -0800 Subject: Update CHANGELOG for 2.6.5 --- CHANGELOG | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d12918c98..44d8d037a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,26 +1,24 @@ -2.6.5rc5 -======== +2.6.5 +===== +30fa41d Updated CHANGELOG for 2.6.5rc5 b481321 (#6337) Fix Ruby warning on 1.8.6 about "future compatibility" dcce45c (#6353) Restore the ability to store paths in the filebucket 0450197 (#6126) Puppet inspect now reports status after run completes. 960890f (#6364) Adjust mis-translated regex in mount provider for AIX - -2.6.5rc4 -======== +9e0f9c5 Updated CHANGELOG for 2.6.5rc4 664ef67 (#3646) Fix the documentation fix for `puppet apply --apply` - -2.6.5rc3 -======== +4b6519a Updated CHANGELOG for 2.6.5rc3 7ef2fbf Updated fix for #3646 - apply / compile documentation 193016d (#5977) fix spec test failure when new applications are introduced. - -2.6.5rc2 -======== +c08fc1b Updated CHANGELOG for 2.6.5rc2 1f89906 (#6257) Speed up PUT and POST requests under rack -7b3b56e (5977) Puppet::Applications can be loaded from multiple paths. - -2.6.5rc1 -======== +70a43c4 Updated CHANGELOG and version for 2.6.5rc1 +f108f03 (#6018) Nick F's --help text for puppet inspect. +04ea826 (#5823) document the not-an-API status of set_run_mode +4ff5769 (#5823) run mode can now be set dynamically... +bddfa1e (6114) Update the audit metaparameter for 2.6.5. +ac8d316 Fix for #5755 -- making zaml serialization robust over projected objects +c912a2a (#4139) hook log autoflush into global defaults f9e2e2b Augmentation of tests for prior commit 392504a Fix to fix for #5755 -- backref serialization issues in zaml a732a15 Fixed #5564 - Added some more fqdn_rand documentation @@ -66,6 +64,7 @@ ae48634 Fixed #5914 Removed genconfig = true from genconfig output e58f5dc Fixed #5742 - Removed legacy fqdn option from documentation 4d1b51f Fixed #5167 - misleading documentation in the defaults of [main] c1b5c7f (#5913) Fix Puppet::Application.find constant lookup behavior +7b3b56e (5977) Puppet::Applications can be loaded from multiple paths. f9bfb96 (#5900) Include ResourceStatus#failed in serialized reports 79b6332 (#5882) Added error-handling for bucketing files in puppet inspect 17843d5 (#5882) Added error-handling to puppet inspect when auditing -- cgit From 24eacb7fe6696a8c049b08ec382c5d1ab114ce67 Mon Sep 17 00:00:00 2001 From: Nan Liu Date: Tue, 1 Feb 2011 18:34:23 -0800 Subject: (#5466) Fixed puppet resource bug with trailing , --- lib/puppet/resource.rb | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index e832804f5..a71675e11 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -255,15 +255,26 @@ class Puppet::Resource # Convert our resource to Puppet code. def to_manifest - "%s { '%s':\n%s\n}" % [self.type.to_s.downcase, self.title, - @parameters.collect { |p, v| - if v.is_a? Array - " #{p} => [\'#{v.join("','")}\']" - else - " #{p} => \'#{v}\'" - end - }.join(",\n") - ] + # Collect list of attributes to align => and move ensure first + attr = @parameters.keys + attr_max = attr.inject(0) { |max,k| k.to_s.length > max ? k.to_s.length : max } + + attr.sort! + if attr.first != :ensure && attr.include?(:ensure) + attr.delete(:ensure) + attr.unshift(:ensure) + end + + attributes = attr.collect { |k| + v = @parameters[k] + if v.is_a? Array + " %-#{attr_max}s => %s,\n" % [ k, "[\'#{v.join("', '")}\']" ] + else + " %-#{attr_max}s => %s,\n" % [ k, "\'#{v}\'" ] + end + } + + "%s { '%s':\n%s}" % [self.type.to_s.downcase, self.title, attributes] end def to_ref -- cgit From 8cc390caa18e3b536869f0591d529d8ade76fc49 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Mon, 28 Feb 2011 16:37:22 -0800 Subject: (#5466) Monkey patch Symbol so that you can sort them It turns out that the ability to sort symbols comes in the preinit section of application run when we load Facter and hit the code that adds the <=> method for symbols in lib/facter/util/plist/generator.rb Reviewed-by: Nick Lewis --- lib/puppet/util/monkey_patches.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index 85854a04c..16384855a 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -21,6 +21,9 @@ class Symbol z.emit("!ruby/sym ") to_s.to_zaml(z) end + def <=> (other) + self.to_s <=> other.to_s + end end [Object, Exception, Integer, Struct, Date, Time, Range, Regexp, Hash, Array, Float, String, FalseClass, TrueClass, Symbol, NilClass, Class].each { |cls| -- cgit From 422399b47764e29055974ff5bad5dfcb982a8b74 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Mon, 28 Feb 2011 16:55:18 -0800 Subject: (#5466) Write specs for output of puppet resource Reviewed-by: Nick Lewis --- spec/unit/resource_spec.rb | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index ff31b2492..eaa3d5519 100755 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -99,11 +99,11 @@ describe Puppet::Resource do end it 'should fail if strict is set and type does not exist' do - lambda { Puppet::Resource.new('foo', 'title', {:strict=>true}) }.should raise_error(ArgumentError, 'Invalid resource type foo') + lambda { Puppet::Resource.new('foo', 'title', {:strict=>true}) }.should raise_error(ArgumentError, 'Invalid resource type foo') end it 'should fail if strict is set and class does not exist' do - lambda { Puppet::Resource.new('Class', 'foo', {:strict=>true}) }.should raise_error(ArgumentError, 'Could not find declared class foo') + lambda { Puppet::Resource.new('Class', 'foo', {:strict=>true}) }.should raise_error(ArgumentError, 'Could not find declared class foo') end it "should fail if the title is a hash and the type is not a valid resource reference string" do @@ -486,19 +486,23 @@ describe Puppet::Resource do describe "when converting to puppet code" do before do - @resource = Puppet::Resource.new("one::two", "/my/file", :parameters => {:noop => true, :foo => %w{one two}}) - end - - it "should print the type and title" do - @resource.to_manifest.should be_include("one::two { '/my/file':\n") - end - - it "should print each parameter, with the value single-quoted" do - @resource.to_manifest.should be_include(" noop => 'true'") + @resource = Puppet::Resource.new("one::two", "/my/file", + :parameters => { + :noop => true, + :foo => %w{one two}, + :ensure => 'present', + } + ) end - it "should print array values appropriately" do - @resource.to_manifest.should be_include(" foo => ['one','two']") + it "should align, sort and add trailing commas to attributes with ensure first" do + @resource.to_manifest.should == <<-HEREDOC.gsub(/^\s{8}/, '').gsub(/\n$/, '') + one::two { '/my/file': + ensure => 'present', + foo => ['one', 'two'], + noop => 'true', + } + HEREDOC end end -- cgit From 026eba3a7b568e6ef7c8ea8032ea49c65dfd8295 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Tue, 1 Mar 2011 11:38:02 -0800 Subject: Revert #5691 "Merge remote branch 'brice/feature/process-instrumentation' into next" This reverts commit 448a439f5abc3d51accececb678e9c5f547f7615, reversing changes made to 06939c51a3f675137b53fac8a521132a4c9cfcbe. As per discussion in http://projects.puppetlabs.com/issues/5691#note-5 --- lib/puppet/configurer.rb | 25 +-- lib/puppet/network/http/handler.rb | 6 +- lib/puppet/parser/compiler.rb | 6 +- lib/puppet/transaction.rb | 9 +- lib/puppet/util/instrumentation.rb | 12 -- lib/puppet/util/instrumentation/process_name.rb | 129 ------------- .../unit/util/instrumentation/process_name_spec.rb | 207 --------------------- 7 files changed, 10 insertions(+), 384 deletions(-) delete mode 100644 lib/puppet/util/instrumentation.rb delete mode 100644 lib/puppet/util/instrumentation/process_name.rb delete mode 100644 spec/unit/util/instrumentation/process_name_spec.rb diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index a39f9cda8..72e387c64 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -3,7 +3,6 @@ require 'sync' require 'timeout' require 'puppet/network/http_pool' require 'puppet/util' -require 'puppet/util/instrumentation' class Puppet::Configurer class CommandHookError < RuntimeError; end @@ -13,7 +12,6 @@ class Puppet::Configurer include Puppet::Configurer::FactHandler include Puppet::Configurer::PluginHandler - include Puppet::Util::Instrumentation # For benchmarking include Puppet::Util @@ -78,17 +76,11 @@ class Puppet::Configurer def prepare(options) dostorage - instrument("downloading plugins") do - download_plugins unless options[:skip_plugin_download] - end + download_plugins unless options[:skip_plugin_download] - instrument("downloading facts plugins") do - download_fact_plugins unless options[:skip_plugin_download] - end + download_fact_plugins unless options[:skip_plugin_download] - instrument("executing prerun command") do - execute_prerun_command - end + execute_prerun_command end # Get the remote catalog, yo. Returns nil if no catalog can be found. @@ -154,10 +146,8 @@ class Puppet::Configurer transaction = nil begin - instrument("applying catalog") do - benchmark(:notice, "Finished catalog run") do - transaction = catalog.apply(options) - end + benchmark(:notice, "Finished catalog run") do + transaction = catalog.apply(options) end report rescue => detail @@ -176,10 +166,7 @@ class Puppet::Configurer execute_postrun_command Puppet::Util::Log.close(report) - - instrument("sending report") do - send_report(report, transaction) - end + send_report(report, transaction) end def send_report(report, trans) diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb index aa33f82f7..2b9e81b61 100644 --- a/lib/puppet/network/http/handler.rb +++ b/lib/puppet/network/http/handler.rb @@ -5,12 +5,10 @@ require 'puppet/network/http/api/v1' require 'puppet/network/rest_authorization' require 'puppet/network/rights' require 'resolv' -require 'puppet/util/instrumentation' module Puppet::Network::HTTP::Handler include Puppet::Network::HTTP::API::V1 include Puppet::Network::RestAuthorization - include Puppet::Util::Instrumentation attr_reader :server, :handler @@ -67,9 +65,7 @@ module Puppet::Network::HTTP::Handler check_authorization(indirection, method, key, params) - instrument("processing #{indirection} #{key}") do - send("do_#{method}", indirection, key, params, request, response) - end + send("do_#{method}", indirection, key, params, request, response) rescue SystemExit,NoMemoryError raise rescue Exception => e diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index 4301e8c0f..fdabd05c9 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -4,7 +4,6 @@ require 'puppet/node' require 'puppet/resource/catalog' require 'puppet/util/errors' -require 'puppet/util/instrumentation' require 'puppet/resource/type_collection_helper' @@ -14,12 +13,9 @@ class Puppet::Parser::Compiler include Puppet::Util include Puppet::Util::Errors include Puppet::Resource::TypeCollectionHelper - extend Puppet::Util::Instrumentation def self.compile(node) - instrument("compiling #{node.name}") do - new(node).compile.to_resource - end + new(node).compile.to_resource rescue => detail puts detail.backtrace if Puppet[:trace] raise Puppet::Error, "#{detail} on node #{node.name}" diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index df4c8b27d..eba601cfe 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -4,11 +4,8 @@ require 'puppet' require 'puppet/util/tagging' require 'puppet/application' -require 'puppet/util/instrumentation' class Puppet::Transaction - include Puppet::Util::Instrumentation - require 'puppet/transaction/event' require 'puppet/transaction/event_manager' require 'puppet/transaction/resource_harness' @@ -141,10 +138,8 @@ class Puppet::Transaction next end ret = nil - instrument("evaluating #{resource}") do - seconds = thinmark do - ret = eval_resource(resource) - end + seconds = thinmark do + ret = eval_resource(resource) end resource.info "Evaluated in %0.2f seconds" % seconds if Puppet[:evaltrace] and @catalog.host_config? diff --git a/lib/puppet/util/instrumentation.rb b/lib/puppet/util/instrumentation.rb deleted file mode 100644 index 5981bea59..000000000 --- a/lib/puppet/util/instrumentation.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'puppet/util/instrumentation/process_name' - -module Puppet::Util::Instrumentation - - def instrument(title) - Puppet::Util::Instrumentation::ProcessName.instrument(title) do - yield - end - end - module_function :instrument - -end \ No newline at end of file diff --git a/lib/puppet/util/instrumentation/process_name.rb b/lib/puppet/util/instrumentation/process_name.rb deleted file mode 100644 index 370d29e2e..000000000 --- a/lib/puppet/util/instrumentation/process_name.rb +++ /dev/null @@ -1,129 +0,0 @@ -require 'puppet' -require 'puppet/util/instrumentation' - -module Puppet::Util::Instrumentation - class ProcessName - - # start scrolling when process name is longer than - SCROLL_LENGTH = 50 - - @active = false - class << self - attr_accessor :active, :reason - end - - trap(:QUIT) do - active? ? disable : enable - end - - def self.active? - !! @active - end - - def self.enable - mutex.synchronize do - Puppet.info("Process Name instrumentation is enabled") - @active = true - @x = 0 - setproctitle - end - end - - def self.disable - mutex.synchronize do - Puppet.info("Process Name instrumentation is disabled") - @active = false - $0 = @oldname - end - end - - def self.instrument(activity) - # inconditionnally start the scroller thread here - # because it doesn't seem possible to start a new thrad - # from the USR2 signal handler - @scroller ||= Thread.new do - loop do - scroll if active? - sleep 1 - end - end - - push_activity(Thread.current, activity) - yield - ensure - pop_activity(Thread.current) - end - - def self.setproctitle - @oldname ||= $0 - $0 = "#{base}: " + rotate(process_name,@x) if active? - end - - def self.push_activity(thread, activity) - mutex.synchronize do - @reason ||= {} - @reason[thread] ||= [] - @reason[thread].push(activity) - setproctitle - end - end - - def self.pop_activity(thread) - mutex.synchronize do - @reason[thread].pop - if @reason[thread].empty? - @reason.delete(thread) - end - setproctitle - end - end - - def self.process_name - out = (@reason || {}).inject([]) do |out, reason| - out << "#{thread_id(reason[0])} #{reason[1].join(',')}" - end - out.join(' | ') - end - - # certainly non-portable - def self.thread_id(thread) - thread.inspect.gsub(/^#<.*:0x([a-f0-9]+) .*>$/, '\1') - end - - def self.rotate(string, steps) - steps ||= 0 - if string.length > 0 && steps > 0 - steps = steps % string.length - return string[steps..string.length].concat " -- #{string[0..(steps-1)]}" - end - string - end - - def self.base - basename = case Puppet.run_mode.name - when :master - "master" - when :agent - "agent" - else - "puppet" - end - end - - def self.mutex - #Thread.exclusive { - @mutex ||= Sync.new - #} - @mutex - end - - def self.scroll - return if process_name.length < SCROLL_LENGTH - mutex.synchronize do - setproctitle - @x += 1 - end - end - - end -end \ No newline at end of file diff --git a/spec/unit/util/instrumentation/process_name_spec.rb b/spec/unit/util/instrumentation/process_name_spec.rb deleted file mode 100644 index 9cbedf2d2..000000000 --- a/spec/unit/util/instrumentation/process_name_spec.rb +++ /dev/null @@ -1,207 +0,0 @@ -#!/usr/bin/env ruby - -require File.dirname(__FILE__) + '/../../../spec_helper' - -describe Puppet::Util::Instrumentation::ProcessName do - - ProcessName = Puppet::Util::Instrumentation::ProcessName - - after(:each) do - ProcessName.reason = {} - end - - it "should be disabled by default" do - ProcessName.should_not be_active - end - - describe "when managing thread activity" do - before(:each) do - ProcessName.stubs(:setproctitle) - ProcessName.stubs(:base).returns("base") - end - - it "should be able to append activity" do - thread1 = stub 'thread1' - ProcessName.push_activity(:thread1,"activity1") - ProcessName.push_activity(:thread1,"activity2") - - ProcessName.reason[:thread1].should == ["activity1", "activity2"] - end - - it "should be able to remove activity" do - ProcessName.push_activity(:thread1,"activity1") - ProcessName.push_activity(:thread1,"activity1") - ProcessName.pop_activity(:thread1) - - ProcessName.reason[:thread1].should == ["activity1"] - end - - it "should maintain activity thread by thread" do - ProcessName.push_activity(:thread1,"activity1") - ProcessName.push_activity(:thread2,"activity2") - - ProcessName.reason[:thread1].should == ["activity1"] - ProcessName.reason[:thread2].should == ["activity2"] - end - - it "should set process title" do - ProcessName.expects(:setproctitle) - - ProcessName.push_activity("thread1","activity1") - end - end - - describe "when computing the current process name" do - before(:each) do - ProcessName.stubs(:setproctitle) - ProcessName.stubs(:base).returns("base") - end - - it "should include every running thread activity" do - thread1 = stub 'thread1', :inspect => "\#", :hash => 1 - thread2 = stub 'thread2', :inspect => "\#", :hash => 0 - - ProcessName.push_activity(thread1,"Compiling node1.domain.com") - ProcessName.push_activity(thread2,"Compiling node4.domain.com") - ProcessName.push_activity(thread1,"Parsing file site.pp") - ProcessName.push_activity(thread2,"Parsing file node.pp") - - ProcessName.process_name.should == "12344321 Compiling node4.domain.com,Parsing file node.pp | deadbeef Compiling node1.domain.com,Parsing file site.pp" - end - end - - describe "when finding base process name" do - {:master => "master", :agent => "agent", :user => "puppet"}.each do |program,base| - it "should return #{base} for #{program}" do - Puppet.run_mode.stubs(:name).returns(program) - ProcessName.base.should == base - end - end - end - - describe "when finding a thread id" do - it "should return the id from the thread inspect string" do - thread = stub 'thread', :inspect => "\#" - ProcessName.thread_id(thread).should == "1234abdc" - end - end - - describe "when scrolling the instrumentation string" do - it "should rotate the string of various step" do - ProcessName.rotate("this is a rotation", 10).should == "rotation -- this is a " - end - - it "should not rotate the string for the 0 offset" do - ProcessName.rotate("this is a rotation", 0).should == "this is a rotation" - end - end - - describe "when setting process name" do - before(:each) do - ProcessName.stubs(:process_name).returns("12345 activity") - ProcessName.stubs(:base).returns("base") - @oldname = $0 - end - - after(:each) do - $0 = @oldname - end - - it "should not do it if the feature is disabled" do - ProcessName.setproctitle - - $0.should_not == "base: 12345 activity" - end - - it "should do it if the feature is enabled" do - ProcessName.active = true - ProcessName.setproctitle - - $0.should == "base: 12345 activity" - end - end - - describe "when setting a probe" do - before(:each) do - thread = stub 'thread', :inspect => "\#" - Thread.stubs(:current).returns(thread) - Thread.stubs(:new) - ProcessName.active = true - end - - it "should start the scroller thread" do - Thread.expects(:new) - ProcessName.instrument("doing something") do - end - end - - it "should push current thread activity and execute the block" do - ProcessName.instrument("doing something") do - $0.should == "puppet: 1234abdc doing something" - end - end - - it "should finally pop the activity" do - ProcessName.instrument("doing something") do - end - $0.should == "puppet: " - end - end - - describe "when enabling" do - before do - Thread.stubs(:new) - ProcessName.stubs(:setproctitle) - end - - it "should be active" do - ProcessName.enable - ProcessName.should be_active - end - - it "should set the new process name" do - ProcessName.expects(:setproctitle) - ProcessName.enable - end - end - - describe "when disabling" do - it "should set active to false" do - ProcessName.active = true - ProcessName.disable - ProcessName.should_not be_active - end - - it "should restore the old process name" do - oldname = $0 - ProcessName.active = true - ProcessName.setproctitle - ProcessName.disable - $0.should == oldname - end - end - - describe "when scrolling" do - it "should do nothing for shorter process names" do - ProcessName.expects(:setproctitle).never - ProcessName.scroll - end - - it "should call setproctitle" do - ProcessName.stubs(:process_name).returns("x" * 60) - ProcessName.expects(:setproctitle) - ProcessName.scroll - end - - it "should increment rotation offset" do - name = "x" * 60 - ProcessName.active = true - ProcessName.stubs(:process_name).returns(name) - ProcessName.expects(:rotate).once.with(name,1).returns("") - ProcessName.expects(:rotate).once.with(name,2).returns("") - ProcessName.scroll - ProcessName.scroll - end - end - -end \ No newline at end of file -- cgit From b1d97284d0fea1cbcc52bc55117a4b1ad3cf385b Mon Sep 17 00:00:00 2001 From: Devon Peters Date: Tue, 14 Dec 2010 14:05:55 -0800 Subject: (#5496) zpool provider supports new 'zpool status' format The "Solaris 10 9/10 release (Update 9)" update changed the output from the "zpool status" command, which breaks the zpool provider. The format basically changed from "vdev" to "vdev-n" (ex: "mirror" to "mirror-0"), which the current provider doesn't recognize. This fix changes the way vdev's are checked by the zpool provider, to support either format. Reviewed-By: Nick Lewis --- lib/puppet/provider/zpool/solaris.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/puppet/provider/zpool/solaris.rb b/lib/puppet/provider/zpool/solaris.rb index e597c2ae1..758ea618a 100644 --- a/lib/puppet/provider/zpool/solaris.rb +++ b/lib/puppet/provider/zpool/solaris.rb @@ -19,11 +19,13 @@ Puppet::Type.type(:zpool).provide(:solaris) do pool_array.reverse.each do |value| sym = nil case value - when "spares"; sym = :spare - when "logs"; sym = :log - when "mirror", "raidz1", "raidz2" - sym = value == "mirror" ? :mirror : :raidz - pool[:raid_parity] = "raidz2" if value == "raidz2" + when "spares"; + sym = :spare + when "logs"; + sym = :log + when /^mirror|^raidz1|^raidz2/; + sym = value =~ /^mirror/ ? :mirror : :raidz + pool[:raid_parity] = "raidz2" if value =~ /^raidz2/ else tmp << value sym = :disk if value == pool_array.first -- cgit From 9c0e55b43f6db69f060d54c894f2303ecbbe04e3 Mon Sep 17 00:00:00 2001 From: Devon Peters Date: Wed, 2 Feb 2011 09:29:53 -0800 Subject: (#5496) Added tests for the new zpool output format Reviewed-By: Nick Lewis --- spec/unit/provider/zpool/solaris_spec.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/spec/unit/provider/zpool/solaris_spec.rb b/spec/unit/provider/zpool/solaris_spec.rb index 99e6997e4..f15b7d1f4 100755 --- a/spec/unit/provider/zpool/solaris_spec.rb +++ b/spec/unit/provider/zpool/solaris_spec.rb @@ -76,6 +76,13 @@ describe provider_class do end end + describe "when the vdev is a single mirror on solaris 10u9 or later" do + it "should call create_multi_array with mirror" do + @zpool_data = ["mirrorpool", "mirror-0", "disk1", "disk2"] + @provider.process_zpool_data(@zpool_data)[:mirror].should == ["disk1 disk2"] + end + end + describe "when the vdev is a double mirror" do it "should call create_multi_array with mirror" do @zpool_data = ["mirrorpool", "mirror", "disk1", "disk2", "mirror", "disk3", "disk4"] @@ -83,6 +90,13 @@ describe provider_class do end end + describe "when the vdev is a double mirror on solaris 10u9 or later" do + it "should call create_multi_array with mirror" do + @zpool_data = ["mirrorpool", "mirror-0", "disk1", "disk2", "mirror-1", "disk3", "disk4"] + @provider.process_zpool_data(@zpool_data)[:mirror].should == ["disk1 disk2", "disk3 disk4"] + end + end + describe "when the vdev is a raidz1" do it "should call create_multi_array with raidz1" do @zpool_data = ["mirrorpool", "raidz1", "disk1", "disk2"] @@ -90,6 +104,13 @@ describe provider_class do end end + describe "when the vdev is a raidz1 on solaris 10u9 or later" do + it "should call create_multi_array with raidz1" do + @zpool_data = ["mirrorpool", "raidz1-0", "disk1", "disk2"] + @provider.process_zpool_data(@zpool_data)[:raidz].should == ["disk1 disk2"] + end + end + describe "when the vdev is a raidz2" do it "should call create_multi_array with raidz2 and set the raid_parity" do @zpool_data = ["mirrorpool", "raidz2", "disk1", "disk2"] @@ -98,6 +119,15 @@ describe provider_class do pool[:raid_parity].should == "raidz2" end end + + describe "when the vdev is a raidz2 on solaris 10u9 or later" do + it "should call create_multi_array with raidz2 and set the raid_parity" do + @zpool_data = ["mirrorpool", "raidz2-0", "disk1", "disk2"] + pool = @provider.process_zpool_data(@zpool_data) + pool[:raidz].should == ["disk1 disk2"] + pool[:raid_parity].should == "raidz2" + end + end end describe "when calling the getters and setters" do -- cgit From b907ba3156cdc273e220a1fc00deb500843d19e5 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Tue, 1 Mar 2011 16:04:36 -0800 Subject: (#6541) Fix content with checksum truncation bug The patch for #6107 fd73874147a1aaa3a047f904a0bc1ae67780a2e4 introduced a bug when content was an invalid checksum. Rather than error the checksum was invalid, it would overwrite the file with empty string, essentially truncating it. The problem with #6107 is that when I wrote it, I didn't realize that the content parameter was munged to be nil when it was a checksum, and then chunking method special cased nil content to mean you should check the filebucket. #6107 intended to fix the case where content REALLY WAS nil, and handle that by returning an empty string. This patch fixes it so that we check to see if we really passed in a checksum when chunking, and only then going to the filebucket. Surprisingly it is possible to have a content checksum should value set from source, so we have to be careful not to assume the use of the filebucket whenever there's a checksum. The following manifest produces this situation: file { "/tmp/mydir" : source => '/tmp/sourcedir', recurse => true, } I've said it before, and sure I'll say it again, but long term the file provider really needs a refactor. I'll write some acceptance tests for file behavior right after committing this so that the refactoring will be easier. Reviewed-by: Daniel Pittman --- lib/puppet/type/file/content.rb | 12 +++++++++--- spec/unit/type/file/content_spec.rb | 23 ++++++++++++++++++++++- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb index 5223ee333..827183213 100755 --- a/lib/puppet/type/file/content.rb +++ b/lib/puppet/type/file/content.rb @@ -163,13 +163,15 @@ module Puppet Puppet.settings[:name] == "apply" end + # the content is munged so if it's a checksum source_or_content is nil + # unless the checksum indirectly comes from source def each_chunk_from(source_or_content) if source_or_content.is_a?(String) yield source_or_content - elsif source_or_content.nil? && resource.parameter(:ensure) && [:present, :file].include?(resource.parameter(:ensure).value) - yield '' - elsif source_or_content.nil? + elsif content_is_really_a_checksum? && source_or_content.nil? yield read_file_from_filebucket + elsif source_or_content.nil? + yield '' elsif self.class.standalone? yield source_or_content.content elsif source_or_content.local? @@ -181,6 +183,10 @@ module Puppet private + def content_is_really_a_checksum? + checksum?(should) + end + def chunk_file_from_disk(source_or_content) File.open(source_or_content.full_path, "r") do |src| while chunk = src.read(8192) diff --git a/spec/unit/type/file/content_spec.rb b/spec/unit/type/file/content_spec.rb index 7d23399cf..bd2b2adaf 100755 --- a/spec/unit/type/file/content_spec.rb +++ b/spec/unit/type/file/content_spec.rb @@ -375,17 +375,38 @@ describe content do @content.each_chunk_from('i_am_a_string') { |chunk| chunk.should == 'i_am_a_string' } end + # The following manifest is a case where source and content.should are both set + # file { "/tmp/mydir" : + # source => '/tmp/sourcedir', + # recurse => true, + # } + it "when content checksum comes from source" do + source_param = Puppet::Type.type(:file).attrclass(:source) + source = source_param.new(:resource => @resource) + @content.should = "{md5}123abcd" + + @content.expects(:chunk_file_from_source).returns('from_source') + @content.each_chunk_from(source) { |chunk| chunk.should == 'from_source' } + end + it "when no content, source, but ensure present" do @resource[:ensure] = :present @content.each_chunk_from(nil) { |chunk| chunk.should == '' } end + # you might do this if you were just auditing it "when no content, source, but ensure file" do @resource[:ensure] = :file @content.each_chunk_from(nil) { |chunk| chunk.should == '' } end - it "when no content or source" do + it "when source_or_content is nil and content not a checksum" do + @content.each_chunk_from(nil) { |chunk| chunk.should == '' } + end + + # the content is munged so that if it's a checksum nil gets passed in + it "when content is a checksum it should try to read from filebucket" do + @content.should = "{md5}123abcd" @content.expects(:read_file_from_filebucket).once.returns('im_a_filebucket') @content.each_chunk_from(nil) { |chunk| chunk.should == 'im_a_filebucket' } end -- cgit From 4e29f439189e0a40364724f50971c83652463085 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Tue, 1 Mar 2011 21:45:07 -0800 Subject: (#6541) maint: whitespace cleanup on the file integration spec --- spec/integration/type/file_spec.rb | 61 ++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/spec/integration/type/file_spec.rb b/spec/integration/type/file_spec.rb index 4b91e5ef9..31f4adee6 100755 --- a/spec/integration/type/file_spec.rb +++ b/spec/integration/type/file_spec.rb @@ -173,7 +173,12 @@ describe Puppet::Type.type(:file) do it "should be able to recurse over a nonexistent file" do @path = tmpfile("file_integration_tests") - @file = Puppet::Type::File.new(:name => @path, :mode => 0644, :recurse => true, :backup => false) + @file = Puppet::Type::File.new( + :name => @path, + :mode => 0644, + :recurse => true, + :backup => false + ) @catalog = Puppet::Resource::Catalog.new @catalog.add_resource @file @@ -186,7 +191,12 @@ describe Puppet::Type.type(:file) do build_path(@path) - @file = Puppet::Type::File.new(:name => @path, :mode => 0644, :recurse => true, :backup => false) + @file = Puppet::Type::File.new( + :name => @path, + :mode => 0644, + :recurse => true, + :backup => false + ) @catalog = Puppet::Resource::Catalog.new @catalog.add_resource @file @@ -393,10 +403,8 @@ describe Puppet::Type.type(:file) do dest = tmpfile("files_with_content") - file = Puppet::Type.type(:file).new( - - :name => dest, - + file = Puppet::Type.type(:file).new( + :name => dest, :content => "this is some content, yo" ) @@ -411,11 +419,9 @@ describe Puppet::Type.type(:file) do dest = tmpfile("files_with_content") - file = Puppet::Type.type(:file).new( - - :name => dest, - :ensure => "file", - + file = Puppet::Type.type(:file).new( + :name => dest, + :ensure => "file", :content => "this is some content, yo" ) @@ -433,12 +439,10 @@ describe Puppet::Type.type(:file) do File.open(dest, "w") { |f| f.puts "boo" } - file = Puppet::Type.type(:file).new( - - :name => dest, + file = Puppet::Type.type(:file).new( + :name => dest, :ensure => :absent, :source => source, - :backup => false ) @@ -465,24 +469,23 @@ describe Puppet::Type.type(:file) do File.open(@purgee, "w") { |f| f.puts "footest" } - @lfobj = Puppet::Type.newfile( - - :title => "localfile", - :path => @localfile, + @lfobj = Puppet::Type.newfile( + :title => "localfile", + :path => @localfile, :content => "rahtest\n", - :ensure => :file, - - :backup => false + :ensure => :file, + :backup => false ) - @destobj = Puppet::Type.newfile( - :title => "destdir", :path => @destdir, - :source => @sourcedir, - :backup => false, - :purge => true, - - :recurse => true) + @destobj = Puppet::Type.newfile( + :title => "destdir", + :path => @destdir, + :source => @sourcedir, + :backup => false, + :purge => true, + :recurse => true + ) @catalog = Puppet::Resource::Catalog.new @catalog.add_resource @lfobj, @destobj -- cgit From 63e911f90c0ab9e796b11cd42cc8d339e6c312b3 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Tue, 22 Feb 2011 16:51:39 -0800 Subject: (#6418) Recursive files shouldn't be audited A vestigial codepath was accidentally made live again when 2.6.0's audit parameter was added. This patch removes that code. As it's very difficult to write a meaningful unit test of a negative case, a test will be added to the acceptance test project to confirm before & after behavior for this fix. Reviewed-By: Markus Roberts --- lib/puppet/type/file/source.rb | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb index bc464e1c3..6dda7957c 100755 --- a/lib/puppet/type/file/source.rb +++ b/lib/puppet/type/file/source.rb @@ -132,10 +132,6 @@ module Puppet end end - def pinparams - [:mode, :type, :owner, :group, :content] - end - def found? ! (metadata.nil? or metadata.ftype.nil?) end @@ -161,16 +157,6 @@ module Puppet result end - # Make sure we're also checking the checksum - def value=(value) - super - - checks = (pinparams + [:ensure]) - checks.delete(:checksum) - - resource[:audit] = checks - end - def local? found? and uri and (uri.scheme || "file") == "file" end -- cgit From 7c2a980212055dc41f0ab163857b8a91316d8185 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Tue, 1 Mar 2011 16:04:36 -0800 Subject: (#6541) Fix content with checksum truncation bug The patch for #6107 fd73874147a1aaa3a047f904a0bc1ae67780a2e4 introduced a bug when content was an invalid checksum. Rather than error the checksum was invalid, it would overwrite the file with empty string, essentially truncating it. The problem with #6107 is that when I wrote it, I didn't realize that the content parameter was munged to be nil when it was a checksum, and then chunking method special cased nil content to mean you should check the filebucket. #6107 intended to fix the case where content REALLY WAS nil, and handle that by returning an empty string. This patch fixes it so that we check to see if we really passed in a checksum when chunking, and only then going to the filebucket. Surprisingly it is possible to have a content checksum should value set from source, so we have to be careful not to assume the use of the filebucket whenever there's a checksum. The following manifest produces this situation: file { "/tmp/mydir" : source => '/tmp/sourcedir', recurse => true, } I've said it before, and sure I'll say it again, but long term the file provider really needs a refactor. I'll write some acceptance tests for file behavior right after committing this so that the refactoring will be easier. Reviewed-by: Daniel Pittman --- lib/puppet/type/file/content.rb | 12 +++++++++--- spec/unit/type/file/content_spec.rb | 23 ++++++++++++++++++++++- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb index cf924f371..6aa173f6c 100755 --- a/lib/puppet/type/file/content.rb +++ b/lib/puppet/type/file/content.rb @@ -164,13 +164,15 @@ module Puppet Puppet.settings[:name] == "apply" end + # the content is munged so if it's a checksum source_or_content is nil + # unless the checksum indirectly comes from source def each_chunk_from(source_or_content) if source_or_content.is_a?(String) yield source_or_content - elsif source_or_content.nil? && resource.parameter(:ensure) && [:present, :file].include?(resource.parameter(:ensure).value) - yield '' - elsif source_or_content.nil? + elsif content_is_really_a_checksum? && source_or_content.nil? yield read_file_from_filebucket + elsif source_or_content.nil? + yield '' elsif self.class.standalone? yield source_or_content.content elsif source_or_content.local? @@ -182,6 +184,10 @@ module Puppet private + def content_is_really_a_checksum? + checksum?(should) + end + def chunk_file_from_disk(source_or_content) File.open(source_or_content.full_path, "r") do |src| while chunk = src.read(8192) diff --git a/spec/unit/type/file/content_spec.rb b/spec/unit/type/file/content_spec.rb index 9178c94bf..5ee26cc52 100755 --- a/spec/unit/type/file/content_spec.rb +++ b/spec/unit/type/file/content_spec.rb @@ -474,17 +474,38 @@ describe content do @content.each_chunk_from('i_am_a_string') { |chunk| chunk.should == 'i_am_a_string' } end + # The following manifest is a case where source and content.should are both set + # file { "/tmp/mydir" : + # source => '/tmp/sourcedir', + # recurse => true, + # } + it "when content checksum comes from source" do + source_param = Puppet::Type.type(:file).attrclass(:source) + source = source_param.new(:resource => @resource) + @content.should = "{md5}123abcd" + + @content.expects(:chunk_file_from_source).returns('from_source') + @content.each_chunk_from(source) { |chunk| chunk.should == 'from_source' } + end + it "when no content, source, but ensure present" do @resource[:ensure] = :present @content.each_chunk_from(nil) { |chunk| chunk.should == '' } end + # you might do this if you were just auditing it "when no content, source, but ensure file" do @resource[:ensure] = :file @content.each_chunk_from(nil) { |chunk| chunk.should == '' } end - it "when no content or source" do + it "when source_or_content is nil and content not a checksum" do + @content.each_chunk_from(nil) { |chunk| chunk.should == '' } + end + + # the content is munged so that if it's a checksum nil gets passed in + it "when content is a checksum it should try to read from filebucket" do + @content.should = "{md5}123abcd" @content.expects(:read_file_from_filebucket).once.returns('im_a_filebucket') @content.each_chunk_from(nil) { |chunk| chunk.should == 'im_a_filebucket' } end -- cgit From d24e32a19648d7a97c329fc3a5c4277f05cc5b04 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Wed, 2 Mar 2011 16:09:42 -0800 Subject: Update CHANGELOG and version for 2.6.6rc1 --- CHANGELOG | 5 +++++ lib/puppet.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 44d8d037a..c08d7e72f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +2.6.6rc1 +======== +7c2a980 (#6541) Fix content with checksum truncation bug +63e911f (#6418) Recursive files shouldn't be audited + 2.6.5 ===== 30fa41d Updated CHANGELOG for 2.6.5rc5 diff --git a/lib/puppet.rb b/lib/puppet.rb index 5c3e7f18b..b13e06b9d 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -24,7 +24,7 @@ require 'puppet/util/run_mode' # it's also a place to find top-level commands like 'debug' module Puppet - PUPPETVERSION = '2.6.5' + PUPPETVERSION = '2.6.6' def Puppet.version PUPPETVERSION -- cgit From af2c85b5a98ba062a9a58c6c92279f3371d59bb4 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 1 Mar 2011 20:33:56 -0800 Subject: (#6551) remove deprecated 'env' parameter to the 'exec' type We deprecated this back in 0.24, so we can eliminate it in the next release. We ran through our deprecation period full of constant complaints to the users. Now we just fail. --- lib/puppet/type/exec.rb | 9 --------- test/ral/type/exec.rb | 43 ------------------------------------------- 2 files changed, 52 deletions(-) diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb index daa49e223..033183ae7 100755 --- a/lib/puppet/type/exec.rb +++ b/lib/puppet/type/exec.rb @@ -211,15 +211,6 @@ module Puppet end end - newparam(:env) do - desc "This parameter is deprecated. Use 'environment' instead." - - munge do |value| - warning "'env' is deprecated on exec; use 'environment' instead." - resource[:environment] = value - end - end - newparam(:environment) do desc "Any additional environment variables you want to set for a command. Note that if you use this to set PATH, it will override diff --git a/test/ral/type/exec.rb b/test/ral/type/exec.rb index 933994b88..829b1a068 100755 --- a/test/ral/type/exec.rb +++ b/test/ral/type/exec.rb @@ -609,49 +609,6 @@ class TestExec < Test::Unit::TestCase } end - def test_envparam - - exec = Puppet::Type.newexec( - - :command => "echo $envtest", - :path => ENV["PATH"], - - :env => "envtest=yayness" - ) - - assert(exec, "Could not make exec") - - output = status = nil - assert_nothing_raised { - output, status = exec.run("echo $envtest") - } - - assert_equal("yayness\n", output) - - # Now check whether we can do multiline settings - assert_nothing_raised do - exec[:env] = "envtest=a list of things -and stuff" - end - - output = status = nil - assert_nothing_raised { - output, status = exec.run('echo "$envtest"') - } - assert_equal("a list of things\nand stuff\n", output) - - # Now test arrays - assert_nothing_raised do - exec[:env] = ["funtest=A", "yaytest=B"] - end - - output = status = nil - assert_nothing_raised { - output, status = exec.run('echo "$funtest" "$yaytest"') - } - assert_equal("A B\n", output) - end - def test_environmentparam exec = Puppet::Type.newexec( -- cgit From b311651526c7c9448bdd9a77a111302fd0c0efa4 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 22 Feb 2011 14:18:57 -0800 Subject: (#6407) Fix spec test hang with Mocha >= 0.9.11 in zlib testing We had a combination of bad logic, and bad testing, and a nasty behaviour of Mocha <= 0.9.10 that would result in a false pass for one of our tests. This not only falsely passed, but hid an infinite loop retrying decompression on an invalid data stream; it could be triggered by anything that sent an HTTP request with an invalid compressed body, resulting in a livelock. Paired-with: Jesse Wolfe Signed-off-by: Daniel Pittman --- lib/puppet/network/http/compression.rb | 5 ++++- spec/unit/network/http/compression_spec.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) mode change 100644 => 100755 spec/unit/network/http/compression_spec.rb diff --git a/lib/puppet/network/http/compression.rb b/lib/puppet/network/http/compression.rb index d9b56f184..c8d001169 100644 --- a/lib/puppet/network/http/compression.rb +++ b/lib/puppet/network/http/compression.rb @@ -75,7 +75,10 @@ module Puppet::Network::HTTP::Compression # in this case, we try with a verbatim (no header) # deflater. @uncompressor = Zlib::Inflate.new - retry if @first + if @first then + @first = false + retry + end raise end diff --git a/spec/unit/network/http/compression_spec.rb b/spec/unit/network/http/compression_spec.rb old mode 100644 new mode 100755 index d44c5f1bb..85c62f358 --- a/spec/unit/network/http/compression_spec.rb +++ b/spec/unit/network/http/compression_spec.rb @@ -178,7 +178,7 @@ describe "http compression" do end it "should raise the error the second time" do - @inflater.expects(:inflate).raises(Zlib::DataError.new("not a zlib stream")) + @inflater.stubs(:inflate).raises(Zlib::DataError.new("not a zlib stream")) Zlib::Inflate.expects(:new).with.returns(@inflater) lambda { @adapter.uncompress("chunk") }.should raise_error end -- cgit From 6c53eb3967a1d0c3a31f65356515f07f90524f98 Mon Sep 17 00:00:00 2001 From: Ben Hughes Date: Thu, 3 Mar 2011 16:23:08 -0800 Subject: (#6445) Fix inline docs: puppet agent does not accept --mkusers Inline documentation in lib/puppet/reference/configuration.rb stated that puppet agent accepted the --mkusers flag, which is only intended for use with puppet master. --- lib/puppet/reference/configuration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/reference/configuration.rb b/lib/puppet/reference/configuration.rb index c8ff145ba..6581427ff 100644 --- a/lib/puppet/reference/configuration.rb +++ b/lib/puppet/reference/configuration.rb @@ -122,7 +122,7 @@ likewise be redirected to a file: Puppet can also create user and group accounts for itself (one `puppet` group and one `puppet` user) if it is invoked as `root` with the `--mkusers` argument: - $ puppet agent --mkusers + $ puppet master --mkusers ## Signals -- cgit From 7c9f1b803d86ead714ff90770e0ccc87ab29efbc Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Wed, 2 Mar 2011 19:08:24 -0800 Subject: (#6582) order RSpec global :before and :after hooks naturally. Specifically, reverse the order of the two in spec_helper so that they make more sense; the inverted order was confusing. There are no functional changes, only code movement, in this patchset. Reviewed-By: Nick Lewis --- spec/spec_helper.rb | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 84ef3f279..feb8928c1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -30,6 +30,23 @@ require 'monkey_patches/publicize_methods' RSpec.configure do |config| config.mock_with :mocha + config.before :each do + # these globals are set by Application + $puppet_application_mode = nil + $puppet_application_name = nil + + # Set the confdir and vardir to gibberish so that tests + # have to be correctly mocked. + Puppet[:confdir] = "/dev/null" + Puppet[:vardir] = "/dev/null" + + # Avoid opening ports to the outside world + Puppet.settings[:bindaddress] = "127.0.0.1" + + @logs = [] + Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(@logs)) + end + config.after :each do Puppet.settings.clear Puppet::Node::Environment.clear @@ -59,23 +76,6 @@ RSpec.configure do |config| @logs.clear Puppet::Util::Log.close_all end - - config.before :each do - # these globals are set by Application - $puppet_application_mode = nil - $puppet_application_name = nil - - # Set the confdir and vardir to gibberish so that tests - # have to be correctly mocked. - Puppet[:confdir] = "/dev/null" - Puppet[:vardir] = "/dev/null" - - # Avoid opening ports to the outside world - Puppet.settings[:bindaddress] = "127.0.0.1" - - @logs = [] - Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(@logs)) - end end end -- cgit From 6b8f1b724d08e62af6fcf6a2ea55d72b74876de3 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Wed, 2 Mar 2011 21:54:40 -0800 Subject: (#6582) add fixture helper methods to replace unit test code. We validate that fixtures exist, when requested, or that they match something when they use a glob. This catches internal errors where we don't match any fixtures with a glob; this can reveal problems that would otherwise avoid all assertions and result in internal failures. The code is hidden out in a module, included in the main RSpec namespace. This doesn't clean up the API any, but it isolates the code more effectively and keeps the configuration file cleaner. Reviewed-By: Nick Lewis --- spec/lib/puppet_spec/fixtures.rb | 28 ++++++++++++++++++++++++++++ spec/spec_helper.rb | 3 +++ 2 files changed, 31 insertions(+) create mode 100644 spec/lib/puppet_spec/fixtures.rb diff --git a/spec/lib/puppet_spec/fixtures.rb b/spec/lib/puppet_spec/fixtures.rb new file mode 100644 index 000000000..96bb1e39d --- /dev/null +++ b/spec/lib/puppet_spec/fixtures.rb @@ -0,0 +1,28 @@ +module PuppetSpec::Fixtures + def fixtures(*rest) + File.join(PuppetSpec::FIXTURE_DIR, *rest) + end + def my_fixture_dir + callers = caller + while line = callers.shift do + next unless found = line.match(%r{puppet/spec/(.*)_spec\.rb:}) + return fixtures(found[1]) + end + fail "sorry, I couldn't work out your path from the caller stack!" + end + def my_fixture(name) + file = File.join(my_fixture_dir, name) + unless File.readable? file then + fail Puppet::DevError, "fixture '#{name}' for #{my_fixture_dir} is not readable" + end + return file + end + def my_fixtures(glob = '*', flags = 0) + files = Dir.glob(File.join(my_fixture_dir, glob), flags) + unless files.length > 0 then + fail Puppet::DevError, "fixture '#{glob}' for #{my_fixture_dir} had no files!" + end + block_given? and files.each do |file| yield file end + files + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index feb8928c1..cf5f39b1e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -24,10 +24,13 @@ module PuppetTest end require 'lib/puppet_spec/files' +require 'lib/puppet_spec/fixtures' require 'monkey_patches/alias_should_to_must' require 'monkey_patches/publicize_methods' RSpec.configure do |config| + include PuppetSpec::Fixtures + config.mock_with :mocha config.before :each do -- cgit From f490526726a5f35437cda11652ae9977d89279e5 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 3 Mar 2011 10:35:27 -0800 Subject: (#6582) move more helper code into methods, out of RSpec#configure We move the tempfile cleanup support off into the module that uses it, which removes some of the dependency on magic globals from configure. It still exists, but is hidden in the same module that uses it, which helps. Reviewed-By: Nick Lewis --- spec/lib/puppet_spec/files.rb | 23 +++++++++++++++++++++++ spec/spec_helper.rb | 21 +-------------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/spec/lib/puppet_spec/files.rb b/spec/lib/puppet_spec/files.rb index 52ed903ec..38c51a572 100644 --- a/spec/lib/puppet_spec/files.rb +++ b/spec/lib/puppet_spec/files.rb @@ -3,6 +3,29 @@ require 'tempfile' # A support module for testing files. module PuppetSpec::Files + def self.cleanup + if defined?($tmpfiles) + $tmpfiles.each do |file| + file = File.expand_path(file) + if Puppet.features.posix? and file !~ /^\/tmp/ and file !~ /^\/var\/folders/ + puts "Not deleting tmpfile #{file} outside of /tmp or /var/folders" + next + elsif Puppet.features.microsoft_windows? + tempdir = File.expand_path(File.join(Dir::LOCAL_APPDATA, "Temp")) + if file !~ /^#{tempdir}/ + puts "Not deleting tmpfile #{file} outside of #{tempdir}" + next + end + end + if FileTest.exist?(file) + system("chmod -R 755 '#{file}'") + system("rm -rf '#{file}'") + end + end + $tmpfiles.clear + end + end + def tmpfile(name) source = Tempfile.new(name) path = source.path diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cf5f39b1e..7f3654456 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -55,26 +55,7 @@ RSpec.configure do |config| Puppet::Node::Environment.clear Puppet::Util::Storage.clear - if defined?($tmpfiles) - $tmpfiles.each do |file| - file = File.expand_path(file) - if Puppet.features.posix? and file !~ /^\/tmp/ and file !~ /^\/var\/folders/ - puts "Not deleting tmpfile #{file} outside of /tmp or /var/folders" - next - elsif Puppet.features.microsoft_windows? - tempdir = File.expand_path(File.join(Dir::LOCAL_APPDATA, "Temp")) - if file !~ /^#{tempdir}/ - puts "Not deleting tmpfile #{file} outside of #{tempdir}" - next - end - end - if FileTest.exist?(file) - system("chmod -R 755 '#{file}'") - system("rm -rf '#{file}'") - end - end - $tmpfiles.clear - end + PuppetSpec::Files.cleanup @logs.clear Puppet::Util::Log.close_all -- cgit From 0f6faf5e138e6d11e79b2430b4e6fa6139442509 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Wed, 2 Mar 2011 19:06:57 -0800 Subject: (#6582) Eliminate the old fakedata helper method. This is replaced with the new my_fixture{,s} methods; old fixture data is ported into the spec tests at the same time, but left where it was against unit tests that require it. Reviewed-By: Nick Lewis --- .../integration/provider/mailalias/aliases/test1 | 28 ++++++++++ spec/fixtures/unit/parser/lexer/aliastest.pp | 16 ++++++ spec/fixtures/unit/parser/lexer/append.pp | 11 ++++ .../fixtures/unit/parser/lexer/argumentdefaults.pp | 14 +++++ .../unit/parser/lexer/arithmetic_expression.pp | 8 +++ .../unit/parser/lexer/arraytrailingcomma.pp | 3 + spec/fixtures/unit/parser/lexer/casestatement.pp | 65 ++++++++++++++++++++++ spec/fixtures/unit/parser/lexer/classheirarchy.pp | 15 +++++ spec/fixtures/unit/parser/lexer/classincludes.pp | 17 ++++++ spec/fixtures/unit/parser/lexer/classpathtest.pp | 11 ++++ spec/fixtures/unit/parser/lexer/collection.pp | 10 ++++ .../unit/parser/lexer/collection_override.pp | 8 +++ .../lexer/collection_within_virtual_definitions.pp | 20 +++++++ .../unit/parser/lexer/componentmetaparams.pp | 11 ++++ .../fixtures/unit/parser/lexer/componentrequire.pp | 8 +++ .../unit/parser/lexer/deepclassheirarchy.pp | 23 ++++++++ spec/fixtures/unit/parser/lexer/defineoverrides.pp | 17 ++++++ spec/fixtures/unit/parser/lexer/emptyclass.pp | 9 +++ spec/fixtures/unit/parser/lexer/emptyexec.pp | 3 + spec/fixtures/unit/parser/lexer/emptyifelse.pp | 9 +++ spec/fixtures/unit/parser/lexer/falsevalues.pp | 3 + spec/fixtures/unit/parser/lexer/filecreate.pp | 11 ++++ spec/fixtures/unit/parser/lexer/fqdefinition.pp | 5 ++ spec/fixtures/unit/parser/lexer/fqparents.pp | 11 ++++ spec/fixtures/unit/parser/lexer/funccomma.pp | 5 ++ spec/fixtures/unit/parser/lexer/hash.pp | 33 +++++++++++ spec/fixtures/unit/parser/lexer/ifexpression.pp | 12 ++++ .../unit/parser/lexer/implicititeration.pp | 15 +++++ .../unit/parser/lexer/multilinecomments.pp | 10 ++++ spec/fixtures/unit/parser/lexer/multipleclass.pp | 9 +++ .../unit/parser/lexer/multipleinstances.pp | 7 +++ spec/fixtures/unit/parser/lexer/multisubs.pp | 13 +++++ spec/fixtures/unit/parser/lexer/namevartest.pp | 9 +++ spec/fixtures/unit/parser/lexer/scopetest.pp | 13 +++++ spec/fixtures/unit/parser/lexer/selectorvalues.pp | 49 ++++++++++++++++ spec/fixtures/unit/parser/lexer/simpledefaults.pp | 5 ++ spec/fixtures/unit/parser/lexer/simpleselector.pp | 38 +++++++++++++ spec/fixtures/unit/parser/lexer/singleary.pp | 19 +++++++ spec/fixtures/unit/parser/lexer/singlequote.pp | 11 ++++ spec/fixtures/unit/parser/lexer/singleselector.pp | 22 ++++++++ .../unit/parser/lexer/subclass_name_duplication.pp | 11 ++++ spec/fixtures/unit/parser/lexer/tag.pp | 9 +++ spec/fixtures/unit/parser/lexer/tagged.pp | 35 ++++++++++++ .../fixtures/unit/parser/lexer/virtualresources.pp | 14 +++++ .../fixtures/unit/provider/host/parsed/valid_hosts | 19 +++++++ .../unit/provider/mount/parsed/freebsd.fstab | 7 +++ .../unit/provider/mount/parsed/linux.fstab | 11 ++++ .../unit/provider/mount/parsed/solaris.fstab | 11 ++++ .../ssh_authorized_key/parsed/authorized_keys | 7 +++ .../ssh_authorized_key/parsed/authorized_keys1 | 3 + .../ssh_authorized_key/parsed/authorized_keys2 | 1 + .../unit/reports/tagmail/tagmail_failers.conf | 3 + .../unit/reports/tagmail/tagmail_passers.conf | 30 ++++++++++ .../integration/provider/mailalias/aliases_spec.rb | 6 +- spec/unit/parser/lexer_spec.rb | 5 +- spec/unit/provider/host/parsed_spec.rb | 4 +- spec/unit/provider/mount/parsed_spec.rb | 4 +- .../provider/ssh_authorized_key/parsed_spec.rb | 6 +- spec/unit/reports/tagmail_spec.rb | 7 +-- spec/unit/type/file_spec.rb | 10 +--- 60 files changed, 777 insertions(+), 32 deletions(-) create mode 100644 spec/fixtures/integration/provider/mailalias/aliases/test1 create mode 100644 spec/fixtures/unit/parser/lexer/aliastest.pp create mode 100644 spec/fixtures/unit/parser/lexer/append.pp create mode 100644 spec/fixtures/unit/parser/lexer/argumentdefaults.pp create mode 100644 spec/fixtures/unit/parser/lexer/arithmetic_expression.pp create mode 100644 spec/fixtures/unit/parser/lexer/arraytrailingcomma.pp create mode 100644 spec/fixtures/unit/parser/lexer/casestatement.pp create mode 100644 spec/fixtures/unit/parser/lexer/classheirarchy.pp create mode 100644 spec/fixtures/unit/parser/lexer/classincludes.pp create mode 100644 spec/fixtures/unit/parser/lexer/classpathtest.pp create mode 100644 spec/fixtures/unit/parser/lexer/collection.pp create mode 100644 spec/fixtures/unit/parser/lexer/collection_override.pp create mode 100644 spec/fixtures/unit/parser/lexer/collection_within_virtual_definitions.pp create mode 100644 spec/fixtures/unit/parser/lexer/componentmetaparams.pp create mode 100644 spec/fixtures/unit/parser/lexer/componentrequire.pp create mode 100644 spec/fixtures/unit/parser/lexer/deepclassheirarchy.pp create mode 100644 spec/fixtures/unit/parser/lexer/defineoverrides.pp create mode 100644 spec/fixtures/unit/parser/lexer/emptyclass.pp create mode 100644 spec/fixtures/unit/parser/lexer/emptyexec.pp create mode 100644 spec/fixtures/unit/parser/lexer/emptyifelse.pp create mode 100644 spec/fixtures/unit/parser/lexer/falsevalues.pp create mode 100644 spec/fixtures/unit/parser/lexer/filecreate.pp create mode 100644 spec/fixtures/unit/parser/lexer/fqdefinition.pp create mode 100644 spec/fixtures/unit/parser/lexer/fqparents.pp create mode 100644 spec/fixtures/unit/parser/lexer/funccomma.pp create mode 100644 spec/fixtures/unit/parser/lexer/hash.pp create mode 100644 spec/fixtures/unit/parser/lexer/ifexpression.pp create mode 100644 spec/fixtures/unit/parser/lexer/implicititeration.pp create mode 100644 spec/fixtures/unit/parser/lexer/multilinecomments.pp create mode 100644 spec/fixtures/unit/parser/lexer/multipleclass.pp create mode 100644 spec/fixtures/unit/parser/lexer/multipleinstances.pp create mode 100644 spec/fixtures/unit/parser/lexer/multisubs.pp create mode 100644 spec/fixtures/unit/parser/lexer/namevartest.pp create mode 100644 spec/fixtures/unit/parser/lexer/scopetest.pp create mode 100644 spec/fixtures/unit/parser/lexer/selectorvalues.pp create mode 100644 spec/fixtures/unit/parser/lexer/simpledefaults.pp create mode 100644 spec/fixtures/unit/parser/lexer/simpleselector.pp create mode 100644 spec/fixtures/unit/parser/lexer/singleary.pp create mode 100644 spec/fixtures/unit/parser/lexer/singlequote.pp create mode 100644 spec/fixtures/unit/parser/lexer/singleselector.pp create mode 100755 spec/fixtures/unit/parser/lexer/subclass_name_duplication.pp create mode 100644 spec/fixtures/unit/parser/lexer/tag.pp create mode 100644 spec/fixtures/unit/parser/lexer/tagged.pp create mode 100644 spec/fixtures/unit/parser/lexer/virtualresources.pp create mode 100644 spec/fixtures/unit/provider/host/parsed/valid_hosts create mode 100644 spec/fixtures/unit/provider/mount/parsed/freebsd.fstab create mode 100644 spec/fixtures/unit/provider/mount/parsed/linux.fstab create mode 100644 spec/fixtures/unit/provider/mount/parsed/solaris.fstab create mode 100644 spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys create mode 100644 spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys1 create mode 100644 spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys2 create mode 100644 spec/fixtures/unit/reports/tagmail/tagmail_failers.conf create mode 100644 spec/fixtures/unit/reports/tagmail/tagmail_passers.conf mode change 100644 => 100755 spec/unit/provider/host/parsed_spec.rb diff --git a/spec/fixtures/integration/provider/mailalias/aliases/test1 b/spec/fixtures/integration/provider/mailalias/aliases/test1 new file mode 100644 index 000000000..ecf532213 --- /dev/null +++ b/spec/fixtures/integration/provider/mailalias/aliases/test1 @@ -0,0 +1,28 @@ +# Basic system aliases -- these MUST be present +MAILER-DAEMON: postmaster +postmaster: root + +# General redirections for pseudo accounts +bin: root +daemon: root +named: root +nobody: root +uucp: root +www: root +ftp-bugs: root +postfix: root + +# Put your local aliases here. + +# Well-known aliases +manager: root +dumper: root +operator: root +abuse: postmaster + +# trap decode to catch security attacks +decode: root + +# Other tests +anothertest: "|/path/to/rt-mailgate --queue 'another test' --action correspond --url http://my.com/" +test: "|/path/to/rt-mailgate --queue 'test' --action correspond --url http://my.com/" diff --git a/spec/fixtures/unit/parser/lexer/aliastest.pp b/spec/fixtures/unit/parser/lexer/aliastest.pp new file mode 100644 index 000000000..f2b61592e --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/aliastest.pp @@ -0,0 +1,16 @@ +file { "a file": + path => "/tmp/aliastest", + ensure => file +} + +file { "another": + path => "/tmp/aliastest2", + ensure => file, + require => File["a file"] +} + +file { "a third": + path => "/tmp/aliastest3", + ensure => file, + require => File["/tmp/aliastest"] +} diff --git a/spec/fixtures/unit/parser/lexer/append.pp b/spec/fixtures/unit/parser/lexer/append.pp new file mode 100644 index 000000000..20cbda662 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/append.pp @@ -0,0 +1,11 @@ +$var=['/tmp/file1','/tmp/file2'] + +class arraytest { + $var += ['/tmp/file3', '/tmp/file4'] + file { + $var: + content => "test" + } +} + +include arraytest diff --git a/spec/fixtures/unit/parser/lexer/argumentdefaults.pp b/spec/fixtures/unit/parser/lexer/argumentdefaults.pp new file mode 100644 index 000000000..eac9dd757 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/argumentdefaults.pp @@ -0,0 +1,14 @@ +# $Id$ + +define testargs($file, $mode = 755) { + file { $file: ensure => file, mode => $mode } +} + +testargs { "testingname": + file => "/tmp/argumenttest1" +} + +testargs { "testingother": + file => "/tmp/argumenttest2", + mode => 644 +} diff --git a/spec/fixtures/unit/parser/lexer/arithmetic_expression.pp b/spec/fixtures/unit/parser/lexer/arithmetic_expression.pp new file mode 100644 index 000000000..aae98a4db --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/arithmetic_expression.pp @@ -0,0 +1,8 @@ + +$one = 1.30 +$two = 2.034e-2 + +$result = ((( $two + 2) / $one) + 4 * 5.45) - (6 << 7) + (0x800 + -9) + + +notice("result is $result == 1295.87692307692") \ No newline at end of file diff --git a/spec/fixtures/unit/parser/lexer/arraytrailingcomma.pp b/spec/fixtures/unit/parser/lexer/arraytrailingcomma.pp new file mode 100644 index 000000000..a410f9553 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/arraytrailingcomma.pp @@ -0,0 +1,3 @@ +file { + ["/tmp/arraytrailingcomma1","/tmp/arraytrailingcomma2", ]: content => "tmp" +} diff --git a/spec/fixtures/unit/parser/lexer/casestatement.pp b/spec/fixtures/unit/parser/lexer/casestatement.pp new file mode 100644 index 000000000..66ecd72b9 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/casestatement.pp @@ -0,0 +1,65 @@ +# $Id$ + +$var = "value" + +case $var { + "nope": { + file { "/tmp/fakefile": mode => 644, ensure => file } + } + "value": { + file { "/tmp/existsfile": mode => 755, ensure => file } + } +} + +$ovar = "yayness" + +case $ovar { + "fooness": { + file { "/tmp/nostillexistsfile": mode => 644, ensure => file } + } + "booness", "yayness": { + case $var { + "nep": { + file { "/tmp/noexistsfile": mode => 644, ensure => file } + } + "value": { + file { "/tmp/existsfile2": mode => 755, ensure => file } + } + } + } +} + +case $ovar { + "fooness": { + file { "/tmp/nostillexistsfile": mode => 644, ensure => file } + } + default: { + file { "/tmp/existsfile3": mode => 755, ensure => file } + } +} + +$bool = true + +case $bool { + true: { + file { "/tmp/existsfile4": mode => 755, ensure => file } + } +} + +$yay = yay +$a = yay +$b = boo + +case $yay { + $a: { file { "/tmp/existsfile5": mode => 755, ensure => file } } + $b: { file { "/tmp/existsfile5": mode => 644, ensure => file } } + default: { file { "/tmp/existsfile5": mode => 711, ensure => file } } + +} + +$regexvar = "exists regex" +case $regexvar { + "no match": { file { "/tmp/existsfile6": mode => 644, ensure => file } } + /(.*) regex$/: { file { "/tmp/${1}file6": mode => 755, ensure => file } } + default: { file { "/tmp/existsfile6": mode => 711, ensure => file } } +} diff --git a/spec/fixtures/unit/parser/lexer/classheirarchy.pp b/spec/fixtures/unit/parser/lexer/classheirarchy.pp new file mode 100644 index 000000000..36619d8b9 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/classheirarchy.pp @@ -0,0 +1,15 @@ +# $Id$ + +class base { + file { "/tmp/classheir1": ensure => file, mode => 755 } +} + +class sub1 inherits base { + file { "/tmp/classheir2": ensure => file, mode => 755 } +} + +class sub2 inherits base { + file { "/tmp/classheir3": ensure => file, mode => 755 } +} + +include sub1, sub2 diff --git a/spec/fixtures/unit/parser/lexer/classincludes.pp b/spec/fixtures/unit/parser/lexer/classincludes.pp new file mode 100644 index 000000000..bd5b44ed7 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/classincludes.pp @@ -0,0 +1,17 @@ +# $Id$ + +class base { + file { "/tmp/classincludes1": ensure => file, mode => 755 } +} + +class sub1 inherits base { + file { "/tmp/classincludes2": ensure => file, mode => 755 } +} + +class sub2 inherits base { + file { "/tmp/classincludes3": ensure => file, mode => 755 } +} + +$sub = "sub2" + +include sub1, $sub diff --git a/spec/fixtures/unit/parser/lexer/classpathtest.pp b/spec/fixtures/unit/parser/lexer/classpathtest.pp new file mode 100644 index 000000000..580333369 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/classpathtest.pp @@ -0,0 +1,11 @@ +# $Id$ + +define mytype { + file { "/tmp/classtest": ensure => file, mode => 755 } +} + +class testing { + mytype { "componentname": } +} + +include testing diff --git a/spec/fixtures/unit/parser/lexer/collection.pp b/spec/fixtures/unit/parser/lexer/collection.pp new file mode 100644 index 000000000..bc29510a9 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/collection.pp @@ -0,0 +1,10 @@ +class one { + @file { "/tmp/colltest1": content => "one" } + @file { "/tmp/colltest2": content => "two" } +} + +class two { + File <| content == "one" |> +} + +include one, two diff --git a/spec/fixtures/unit/parser/lexer/collection_override.pp b/spec/fixtures/unit/parser/lexer/collection_override.pp new file mode 100644 index 000000000..b1b39ab16 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/collection_override.pp @@ -0,0 +1,8 @@ +@file { + "/tmp/collection": + content => "whatever" +} + +File<| |> { + mode => 0600 +} diff --git a/spec/fixtures/unit/parser/lexer/collection_within_virtual_definitions.pp b/spec/fixtures/unit/parser/lexer/collection_within_virtual_definitions.pp new file mode 100644 index 000000000..3c21468b0 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/collection_within_virtual_definitions.pp @@ -0,0 +1,20 @@ +define test($name) { + file {"/tmp/collection_within_virtual_definitions1_$name.txt": + content => "File name $name\n" + } + Test2 <||> +} + +define test2() { + file {"/tmp/collection_within_virtual_definitions2_$name.txt": + content => "This is a test\n" + } +} + +node default { + @test {"foo": + name => "foo" + } + @test2 {"foo2": } + Test <||> +} diff --git a/spec/fixtures/unit/parser/lexer/componentmetaparams.pp b/spec/fixtures/unit/parser/lexer/componentmetaparams.pp new file mode 100644 index 000000000..7d9f0c2c1 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/componentmetaparams.pp @@ -0,0 +1,11 @@ +file { "/tmp/component1": + ensure => file +} + +define thing { + file { $name: ensure => file } +} + +thing { "/tmp/component2": + require => File["/tmp/component1"] +} diff --git a/spec/fixtures/unit/parser/lexer/componentrequire.pp b/spec/fixtures/unit/parser/lexer/componentrequire.pp new file mode 100644 index 000000000..a61d2050c --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/componentrequire.pp @@ -0,0 +1,8 @@ +define testfile($mode) { + file { $name: mode => $mode, ensure => present } +} + +testfile { "/tmp/testing_component_requires2": mode => 755 } + +file { "/tmp/testing_component_requires1": mode => 755, ensure => present, + require => Testfile["/tmp/testing_component_requires2"] } diff --git a/spec/fixtures/unit/parser/lexer/deepclassheirarchy.pp b/spec/fixtures/unit/parser/lexer/deepclassheirarchy.pp new file mode 100644 index 000000000..249e6334d --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/deepclassheirarchy.pp @@ -0,0 +1,23 @@ +# $Id$ + +class base { + file { "/tmp/deepclassheir1": ensure => file, mode => 755 } +} + +class sub1 inherits base { + file { "/tmp/deepclassheir2": ensure => file, mode => 755 } +} + +class sub2 inherits sub1 { + file { "/tmp/deepclassheir3": ensure => file, mode => 755 } +} + +class sub3 inherits sub2 { + file { "/tmp/deepclassheir4": ensure => file, mode => 755 } +} + +class sub4 inherits sub3 { + file { "/tmp/deepclassheir5": ensure => file, mode => 755 } +} + +include sub4 diff --git a/spec/fixtures/unit/parser/lexer/defineoverrides.pp b/spec/fixtures/unit/parser/lexer/defineoverrides.pp new file mode 100644 index 000000000..c68b139e3 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/defineoverrides.pp @@ -0,0 +1,17 @@ +# $Id$ + +$file = "/tmp/defineoverrides1" + +define myfile($mode) { + file { $name: ensure => file, mode => $mode } +} + +class base { + myfile { $file: mode => 644 } +} + +class sub inherits base { + Myfile[$file] { mode => 755, } # test the end-comma +} + +include sub diff --git a/spec/fixtures/unit/parser/lexer/emptyclass.pp b/spec/fixtures/unit/parser/lexer/emptyclass.pp new file mode 100644 index 000000000..48047e748 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/emptyclass.pp @@ -0,0 +1,9 @@ +# $Id$ + +define component { +} + +class testing { +} + +include testing diff --git a/spec/fixtures/unit/parser/lexer/emptyexec.pp b/spec/fixtures/unit/parser/lexer/emptyexec.pp new file mode 100644 index 000000000..847a30d18 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/emptyexec.pp @@ -0,0 +1,3 @@ +exec { "touch /tmp/emptyexectest": + path => "/usr/bin:/bin" +} diff --git a/spec/fixtures/unit/parser/lexer/emptyifelse.pp b/spec/fixtures/unit/parser/lexer/emptyifelse.pp new file mode 100644 index 000000000..598b486ac --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/emptyifelse.pp @@ -0,0 +1,9 @@ + +if false { +} else { + # nothing here +} + +if true { + # still nothing +} diff --git a/spec/fixtures/unit/parser/lexer/falsevalues.pp b/spec/fixtures/unit/parser/lexer/falsevalues.pp new file mode 100644 index 000000000..2143b79a7 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/falsevalues.pp @@ -0,0 +1,3 @@ +$value = false + +file { "/tmp/falsevalues$value": ensure => file } diff --git a/spec/fixtures/unit/parser/lexer/filecreate.pp b/spec/fixtures/unit/parser/lexer/filecreate.pp new file mode 100644 index 000000000..d7972c234 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/filecreate.pp @@ -0,0 +1,11 @@ +# $Id$ + +file { + "/tmp/createatest": ensure => file, mode => 755; + "/tmp/createbtest": ensure => file, mode => 755 +} + +file { + "/tmp/createctest": ensure => file; + "/tmp/createdtest": ensure => file; +} diff --git a/spec/fixtures/unit/parser/lexer/fqdefinition.pp b/spec/fixtures/unit/parser/lexer/fqdefinition.pp new file mode 100644 index 000000000..ddb0675a9 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/fqdefinition.pp @@ -0,0 +1,5 @@ +define one::two($ensure) { + file { "/tmp/fqdefinition": ensure => $ensure } +} + +one::two { "/tmp/fqdefinition": ensure => file } diff --git a/spec/fixtures/unit/parser/lexer/fqparents.pp b/spec/fixtures/unit/parser/lexer/fqparents.pp new file mode 100644 index 000000000..ee2f65423 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/fqparents.pp @@ -0,0 +1,11 @@ +class base { + class one { + file { "/tmp/fqparent1": ensure => file } + } +} + +class two::three inherits base::one { + file { "/tmp/fqparent2": ensure => file } +} + +include two::three diff --git a/spec/fixtures/unit/parser/lexer/funccomma.pp b/spec/fixtures/unit/parser/lexer/funccomma.pp new file mode 100644 index 000000000..32e34f92e --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/funccomma.pp @@ -0,0 +1,5 @@ +@file { + ["/tmp/funccomma1","/tmp/funccomma2"]: content => "1" +} + +realize( File["/tmp/funccomma1"], File["/tmp/funccomma2"] , ) diff --git a/spec/fixtures/unit/parser/lexer/hash.pp b/spec/fixtures/unit/parser/lexer/hash.pp new file mode 100644 index 000000000..d33249872 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/hash.pp @@ -0,0 +1,33 @@ + +$hash = { "file" => "/tmp/myhashfile1" } + +file { + $hash["file"]: + ensure => file, content => "content"; +} + +$hash2 = { "a" => { key => "/tmp/myhashfile2" }} + +file { + $hash2["a"][key]: + ensure => file, content => "content"; +} + +define test($a = { "b" => "c" }) { + file { + $a["b"]: + ensure => file, content => "content" + } +} + +test { + "test": + a => { "b" => "/tmp/myhashfile3" } +} + +$hash3 = { mykey => "/tmp/myhashfile4" } +$key = "mykey" + +file { + $hash3[$key]: ensure => file, content => "content" +} diff --git a/spec/fixtures/unit/parser/lexer/ifexpression.pp b/spec/fixtures/unit/parser/lexer/ifexpression.pp new file mode 100644 index 000000000..29a637291 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/ifexpression.pp @@ -0,0 +1,12 @@ +$one = 1 +$two = 2 + +if ($one < $two) and (($two < 3) or ($two == 2)) { + notice("True!") +} + +if "test regex" =~ /(.*) regex/ { + file { + "/tmp/${1}iftest": ensure => file, mode => 0755 + } +} diff --git a/spec/fixtures/unit/parser/lexer/implicititeration.pp b/spec/fixtures/unit/parser/lexer/implicititeration.pp new file mode 100644 index 000000000..6f34cb29c --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/implicititeration.pp @@ -0,0 +1,15 @@ +# $Id$ + +$files = ["/tmp/iterationatest", "/tmp/iterationbtest"] + +file { $files: ensure => file, mode => 755 } + +file { ["/tmp/iterationctest", "/tmp/iterationdtest"]: + ensure => file, + mode => 755 +} + +file { + ["/tmp/iterationetest", "/tmp/iterationftest"]: ensure => file, mode => 755; + ["/tmp/iterationgtest", "/tmp/iterationhtest"]: ensure => file, mode => 755; +} diff --git a/spec/fixtures/unit/parser/lexer/multilinecomments.pp b/spec/fixtures/unit/parser/lexer/multilinecomments.pp new file mode 100644 index 000000000..f9819c020 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/multilinecomments.pp @@ -0,0 +1,10 @@ + +/* +file { + "/tmp/multilinecomments": content => "pouet" +} +*/ + +/* and another one for #2333, the whitespace after the +end comment is here on purpose */ + diff --git a/spec/fixtures/unit/parser/lexer/multipleclass.pp b/spec/fixtures/unit/parser/lexer/multipleclass.pp new file mode 100644 index 000000000..ae02edc38 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/multipleclass.pp @@ -0,0 +1,9 @@ +class one { + file { "/tmp/multipleclassone": content => "one" } +} + +class one { + file { "/tmp/multipleclasstwo": content => "two" } +} + +include one diff --git a/spec/fixtures/unit/parser/lexer/multipleinstances.pp b/spec/fixtures/unit/parser/lexer/multipleinstances.pp new file mode 100644 index 000000000..2f9b3c2e8 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/multipleinstances.pp @@ -0,0 +1,7 @@ +# $Id$ + +file { + "/tmp/multipleinstancesa": ensure => file, mode => 755; + "/tmp/multipleinstancesb": ensure => file, mode => 755; + "/tmp/multipleinstancesc": ensure => file, mode => 755; +} diff --git a/spec/fixtures/unit/parser/lexer/multisubs.pp b/spec/fixtures/unit/parser/lexer/multisubs.pp new file mode 100644 index 000000000..bcec69e2a --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/multisubs.pp @@ -0,0 +1,13 @@ +class base { + file { "/tmp/multisubtest": content => "base", mode => 644 } +} + +class sub1 inherits base { + File["/tmp/multisubtest"] { mode => 755 } +} + +class sub2 inherits base { + File["/tmp/multisubtest"] { content => sub2 } +} + +include sub1, sub2 diff --git a/spec/fixtures/unit/parser/lexer/namevartest.pp b/spec/fixtures/unit/parser/lexer/namevartest.pp new file mode 100644 index 000000000..dbee1c356 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/namevartest.pp @@ -0,0 +1,9 @@ +define filetest($mode, $ensure = file) { + file { $name: + mode => $mode, + ensure => $ensure + } +} + +filetest { "/tmp/testfiletest": mode => 644} +filetest { "/tmp/testdirtest": mode => 755, ensure => directory} diff --git a/spec/fixtures/unit/parser/lexer/scopetest.pp b/spec/fixtures/unit/parser/lexer/scopetest.pp new file mode 100644 index 000000000..331491766 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/scopetest.pp @@ -0,0 +1,13 @@ + +$mode = 640 + +define thing { + file { "/tmp/$name": ensure => file, mode => $mode } +} + +class testing { + $mode = 755 + thing {scopetest: } +} + +include testing diff --git a/spec/fixtures/unit/parser/lexer/selectorvalues.pp b/spec/fixtures/unit/parser/lexer/selectorvalues.pp new file mode 100644 index 000000000..d80d26c36 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/selectorvalues.pp @@ -0,0 +1,49 @@ +$value1 = "" +$value2 = true +$value3 = false +$value4 = yay + +$test = "yay" + +$mode1 = $value1 ? { + "" => 755, + default => 644 +} + +$mode2 = $value2 ? { + true => 755, + default => 644 +} + +$mode3 = $value3 ? { + false => 755, + default => 644 +} + +$mode4 = $value4 ? { + $test => 755, + default => 644 +} + +$mode5 = yay ? { + $test => 755, + default => 644 +} + +$mode6 = $mode5 ? { + 755 => 755 +} + +$mode7 = "test regex" ? { + /regex$/ => 755, + default => 644 +} + + +file { "/tmp/selectorvalues1": ensure => file, mode => $mode1 } +file { "/tmp/selectorvalues2": ensure => file, mode => $mode2 } +file { "/tmp/selectorvalues3": ensure => file, mode => $mode3 } +file { "/tmp/selectorvalues4": ensure => file, mode => $mode4 } +file { "/tmp/selectorvalues5": ensure => file, mode => $mode5 } +file { "/tmp/selectorvalues6": ensure => file, mode => $mode6 } +file { "/tmp/selectorvalues7": ensure => file, mode => $mode7 } diff --git a/spec/fixtures/unit/parser/lexer/simpledefaults.pp b/spec/fixtures/unit/parser/lexer/simpledefaults.pp new file mode 100644 index 000000000..63d199a68 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/simpledefaults.pp @@ -0,0 +1,5 @@ +# $Id$ + +File { mode => 755 } + +file { "/tmp/defaulttest": ensure => file } diff --git a/spec/fixtures/unit/parser/lexer/simpleselector.pp b/spec/fixtures/unit/parser/lexer/simpleselector.pp new file mode 100644 index 000000000..8b9bc7292 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/simpleselector.pp @@ -0,0 +1,38 @@ +# $Id$ + +$var = "value" + +file { "/tmp/snippetselectatest": + ensure => file, + mode => $var ? { + nottrue => 641, + value => 755 + } +} + +file { "/tmp/snippetselectbtest": + ensure => file, + mode => $var ? { + nottrue => 644, + default => 755 + } +} + +$othervar = "complex value" + +file { "/tmp/snippetselectctest": + ensure => file, + mode => $othervar ? { + "complex value" => 755, + default => 644 + } +} +$anothervar = Yayness + +file { "/tmp/snippetselectdtest": + ensure => file, + mode => $anothervar ? { + Yayness => 755, + default => 644 + } +} diff --git a/spec/fixtures/unit/parser/lexer/singleary.pp b/spec/fixtures/unit/parser/lexer/singleary.pp new file mode 100644 index 000000000..9ce56dd89 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/singleary.pp @@ -0,0 +1,19 @@ +# $Id$ + +file { "/tmp/singleary1": + ensure => file +} + +file { "/tmp/singleary2": + ensure => file +} + +file { "/tmp/singleary3": + ensure => file, + require => [File["/tmp/singleary1"], File["/tmp/singleary2"]] +} + +file { "/tmp/singleary4": + ensure => file, + require => [File["/tmp/singleary1"]] +} diff --git a/spec/fixtures/unit/parser/lexer/singlequote.pp b/spec/fixtures/unit/parser/lexer/singlequote.pp new file mode 100644 index 000000000..dc876a2f8 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/singlequote.pp @@ -0,0 +1,11 @@ +# $Id$ + +file { "/tmp/singlequote1": + ensure => file, + content => 'a $quote' +} + +file { "/tmp/singlequote2": + ensure => file, + content => 'some "\yayness\"' +} diff --git a/spec/fixtures/unit/parser/lexer/singleselector.pp b/spec/fixtures/unit/parser/lexer/singleselector.pp new file mode 100644 index 000000000..520a14017 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/singleselector.pp @@ -0,0 +1,22 @@ +$value1 = "" +$value2 = true +$value3 = false +$value4 = yay + +$test = "yay" + +$mode1 = $value1 ? { + "" => 755 +} + +$mode2 = $value2 ? { + true => 755 +} + +$mode3 = $value3 ? { + default => 755 +} + +file { "/tmp/singleselector1": ensure => file, mode => $mode1 } +file { "/tmp/singleselector2": ensure => file, mode => $mode2 } +file { "/tmp/singleselector3": ensure => file, mode => $mode3 } diff --git a/spec/fixtures/unit/parser/lexer/subclass_name_duplication.pp b/spec/fixtures/unit/parser/lexer/subclass_name_duplication.pp new file mode 100755 index 000000000..10f1d75ed --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/subclass_name_duplication.pp @@ -0,0 +1,11 @@ +#!/usr/bin/env puppet + +class one::fake { + file { "/tmp/subclass_name_duplication1": ensure => present } +} + +class two::fake { + file { "/tmp/subclass_name_duplication2": ensure => present } +} + +include one::fake, two::fake diff --git a/spec/fixtures/unit/parser/lexer/tag.pp b/spec/fixtures/unit/parser/lexer/tag.pp new file mode 100644 index 000000000..e6e770dd9 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/tag.pp @@ -0,0 +1,9 @@ +# $Id$ + +$variable = value + +tag yayness, rahness + +tag booness, $variable + +file { "/tmp/settestingness": ensure => file } diff --git a/spec/fixtures/unit/parser/lexer/tagged.pp b/spec/fixtures/unit/parser/lexer/tagged.pp new file mode 100644 index 000000000..7bf90a645 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/tagged.pp @@ -0,0 +1,35 @@ +# $Id$ + +tag testing +tag(funtest) + +class tagdefine { + $path = tagged(tagdefine) ? { + true => "true", false => "false" + } + + file { "/tmp/taggeddefine$path": ensure => file } +} + +include tagdefine + +$yayness = tagged(yayness) ? { + true => "true", false => "false" +} + +$funtest = tagged(testing) ? { + true => "true", false => "false" +} + +$both = tagged(testing, yayness) ? { + true => "true", false => "false" +} + +$bothtrue = tagged(testing, testing) ? { + true => "true", false => "false" +} + +file { "/tmp/taggedyayness$yayness": ensure => file } +file { "/tmp/taggedtesting$funtest": ensure => file } +file { "/tmp/taggedboth$both": ensure => file } +file { "/tmp/taggedbothtrue$bothtrue": ensure => file } diff --git a/spec/fixtures/unit/parser/lexer/virtualresources.pp b/spec/fixtures/unit/parser/lexer/virtualresources.pp new file mode 100644 index 000000000..a29406b84 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/virtualresources.pp @@ -0,0 +1,14 @@ +class one { + @file { "/tmp/virtualtest1": content => "one" } + @file { "/tmp/virtualtest2": content => "two" } + @file { "/tmp/virtualtest3": content => "three" } + @file { "/tmp/virtualtest4": content => "four" } +} + +class two { + File <| content == "one" |> + realize File["/tmp/virtualtest2"] + realize(File["/tmp/virtualtest3"], File["/tmp/virtualtest4"]) +} + +include one, two diff --git a/spec/fixtures/unit/provider/host/parsed/valid_hosts b/spec/fixtures/unit/provider/host/parsed/valid_hosts new file mode 100644 index 000000000..24636295d --- /dev/null +++ b/spec/fixtures/unit/provider/host/parsed/valid_hosts @@ -0,0 +1,19 @@ +# Some leading comment, that should be ignored +# The next line is empty so it should be ignored + +::1 localhost + +# We now try another delimiter: Several tabs +127.0.0.1 localhost + +# No test trailing spaces +10.0.0.1 host1 + +# Ok its time to test aliases +2001:252:0:1::2008:8 ipv6host alias1 +192.168.0.1 ipv4host alias2 alias3 + +# Testing inlinecomments now +192.168.0.2 host3 # This is host3 +192.168.0.3 host4 alias10 # This is host4 +192.168.0.4 host5 alias11 alias12 # This is host5 diff --git a/spec/fixtures/unit/provider/mount/parsed/freebsd.fstab b/spec/fixtures/unit/provider/mount/parsed/freebsd.fstab new file mode 100644 index 000000000..a41104236 --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/freebsd.fstab @@ -0,0 +1,7 @@ +# Device Mountpoint FStype Options Dump Pass# +/dev/ad0s1b none swap sw 0 0 +/dev/ad0s1a / ufs rw 1 1 +/dev/ad0s1e /tmp ufs rw 2 2 +/dev/ad0s1f /usr ufs rw 2 2 +/dev/ad0s1d /var ufs rw 2 2 +/dev/acd0 /cdrom cd9660 ro,noauto 0 0 diff --git a/spec/fixtures/unit/provider/mount/parsed/linux.fstab b/spec/fixtures/unit/provider/mount/parsed/linux.fstab new file mode 100644 index 000000000..b1debff9c --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/linux.fstab @@ -0,0 +1,11 @@ +# A sample fstab, typical for a Fedora system +/dev/vg00/lv00 / ext3 defaults 1 1 +LABEL=/boot /boot ext3 defaults 1 2 +devpts /dev/pts devpts gid=5,mode=620 0 +tmpfs /dev/shm tmpfs defaults 0 +LABEL=/home /home ext3 defaults 1 2 +/home /homes auto bind 0 2 +proc /proc proc defaults 0 0 +/dev/vg00/lv01 /spare ext3 defaults 1 2 +sysfs /sys sysfs defaults 0 0 +LABEL=SWAP-hda6 swap swap defaults 0 0 diff --git a/spec/fixtures/unit/provider/mount/parsed/solaris.fstab b/spec/fixtures/unit/provider/mount/parsed/solaris.fstab new file mode 100644 index 000000000..54afc898c --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/solaris.fstab @@ -0,0 +1,11 @@ +#device device mount FS fsck mount mount +#to mount to fsck point type pass at boot options +# +fd - /dev/fd fd - no - +/proc - /proc proc - no - +/dev/dsk/c0d0s0 /dev/rdsk/c0d0s0 / ufs 1 no - +/dev/dsk/c0d0p0:boot - /boot pcfs - no - +/devices - /devices devfs - no - +ctfs - /system/contract ctfs - no - +objfs - /system/object objfs - no - +#swap - /tmp tmpfs - yes - diff --git a/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys b/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys new file mode 100644 index 000000000..b22329dca --- /dev/null +++ b/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys @@ -0,0 +1,7 @@ +ssh-dss AAAAB3NzaC1kc3MAAACBAJkupmdsJSDXfUy5EU5NTRBDr9Woo3w0YnB8KmnJW9ghU8C7SkWPB1fIHVe+esFfd3qWBseb83PoFX63geZJAg6bjV4/Rdn1zEoa9EO2QyUdYUen4+rpsh3vVKZ6HFNsn3+W5+kPYgE1F/N4INqkbjY3sqCkP/W1BL9+sbVVbuJFAAAAFQCfjWDk5XhvGUkPjNWWVqltBYzHtwAAAIEAg/XL7ky7x9Ad5banzPFAfmM+DGFe0A/JEbLDjKmr5KBM5x4RFohtEvZ8ECuVGUOqBWdgAjyYwsG4oRVjLnKrf/rgmbNRzSFgEWkcAye3BVwk7Dt6hh4knEl+mNfOLq+FH0011UhecOiqTcESMzQDtgQ1vJh2VchElBLjl3x/ZugAAACAAh5jGQC338t5ObP8trSlOefkx0sXmmEzUbo3Mt8mGUuGJPx8m+X0L8Xd+l5rQxytqE3SmV/RD+6REqBuPqHM8RQuqAzfjdOeg/Ajdggx1CRMTVhltZsgQoxO30cz9Qo0SdPoL+Jp1fLuaLZq7m/RmsWYvoLT3jebBlpvvQE8YlI= francois.deppierraz@nimag.net +ssh-dss AAAAB3NzaC1kc3MAAACBAJkupmdsJSDXfUy5EU5NTRBDr9Woo3w0YnB8KmnJW9ghU8C7SkWPB1fIHVe+esFfd3qWBseb83PoFX63geZJAg6bjV4/Rdn1zEoa9EO2QyUdYUen4+rpsh3vVKZ6HFNsn3+W5+kPYgE1F/N4INqkbjY3sqCkP/W1BL9+sbVVbuJFAAAAFQCfjWDk5XhvGUkPjNWWVqltBYzHtwAAAIEAg/XL7ky7x9Ad5banzPFAfmM+DGFe0A/JEbLDjKmr5KBM5x4RFohtEvZ8ECuVGUOqBWdgAjyYwsG4oRVjLnKrf/rgmbNRzSFgEWkcAye3BVwk7Dt6hh4knEl+mNfOLq+FH0011UhecOiqTcESMzQDtgQ1vJh2VchElBLjl3x/ZugAAACAAh5jGQC338t5ObP8trSlOefkx0sXmmEzUbo3Mt8mGUuGJPx8m+X0L8Xd+l5rQxytqE3SmV/RD+6REqBuPqHM8RQuqAzfjdOeg/Ajdggx1CRMTVhltZsgQoxO30cz9Qo0SdPoL+Jp1fLuaLZq7m/RmsWYvoLT3jebBlpvvQE8YlI= Francois Deppierraz +from="192.168.1.1",command="/bin/false",no-pty,no-port-forwarding ssh-dss AAAAB3NzaC1kc3MAAACBAJkupmdsJSDXfUy5EU5NTRBDr9Woo3w0YnB8KmnJW9ghU8C7SkWPB1fIHVe+esFfd3qWBseb83PoFX63geZJAg6bjV4/Rdn1zEoa9EO2QyUdYUen4+rpsh3vVKZ6HFNsn3+W5+kPYgE1F/N4INqkbjY3sqCkP/W1BL9+sbVVbuJFAAAAFQCfjWDk5XhvGUkPjNWWVqltBYzHtwAAAIEAg/XL7ky7x9Ad5banzPFAfmM+DGFe0A/JEbLDjKmr5KBM5x4RFohtEvZ8ECuVGUOqBWdgAjyYwsG4oRVjLnKrf/rgmbNRzSFgEWkcAye3BVwk7Dt6hh4knEl+mNfOLq+FH0011UhecOiqTcESMzQDtgQ1vJh2VchElBLjl3x/ZugAAACAAh5jGQC338t5ObP8trSlOefkx0sXmmEzUbo3Mt8mGUuGJPx8m+X0L8Xd+l5rQxytqE3SmV/RD+6REqBuPqHM8RQuqAzfjdOeg/Ajdggx1CRMTVhltZsgQoxO30cz9Qo0SdPoL+Jp1fLuaLZq7m/RmsWYvoLT3jebBlpvvQE8YlI= Francois Deppierraz +from="192.168.1.1, www.reductivelabs.com",command="/bin/false",no-pty,no-port-forwarding ssh-dss AAAAB3NzaC1kc3MAAACBAJkupmdsJSDXfUy5EU5NTRBDr9Woo3w0YnB8KmnJW9ghU8C7SkWPB1fIHVe+esFfd3qWBseb83PoFX63geZJAg6bjV4/Rdn1zEoa9EO2QyUdYUen4+rpsh3vVKZ6HFNsn3+W5+kPYgE1F/N4INqkbjY3sqCkP/W1BL9+sbVVbuJFAAAAFQCfjWDk5XhvGUkPjNWWVqltBYzHtwAAAIEAg/XL7ky7x9Ad5banzPFAfmM+DGFe0A/JEbLDjKmr5KBM5x4RFohtEvZ8ECuVGUOqBWdgAjyYwsG4oRVjLnKrf/rgmbNRzSFgEWkcAye3BVwk7Dt6hh4knEl+mNfOLq+FH0011UhecOiqTcESMzQDtgQ1vJh2VchElBLjl3x/ZugAAACAAh5jGQC338t5ObP8trSlOefkx0sXmmEzUbo3Mt8mGUuGJPx8m+X0L8Xd+l5rQxytqE3SmV/RD+6REqBuPqHM8RQuqAzfjdOeg/Ajdggx1CRMTVhltZsgQoxO30cz9Qo0SdPoL+Jp1fLuaLZq7m/RmsWYvoLT3jebBlpvvQE8YlI= Francois Deppierraz +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Vi+TdC3iOGYcIo5vGTvC9P9rjHl9RxCuZmSfn+YDFQ35RXf0waijtjp9I7GYh6R4hBjA5z0u/Pzi95LET5NfRM0Gdc0DJyvBI7K+ALBxIT383Iz6Yz4iKxe1TEJgHGM2he4+7BHkjc3kdIZqIpZjucCk4VsXSxujO4MKKvtaKK2l+kahlLQHHw/vZkDpIgL52iGVsjW9l8RLJaKHZ4mDHJN/Q/Rzn2W4EvcdHUzwhvGMwZlm8clDwITBrSsawYtnivJrQSYcmTRqJuS8wprNDrLIhTGjrwFg5WpruUuMt6fLuCqwe6TeEL+nh3DQ4g554c5aRp3oU6LGBKTvNZGWQ== francois@korn +ssh-dss AAAAB3NzaC1kc3MAAACBAMPpCYnjywOemd8LqbbmC+bePNR3/H1rXsiFwjSLhYE3bbOpvclvOzN1DruFc34m0FopVnMkP+aubjdIYF8pijl+5hg9ggB7Kno2dl0Dd1rGN/swvmhA8OpLAQv7Qt7UnXKVho3as08zYZsrHxYFu0wlnkdbsv4cy4aXyQKd4MPVAAAAFQDSyQFWg8Qt3wU05buhZ10psoR7tQAAAIEAmAhguXwUnI3P2FF5NAW/mpJUmUERdL4pyZARUyAgpf7ezwrh9TJqrvGTQNBF97Xqaivyncm5JWQdMIsTBxEFaXZGkmBta02KnWcn447qvIh7iv8XpNL6M9flCkBEZOJ4t9El0ytTSHHaiCz8A20Et+E8evWyi1kXkFDt8ML2dGgAAACBAK0X4ympbdEjgV/ZyOc+BU22u7vOnfSOUJmyar4Ax1MIDNnoyNWKnGvxRutydQcQOKQHZEU0fE8MhPFn6nLF6CoVfEl/oz0EYz3hjV4WPFpHrF5DY/rhvNj8iuneKJ5P0dy/rG6m5qey25PnHyGFVoIRlkHJvBCJT40dHs40YEjI francois@korn +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAut8aOSxenjOqF527dlsdHWV4MNoAsX14l9M297+SQXaQ5Z3BedIxZaoQthkDALlV/25A1COELrg9J2MqJNQc8Xe9XQOIkBQWWinUlD/BXwoOTWEy8C8zSZPHZ3getMMNhGTBO+q/O+qiJx3y5cA4MTbw2zSxukfWC87qWwcZ64UUlegIM056vPsdZWFclS9hsROVEa57YUMrehQ1EGxT4Z5j6zIopufGFiAPjZigq/vqgcAqhAKP6yu4/gwO6S9tatBeEjZ8fafvj1pmvvIplZeMr96gHE7xS3pEEQqnB3nd4RY7AF6j9kFixnsytAUO7STPh/M3pLiVQBN89TvWPQ== diff --git a/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys1 b/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys1 new file mode 100644 index 000000000..7aa0647ca --- /dev/null +++ b/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys1 @@ -0,0 +1,3 @@ +1024 35 167576894966720957580065952882142495543043407324667405194097438434880798807651864847570827148390962746149410384891026772700627764845955493549511618975091512997118590589399665757714186775228807376424903966072778732134483862302766419277581465932186641863495699668069439475320990051723279127881281145164415361627 francois@korn +2048 35 27332429396020032283276339339051507284036000350350092862949624519871013308460312287866673933080560923221560798334008554200019645416448528663000202951887890525621015333936122655294782671001073795264378070156670395703161543893088138531854776737799752600933431638059304355933305878665812555436198516842364330938321746086651639330436648850787370397302524667456837036413634152938122227368132322078811602953517461933179827432019932348409533535942749570969101453655028606209719023224268890314608444789012688070463327764203306501923404494017305972543000091038543051645924928018568725584728655193415567703220002707737714942757 francois@korn +from="192.168.1.1",command="/bin/false",no-pty,no-port-forwarding 2048 35 27332429396020032283276339339051507284036000350350092862949624519871013308460312287866673933080560923221560798334008554200019645416448528663000202951887890525621015333936122655294782671001073795264378070156670395703161543893088138531854776737799752600933431638059304355933305878665812555436198516842364330938321746086651639330436648850787370397302524667456837036413634152938122227368132322078811602953517461933179827432019932348409533535942749570969101453655028606209719023224268890314608444789012688070463327764203306501923404494017305972543000091038543051645924928018568725584728655193415567703220002707737714942757 francois@korn diff --git a/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys2 b/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys2 new file mode 100644 index 000000000..9bf830112 --- /dev/null +++ b/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys2 @@ -0,0 +1 @@ +false ssh-dss AAAAB3NzaC1kc3MAAACBAJkupmdsJSDXfUy5EU5NTRBDr9Woo3w0YnB8KmnJW9ghU8C7SkWPB1fIHVe+esFfd3qWBseb83PoFX63geZJAg6bjV4/Rdn1zEoa9EO2QyUdYUen4+rpsh3vVKZ6HFNsn3+W5+kPYgE1F/N4INqkbjY3sqCkP/W1BL9+sbVVbuJFAAAAFQCfjWDk5XhvGUkPjNWWVqltBYzHtwAAAIEAg/XL7ky7x9Ad5banzPFAfmM+DGFe0A/JEbLDjKmr5KBM5x4RFohtEvZ8ECuVGUOqBWdgAjyYwsG4oRVjLnKrf/rgmbNRzSFgEWkcAye3BVwk7Dt6hh4knEl+mNfOLq+FH0011UhecOiqTcESMzQDtgQ1vJh2VchElBLjl3x/ZugAAACAAh5jGQC338t5ObP8trSlOefkx0sXmmEzUbo3Mt8mGUuGJPx8m+X0L8Xd+l5rQxytqE3SmV/RD+6REqBuPqHM8RQuqAzfjdOeg/Ajdggx1CRMTVhltZsgQoxO30cz9Qo0SdPoL+Jp1fLuaLZq7m/RmsWYvoLT3jebBlpvvQE8YlI= Francois Deppierraz diff --git a/spec/fixtures/unit/reports/tagmail/tagmail_failers.conf b/spec/fixtures/unit/reports/tagmail/tagmail_failers.conf new file mode 100644 index 000000000..d116b5fc7 --- /dev/null +++ b/spec/fixtures/unit/reports/tagmail/tagmail_failers.conf @@ -0,0 +1,3 @@ +tag: +: abuse@domain.com +invalid!tag: abuse@domain.com diff --git a/spec/fixtures/unit/reports/tagmail/tagmail_passers.conf b/spec/fixtures/unit/reports/tagmail/tagmail_passers.conf new file mode 100644 index 000000000..ae6d2e7f2 --- /dev/null +++ b/spec/fixtures/unit/reports/tagmail/tagmail_passers.conf @@ -0,0 +1,30 @@ +# A comment +# or maybe two +# plus some blank lines + # with some blanks plus a comment + +# a simple tag report +one: abuse@domain.com + +# with weird spacing + one : abuse@domain.com + +# with multiple tags +one, two: abuse@domain.com + +# again with the weird syntax + one , two : abuse@domain.com + +# Some negations +one, !two: abuse@domain.com + +# some oddly-formatted tags +one, two-three, !four-five, !six: abuse@domain.com + +# multiple addresses +one, two: abuse@domain.com, testing@domain.com + +# and with weird spacing +one, two: abuse@domain.com , testing@domain.com + +# and a trailing comment diff --git a/spec/integration/provider/mailalias/aliases_spec.rb b/spec/integration/provider/mailalias/aliases_spec.rb index bce9374c1..c9c252600 100755 --- a/spec/integration/provider/mailalias/aliases_spec.rb +++ b/spec/integration/provider/mailalias/aliases_spec.rb @@ -2,14 +2,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') -require 'puppettest/support/utils' require 'puppettest/fileparsing' provider_class = Puppet::Type.type(:mailalias).provider(:aliases) describe provider_class do include PuppetTest::FileParsing - include PuppetTest::Support::Utils before :each do @provider = provider_class @@ -17,8 +15,8 @@ describe provider_class do # #1560 it "should be able to parse the mailalias examples" do - fakedata("data/providers/mailalias/aliases").each { |file| + my_fixtures do |file| fakedataparse(file) - } + end end end diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb index 58978ff03..b8254f2e0 100755 --- a/spec/unit/parser/lexer_spec.rb +++ b/spec/unit/parser/lexer_spec.rb @@ -651,11 +651,8 @@ describe "Puppet::Parser::Lexer in the old tests" do end end -require File.dirname(__FILE__) + '/../../../test/lib/puppettest' -require File.dirname(__FILE__) + '/../../../test/lib/puppettest/support/utils' describe "Puppet::Parser::Lexer in the old tests when lexing example files" do - extend PuppetTest::Support::Utils - textfiles do |file| + my_fixtures('*.pp') do |file| it "should correctly lex #{file}" do lexer = Puppet::Parser::Lexer.new lexer.file = file diff --git a/spec/unit/provider/host/parsed_spec.rb b/spec/unit/provider/host/parsed_spec.rb old mode 100644 new mode 100755 index 5704304ba..4a616f34b --- a/spec/unit/provider/host/parsed_spec.rb +++ b/spec/unit/provider/host/parsed_spec.rb @@ -3,14 +3,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet_spec/files' -require 'puppettest/support/utils' require 'puppettest/fileparsing' provider_class = Puppet::Type.type(:host).provider(:parsed) describe provider_class do include PuppetSpec::Files - extend PuppetTest::Support::Utils include PuppetTest::FileParsing before do @@ -132,7 +130,7 @@ describe provider_class do end describe "when operating on /etc/hosts like files" do - fakedata("data/providers/host/parsed","valid*").each do |file| + my_fixtures('valid*') do |file| it "should be able to parse #{file}" do fakedataparse(file) end diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index fc4df97ab..0eb473978 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -5,11 +5,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') -require 'puppettest/support/utils' require 'puppettest/fileparsing' module ParsedMountTesting - include PuppetTest::Support::Utils include PuppetTest::FileParsing def fake_fstab @@ -23,7 +21,7 @@ module ParsedMountTesting name = "linux.fstab" end oldpath = @provider_class.default_target - fakefile(File::join("data/types/mount", name)) + my_fixture(name) end def mkmountargs diff --git a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb index fb4c64926..b951b0a38 100755 --- a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +++ b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb @@ -3,7 +3,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet_spec/files' -require 'puppettest/support/utils' require 'puppettest/fileparsing' require 'puppettest/fakes' @@ -11,7 +10,6 @@ provider_class = Puppet::Type.type(:ssh_authorized_key).provider(:parsed) describe provider_class do include PuppetSpec::Files - extend PuppetTest::Support::Utils include PuppetTest include PuppetTest::FileParsing @@ -50,11 +48,11 @@ describe provider_class do @provider.target_object(@keyfile).read end - fakedata("data/providers/ssh_authorized_key/parsed").each { |file| + my_fixtures do |file| it "should be able to parse example data in #{file}" do fakedataparse(file) end - } + end it "should be able to generate a basic authorized_keys file" do diff --git a/spec/unit/reports/tagmail_spec.rb b/spec/unit/reports/tagmail_spec.rb index 1dadfc7cd..fa8990ebb 100755 --- a/spec/unit/reports/tagmail_spec.rb +++ b/spec/unit/reports/tagmail_spec.rb @@ -3,26 +3,23 @@ Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") } require 'puppet/reports' -require 'puppettest/support/utils' tagmail = Puppet::Reports.report(:tagmail) describe tagmail do - extend PuppetTest::Support::Utils - before do @processor = Puppet::Transaction::Report.new("apply") @processor.extend(Puppet::Reports.report(:tagmail)) end - passers = File.join(datadir, "reports", "tagmail_passers.conf") + passers = my_fixture "tagmail_passers.conf" File.readlines(passers).each do |line| it "should be able to parse '#{line.inspect}'" do @processor.parse(line) end end - failers = File.join(datadir, "reports", "tagmail_failers.conf") + failers = my_fixture "tagmail_failers.conf" File.readlines(failers).each do |line| it "should not be able to parse '#{line.inspect}'" do lambda { @processor.parse(line) }.should raise_error(ArgumentError) diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb index 539782fd4..b15d41d4b 100755 --- a/spec/unit/type/file_spec.rb +++ b/spec/unit/type/file_spec.rb @@ -379,8 +379,6 @@ describe Puppet::Type.type(:file) do end describe "when managing links" do - require 'puppettest/support/assertions' - include PuppetTest require 'tempfile' if @real_posix @@ -394,13 +392,7 @@ describe Puppet::Type.type(:file) do File.open(@file, "w", 0644) { |f| f.puts "yayness"; f.flush } File.symlink(@file, @link) - - @resource = Puppet::Type.type(:file).new( - - :path => @link, - - :mode => "755" - ) + @resource = Puppet::Type.type(:file).new(:path => @link, :mode => "755") @catalog.add_resource @resource end -- cgit From 53b6df3781fe67a3e7fd686cb93cad50c40c6ce3 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 3 Mar 2011 00:05:38 -0800 Subject: (#6582) eliminate fakeparsefile helper method. This was a helper that implemented rspec style "shared behaviour" for Test::Unit; now that we have moved on we can use the upstream implementation instead. This eliminates a whole bit of code we have to maintain. Reviewed-By: Nick Lewis --- .../integration/provider/mailalias/aliases_spec.rb | 18 +++------------- spec/shared_behaviours/all_parsedfile_providers.rb | 21 ++++++++++++++++++ spec/unit/provider/host/parsed_spec.rb | 9 ++------ spec/unit/provider/mount/parsed_spec.rb | 25 ++++++---------------- .../provider/ssh_authorized_key/parsed_spec.rb | 8 +------ 5 files changed, 34 insertions(+), 47 deletions(-) create mode 100644 spec/shared_behaviours/all_parsedfile_providers.rb diff --git a/spec/integration/provider/mailalias/aliases_spec.rb b/spec/integration/provider/mailalias/aliases_spec.rb index c9c252600..19e430ba1 100755 --- a/spec/integration/provider/mailalias/aliases_spec.rb +++ b/spec/integration/provider/mailalias/aliases_spec.rb @@ -1,22 +1,10 @@ #!/usr/bin/env ruby - require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') - -require 'puppettest/fileparsing' +require 'shared_behaviours/all_parsedfile_providers' provider_class = Puppet::Type.type(:mailalias).provider(:aliases) describe provider_class do - include PuppetTest::FileParsing - - before :each do - @provider = provider_class - end - - # #1560 - it "should be able to parse the mailalias examples" do - my_fixtures do |file| - fakedataparse(file) - end - end + # #1560, in which we corrupt the format of complex mail aliases. + it_should_behave_like "all parsedfile providers", provider_class end diff --git a/spec/shared_behaviours/all_parsedfile_providers.rb b/spec/shared_behaviours/all_parsedfile_providers.rb new file mode 100644 index 000000000..9cb199b5f --- /dev/null +++ b/spec/shared_behaviours/all_parsedfile_providers.rb @@ -0,0 +1,21 @@ +shared_examples_for "all parsedfile providers" do |provider, *files| + if files.empty? then + files = my_fixtures + end + + files.flatten.each do |file| + it "should rewrite #{file} reasonably unchanged" do + provider.stubs(:default_target).returns(file) + provider.prefetch + + text = provider.to_file(provider.target_records(file)) + text.gsub!(/^# HEADER.+\n/, '') + + oldlines = File.readlines(file) + newlines = text.chomp.split "\n" + oldlines.zip(newlines).each do |old, new| + new.gsub(/\s+/, '').should == old.chomp.gsub(/\s+/, '') + end + end + end +end diff --git a/spec/unit/provider/host/parsed_spec.rb b/spec/unit/provider/host/parsed_spec.rb index 4a616f34b..3ed479974 100755 --- a/spec/unit/provider/host/parsed_spec.rb +++ b/spec/unit/provider/host/parsed_spec.rb @@ -3,13 +3,11 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet_spec/files' -require 'puppettest/fileparsing' provider_class = Puppet::Type.type(:host).provider(:parsed) describe provider_class do include PuppetSpec::Files - include PuppetTest::FileParsing before do @host_class = Puppet::Type.type(:host) @@ -130,11 +128,8 @@ describe provider_class do end describe "when operating on /etc/hosts like files" do - my_fixtures('valid*') do |file| - it "should be able to parse #{file}" do - fakedataparse(file) - end - end + it_should_behave_like "all parsedfile providers", + provider_class, my_fixtures('valid*') it "should be able to generate a simple hostfile entry" do host = mkhost( diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index 0eb473978..01262f94c 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -4,26 +4,9 @@ # Copyright (c) 2006. All rights reserved. require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') - -require 'puppettest/fileparsing' +require 'shared_behaviours/all_parsedfile_providers' module ParsedMountTesting - include PuppetTest::FileParsing - - def fake_fstab - os = Facter['operatingsystem'] - if os == "Solaris" - name = "solaris.fstab" - elsif os == "FreeBSD" - name = "freebsd.fstab" - else - # Catchall for other fstabs - name = "linux.fstab" - end - oldpath = @provider_class.default_target - my_fixture(name) - end - def mkmountargs mount = nil @@ -79,7 +62,13 @@ describe provider_class do describe provider_class do include ParsedMountTesting + it_should_behave_like "all parsedfile providers", + provider_class, my_fixtures('*.fstab') + it "should be able to parse all of the example mount tabs" do + pending "REVISIT: these may want to be dropped, or maybe rewritten." + # fake_fstab was just one of the *.fstab files, based on running OS, + # despite the claim in the title of this test. --daniel 2011-03-03 tab = fake_fstab @provider = @provider_class diff --git a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb index b951b0a38..6d67ee3bb 100755 --- a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +++ b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb @@ -3,7 +3,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet_spec/files' -require 'puppettest/fileparsing' require 'puppettest/fakes' provider_class = Puppet::Type.type(:ssh_authorized_key).provider(:parsed) @@ -11,7 +10,6 @@ provider_class = Puppet::Type.type(:ssh_authorized_key).provider(:parsed) describe provider_class do include PuppetSpec::Files include PuppetTest - include PuppetTest::FileParsing before :each do @sshauthkey_class = Puppet::Type.type(:ssh_authorized_key) @@ -48,11 +46,7 @@ describe provider_class do @provider.target_object(@keyfile).read end - my_fixtures do |file| - it "should be able to parse example data in #{file}" do - fakedataparse(file) - end - end + it_should_behave_like "all parsedfile providers", provider_class it "should be able to generate a basic authorized_keys file" do -- cgit From 3954576bca044e4fa9c3d74047fdd0833be0c5b6 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 3 Mar 2011 00:40:50 -0800 Subject: (#6582) eliminate fakeresource use in ssh_authorized_key spec. We replace it with an instance of the actual resource we are testing, which reduces the number of ways this code is tied to the specific implementation. Reviewed-By: Nick Lewis --- spec/unit/provider/host/parsed_spec.rb | 1 + .../provider/ssh_authorized_key/parsed_spec.rb | 44 +++++++++------------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/spec/unit/provider/host/parsed_spec.rb b/spec/unit/provider/host/parsed_spec.rb index 3ed479974..048d77ba2 100755 --- a/spec/unit/provider/host/parsed_spec.rb +++ b/spec/unit/provider/host/parsed_spec.rb @@ -1,6 +1,7 @@ #!/usr/bin/env ruby require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'shared_behaviours/all_parsedfile_providers' require 'puppet_spec/files' diff --git a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb index 6d67ee3bb..7a1bd77f4 100755 --- a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +++ b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb @@ -1,15 +1,13 @@ #!/usr/bin/env ruby require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') - +require 'shared_behaviours/all_parsedfile_providers' require 'puppet_spec/files' -require 'puppettest/fakes' provider_class = Puppet::Type.type(:ssh_authorized_key).provider(:parsed) describe provider_class do include PuppetSpec::Files - include PuppetTest before :each do @sshauthkey_class = Puppet::Type.type(:ssh_authorized_key) @@ -25,15 +23,13 @@ describe provider_class do end def mkkey(args) - fakeresource = fakeresource(:ssh_authorized_key, args[:name]) - fakeresource.stubs(:should).with(:user).returns @user - fakeresource.stubs(:should).with(:target).returns @keyfile - - key = @provider.new(fakeresource) + args[:target] = @keyfile + args[:user] = @user + resource = Puppet::Type.type(:ssh_authorized_key).new(args) + key = @provider.new(resource) args.each do |p,v| key.send(p.to_s + "=", v) end - key end @@ -50,30 +46,24 @@ describe provider_class do it "should be able to generate a basic authorized_keys file" do - key = mkkey( - { - :name => "Just Testing", - :key => "AAAAfsfddsjldjgksdflgkjsfdlgkj", - :type => "ssh-dss", - :ensure => :present, - - :options => [:absent] - }) + key = mkkey(:name => "Just Testing", + :key => "AAAAfsfddsjldjgksdflgkjsfdlgkj", + :type => "ssh-dss", + :ensure => :present, + :options => [:absent] + ) genkey(key).should == "ssh-dss AAAAfsfddsjldjgksdflgkjsfdlgkj Just Testing\n" end it "should be able to generate a authorized_keys file with options" do - key = mkkey( - { - :name => "root@localhost", - :key => "AAAAfsfddsjldjgksdflgkjsfdlgkj", - :type => "ssh-rsa", - :ensure => :present, - - :options => ['from="192.168.1.1"', "no-pty", "no-X11-forwarding"] - }) + key = mkkey(:name => "root@localhost", + :key => "AAAAfsfddsjldjgksdflgkjsfdlgkj", + :type => "ssh-rsa", + :ensure => :present, + :options => ['from="192.168.1.1"', "no-pty", "no-X11-forwarding"] + ) genkey(key).should == "from=\"192.168.1.1\",no-pty,no-X11-forwarding ssh-rsa AAAAfsfddsjldjgksdflgkjsfdlgkj root@localhost\n" end -- cgit From 92499c86bc7fcc4c7b7d5de838973868a5e0aba2 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 3 Mar 2011 00:41:04 -0800 Subject: (#6582) Eliminate the last vestige of the unit tests from the specs. This eliminates a stub module in spec_helper, which was used for compatibility with code that didn't bother to require the right files out of the unit tests. It also removes test/lib from LOAD_PATH when running specs, since we don't run with that code, and now we detect that as a larger scale test failure. Reviewed-By: Nick Lewis --- spec/spec_helper.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7f3654456..8d539fa26 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,7 +6,6 @@ dir = File.expand_path(File.dirname(__FILE__)) $LOAD_PATH.unshift("#{dir}/") $LOAD_PATH.unshift("#{dir}/lib") # a spec-specific test lib dir $LOAD_PATH.unshift("#{dir}/../lib") -$LOAD_PATH.unshift("#{dir}/../test/lib") # Don't want puppet getting the command line arguments for rake or autotest ARGV.clear @@ -20,9 +19,6 @@ module PuppetSpec FIXTURE_DIR = File.join(dir = File.expand_path(File.dirname(__FILE__)), "fixtures") unless defined?(FIXTURE_DIR) end -module PuppetTest -end - require 'lib/puppet_spec/files' require 'lib/puppet_spec/fixtures' require 'monkey_patches/alias_should_to_must' -- cgit From 93082e4a683d417603aeb3bffb73b45d007315a7 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 3 Mar 2011 10:56:00 -0800 Subject: (#6582) unstub Puppet settings to improve indirector queue tests. This code was stubbing Puppet settings, which is no longer required now we reset them between tests. Using the real thing reduces points that the rest of the code can break, too. As a side effect this caused Puppet[:trace] to be "true", which meant that we emitted a huge, nasty backtrace during the testing of a specific internal failure handling case. Reviewed-By: Nick Lewis --- spec/unit/indirector/queue_spec.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spec/unit/indirector/queue_spec.rb b/spec/unit/indirector/queue_spec.rb index 7732e411a..49e5e1015 100755 --- a/spec/unit/indirector/queue_spec.rb +++ b/spec/unit/indirector/queue_spec.rb @@ -42,8 +42,7 @@ describe Puppet::Indirector::Queue, :if => Puppet.features.pson? do @subject = @subject_class.new @subject.name = :me - Puppet.settings.stubs(:value).returns("bogus setting data") - Puppet.settings.stubs(:value).with(:queue_type).returns(:test_client) + Puppet[:queue_type] = :test_client Puppet::Util::Queue.stubs(:queue_type_to_class).with(:test_client).returns(Puppet::Indirector::Queue::TestClient) @request = stub 'request', :key => :me, :instance => @subject @@ -112,9 +111,12 @@ describe Puppet::Indirector::Queue, :if => Puppet.features.pson? do it "should log but not propagate errors" do @store_class.client.expects(:subscribe).yields("foo") - @store_class.expects(:intern).raises ArgumentError - Puppet.expects(:err) - @store_class.subscribe {|o| o } + @store_class.expects(:intern).raises(ArgumentError) + expect { @store_class.subscribe {|o| o } }.should_not raise_error + + @logs.length.should == 1 + @logs.first.message.should =~ /Error occured with subscription to queue my_queue for indirection my_queue: ArgumentError/ + @logs.first.level.should == :err end end end -- cgit From ec23d96ebb165c05ffb7c4f68f08da47d530ee92 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 3 Mar 2011 11:04:44 -0800 Subject: (#6582) eliminate a backtrace from mismatched block arguments. This was tightly coupled to the code implementation; it mostly still is, but now allows argument extension without needing to adjust the test which is only focused on the first argument anyhow. Reviewed-By: Nick Lewis --- spec/unit/parser/parser_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb index f5df3041c..d5861d7db 100755 --- a/spec/unit/parser/parser_spec.rb +++ b/spec/unit/parser/parser_spec.rb @@ -281,7 +281,7 @@ describe Puppet::Parser do it "should include docs when the AST class uses them" do @class.expects(:use_docs).returns true @class.stubs(:new) - @parser.expects(:ast_context).with{ |a| a[0] == true }.returns({}) + @parser.expects(:ast_context).with{ |*a| a[0] == true }.returns({}) @parser.ast(@class, :file => "/bar") end -- cgit From 85a743b7e87649c149c9914b6e0909472d059517 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 3 Mar 2011 11:09:25 -0800 Subject: (#6582) stub puts to prevent screen output when testing help. We only really want to verify that the code exits, but the current implementation emits text directly; this results in messing up the tests, which we can avoid with this tiny shim. Reviewed-By: Nick Lewis --- spec/unit/application_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index ca663e317..befc4f510 100755 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -287,6 +287,7 @@ describe Puppet::Application do it "should call exit" do @app.expects(:exit) + @app.stubs(:puts) @app.handle_help(nil) end -- cgit From c3baa2899d88fadd4bbe94e008015e33f98132c7 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Thu, 3 Mar 2011 14:12:44 -0800 Subject: (#6338) Remove inventory indirection, and move to facts indirection The inventory indirection was just providing the search method for facts. Because the route is now facts_search instead of inventory, it can just be implemented as the search method for facts. Reviewed-By: Daniel Pittman --- lib/puppet/indirector/facts/yaml.rb | 75 ++++++++++ lib/puppet/indirector/inventory/yaml.rb | 81 ---------- lib/puppet/node.rb | 1 - lib/puppet/node/inventory.rb | 7 - spec/unit/indirector/facts/yaml_spec.rb | 214 +++++++++++++++++++++++++++ spec/unit/indirector/inventory/yaml_spec.rb | 221 ---------------------------- 6 files changed, 289 insertions(+), 310 deletions(-) delete mode 100644 lib/puppet/indirector/inventory/yaml.rb delete mode 100644 lib/puppet/node/inventory.rb delete mode 100644 spec/unit/indirector/inventory/yaml_spec.rb diff --git a/lib/puppet/indirector/facts/yaml.rb b/lib/puppet/indirector/facts/yaml.rb index 89feaf2ab..65bd78354 100644 --- a/lib/puppet/indirector/facts/yaml.rb +++ b/lib/puppet/indirector/facts/yaml.rb @@ -4,4 +4,79 @@ require 'puppet/indirector/yaml' class Puppet::Node::Facts::Yaml < Puppet::Indirector::Yaml desc "Store client facts as flat files, serialized using YAML, or return deserialized facts from disk." + + def search(request) + node_names = [] + Dir.glob(yaml_dir_path).each do |file| + facts = YAML.load_file(file) + node_names << facts.name if node_matches?(facts, request.options) + end + node_names + end + + private + + # Return the path to a given node's file. + def yaml_dir_path + base = Puppet.run_mode.master? ? Puppet[:yamldir] : Puppet[:clientyamldir] + File.join(base, 'facts', '*.yaml') + end + + def node_matches?(facts, options) + options.each do |key, value| + type, name, operator = key.to_s.split(".") + operator ||= 'eq' + + return false unless node_matches_option?(type, name, operator, value, facts) + end + return true + end + + def node_matches_option?(type, name, operator, value, facts) + case type + when "meta" + case name + when "timestamp" + compare_timestamp(operator, facts.timestamp, Time.parse(value)) + end + when "facts" + compare_facts(operator, facts.values[name], value) + end + end + + def compare_facts(operator, value1, value2) + return false unless value1 + + case operator + when "eq" + value1.to_s == value2.to_s + when "le" + value1.to_f <= value2.to_f + when "ge" + value1.to_f >= value2.to_f + when "lt" + value1.to_f < value2.to_f + when "gt" + value1.to_f > value2.to_f + when "ne" + value1.to_s != value2.to_s + end + end + + def compare_timestamp(operator, value1, value2) + case operator + when "eq" + value1 == value2 + when "le" + value1 <= value2 + when "ge" + value1 >= value2 + when "lt" + value1 < value2 + when "gt" + value1 > value2 + when "ne" + value1 != value2 + end + end end diff --git a/lib/puppet/indirector/inventory/yaml.rb b/lib/puppet/indirector/inventory/yaml.rb deleted file mode 100644 index fe3489a95..000000000 --- a/lib/puppet/indirector/inventory/yaml.rb +++ /dev/null @@ -1,81 +0,0 @@ -require 'puppet/node/inventory' -require 'puppet/indirector/yaml' - -class Puppet::Node::Inventory::Yaml < Puppet::Indirector::Yaml - desc "Return node names matching the fact query" - - # Return the path to a given node's file. - def yaml_dir_path - base = Puppet.run_mode.master? ? Puppet[:yamldir] : Puppet[:clientyamldir] - File.join(base, 'facts', '*.yaml') - end - - def node_matches?(facts, options) - options.each do |key, value| - type, name, operator = key.to_s.split(".") - operator ||= 'eq' - - return false unless node_matches_option?(type, name, operator, value, facts) - end - return true - end - - def search(request) - node_names = [] - Dir.glob(yaml_dir_path).each do |file| - facts = YAML.load_file(file) - node_names << facts.name if node_matches?(facts, request.options) - end - node_names - end - - private - - def node_matches_option?(type, name, operator, value, facts) - case type - when "meta" - case name - when "timestamp" - compare_timestamp(operator, facts.timestamp, Time.parse(value)) - end - when "facts" - compare_facts(operator, facts.values[name], value) - end - end - - def compare_facts(operator, value1, value2) - return false unless value1 - - case operator - when "eq" - value1.to_s == value2.to_s - when "le" - value1.to_f <= value2.to_f - when "ge" - value1.to_f >= value2.to_f - when "lt" - value1.to_f < value2.to_f - when "gt" - value1.to_f > value2.to_f - when "ne" - value1.to_s != value2.to_s - end - end - - def compare_timestamp(operator, value1, value2) - case operator - when "eq" - value1 == value2 - when "le" - value1 <= value2 - when "ge" - value1 >= value2 - when "lt" - value1 < value2 - when "gt" - value1 > value2 - when "ne" - value1 != value2 - end - end -end diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb index e8d58e6be..2453cd1d5 100644 --- a/lib/puppet/node.rb +++ b/lib/puppet/node.rb @@ -3,7 +3,6 @@ require 'puppet/indirector' # A class for managing nodes, including their facts and environment. class Puppet::Node require 'puppet/node/facts' - require 'puppet/node/inventory' require 'puppet/node/environment' # Set up indirection, so that nodes can be looked for in diff --git a/lib/puppet/node/inventory.rb b/lib/puppet/node/inventory.rb deleted file mode 100644 index fd99163b0..000000000 --- a/lib/puppet/node/inventory.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'puppet/node' -require 'puppet/indirector' - -class Puppet::Node::Inventory - extend Puppet::Indirector - indirects :inventory, :terminus_setting => :inventory_terminus -end diff --git a/spec/unit/indirector/facts/yaml_spec.rb b/spec/unit/indirector/facts/yaml_spec.rb index 37a1bcae0..c625c8ee3 100755 --- a/spec/unit/indirector/facts/yaml_spec.rb +++ b/spec/unit/indirector/facts/yaml_spec.rb @@ -23,4 +23,218 @@ describe Puppet::Node::Facts::Yaml do it "should have its name set to :yaml" do Puppet::Node::Facts::Yaml.name.should == :yaml end + + describe "#search" do + def assert_search_matches(matching, nonmatching, query) + request = Puppet::Indirector::Request.new(:inventory, :search, nil, query) + + Dir.stubs(:glob).returns(matching.keys + nonmatching.keys) + [matching, nonmatching].each do |examples| + examples.each do |key, value| + YAML.stubs(:load_file).with(key).returns value + end + end + Puppet::Node::Facts::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} + end + + it "should return node names that match the search query options" do + assert_search_matches({ + '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '4'), + '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "i386", 'processor_count' => '4', 'randomfact' => 'foo') + }, + { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '4'), + "/path/to/nonmatching1.yaml" => Puppet::Node::Facts.new("nonmatchingnode1", "architecture" => "powerpc", 'processor_count' => '5'), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '5'), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3", 'processor_count' => '4'), + }, + {'facts.architecture' => 'i386', 'facts.processor_count' => '4'} + ) + end + + it "should return empty array when no nodes match the search query options" do + assert_search_matches({}, { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '10'), + "/path/to/nonmatching1.yaml" => Puppet::Node::Facts.new("nonmatchingnode1", "architecture" => "powerpc", 'processor_count' => '5'), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '5'), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3", 'processor_count' => '4'), + }, + {'facts.processor_count.lt' => '4', 'facts.processor_count.gt' => '4'} + ) + end + + + it "should return node names that match the search query options with the greater than operator" do + assert_search_matches({ + '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), + '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '10', 'randomfact' => 'foo') + }, + { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '4'), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '3'), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.processor_count.gt' => '4'} + ) + end + + it "should return node names that match the search query options with the less than operator" do + assert_search_matches({ + '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), + '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '30', 'randomfact' => 'foo') + }, + { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '50' ), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '100'), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.processor_count.lt' => '50'} + ) + end + + it "should return node names that match the search query options with the less than or equal to operator" do + assert_search_matches({ + '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), + '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '50', 'randomfact' => 'foo') + }, + { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '100' ), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '5000'), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.processor_count.le' => '50'} + ) + end + + it "should return node names that match the search query options with the greater than or equal to operator" do + assert_search_matches({ + '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '100'), + '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '50', 'randomfact' => 'foo') + }, + { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '40'), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '9' ), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.processor_count.ge' => '50'} + ) + end + + it "should return node names that match the search query options with the not equal operator" do + assert_search_matches({ + '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => 'arm' ), + '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => 'powerpc', 'randomfact' => 'foo') + }, + { + "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "i386" ), + "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '9' ), + "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.architecture.ne' => 'i386'} + ) + end + + def apply_timestamp(facts, timestamp) + facts.timestamp = timestamp + facts + end + + it "should be able to query based on meta.timestamp.gt" do + assert_search_matches({ + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + }, + { + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + {'meta.timestamp.gt' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.le" do + assert_search_matches({ + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + { + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + }, + {'meta.timestamp.le' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.lt" do + assert_search_matches({ + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + { + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + {'meta.timestamp.lt' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.ge" do + assert_search_matches({ + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + { + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + {'meta.timestamp.ge' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.eq" do + assert_search_matches({ + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + { + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + {'meta.timestamp.eq' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp" do + assert_search_matches({ + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + { + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + {'meta.timestamp' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.ne" do + assert_search_matches({ + '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + { + '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + {'meta.timestamp.ne' => '2010-10-15'} + ) + end + end end diff --git a/spec/unit/indirector/inventory/yaml_spec.rb b/spec/unit/indirector/inventory/yaml_spec.rb deleted file mode 100644 index 9f0c54353..000000000 --- a/spec/unit/indirector/inventory/yaml_spec.rb +++ /dev/null @@ -1,221 +0,0 @@ -#!/usr/bin/env ruby - -require File.dirname(__FILE__) + '/../../../spec_helper' - -require 'puppet/node/inventory' -require 'puppet/indirector/inventory/yaml' -require 'puppet/indirector/request' - -describe Puppet::Node::Inventory::Yaml do - def assert_search_matches(matching, nonmatching, query) - request = Puppet::Indirector::Request.new(:inventory, :search, nil, query) - - Dir.stubs(:glob).returns(matching.keys + nonmatching.keys) - [matching, nonmatching].each do |examples| - examples.each do |key, value| - YAML.stubs(:load_file).with(key).returns value - end - end - Puppet::Node::Inventory::Yaml.new.search(request).should =~ matching.values.map {|facts| facts.name} - end - - it "should return node names that match the search query options" do - assert_search_matches({ - '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '4'), - '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "i386", 'processor_count' => '4', 'randomfact' => 'foo') - }, - { - "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '4'), - "/path/to/nonmatching1.yaml" => Puppet::Node::Facts.new("nonmatchingnode1", "architecture" => "powerpc", 'processor_count' => '5'), - "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '5'), - "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3", 'processor_count' => '4'), - }, - {'facts.architecture' => 'i386', 'facts.processor_count' => '4'} - ) - end - - it "should return empty array when no nodes match the search query options" do - assert_search_matches({}, { - "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '10'), - "/path/to/nonmatching1.yaml" => Puppet::Node::Facts.new("nonmatchingnode1", "architecture" => "powerpc", 'processor_count' => '5'), - "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '5'), - "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3", 'processor_count' => '4'), - }, - {'facts.processor_count.lt' => '4', 'facts.processor_count.gt' => '4'} - ) - end - - - it "should return node names that match the search query options with the greater than operator" do - assert_search_matches({ - '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), - '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '10', 'randomfact' => 'foo') - }, - { - "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '4'), - "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '3'), - "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), - }, - {'facts.processor_count.gt' => '4'} - ) - end - - it "should return node names that match the search query options with the less than operator" do - assert_search_matches({ - '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), - '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '30', 'randomfact' => 'foo') - }, - { - "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '50' ), - "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '100'), - "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), - }, - {'facts.processor_count.lt' => '50'} - ) - end - - it "should return node names that match the search query options with the less than or equal to operator" do - assert_search_matches({ - '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), - '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '50', 'randomfact' => 'foo') - }, - { - "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '100' ), - "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '5000'), - "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), - }, - {'facts.processor_count.le' => '50'} - ) - end - - it "should return node names that match the search query options with the greater than or equal to operator" do - assert_search_matches({ - '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '100'), - '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '50', 'randomfact' => 'foo') - }, - { - "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '40'), - "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '9' ), - "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), - }, - {'facts.processor_count.ge' => '50'} - ) - end - - it "should return node names that match the search query options with the not equal operator" do - assert_search_matches({ - '/path/to/matching.yaml' => Puppet::Node::Facts.new("matchingnode", "architecture" => 'arm' ), - '/path/to/matching1.yaml' => Puppet::Node::Facts.new("matchingnode1", "architecture" => 'powerpc', 'randomfact' => 'foo') - }, - { - "/path/to/nonmatching.yaml" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "i386" ), - "/path/to/nonmatching2.yaml" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '9' ), - "/path/to/nonmatching3.yaml" => Puppet::Node::Facts.new("nonmatchingnode3" ), - }, - {'facts.architecture.ne' => 'i386'} - ) - end - - def apply_timestamp(facts, timestamp) - facts.timestamp = timestamp - facts - end - - it "should be able to query based on meta.timestamp.gt" do - assert_search_matches({ - '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), - '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), - }, - { - '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), - '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), - '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), - }, - {'meta.timestamp.gt' => '2010-10-15'} - ) - end - - it "should be able to query based on meta.timestamp.le" do - assert_search_matches({ - '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), - '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), - '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), - }, - { - '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), - '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), - }, - {'meta.timestamp.le' => '2010-10-15'} - ) - end - - it "should be able to query based on meta.timestamp.lt" do - assert_search_matches({ - '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), - '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), - }, - { - '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), - '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), - '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), - }, - {'meta.timestamp.lt' => '2010-10-15'} - ) - end - - it "should be able to query based on meta.timestamp.ge" do - assert_search_matches({ - '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), - '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), - '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), - }, - { - '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), - '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), - }, - {'meta.timestamp.ge' => '2010-10-15'} - ) - end - - it "should be able to query based on meta.timestamp.eq" do - assert_search_matches({ - '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), - }, - { - '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), - '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), - '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), - '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), - }, - {'meta.timestamp.eq' => '2010-10-15'} - ) - end - - it "should be able to query based on meta.timestamp" do - assert_search_matches({ - '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), - }, - { - '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), - '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), - '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), - '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), - }, - {'meta.timestamp' => '2010-10-15'} - ) - end - - it "should be able to query based on meta.timestamp.ne" do - assert_search_matches({ - '/path/to/2010-11-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), - '/path/to/2010-11-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), - '/path/to/2010-10-01.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), - '/path/to/2010-10-10.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), - }, - { - '/path/to/2010-10-15.yaml' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), - }, - {'meta.timestamp.ne' => '2010-10-15'} - ) - end -end -- cgit From 455d1978c31c56ad95dd8289552c99891d09bdee Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 3 Mar 2011 18:11:22 -0800 Subject: (#6582) Don't demand the checkout be named 'puppet'. As part of implementing the fixture support I hard-coded the assumption that the git checkout was a directory named 'puppet'; this broke on our CI server, and would break for anyone else who didn't follow that default. This commit eliminates that assumption and depends only on the appropriate part of the input filename. Reviewed-By: Paul Berry --- spec/lib/puppet_spec/fixtures.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/lib/puppet_spec/fixtures.rb b/spec/lib/puppet_spec/fixtures.rb index 96bb1e39d..7f6bc2a8f 100644 --- a/spec/lib/puppet_spec/fixtures.rb +++ b/spec/lib/puppet_spec/fixtures.rb @@ -5,7 +5,7 @@ module PuppetSpec::Fixtures def my_fixture_dir callers = caller while line = callers.shift do - next unless found = line.match(%r{puppet/spec/(.*)_spec\.rb:}) + next unless found = line.match(%r{/spec/(.*)_spec\.rb:}) return fixtures(found[1]) end fail "sorry, I couldn't work out your path from the caller stack!" -- cgit From 124ff3c17c6c6b1ac1b1b6af21e269d5b4f9f222 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Thu, 3 Mar 2011 18:28:35 -0800 Subject: maint: Fix a randomization test failure The commit for #2597 included a test that asserted the text resulting from detecting a cycle. However, the cycle detection could start randomly from any node, resulting in different text in the error. I'm not sure what the randomization key would be based on since the test failed consistently over dozens of runs for me, and didn't for Daniel. Paired-with: Daniel Pittman --- spec/unit/simple_graph_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/unit/simple_graph_spec.rb b/spec/unit/simple_graph_spec.rb index 2c6af063b..c106f550b 100755 --- a/spec/unit/simple_graph_spec.rb +++ b/spec/unit/simple_graph_spec.rb @@ -305,7 +305,9 @@ describe Puppet::SimpleGraph do it "should produce the correct relationship text" do add_edges :a => :b, :b => :a - want = %r{Found 1 dependency cycle:\n\(a => b => a\)\nTry} + # cycle detection starts from a or b randomly + # so we need to check for either ordering in the error message + want = %r{Found 1 dependency cycle:\n\((a => b => a|b => a => b)\)\nTry} expect { @graph.topsort }.to raise_error(Puppet::Error, want) end -- cgit From 8bd80a99a259e6409a9ac0a8a60325f94b5c5e9d Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Thu, 28 Oct 2010 12:49:19 -0700 Subject: (#5148) Add support for PSON to facts Previously, facts could be fetched via the REST API in PSON, but came back as the to_s representation of a Ruby object, rather than as proper PSON data. This patch adds to_pson and from_pson to facts, so they can be properly used with PSON. --- lib/puppet/node/facts.rb | 21 +++++++++++++++++++++ spec/unit/node/facts_spec.rb | 24 ++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb index 562690026..0a96e553b 100755 --- a/lib/puppet/node/facts.rb +++ b/lib/puppet/node/facts.rb @@ -1,12 +1,17 @@ +require 'time' + require 'puppet/node' require 'puppet/indirector' +require 'puppet/util/pson' + # Manage a given node's facts. This either accepts facts and stores them, or # returns facts for a given node. class Puppet::Node::Facts # Set up indirection, so that nodes can be looked for in # the node sources. extend Puppet::Indirector + extend Puppet::Util::Pson # We want to expire any cached nodes if the facts are saved. module NodeExpirer @@ -62,6 +67,22 @@ class Puppet::Node::Facts self.values[:_timestamp] end + def self.from_pson(data) + result = new(data['name'], data['values']) + result.timestamp = Time.parse(data['timestamp']) + result.expiration = Time.parse(data['expiration']) + result + end + + def to_pson(*args) + { + 'expiration' => expiration, + 'name' => name, + 'timestamp' => timestamp, + 'values' => strip_internal, + }.to_pson(*args) + end + private # Add internal data to the facts for storage. diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb index 394db7913..19049e9bf 100755 --- a/spec/unit/node/facts_spec.rb +++ b/spec/unit/node/facts_spec.rb @@ -109,5 +109,29 @@ describe Puppet::Node::Facts, "when indirecting" do facts = Puppet::Node::Facts.new("me", "one" => "two", "three" => "four") facts.values[:_timestamp].should be_instance_of(Time) end + + describe "using pson" do + before :each do + @timestamp = Time.parse("Thu Oct 28 11:16:31 -0700 2010") + @expiration = Time.parse("Thu Oct 28 11:21:31 -0700 2010") + end + + it "should accept properly formatted pson" do + pson = %Q({"name": "foo", "expiration": "#{@expiration}", "timestamp": "#{@timestamp}", "values": {"a": "1", "b": "2", "c": "3"}}) + format = Puppet::Network::FormatHandler.format('pson') + facts = format.intern(Puppet::Node::Facts,pson) + facts.name.should == 'foo' + facts.expiration.should == @expiration + facts.values.should == {'a' => '1', 'b' => '2', 'c' => '3', :_timestamp => @timestamp} + end + + it "should generate properly formatted pson" do + Time.stubs(:now).returns(@timestamp) + facts = Puppet::Node::Facts.new("foo", {'a' => 1, 'b' => 2, 'c' => 3}) + facts.expiration = @expiration + pson = PSON.parse(facts.to_pson) + pson.should == {"name"=>"foo", "timestamp"=>"Thu Oct 28 11:16:31 -0700 2010", "expiration"=>"Thu Oct 28 11:21:31 -0700 2010", "values"=>{"a"=>1, "b"=>2, "c"=>3}} + end + end end end -- cgit From e3aec14c2ede8ea9b6b1c1684755c715b9923295 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Thu, 28 Oct 2010 14:30:02 -0700 Subject: (#5148) Fix failing spec due to timezone Time.parse(...) will yield a string in the local timezone. So when this spec was run in a non -0700 timezone, it was failing, because it was comparing a string in local time to a string in -0700. This fixes it to compare to the local string representation of the time. --- spec/unit/node/facts_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb index 19049e9bf..cb2aa3dc7 100755 --- a/spec/unit/node/facts_spec.rb +++ b/spec/unit/node/facts_spec.rb @@ -130,7 +130,7 @@ describe Puppet::Node::Facts, "when indirecting" do facts = Puppet::Node::Facts.new("foo", {'a' => 1, 'b' => 2, 'c' => 3}) facts.expiration = @expiration pson = PSON.parse(facts.to_pson) - pson.should == {"name"=>"foo", "timestamp"=>"Thu Oct 28 11:16:31 -0700 2010", "expiration"=>"Thu Oct 28 11:21:31 -0700 2010", "values"=>{"a"=>1, "b"=>2, "c"=>3}} + pson.should == {"name"=>"foo", "timestamp"=>@timestamp.to_s, "expiration"=>@expiration.to_s, "values"=>{"a"=>1, "b"=>2, "c"=>3}} end end end -- cgit From 7a00d6b4b7428145ab774f76c7433bda07c81f99 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Fri, 4 Mar 2011 17:46:25 -0800 Subject: (#6606) Inline docs: Document all autorequire relationships This patch appends **Autorequires:** notes to the @doc string of every type whose instances can autorequire other resources. This will put autorequire info right on the types reference where it can do the most good. --- lib/puppet/type/computer.rb | 6 +++++- lib/puppet/type/exec.rb | 4 +++- lib/puppet/type/file.rb | 4 +++- lib/puppet/type/macauthorization.rb | 5 ++++- lib/puppet/type/mcx.rb | 5 ++++- lib/puppet/type/package.rb | 6 +++++- lib/puppet/type/selmodule.rb | 4 +++- lib/puppet/type/ssh_authorized_key.rb | 6 +++++- lib/puppet/type/user.rb | 4 +++- lib/puppet/type/zfs.rb | 4 +++- lib/puppet/type/zone.rb | 4 +++- 11 files changed, 41 insertions(+), 11 deletions(-) diff --git a/lib/puppet/type/computer.rb b/lib/puppet/type/computer.rb index 89a0692bf..7a2c52d53 100644 --- a/lib/puppet/type/computer.rb +++ b/lib/puppet/type/computer.rb @@ -14,7 +14,11 @@ Puppet::Type.newtype(:computer) do type as per other platforms. This type primarily exists to create localhost Computer objects that MCX - policy can then be attached to." + policy can then be attached to. + + **Autorequires:** If Puppet is managing the plist file representing a + Computer object (located at `/var/db/dslocal/nodes/Default/computers/{name}.plist`), + the Computer resource will autorequire it." # ensurable diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb index daa49e223..5ed2b104c 100755 --- a/lib/puppet/type/exec.rb +++ b/lib/puppet/type/exec.rb @@ -22,7 +22,9 @@ module Puppet to native Puppet types as quickly as possible. If you find that you are doing a lot of work with `exec`, please at least notify us at Puppet Labs what you are doing, and hopefully we can work with - you to get a native resource type for the work you are doing." + you to get a native resource type for the work you are doing. + + **Autorequires:** If Puppet is managing an exec's cwd or the executable file used in an exec's command, the exec resource will autorequire those files. If Puppet is managing the user that an exec should run as, the exec resource will autorequire that user." require 'open3' diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index cbb51bbed..e1a4ecbb9 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -22,7 +22,9 @@ Puppet::Type.newtype(:file) do If you find that you are often copying files in from a central location, rather than using native resources, please contact Puppet Labs and we can hopefully work with you to develop a - native resource to support what you are doing." + native resource to support what you are doing. + + **Autorequires:** If Puppet is managing the user or group that owns a file, the file resource will autorequire them. If Puppet is managing any parent directories of a file, the file resource will autorequire them." def self.title_patterns [ [ /^(.*?)\/*\Z/m, [ [ :path, lambda{|x| x} ] ] ] ] diff --git a/lib/puppet/type/macauthorization.rb b/lib/puppet/type/macauthorization.rb index ef6fbb6c1..e89aa7c89 100644 --- a/lib/puppet/type/macauthorization.rb +++ b/lib/puppet/type/macauthorization.rb @@ -1,7 +1,10 @@ Puppet::Type.newtype(:macauthorization) do @doc = "Manage the Mac OS X authorization database. - See the [Apple developer site](http://developer.apple.com/documentation/Security/Conceptual/Security_Overview/Security_Services/chapter_4_section_5.html) for more information." + See the [Apple developer site](http://developer.apple.com/documentation/Security/Conceptual/Security_Overview/Security_Services/chapter_4_section_5.html) for more information. + + **Autorequires:** If Puppet is managing the `/etc/authorization` file, each + macauthorization resource will autorequire it." ensurable diff --git a/lib/puppet/type/mcx.rb b/lib/puppet/type/mcx.rb index 4f0a6c3c5..07c9348dd 100644 --- a/lib/puppet/type/mcx.rb +++ b/lib/puppet/type/mcx.rb @@ -27,8 +27,11 @@ content property of the file type in Puppet. The recommended method of using this type is to use Work Group Manager to manage users and groups on the local computer, record the resulting -puppet manifest using the command 'ralsh mcx' then deploying this +puppet manifest using the command `puppet resource mcx`, then deploy it to other machines. + +**Autorequires:** If Puppet is managing the user, group, or computer that these +MCX settings refer to, the MCX resource will autorequire that user, group, or computer. " feature :manages_content, \ "The provider can manage MCXSettings as a string.", diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb index d73d90dff..1222a5319 100644 --- a/lib/puppet/type/package.rb +++ b/lib/puppet/type/package.rb @@ -15,7 +15,11 @@ module Puppet using based on the platform you are on, but you can override it using the `provider` parameter; each provider defines what it requires in order to function, and you must meet those requirements - to use a given provider." + to use a given provider. + + **Autorequires:** If Puppet is managing the files specified as a package's + `adminfile`, `responsefile`, or `source`, the package resource will autorequire + those files." feature :installable, "The provider can install packages.", :methods => [:install] diff --git a/lib/puppet/type/selmodule.rb b/lib/puppet/type/selmodule.rb index 60be8a855..e76c18cc0 100644 --- a/lib/puppet/type/selmodule.rb +++ b/lib/puppet/type/selmodule.rb @@ -5,7 +5,9 @@ Puppet::Type.newtype(:selmodule) do @doc = "Manages loading and unloading of SELinux policy modules on the system. Requires SELinux support. See man semodule(8) - for more information on SELinux policy modules." + for more information on SELinux policy modules. + + **Autorequires:** If Puppet is managing the file containing this SELinux policy module (which is either explicitly specified in the `selmodulepath` attribute or will be found at {`selmoduledir`}/{`name`}.pp), the selmodule resource will autorequire that file." ensurable diff --git a/lib/puppet/type/ssh_authorized_key.rb b/lib/puppet/type/ssh_authorized_key.rb index e3320140e..8338e2d64 100644 --- a/lib/puppet/type/ssh_authorized_key.rb +++ b/lib/puppet/type/ssh_authorized_key.rb @@ -1,7 +1,11 @@ module Puppet newtype(:ssh_authorized_key) do @doc = "Manages SSH authorized keys. Currently only type 2 keys are - supported." + supported. + + **Autorequires:** If Puppet is managing the user account in which this + SSH key should be installed, the `ssh_authorized_key` resource will autorequire + that user." ensurable diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index e7389a0d1..584d3adfc 100755 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -12,7 +12,9 @@ module Puppet This resource type uses the prescribed native tools for creating groups and generally uses POSIX APIs for retrieving information - about them. It does not directly modify `/etc/passwd` or anything." + about them. It does not directly modify `/etc/passwd` or anything. + + **Autorequires:** If Puppet is managing the user's primary group (as provided in the `gid` attribute), the user resource will autorequire that group. If Puppet is managing any role accounts corresponding to the user's roles, the user resource will autorequire those role accounts." feature :allows_duplicates, "The provider supports duplicate users with the same UID." diff --git a/lib/puppet/type/zfs.rb b/lib/puppet/type/zfs.rb index 1757931f8..6f04bddd8 100755 --- a/lib/puppet/type/zfs.rb +++ b/lib/puppet/type/zfs.rb @@ -1,6 +1,8 @@ module Puppet newtype(:zfs) do - @doc = "Manage zfs. Create destroy and set properties on zfs instances." + @doc = "Manage zfs. Create destroy and set properties on zfs instances. + +**Autorequires:** If Puppet is managing the zpool at the root of this zfs instance, the zfs resource will autorequire it. If Puppet is managing any parent zfs instances, the zfs resource will autorequire them." ensurable diff --git a/lib/puppet/type/zone.rb b/lib/puppet/type/zone.rb index 408d6f5dd..471619c98 100644 --- a/lib/puppet/type/zone.rb +++ b/lib/puppet/type/zone.rb @@ -1,5 +1,7 @@ Puppet::Type.newtype(:zone) do - @doc = "Solaris zones." + @doc = "Solaris zones. + +**Autorequires:** If Puppet is managing the directory specified as the root of the zone's filesystem (with the `path` attribute), the zone resource will autorequire that directory." # These properties modify the zone configuration, and they need to provide # the text separately from syncing it, so all config statements can be rolled -- cgit From f4a0af16eaa30571662017cab7e106a96b99988d Mon Sep 17 00:00:00 2001 From: Elias Lutfallah Date: Sat, 5 Mar 2011 15:07:39 -0600 Subject: Refactoring duplicate code and logic in prep for DESTDIR deprecation. DESTDIR is slated to be deprecated. The block of code that checks for DESTDIR contained duplicate code as the block that checks for --destdir. The dupe code has been moved out of the destdir checks. I have also flipped the order of checking. Previously, if the DESTDIR env was set it would be used regardless of whether or not the --destdir flag was set. No env, no flag: ./install.rb destdir = nil Env only: DESTDIR="foo" ./install.rb destdir = foo Flag only: ./install.rb --destdir="bar" destdir = bar Both (uses flag): DESTDIR="foo" ./install.rb --destdir="bar" destdir = bar --- install.rb | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/install.rb b/install.rb index 7627a8d11..d20b7cda7 100755 --- a/install.rb +++ b/install.rb @@ -300,34 +300,28 @@ def prepare_installation mandir = Config::CONFIG['mandir'] end - # To be deprecated once people move over to using --destdir option - if (destdir = ENV['DESTDIR']) - configdir = "#{destdir}#{configdir}" - bindir = "#{destdir}#{bindir}" - sbindir = "#{destdir}#{sbindir}" - mandir = "#{destdir}#{mandir}" - sitelibdir = "#{destdir}#{sitelibdir}" - - FileUtils.makedirs(configdir) if InstallOptions.configs - FileUtils.makedirs(bindir) - FileUtils.makedirs(sbindir) - FileUtils.makedirs(mandir) - FileUtils.makedirs(sitelibdir) # This is the new way forward - elsif (destdir = InstallOptions.destdir) - configdir = "#{destdir}#{configdir}" - bindir = "#{destdir}#{bindir}" - sbindir = "#{destdir}#{sbindir}" - mandir = "#{destdir}#{mandir}" - sitelibdir = "#{destdir}#{sitelibdir}" - - FileUtils.makedirs(configdir) if InstallOptions.configs - FileUtils.makedirs(bindir) - FileUtils.makedirs(sbindir) - FileUtils.makedirs(mandir) - FileUtils.makedirs(sitelibdir) + if not InstallOptions.destdir.nil? + destdir = InstallOptions.destdir + # To be deprecated once people move over to using --destdir option + elsif ENV['DESTDIR'] != nil? + destdir = ENV['DESTDIR'] + else + destdir = '' end + configdir = "#{destdir}#{configdir}" + bindir = "#{destdir}#{bindir}" + sbindir = "#{destdir}#{sbindir}" + mandir = "#{destdir}#{mandir}" + sitelibdir = "#{destdir}#{sitelibdir}" + + FileUtils.makedirs(configdir) if InstallOptions.configs + FileUtils.makedirs(bindir) + FileUtils.makedirs(sbindir) + FileUtils.makedirs(mandir) + FileUtils.makedirs(sitelibdir) + tmpdirs << bindir InstallOptions.tmp_dirs = tmpdirs.compact -- cgit From 1b1e803b4d2bf1e87b8796556439e3c0bada57ea Mon Sep 17 00:00:00 2001 From: Elias Lutfallah Date: Sat, 5 Mar 2011 15:23:06 -0600 Subject: (5724) Prep for deprecation of DESTDIR In preparation of deprecating the DESTDIR env variable, I've added a warning when the DESTDIR variable is being used. --- install.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/install.rb b/install.rb index d20b7cda7..e8755e07a 100755 --- a/install.rb +++ b/install.rb @@ -306,6 +306,7 @@ def prepare_installation # To be deprecated once people move over to using --destdir option elsif ENV['DESTDIR'] != nil? destdir = ENV['DESTDIR'] + warn "DESTDIR is deprecated. Use --destdir instead." else destdir = '' end -- cgit From 455a89129a6860215d8e79972f720eaa7564e625 Mon Sep 17 00:00:00 2001 From: Valdis Victor Vitayaudom Date: Sat, 5 Mar 2011 13:36:02 -0800 Subject: (#5794) create reports directory when creating host specific directory --- lib/puppet/reports/store.rb | 5 ++++- spec/unit/reports/store_spec.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/puppet/reports/store.rb b/lib/puppet/reports/store.rb index 99a9fc177..625a263b3 100644 --- a/lib/puppet/reports/store.rb +++ b/lib/puppet/reports/store.rb @@ -15,7 +15,10 @@ Puppet::Reports.register_report(:store) do dir = File.join(Puppet[:reportdir], client) - Dir.mkdir(dir, 0750) unless FileTest.exists?(dir) + if ! FileTest.exists?(dir) + FileUtils.mkdir_p(dir) + FileUtils.chmod_R(0750, dir) + end # Now store the report. now = Time.now.gmtime diff --git a/spec/unit/reports/store_spec.rb b/spec/unit/reports/store_spec.rb index 1acb5badd..9d9042386 100644 --- a/spec/unit/reports/store_spec.rb +++ b/spec/unit/reports/store_spec.rb @@ -11,7 +11,7 @@ describe processor do describe "#process" do include PuppetSpec::Files before :each do - Puppet[:reportdir] = tmpdir('reports') + Puppet[:reportdir] = tmpdir('reports') << '/reports' @report = YAML.load_file(File.join(PuppetSpec::FIXTURE_DIR, 'yaml/report2.6.x.yaml')).extend processor end -- cgit From 75af5827b68774d0300499fab969239bb8ae6d30 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Mon, 7 Mar 2011 16:46:24 -0800 Subject: maint: Move puppetdoc settings to defaults so we can use them in tests Paired-with: Daniel Pittman --- lib/puppet/application/doc.rb | 8 +------- lib/puppet/defaults.rb | 4 ++++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/puppet/application/doc.rb b/lib/puppet/application/doc.rb index 3bfe41653..74811919e 100644 --- a/lib/puppet/application/doc.rb +++ b/lib/puppet/application/doc.rb @@ -1,7 +1,6 @@ require 'puppet/application' class Puppet::Application::Doc < Puppet::Application - should_not_parse_config run_mode :master @@ -140,7 +139,7 @@ COPYRIGHT Copyright (c) 2005-2007 Puppet Labs, LLC Licensed under the GNU Public License - HELP +HELP end def handle_unknown( opt, arg ) @@ -163,11 +162,6 @@ License files += command_line.args Puppet.info "scanning: #{files.inspect}" - Puppet.settings.setdefaults( - "puppetdoc", - - "document_all" => [false, "Document all resources"] - ) Puppet.settings[:document_all] = options[:all] || false begin require 'puppet/util/rdoc' diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 576acfeb6..f308d4476 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -822,4 +822,8 @@ module Puppet directories." ] ) + setdefaults( + :puppetdoc, + :document_all => [false, "Document all resources"] + ) end -- cgit From 23d1c0346a609369b457da876714c6671fcf3d44 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Thu, 24 Feb 2011 12:43:45 -0800 Subject: Maint: Added the ability to replace the behavior of Puppet::Util.execute with an arbitrary code block for ease in spec testing. Reviewed-by: Max Martin --- lib/puppet/util.rb | 5 +++++ lib/puppet/util/execution_stub.rb | 26 ++++++++++++++++++++++++++ spec/spec_helper.rb | 1 + spec/unit/util/execution_stub_spec.rb | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 lib/puppet/util/execution_stub.rb create mode 100644 spec/unit/util/execution_stub_spec.rb diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb index 850d147e2..d06f44808 100644 --- a/lib/puppet/util.rb +++ b/lib/puppet/util.rb @@ -4,6 +4,7 @@ require 'puppet/util/monkey_patches' require 'sync' require 'puppet/external/lock' require 'monitor' +require 'puppet/util/execution_stub' module Puppet # A command failed to execute. @@ -264,6 +265,10 @@ module Util arguments[:uid] = Puppet::Util::SUIDManager.convert_xid(:uid, arguments[:uid]) if arguments[:uid] arguments[:gid] = Puppet::Util::SUIDManager.convert_xid(:gid, arguments[:gid]) if arguments[:gid] + if execution_stub = Puppet::Util::ExecutionStub.current_value + return execution_stub.call(command, arguments) + end + @@os ||= Facter.value(:operatingsystem) output = nil child_pid, child_status = nil diff --git a/lib/puppet/util/execution_stub.rb b/lib/puppet/util/execution_stub.rb new file mode 100644 index 000000000..af74e0f72 --- /dev/null +++ b/lib/puppet/util/execution_stub.rb @@ -0,0 +1,26 @@ +module Puppet::Util + class ExecutionStub + class << self + # Set a stub block that Puppet::Util.execute() should invoke instead + # of actually executing commands on the target machine. Intended + # for spec testing. + # + # The arguments passed to the block are |command, options|, where + # command is an array of strings and options is an options hash. + def set(&block) + @value = block + end + + # Uninstall any execution stub, so that calls to + # Puppet::Util.execute() behave normally again. + def reset + @value = nil + end + + # Retrieve the current execution stub, or nil if there is no stub. + def current_value + @value + end + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a374fb008..ae4edb2d9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -34,6 +34,7 @@ RSpec.configure do |config| Puppet.settings.clear Puppet::Node::Environment.clear Puppet::Util::Storage.clear + Puppet::Util::ExecutionStub.reset if defined?($tmpfiles) $tmpfiles.each do |file| diff --git a/spec/unit/util/execution_stub_spec.rb b/spec/unit/util/execution_stub_spec.rb new file mode 100644 index 000000000..14cf9c67a --- /dev/null +++ b/spec/unit/util/execution_stub_spec.rb @@ -0,0 +1,35 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../spec_helper' + +describe Puppet::Util::ExecutionStub do + it "should use the provided stub code when 'set' is called" do + Puppet::Util::ExecutionStub.set do |command, options| + command.should == ['/bin/foo', 'bar'] + "stub output" + end + Puppet::Util::ExecutionStub.current_value.should_not == nil + Puppet::Util.execute(['/bin/foo', 'bar']).should == "stub output" + end + + it "should automatically restore normal execution at the conclusion of each spec test" do + # Note: this test relies on the previous test creating a stub. + Puppet::Util::ExecutionStub.current_value.should == nil + end + + it "should restore normal execution after 'reset' is called" do + true_command = Puppet::Util.which('true') # Note: "true" exists at different paths in different OSes + stub_call_count = 0 + Puppet::Util::ExecutionStub.set do |command, options| + command.should == [true_command] + stub_call_count += 1 + 'stub called' + end + Puppet::Util.execute([true_command]).should == 'stub called' + stub_call_count.should == 1 + Puppet::Util::ExecutionStub.reset + Puppet::Util::ExecutionStub.current_value.should == nil + Puppet::Util.execute([true_command]).should == '' + stub_call_count.should == 1 + end +end -- cgit From 9d2fceb7141e4cc7a6215aa2529239eb2eb6c8fd Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Tue, 1 Mar 2011 14:06:42 -0800 Subject: Maint: Begin adding integration tests for the mount provider These tests form a starting point for integration testing the mount provider, using the new Puppet::Util::ExecutionStub mechanism to simulate the state of the machine in response to the execution of "mount" and "umount" commands. The tests currently work around some known bugs (6628, 6632, and 6633). Reviewed-by: Max Martin --- spec/integration/provider/mount_spec.rb | 93 +++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 spec/integration/provider/mount_spec.rb diff --git a/spec/integration/provider/mount_spec.rb b/spec/integration/provider/mount_spec.rb new file mode 100644 index 000000000..69a9eeb56 --- /dev/null +++ b/spec/integration/provider/mount_spec.rb @@ -0,0 +1,93 @@ +require File.dirname(__FILE__) + '/../../spec_helper' + +require 'puppet/file_bucket/dipper' + +describe "mount provider (integration)" do + include PuppetSpec::Files + + before :each do + @fake_fstab = tmpfile('fstab') + File.open(@fake_fstab, 'w') do |f| + # leave file empty + end + Puppet::Type.type(:mount).defaultprovider.stubs(:default_target).returns(@fake_fstab) + Facter.stubs(:value).with(:operatingsystem).returns('Darwin') + Puppet::Util::ExecutionStub.set do |command, options| + case command[0] + when '/sbin/mount' + if command.length == 1 + if @mounted + "/dev/disk1s1 on /Volumes/foo_disk (msdos, local)\n" + else + '' + end + else + command.length.should == 4 + command[1].should == '-o' + command[2].should == 'local' + command[3].should == '/Volumes/foo_disk' + @mounted.should == false # verify that we don't try to call "mount" redundantly + check_fstab + @mounted = true + '' + end + when '/sbin/umount' + fail "unexpected umount" unless @umount_permitted + command.length.should == 2 + command[1].should == '/Volumes/foo_disk' + @mounted = false + '' + else + fail "Unexpected command #{command.inspect} executed" + end + end + end + + after :each do + Puppet::Type::Mount::ProviderParsed.clear # Work around bug #6628 + end + + def check_fstab + # Verify that the fake fstab has the expected data in it + File.read(@fake_fstab).lines.reject { |x| x =~ /^#/ }.should == ["/dev/disk1s1\t/Volumes/foo_disk\tmsdos\tlocal\t0\t0\n"] + end + + def run_in_catalog(ensure_setting) + resource = Puppet::Type.type(:mount).new(:name => "/Volumes/foo_disk", :ensure => ensure_setting, + :device => "/dev/disk1s1", :options => "local", :fstype => "msdos") + Puppet::FileBucket::Dipper.any_instance.stubs(:backup) # Don't backup to the filebucket + resource.expects(:err).never + catalog = Puppet::Resource::Catalog.new + catalog.host_config = false # Stop Puppet from doing a bunch of magic + catalog.add_resource resource + catalog.apply + end + + [:defined, :present].each do |ensure_setting| + describe "When setting ensure => #{ensure_setting}" do + it "should create an fstab entry if none exists" do + @mounted = false + @umount_permitted = false + run_in_catalog(ensure_setting) + @mounted.should == false + check_fstab + end + end + end + + it "should be able to create and mount a brand new mount point" do + @mounted = false + @umount_permitted = true # Work around bug #6632 + run_in_catalog(:mounted) + @mounted.should == true + check_fstab + end + + it "should be able to create an fstab entry for an already-mounted device" do + @mounted = true + @umount_permitted = true # Work around bug #6633 + run_in_catalog(:mounted) + @mounted.should == true + check_fstab + end +end -- cgit From bd5517dd9cd8e10f488713d9654957746e687378 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 7 Mar 2011 17:56:41 -0800 Subject: Adjust Darwin mount provider tests to pass on Linux mount, and umount are located under /bin, instead of /sbin on Linux, so we adjust the ExecutionStub to accept either location. Paired-with: Jacob Helwig --- spec/integration/provider/mount_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/integration/provider/mount_spec.rb b/spec/integration/provider/mount_spec.rb index 69a9eeb56..c28707dd9 100644 --- a/spec/integration/provider/mount_spec.rb +++ b/spec/integration/provider/mount_spec.rb @@ -14,7 +14,7 @@ describe "mount provider (integration)" do Facter.stubs(:value).with(:operatingsystem).returns('Darwin') Puppet::Util::ExecutionStub.set do |command, options| case command[0] - when '/sbin/mount' + when %r{/s?bin/mount} if command.length == 1 if @mounted "/dev/disk1s1 on /Volumes/foo_disk (msdos, local)\n" @@ -31,7 +31,7 @@ describe "mount provider (integration)" do @mounted = true '' end - when '/sbin/umount' + when %r{/s?bin/umount} fail "unexpected umount" unless @umount_permitted command.length.should == 2 command[1].should == '/Volumes/foo_disk' -- cgit From 9a1c3b5ad48a254ff2a6becc72f54feb37bb3de1 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Mon, 7 Mar 2011 18:44:28 -0800 Subject: maint: spec/integration/configurer has races in time checking. This code depended on the time written by the configurer, and Time.now about half a dozen lines later, being the same integer value. This would work almost all the time, because our code is pretty fast, but can race. We now capture the time on both sides of the call, and verify that the emitted time was in that range; this actually tests the whole purpose much better, and more thoroughly. Reviewed-by: Paul Berry --- spec/integration/configurer_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/integration/configurer_spec.rb b/spec/integration/configurer_spec.rb index 825b6322e..05b3d6146 100755 --- a/spec/integration/configurer_spec.rb +++ b/spec/integration/configurer_spec.rb @@ -50,7 +50,12 @@ describe Puppet::Configurer do Puppet[:lastrunfile] = tmpfile("lastrunfile") Puppet[:report] = true + # We only record integer seconds in the timestamp, and truncate + # backwards, so don't use a more accurate timestamp in the test. + # --daniel 2011-03-07 + t1 = Time.now.tv_sec @configurer.run :catalog => @catalog, :report => report + t2 = Time.now.tv_sec summary = nil File.open(Puppet[:lastrunfile], "r") do |fd| @@ -62,7 +67,7 @@ describe Puppet::Configurer do summary.should be_key(key) end summary["time"].should be_key("notify") - summary["time"]["last_run"].should >= Time.now.tv_sec + summary["time"]["last_run"].should be_between(t1, t2) end end end -- cgit From 5ef10315705b8e4d69d13b8df86b9585f2bcc29a Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Tue, 8 Mar 2011 11:35:58 -0800 Subject: (#6632) Adding a new mount no longer causes error with umount There were two problems: * In lib/puppet/type/mount.rb, we were calling provider.mounted? to determine whether we needed to execute "mount" after updating the in-memory fstab record. This wasn't working properly because provider.mounted? makes its decision based on the data stored in the in-memory fstab record. Since the fstab record had just been updated, provider.mounted? was incorrectly returning true even though the device wasn't actually mounted. Fixed this by checking provider.mounted? before updating the in-memory fstab record. * Calling mount from this point in lib/puppet/type/mount.rb is actually too early, because even though the in-memory fstab record has been created, its contents have not been written to `/etc/fstab` yet. Fixed this by storing a :needs_mount entry in the property_hash and checking it at the end of the flush() method. Reviewed-by: Jacob Helwig --- lib/puppet/provider/mount/parsed.rb | 6 ++++++ lib/puppet/type/mount.rb | 3 ++- spec/integration/provider/mount_spec.rb | 3 ++- spec/unit/type/mount_spec.rb | 34 ++++----------------------------- 4 files changed, 14 insertions(+), 32 deletions(-) diff --git a/lib/puppet/provider/mount/parsed.rb b/lib/puppet/provider/mount/parsed.rb index 42e543c15..11c5e21a9 100755 --- a/lib/puppet/provider/mount/parsed.rb +++ b/lib/puppet/provider/mount/parsed.rb @@ -97,4 +97,10 @@ Puppet::Type.type(:mount).provide( end instances end + + def flush + needs_mount = @property_hash.delete(:needs_mount) + super + mount if needs_mount + end end diff --git a/lib/puppet/type/mount.rb b/lib/puppet/type/mount.rb index 98a1f2509..5b8c5ca58 100755 --- a/lib/puppet/type/mount.rb +++ b/lib/puppet/type/mount.rb @@ -74,12 +74,13 @@ module Puppet newvalue(:mounted, :event => :mount_mounted) do # Create the mount point if it does not already exist. current_value = self.retrieve + currently_mounted = provider.mounted? provider.create if [nil, :absent, :ghost].include?(current_value) syncothers # The fs can be already mounted if it was absent but mounted - provider.mount unless provider.mounted? + provider.property_hash[:needs_mount] = true unless currently_mounted end # insync: mounted -> present diff --git a/spec/integration/provider/mount_spec.rb b/spec/integration/provider/mount_spec.rb index c28707dd9..518b2956f 100644 --- a/spec/integration/provider/mount_spec.rb +++ b/spec/integration/provider/mount_spec.rb @@ -35,6 +35,7 @@ describe "mount provider (integration)" do fail "unexpected umount" unless @umount_permitted command.length.should == 2 command[1].should == '/Volumes/foo_disk' + @mounted.should == true # "umount" doesn't work when device not mounted (see #6632) @mounted = false '' else @@ -77,7 +78,7 @@ describe "mount provider (integration)" do it "should be able to create and mount a brand new mount point" do @mounted = false - @umount_permitted = true # Work around bug #6632 + @umount_permitted = true # Work around bug #6633 run_in_catalog(:mounted) @mounted.should == true check_fstab diff --git a/spec/unit/type/mount_spec.rb b/spec/unit/type/mount_spec.rb index 7f9a0eba6..fdb67f7d5 100755 --- a/spec/unit/type/mount_spec.rb +++ b/spec/unit/type/mount_spec.rb @@ -65,7 +65,8 @@ end describe Puppet::Type.type(:mount)::Ensure do before :each do - @provider = stub 'provider', :class => Puppet::Type.type(:mount).defaultprovider, :clear => nil, :satisfies? => true, :name => :mock + provider_properties = {} + @provider = stub 'provider', :class => Puppet::Type.type(:mount).defaultprovider, :clear => nil, :satisfies? => true, :name => :mock, :property_hash => provider_properties Puppet::Type.type(:mount).defaultprovider.stubs(:new).returns(@provider) @mount = Puppet::Type.type(:mount).new(:name => "yay", :check => :ensure) @@ -93,11 +94,12 @@ describe Puppet::Type.type(:mount)::Ensure do @provider.stubs(:mounted?).returns([:mounted,:ghost].include? options[:from]) @provider.expects(:create).times(options[:create] || 0) @provider.expects(:destroy).times(options[:destroy] || 0) - @provider.expects(:mount).times(options[:mount] || 0) + @provider.expects(:mount).never @provider.expects(:unmount).times(options[:unmount] || 0) @ensure.stubs(:syncothers) @ensure.should = options[:to] @ensure.sync + (!!@provider.property_hash[:needs_mount]).should == (!!options[:mount]) end it "should create itself when changing from :ghost to :present" do @@ -285,34 +287,6 @@ describe Puppet::Type.type(:mount), "when modifying an existing mount entry" do @catalog.apply end - it "should flush changes before mounting" do - syncorder = sequence('syncorder') - @mount.provider.expects(:options).returns 'soft' - @mount.provider.expects(:ensure).returns :unmounted - @mount.provider.expects(:mounted?).returns false - - @mount.provider.expects(:options=).in_sequence(syncorder).with 'hard' - @mount.expects(:flush).in_sequence(syncorder) # Have to write with no options - @mount.provider.expects(:mount).in_sequence(syncorder) - @mount.expects(:flush).in_sequence(syncorder) # Call flush again cause we changed everything - - @mount[:ensure] = :mounted - @mount[:options] = 'hard' - - @catalog.apply - end - - it "should not flush before mounting if there are no other changes" do - syncorder = sequence('syncorder') - @mount.provider.expects(:ensure).returns :unmounted - @mount.provider.expects(:mounted?).returns false - @mount.provider.expects(:mount).in_sequence(syncorder) - @mount.expects(:flush).in_sequence(syncorder) # Call flush cause we changed everything - - @mount[:ensure] = :mounted - @catalog.apply - end - it "should umount before flushing changes to disk" do syncorder = sequence('syncorder') @mount.provider.expects(:options).returns 'soft' -- cgit From 28ce355be0a16caa8e1cc0b6f531d2be070ca6f2 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Mon, 7 Mar 2011 16:48:09 -0800 Subject: maint: Fix rdoc when documenting manifest files The structure of the AST has changed from 2.6.x to master, so the code to generate documentation from the AST had to change. Generating documentation for resources other than classes, nodes and defines is still broken, see ticket #6634 Paired-with: Daniel Pittman --- lib/puppet/util/rdoc.rb | 13 ++----- spec/fixtures/unit/util/rdoc/basic.pp | 16 ++++++++ spec/unit/util/rdoc_spec.rb | 70 ++++++++--------------------------- 3 files changed, 35 insertions(+), 64 deletions(-) create mode 100644 spec/fixtures/unit/util/rdoc/basic.pp diff --git a/lib/puppet/util/rdoc.rb b/lib/puppet/util/rdoc.rb index bdac579d6..16d1fa15b 100644 --- a/lib/puppet/util/rdoc.rb +++ b/lib/puppet/util/rdoc.rb @@ -53,17 +53,10 @@ module Puppet::Util::RDoc # of a manifest def output(file, ast) astobj = [] - ast.nodes.each do |name, k| - astobj << k if k.file == file + ast.instantiate('').each do |resource_type| + astobj << resource_type if resource_type.file == file end - ast.hostclasses.each do |name,k| - astobj << k if k.file == file - end - - ast.definitions.each do |name, k| - astobj << k if k.file == file - end astobj.sort! {|a,b| a.line <=> b.line }.each do |k| output_astnode_doc(k) end @@ -89,4 +82,4 @@ module Puppet::Util::RDoc end end -end \ No newline at end of file +end diff --git a/spec/fixtures/unit/util/rdoc/basic.pp b/spec/fixtures/unit/util/rdoc/basic.pp new file mode 100644 index 000000000..5616503c1 --- /dev/null +++ b/spec/fixtures/unit/util/rdoc/basic.pp @@ -0,0 +1,16 @@ +# im a class +class foo { + file { '/tmp/foo' : + ensure => present, + } +} + +# im a node +node gar { +} + +# im a define +define baz { } + +# im a resource +host { 'cow' : } diff --git a/spec/unit/util/rdoc_spec.rb b/spec/unit/util/rdoc_spec.rb index 41d4b9cd0..93c4f9bfa 100755 --- a/spec/unit/util/rdoc_spec.rb +++ b/spec/unit/util/rdoc_spec.rb @@ -123,63 +123,25 @@ describe Puppet::Util::RDoc do end describe "when outputing documentation" do - before :each do - @node = stub 'node', :file => "file", :line => 1, :doc => "" - @class = stub 'class', :file => "file", :line => 4, :doc => "" - @definition = stub 'definition', :file => "file", :line => 3, :doc => "" - @ast = stub 'ast', :nodes => { :node => @node }, :hostclasses => { :class => @class }, :definitions => { :definition => @definition } - end - - it "should output doc for ast nodes" do - @node.expects(:doc) - - Puppet::Util::RDoc.output("file", @ast) - end - - it "should output doc for ast classes" do - @class.expects(:doc) - - Puppet::Util::RDoc.output("file", @ast) - end - - it "should output doc for ast definitions" do - @definition.expects(:doc) - - Puppet::Util::RDoc.output("file", @ast) - end - - it "should output doc in order of increasing line number" do - byline = sequence('byline') - @node.expects(:doc).in_sequence(byline) - @definition.expects(:doc).in_sequence(byline) - @class.expects(:doc).in_sequence(byline) - - Puppet::Util::RDoc.output("file", @ast) - end - - it "should not output documentation of ast object of another node" do - klass = stub 'otherclass', :file => "otherfile", :line => 12, :doc => "" - @ast.stubs(:hostclasses).returns({ :otherclass => klass }) - - klass.expects(:doc).never - - Puppet::Util::RDoc.output("file", @ast) + it "should output doc for ast classes, nodes and definitions in order of increasing line number" do + byline = sequence('documentation outputs in line order') + Puppet::Util::RDoc.expects(:puts).with("im a class\n").in_sequence(byline) + Puppet::Util::RDoc.expects(:puts).with("im a node\n").in_sequence(byline) + Puppet::Util::RDoc.expects(:puts).with("im a define\n").in_sequence(byline) + # any other output must fail + Puppet::Util::RDoc.manifestdoc([my_fixture('basic.pp')]) end it "should output resource documentation if needed" do - Puppet.settings.stubs(:[]).with(:document_all).returns(true) - [@node,@definition].each do |o| - o.stubs(:code).returns([]) - end - - resource = stub_everything 'resource', :line => 1 - resource.stubs(:is_a?).with(Puppet::Parser::AST::ASTArray).returns(false) - resource.stubs(:is_a?).with(Puppet::Parser::AST::Resource).returns(true) - @class.stubs(:code).returns([resource]) - - resource.expects(:doc) - - Puppet::Util::RDoc.output("file", @ast) + pending "#6634 being fixed" + Puppet.settings[:document_all] = true + byline = sequence('documentation outputs in line order') + Puppet::Util::RDoc.expects(:puts).with("im a class\n").in_sequence(byline) + Puppet::Util::RDoc.expects(:puts).with("im a node\n").in_sequence(byline) + Puppet::Util::RDoc.expects(:puts).with("im a define\n").in_sequence(byline) + Puppet::Util::RDoc.expects(:puts).with("im a resource\n").in_sequence(byline) + # any other output must fail + Puppet::Util::RDoc.manifestdoc([my_fixture('basic.pp')]) end end end -- cgit From 2a915725adf0ccefcc28653cbba2219925194594 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Mon, 7 Mar 2011 17:51:09 -0800 Subject: (#4798) Make rdoc work if moduledir & manifestdir overlap Merging 2.6.next into next caused a regression; this commit fixes that regression. Paired-with:Max Martin --- lib/puppet/util/rdoc.rb | 1 + lib/puppet/util/rdoc/parser.rb | 4 +++- spec/integration/application/doc_spec.rb | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/puppet/util/rdoc.rb b/lib/puppet/util/rdoc.rb index 16d1fa15b..c00bc6f85 100644 --- a/lib/puppet/util/rdoc.rb +++ b/lib/puppet/util/rdoc.rb @@ -31,6 +31,7 @@ module Puppet::Util::RDoc options << "--force-update" if Options::OptionList.options.any? { |o| o[0] == "--force-update" } options += [ "--charset", charset] if charset options += files + #TODO dedup file paths (not strict duplication sense, parents, children, etc # launch the documentation process r.document(options) diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb index 2b89baace..0f746e2ea 100644 --- a/lib/puppet/util/rdoc/parser.rb +++ b/lib/puppet/util/rdoc/parser.rb @@ -34,17 +34,18 @@ class Parser # main entry point def scan environment = Puppet::Node::Environment.new + @known_resource_types = environment.known_resource_types unless environment.known_resource_types.watching_file?(@input_file_name) Puppet.info "rdoc: scanning #{@input_file_name}" if @input_file_name =~ /\.pp$/ @parser = Puppet::Parser::Parser.new(environment) @parser.file = @input_file_name - @known_resource_types = environment.known_resource_types @parser.parse.instantiate('').each do |type| @known_resource_types.add type end end end + scan_top_level(@top_level) @top_level end @@ -342,6 +343,7 @@ class Parser # that contains the documentation def parse_elements(container) Puppet.debug "rdoc: scanning manifest" + @known_resource_types.hostclasses.values.sort { |a,b| a.name <=> b.name }.each do |klass| name = klass.name if klass.file == @input_file_name diff --git a/spec/integration/application/doc_spec.rb b/spec/integration/application/doc_spec.rb index d94b3043b..f0b9d7db0 100644 --- a/spec/integration/application/doc_spec.rb +++ b/spec/integration/application/doc_spec.rb @@ -7,7 +7,6 @@ describe Puppet::Application::Doc do include PuppetSpec::Files it "should not generate an error when module dir overlaps parent of site.pp (#4798)" do - pending "need to fix as part of fixing Brice's rdoc patch" begin # Note: the directory structure below is more complex than it # needs to be, but it's representative of the directory structure -- cgit From 92dffb29b50160e429b93f941054e5b74df8c598 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Sat, 5 Mar 2011 12:35:25 -0600 Subject: (#6513) Adjust P::U::Settings test name to reflect what it tests The 'should interpolate found values using the current environment' wasn't actually testing what it was describing, since the environment variable is special cased. Reviewed-by: Jesse Wolfe --- spec/unit/util/settings_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/util/settings_spec.rb b/spec/unit/util/settings_spec.rb index 7bca44b76..3ed843b0b 100755 --- a/spec/unit/util/settings_spec.rb +++ b/spec/unit/util/settings_spec.rb @@ -331,7 +331,7 @@ describe Puppet::Util::Settings do @settings.value(:one, "env").should == "envval" end - it "should interpolate found values using the current environment" do + it 'should use the current environment for $environment' do @settings.setdefaults :main, :myval => ["$environment/foo", "mydocs"] @settings.value(:myval, "myenv").should == "myenv/foo" -- cgit From 64440e58967667426e7294ed38ad16e19812d8c4 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Sat, 5 Mar 2011 12:39:14 -0600 Subject: (#6513) Propagate the environment when doing variable lookup in settings For example with the following: test.conf: [master] rrddir = /var/lib/puppet/rrd templatedir = /var/lib/puppet/templates [env_a] templatedir = $rrddir/templates rrddir = /tmp/env_a/ The command: RUBYLIB=lib bin/puppet master --config ./test.conf --environment env_a --configprint templatedir originally produced '/var/lib/puppet/rrd/templates' instead of the expected '/tmp/env_a/templates' Reviewed-by: Jesse Wolfe --- lib/puppet/util/settings.rb | 2 +- spec/unit/util/settings_spec.rb | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index 626ed20eb..f243b8691 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -91,7 +91,7 @@ class Puppet::Util::Settings varname = $2 || $1 if varname == "environment" and environment environment - elsif pval = self.value(varname) + elsif pval = self.value(varname, environment) pval else raise Puppet::DevError, "Could not find value for #{value}" diff --git a/spec/unit/util/settings_spec.rb b/spec/unit/util/settings_spec.rb index 3ed843b0b..07b712c08 100755 --- a/spec/unit/util/settings_spec.rb +++ b/spec/unit/util/settings_spec.rb @@ -284,7 +284,8 @@ describe Puppet::Util::Settings do @settings = Puppet::Util::Settings.new @settings.setdefaults :section, :config => ["/my/file", "a"], - :one => ["ONE", "a"] + :one => ["ONE", "a"], + :two => ["TWO", "b"] FileTest.stubs(:exist?).returns true Puppet.stubs(:run_mode).returns stub('run_mode', :name => :mymode) end @@ -337,6 +338,14 @@ describe Puppet::Util::Settings do @settings.value(:myval, "myenv").should == "myenv/foo" end + it "should interpolate found values using the current environment" do + text = "[main]\none = mainval\n[myname]\none = nameval\ntwo = $one/two\n" + @settings.stubs(:read_file).returns(text) + @settings.parse + + @settings.value(:two, "myname").should == "nameval/two" + end + it "should return values in a specified environment before values in the main or name sections" do text = "[env]\none = envval\n[main]\none = mainval\n[myname]\none = nameval\n" @settings.stubs(:read_file).returns(text) -- cgit From 3b89f32693d3d58d27eeebb33ba8a39f87ab4135 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 8 Mar 2011 15:03:57 -0800 Subject: maint: use chdir rather than depend on bash for win32 We used to depend on a Unix shell, but with Win32 support this doesn't work so well. Thankfully, all we really wanted to do was change directory down into 'test', which Ruby can do natively, saving us the platform headache. --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 6cc53fe18..e59d20ade 100644 --- a/Rakefile +++ b/Rakefile @@ -49,5 +49,5 @@ end desc "Run the unit tests" task :unit do - sh "cd test; rake" + Dir.chdir("test") { sh "rake" } end -- cgit From 1ef83cb750896f997a347a144e20aa6c96daf171 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Tue, 8 Mar 2011 13:26:43 -0800 Subject: Added integration tests for the mount provider Paired-with: Max Martin --- spec/integration/provider/mount_spec.rb | 99 +++++++++++++++++++++------------ 1 file changed, 64 insertions(+), 35 deletions(-) diff --git a/spec/integration/provider/mount_spec.rb b/spec/integration/provider/mount_spec.rb index 518b2956f..a62505d6d 100644 --- a/spec/integration/provider/mount_spec.rb +++ b/spec/integration/provider/mount_spec.rb @@ -5,11 +5,17 @@ require 'puppet/file_bucket/dipper' describe "mount provider (integration)" do include PuppetSpec::Files - before :each do - @fake_fstab = tmpfile('fstab') + def create_fake_fstab(initially_contains_entry) File.open(@fake_fstab, 'w') do |f| - # leave file empty + if initially_contains_entry + f.puts("/dev/disk1s1\t/Volumes/foo_disk\tmsdos\tlocal\t0\t0") + end end + end + + before :each do + @fake_fstab = tmpfile('fstab') + @current_options = "local" Puppet::Type.type(:mount).defaultprovider.stubs(:default_target).returns(@fake_fstab) Facter.stubs(:value).with(:operatingsystem).returns('Darwin') Puppet::Util::ExecutionStub.set do |command, options| @@ -17,22 +23,21 @@ describe "mount provider (integration)" do when %r{/s?bin/mount} if command.length == 1 if @mounted - "/dev/disk1s1 on /Volumes/foo_disk (msdos, local)\n" + "/dev/disk1s1 on /Volumes/foo_disk (msdos, #{@current_options})\n" else '' end else command.length.should == 4 command[1].should == '-o' - command[2].should == 'local' command[3].should == '/Volumes/foo_disk' @mounted.should == false # verify that we don't try to call "mount" redundantly - check_fstab + @current_options = command[2] + check_fstab(true) @mounted = true '' end when %r{/s?bin/umount} - fail "unexpected umount" unless @umount_permitted command.length.should == 2 command[1].should == '/Volumes/foo_disk' @mounted.should == true # "umount" doesn't work when device not mounted (see #6632) @@ -48,14 +53,15 @@ describe "mount provider (integration)" do Puppet::Type::Mount::ProviderParsed.clear # Work around bug #6628 end - def check_fstab + def check_fstab(expected_to_be_present) # Verify that the fake fstab has the expected data in it - File.read(@fake_fstab).lines.reject { |x| x =~ /^#/ }.should == ["/dev/disk1s1\t/Volumes/foo_disk\tmsdos\tlocal\t0\t0\n"] + expected_data = expected_to_be_present ? ["/dev/disk1s1\t/Volumes/foo_disk\tmsdos\t#{@desired_options}\t0\t0"] : [] + File.read(@fake_fstab).lines.map(&:chomp).reject { |x| x =~ /^#|^$/ }.should == expected_data end - def run_in_catalog(ensure_setting) - resource = Puppet::Type.type(:mount).new(:name => "/Volumes/foo_disk", :ensure => ensure_setting, - :device => "/dev/disk1s1", :options => "local", :fstype => "msdos") + def run_in_catalog(settings) + resource = Puppet::Type.type(:mount).new(settings.merge(:name => "/Volumes/foo_disk", + :device => "/dev/disk1s1", :fstype => "msdos")) Puppet::FileBucket::Dipper.any_instance.stubs(:backup) # Don't backup to the filebucket resource.expects(:err).never catalog = Puppet::Resource::Catalog.new @@ -64,31 +70,54 @@ describe "mount provider (integration)" do catalog.apply end - [:defined, :present].each do |ensure_setting| - describe "When setting ensure => #{ensure_setting}" do - it "should create an fstab entry if none exists" do - @mounted = false - @umount_permitted = false - run_in_catalog(ensure_setting) - @mounted.should == false - check_fstab + [false, true].each do |initial_state| + describe "When initially #{initial_state ? 'mounted' : 'unmounted'}" do + before :each do + @mounted = initial_state end - end - end - it "should be able to create and mount a brand new mount point" do - @mounted = false - @umount_permitted = true # Work around bug #6633 - run_in_catalog(:mounted) - @mounted.should == true - check_fstab - end + [false, true].each do |initial_fstab_entry| + describe "When there is #{initial_fstab_entry ? 'an' : 'no'} initial fstab entry" do + before :each do + create_fake_fstab(initial_fstab_entry) + end - it "should be able to create an fstab entry for an already-mounted device" do - @mounted = true - @umount_permitted = true # Work around bug #6633 - run_in_catalog(:mounted) - @mounted.should == true - check_fstab + [:defined, :present, :mounted, :unmounted, :absent].each do |ensure_setting| + expected_final_state = case ensure_setting + when :mounted + true + when :unmounted, :absent + false + when :defined, :present + initial_state + else + fail "Unknown ensure_setting #{ensure_setting}" + end + expected_fstab_data = (ensure_setting != :absent) + describe "When setting ensure => #{ensure_setting}" do + ["local", "journaled"].each do |options_setting| + describe "When setting options => #{options_setting}" do + it "should leave the system in the #{expected_final_state ? 'mounted' : 'unmounted'} state, #{expected_fstab_data ? 'with' : 'without'} data in /etc/fstab" do + @desired_options = options_setting + run_in_catalog(:ensure=>ensure_setting, :options => options_setting) + @mounted.should == expected_final_state + check_fstab(expected_fstab_data) + if @mounted + if ![:defined, :present].include?(ensure_setting) + @current_options.should == @desired_options + elsif initial_fstab_entry + @current_options.should == @desired_options + else + @current_options.should == 'local' #Workaround for #6645 + end + end + end + end + end + end + end + end + end + end end end -- cgit From 8ce30c83ddba87ba7e2622a46f27143159132789 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Mon, 7 Mar 2011 15:19:20 -0800 Subject: (#6338) Add an InventoryActiveRecord terminus for Facts So far this terminus only supports find and save. Search is forthcoming. It uses two new tables (inventory_host and inventory_facts) so that it won't interact with storedconfigs. Paired-With: Jacob Helwig --- .../indirector/facts/inventory_active_record.rb | 33 ++++++++ .../database/004_add_inventory_service_tables.rb | 36 ++++++++ lib/puppet/rails/database/schema.rb | 17 ++++ lib/puppet/rails/inventory_fact.rb | 6 ++ lib/puppet/rails/inventory_host.rb | 11 +++ .../facts/inventory_active_record_spec.rb | 99 ++++++++++++++++++++++ 6 files changed, 202 insertions(+) create mode 100644 lib/puppet/indirector/facts/inventory_active_record.rb create mode 100644 lib/puppet/rails/database/004_add_inventory_service_tables.rb create mode 100644 lib/puppet/rails/inventory_fact.rb create mode 100644 lib/puppet/rails/inventory_host.rb create mode 100644 spec/unit/indirector/facts/inventory_active_record_spec.rb diff --git a/lib/puppet/indirector/facts/inventory_active_record.rb b/lib/puppet/indirector/facts/inventory_active_record.rb new file mode 100644 index 000000000..6cd63ab1a --- /dev/null +++ b/lib/puppet/indirector/facts/inventory_active_record.rb @@ -0,0 +1,33 @@ +require 'puppet/rails/inventory_host' +require 'puppet/rails/inventory_fact' +require 'puppet/indirector/active_record' + +class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRecord + def find(request) + host = Puppet::Rails::InventoryHost.find_by_name(request.key) + return nil unless host + facts = Puppet::Node::Facts.new(host.name, host.facts_to_hash) + facts.timestamp = host.timestamp + facts.values.each do |key,value| + facts.values[key] = value.first if value.is_a?(Array) && value.length == 1 + end + facts + end + + def save(request) + facts = request.instance + host = Puppet::Rails::InventoryHost.find_by_name(request.key) || Puppet::Rails::InventoryHost.create(:name => request.key, :timestamp => facts.timestamp) + host.timestamp = facts.timestamp + + ActiveRecord::Base.transaction do + Puppet::Rails::InventoryFact.delete_all(:inventory_host_id => host.id) + # We don't want to save internal values as facts, because those are + # metadata that belong on the host + facts.values.each do |name,value| + next if name.to_s =~ /^_/ + host.facts.build(:name => name, :value => value) + end + host.save + end + end +end diff --git a/lib/puppet/rails/database/004_add_inventory_service_tables.rb b/lib/puppet/rails/database/004_add_inventory_service_tables.rb new file mode 100644 index 000000000..22298437a --- /dev/null +++ b/lib/puppet/rails/database/004_add_inventory_service_tables.rb @@ -0,0 +1,36 @@ +class AddInventoryServiceTables < ActiveRecord::Migration + def self.up + unless ActiveRecord::Base.connection.tables.include?("inventory_hosts") + create_table :inventory_hosts do |t| + t.column :name, :string, :null => false + t.column :timestamp, :datetime, :null => false + t.column :updated_at, :datetime + t.column :created_at, :datetime + end + + add_index :inventory_hosts, :name, :unique => true + end + + unless ActiveRecord::Base.connection.tables.include?("inventory_facts") + create_table :inventory_facts, :id => false do |t| + t.column :inventory_host_id, :integer, :null => false + t.column :name, :string, :null => false + t.column :value, :text, :null => false + end + + add_index :inventory_facts, [:inventory_host_id, :name], :unique => true + end + end + + def self.down + unless ActiveRecord::Base.connection.tables.include?("inventory_hosts") + remove_index :inventory_hosts, :name + drop_table :inventory_hosts + end + + if ActiveRecord::Base.connection.tables.include?("inventory_facts") + remove_index :inventory_facts, [:inventory_host_id, :name] + drop_table :inventory_facts + end + end +end diff --git a/lib/puppet/rails/database/schema.rb b/lib/puppet/rails/database/schema.rb index 8b389d773..5e455d6c0 100644 --- a/lib/puppet/rails/database/schema.rb +++ b/lib/puppet/rails/database/schema.rb @@ -103,6 +103,23 @@ class Puppet::Rails::Schema t.column :created_at, :datetime end add_index :param_names, :name + + create_table :inventory_hosts do |t| + t.column :name, :string, :null => false + t.column :timestamp, :datetime, :null => false + t.column :updated_at, :datetime + t.column :created_at, :datetime + end + + add_index :inventory_hosts, :name, :unique => true + + create_table :inventory_facts, :id => false do |t| + t.column :inventory_host_id, :integer, :null => false + t.column :name, :string, :null => false + t.column :value, :text, :null => false + end + + add_index :inventory_facts, [:inventory_host_id, :name], :unique => true end end ensure diff --git a/lib/puppet/rails/inventory_fact.rb b/lib/puppet/rails/inventory_fact.rb new file mode 100644 index 000000000..ecb6e41ee --- /dev/null +++ b/lib/puppet/rails/inventory_fact.rb @@ -0,0 +1,6 @@ +require 'puppet/rails/inventory_host' + +class Puppet::Rails::InventoryFact < ::ActiveRecord::Base + belongs_to :host, :class_name => "Puppet::Rails::InventoryHost" + serialize :value +end diff --git a/lib/puppet/rails/inventory_host.rb b/lib/puppet/rails/inventory_host.rb new file mode 100644 index 000000000..433e54389 --- /dev/null +++ b/lib/puppet/rails/inventory_host.rb @@ -0,0 +1,11 @@ +require 'puppet/rails/inventory_fact' + +class Puppet::Rails::InventoryHost < ::ActiveRecord::Base + has_many :facts, :class_name => "Puppet::Rails::InventoryFact", :dependent => :delete_all + + def facts_to_hash + facts.inject({}) do |fact_hash,fact| + fact_hash.merge(fact.name => fact.value) + end + end +end diff --git a/spec/unit/indirector/facts/inventory_active_record_spec.rb b/spec/unit/indirector/facts/inventory_active_record_spec.rb new file mode 100644 index 000000000..b97bada19 --- /dev/null +++ b/spec/unit/indirector/facts/inventory_active_record_spec.rb @@ -0,0 +1,99 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' +require 'sqlite3' rescue nil +require 'tempfile' +require 'puppet/rails' + +describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.rails? and defined? SQLite3) do + let(:terminus) { Puppet::Node::Facts::InventoryActiveRecord.new } + + before :all do + require 'puppet/indirector/facts/inventory_active_record' + @dbfile = Tempfile.new("testdb") + @dbfile.close + end + + after :all do + Puppet::Node::Facts.indirection.reset_terminus_class + @dbfile.unlink + end + + before :each do + Puppet::Node::Facts.terminus_class = :inventory_active_record + Puppet[:dbadapter] = 'sqlite3' + Puppet[:dblocation] = @dbfile.path + Puppet[:railslog] = "/dev/null" + Puppet::Rails.init + end + + after :each do + Puppet::Rails.teardown + end + + describe "#save" do + it "should use an existing host if possible" do + host = Puppet::Rails::InventoryHost.new(:name => "foo", :timestamp => Time.now) + host.save + Puppet::Node::Facts.new("foo", "uptime_days" => "60", "kernel" => "Darwin").save + + Puppet::Rails::InventoryHost.count.should == 1 + Puppet::Rails::InventoryHost.first.should == host + end + + it "should create a new host if one can't be found" do + # This test isn't valid if there are hosts to begin with + Puppet::Rails::InventoryHost.count.should == 0 + + Puppet::Node::Facts.new("foo", "uptime_days" => "60", "kernel" => "Darwin").save + + Puppet::Rails::InventoryHost.count.should == 1 + Puppet::Rails::InventoryHost.first.name.should == "foo" + end + + it "should save the facts" do + Puppet::Node::Facts.new("foo", "uptime_days" => "60", "kernel" => "Darwin").save + + Puppet::Rails::InventoryFact.all.map{|f| [f.name,f.value]}.should =~ [["uptime_days","60"],["kernel","Darwin"]] + end + + it "should remove the previous facts for an existing host" do + Puppet::Node::Facts.new("foo", "uptime_days" => "30", "kernel" => "Darwin").save + bar_facts = Puppet::Node::Facts.new("bar", "uptime_days" => "35", "kernel" => "Linux") + foo_facts = Puppet::Node::Facts.new("foo", "uptime_days" => "60", "is_virtual" => "false") + bar_facts.save + foo_facts.save + + Puppet::Node::Facts.find("bar").should == bar_facts + Puppet::Node::Facts.find("foo").should == foo_facts + Puppet::Rails::InventoryFact.all.map{|f| [f.name,f.value]}.should_not include(["uptime_days", "30"], ["kernel", "Darwin"]) + end + + it "should not replace the node's facts if something goes wrong" do + end + end + + describe "#find" do + before do + @foo_facts = Puppet::Node::Facts.new("foo", "uptime_days" => "60", "kernel" => "Darwin") + @bar_facts = Puppet::Node::Facts.new("bar", "uptime_days" => "30", "kernel" => "Linux") + @foo_facts.save + @bar_facts.save + end + + it "should identify facts by host name" do + Puppet::Node::Facts.find("foo").should == @foo_facts + end + + it "should return nil if no host instance can be found" do + Puppet::Node::Facts.find("non-existent host").should == nil + end + + it "should convert all single-member arrays into non-arrays" do + Puppet::Node::Facts.new("array", "fact1" => ["value1"]).save + + Puppet::Node::Facts.find("array").values["fact1"].should == "value1" + end + end +end + -- cgit From f83636698229241b2ab35849437f3e515f6ac5c1 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Mon, 7 Mar 2011 16:42:53 -0800 Subject: (#6338) Implement search for InventoryActiveRecord facts terminus Paired-With: Max Martin Reviewed-By: Jacob Helwig --- .../indirector/facts/inventory_active_record.rb | 34 ++++++++++++++ lib/puppet/rails/inventory_host.rb | 26 +++++++++++ .../facts/inventory_active_record_spec.rb | 52 ++++++++++++++++++++++ 3 files changed, 112 insertions(+) diff --git a/lib/puppet/indirector/facts/inventory_active_record.rb b/lib/puppet/indirector/facts/inventory_active_record.rb index 6cd63ab1a..30cb88ea0 100644 --- a/lib/puppet/indirector/facts/inventory_active_record.rb +++ b/lib/puppet/indirector/facts/inventory_active_record.rb @@ -30,4 +30,38 @@ class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRec host.save end end + + def search(request) + return [] unless request.options + fact_names = [] + filters = Hash.new {|h,k| h[k] = []} + request.options.each do |key,value| + type, name, operator = key.to_s.split(".") + operator ||= "eq" + filters[operator] << [name,value] + end + + + host_sets = [] + filters['eq'].each do |name,value| + host_sets << Puppet::Rails::InventoryHost.has_fact_with_value(name,value).map {|host| host.name} + end + filters['ne'].each do |name,value| + host_sets << Puppet::Rails::InventoryHost.has_fact_without_value(name,value).map {|host| host.name} + end + { + 'gt' => '>', + 'lt' => '<', + 'ge' => '>=', + 'le' => '<=' + }.each do |operator_name,operator| + filters[operator_name].each do |name,value| + hosts_with_fact = Puppet::Rails::InventoryHost.has_fact(name) + host_sets << hosts_with_fact.select {|h| h.value_for(name).to_f.send(operator, value.to_f)}.map {|host| host.name} + end + end + + # to_a because [].inject == nil + host_sets.inject {|hosts,this_set| hosts & this_set}.to_a + end end diff --git a/lib/puppet/rails/inventory_host.rb b/lib/puppet/rails/inventory_host.rb index 433e54389..10dd62083 100644 --- a/lib/puppet/rails/inventory_host.rb +++ b/lib/puppet/rails/inventory_host.rb @@ -3,6 +3,32 @@ require 'puppet/rails/inventory_fact' class Puppet::Rails::InventoryHost < ::ActiveRecord::Base has_many :facts, :class_name => "Puppet::Rails::InventoryFact", :dependent => :delete_all + named_scope :has_fact_with_value, lambda { |name,value| + { + :conditions => ["inventory_facts.name = ? AND inventory_facts.value = ?", name, value], + :joins => :facts + } + } + + named_scope :has_fact_without_value, lambda { |name,value| + { + :conditions => ["inventory_facts.name = ? AND inventory_facts.value != ?", name, value], + :joins => :facts + } + } + + named_scope :has_fact, lambda { |name| + { + :conditions => ["inventory_facts.name = ?", name], + :joins => :facts + } + } + + def value_for(fact_name) + fact = facts.find_by_name(fact_name) + fact ? fact.value : nil + end + def facts_to_hash facts.inject({}) do |fact_hash,fact| fact_hash.merge(fact.name => fact.value) diff --git a/spec/unit/indirector/facts/inventory_active_record_spec.rb b/spec/unit/indirector/facts/inventory_active_record_spec.rb index b97bada19..7fb55561d 100644 --- a/spec/unit/indirector/facts/inventory_active_record_spec.rb +++ b/spec/unit/indirector/facts/inventory_active_record_spec.rb @@ -95,5 +95,57 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r Puppet::Node::Facts.find("array").values["fact1"].should == "value1" end end + + describe "#search" do + + it "should return node names that match 'equal' constraints" do + Puppet::Node::Facts.new("foo", "fact1" => "value1", "fact2" => "value2", "fact3" => "value3").save + Puppet::Node::Facts.new("bar", "fact1" => "value2").save + Puppet::Node::Facts.new("baz", "fact1" => "value1", "fact2" => "value1", "fact3" => "value1").save + + request = Puppet::Indirector::Request.new(:facts, :search, nil, + {'facts.fact1.eq' => 'value1', + 'facts.fact2.eq' => 'value2', + 'facts.fact3.eq' => 'value3'}) + terminus.search(request).should =~ ["foo"] + end + + it "should return node names that match 'not equal' constraints" do + Puppet::Node::Facts.new("foo", "fact1" => "value1", "fact2" => "value2", "fact3" => "value3").save + Puppet::Node::Facts.new("bar", "fact1" => "value2").save + Puppet::Node::Facts.new("baz", "fact1" => "value1", "fact2" => "value1", "fact3" => "value1").save + Puppet::Node::Facts.new("bang", "fact1" => "value1", "fact2" => "value2", "fact3" => "value1").save + + request = Puppet::Indirector::Request.new(:facts, :search, nil, + {'facts.fact1.ne' => 'value3', + 'facts.fact2.ne' => 'value1', + 'facts.fact3.ne' => 'value2'}) + terminus.search(request).should =~ ["foo","bang"] + end + + it "should return node names that match strict inequality constraints" do + Puppet::Node::Facts.new("foo", "uptime_days" => "30").save + Puppet::Node::Facts.new("bar", "uptime_days" => "60").save + Puppet::Node::Facts.new("baz", "uptime_days" => "90").save + + request = Puppet::Indirector::Request.new(:facts, :search, nil, + {'facts.uptime_days.gt' => '20', + 'facts.uptime_days.lt' => '70'}) + + terminus.search(request).should =~ ["foo","bar"] + end + + it "should return node names that match non-strict inequality constraints" do + Puppet::Node::Facts.new("foo", "uptime_days" => "30").save + Puppet::Node::Facts.new("bar", "uptime_days" => "60").save + Puppet::Node::Facts.new("baz", "uptime_days" => "90").save + + request = Puppet::Indirector::Request.new(:facts, :search, nil, + {'facts.uptime_days.ge' => '30', + 'facts.uptime_days.le' => '60'}) + + terminus.search(request).should =~ ["foo","bar"] + end + end end -- cgit From 880d0c6cbd20758e02848d1fa61966402dc44dc0 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Mon, 7 Mar 2011 17:28:43 -0800 Subject: (#6338) Support searching on metadata in InventoryActiveRecord terminus Timestamps are currently the only supported metadata for searching. Paired-With: Max Martin Reviewed-By: Jacob Helwig --- .../indirector/facts/inventory_active_record.rb | 42 ++++++++-- .../facts/inventory_active_record_spec.rb | 89 +++++++++++++--------- 2 files changed, 90 insertions(+), 41 deletions(-) diff --git a/lib/puppet/indirector/facts/inventory_active_record.rb b/lib/puppet/indirector/facts/inventory_active_record.rb index 30cb88ea0..5b8606839 100644 --- a/lib/puppet/indirector/facts/inventory_active_record.rb +++ b/lib/puppet/indirector/facts/inventory_active_record.rb @@ -34,19 +34,32 @@ class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRec def search(request) return [] unless request.options fact_names = [] - filters = Hash.new {|h,k| h[k] = []} + fact_filters = Hash.new {|h,k| h[k] = []} + meta_filters = Hash.new {|h,k| h[k] = []} request.options.each do |key,value| type, name, operator = key.to_s.split(".") operator ||= "eq" - filters[operator] << [name,value] + if type == "facts" + fact_filters[operator] << [name,value] + elsif type == "meta" and name == "timestamp" + meta_filters[operator] << [name,value] + end end + matching_hosts = hosts_matching_fact_filters(fact_filters) + hosts_matching_meta_filters(meta_filters) + + # to_a because [].inject == nil + matching_hosts.inject {|hosts,this_set| hosts & this_set}.to_a.sort + end + + private + def hosts_matching_fact_filters(fact_filters) host_sets = [] - filters['eq'].each do |name,value| + fact_filters['eq'].each do |name,value| host_sets << Puppet::Rails::InventoryHost.has_fact_with_value(name,value).map {|host| host.name} end - filters['ne'].each do |name,value| + fact_filters['ne'].each do |name,value| host_sets << Puppet::Rails::InventoryHost.has_fact_without_value(name,value).map {|host| host.name} end { @@ -55,13 +68,28 @@ class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRec 'ge' => '>=', 'le' => '<=' }.each do |operator_name,operator| - filters[operator_name].each do |name,value| + fact_filters[operator_name].each do |name,value| hosts_with_fact = Puppet::Rails::InventoryHost.has_fact(name) host_sets << hosts_with_fact.select {|h| h.value_for(name).to_f.send(operator, value.to_f)}.map {|host| host.name} end end + host_sets + end - # to_a because [].inject == nil - host_sets.inject {|hosts,this_set| hosts & this_set}.to_a + def hosts_matching_meta_filters(meta_filters) + host_sets = [] + { + 'eq' => '=', + 'ne' => '!=', + 'gt' => '>', + 'lt' => '<', + 'ge' => '>=', + 'le' => '<=' + }.each do |operator_name,operator| + meta_filters[operator_name].each do |name,value| + host_sets << Puppet::Rails::InventoryHost.find(:all, :conditions => ["timestamp #{operator} ?", value]).map {|host| host.name} + end + end + host_sets end end diff --git a/spec/unit/indirector/facts/inventory_active_record_spec.rb b/spec/unit/indirector/facts/inventory_active_record_spec.rb index 7fb55561d..69d614023 100644 --- a/spec/unit/indirector/facts/inventory_active_record_spec.rb +++ b/spec/unit/indirector/facts/inventory_active_record_spec.rb @@ -97,54 +97,75 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r end describe "#search" do + def search_request(conditions) + Puppet::Indirector::Request.new(:facts, :search, nil, conditions) + end - it "should return node names that match 'equal' constraints" do - Puppet::Node::Facts.new("foo", "fact1" => "value1", "fact2" => "value2", "fact3" => "value3").save - Puppet::Node::Facts.new("bar", "fact1" => "value2").save - Puppet::Node::Facts.new("baz", "fact1" => "value1", "fact2" => "value1", "fact3" => "value1").save + before :each do + @now = Time.now + @foo = Puppet::Node::Facts.new("foo", "fact1" => "value1", "fact2" => "value2", "uptime_days" => "30") + @bar = Puppet::Node::Facts.new("bar", "fact1" => "value1", "uptime_days" => "60") + @baz = Puppet::Node::Facts.new("baz", "fact1" => "value2", "fact2" => "value1", "uptime_days" => "90") + @bat = Puppet::Node::Facts.new("bat") + @foo.timestamp = @now - 3600*1 + @bar.timestamp = @now - 3600*3 + @baz.timestamp = @now - 3600*5 + @bat.timestamp = @now - 3600*7 + @foo.save + @bar.save + @baz.save + @bat.save + end - request = Puppet::Indirector::Request.new(:facts, :search, nil, - {'facts.fact1.eq' => 'value1', - 'facts.fact2.eq' => 'value2', - 'facts.fact3.eq' => 'value3'}) - terminus.search(request).should =~ ["foo"] + it "should return node names that match 'equal' constraints" do + request = search_request('facts.fact1.eq' => 'value1', + 'facts.fact2.eq' => 'value2') + terminus.search(request).should == ["foo"] end it "should return node names that match 'not equal' constraints" do - Puppet::Node::Facts.new("foo", "fact1" => "value1", "fact2" => "value2", "fact3" => "value3").save - Puppet::Node::Facts.new("bar", "fact1" => "value2").save - Puppet::Node::Facts.new("baz", "fact1" => "value1", "fact2" => "value1", "fact3" => "value1").save - Puppet::Node::Facts.new("bang", "fact1" => "value1", "fact2" => "value2", "fact3" => "value1").save - - request = Puppet::Indirector::Request.new(:facts, :search, nil, - {'facts.fact1.ne' => 'value3', - 'facts.fact2.ne' => 'value1', - 'facts.fact3.ne' => 'value2'}) - terminus.search(request).should =~ ["foo","bang"] + request = search_request('facts.fact1.ne' => 'value2') + terminus.search(request).should == ["bar","foo"] end it "should return node names that match strict inequality constraints" do - Puppet::Node::Facts.new("foo", "uptime_days" => "30").save - Puppet::Node::Facts.new("bar", "uptime_days" => "60").save - Puppet::Node::Facts.new("baz", "uptime_days" => "90").save + request = search_request('facts.uptime_days.gt' => '20', + 'facts.uptime_days.lt' => '70') + terminus.search(request).should == ["bar","foo"] + end - request = Puppet::Indirector::Request.new(:facts, :search, nil, - {'facts.uptime_days.gt' => '20', - 'facts.uptime_days.lt' => '70'}) + it "should return node names that match non-strict inequality constraints" do + request = search_request('facts.uptime_days.ge' => '30', + 'facts.uptime_days.le' => '60') + terminus.search(request).should == ["bar","foo"] + end - terminus.search(request).should =~ ["foo","bar"] + it "should return node names whose facts are within a given timeframe" do + request = search_request('meta.timestamp.ge' => @now - 3600*5, + 'meta.timestamp.le' => @now - 3600*1) + terminus.search(request).should == ["bar","baz","foo"] end - it "should return node names that match non-strict inequality constraints" do - Puppet::Node::Facts.new("foo", "uptime_days" => "30").save - Puppet::Node::Facts.new("bar", "uptime_days" => "60").save - Puppet::Node::Facts.new("baz", "uptime_days" => "90").save + it "should return node names whose facts are from a specific time" do + request = search_request('meta.timestamp.eq' => @now - 3600*3) + terminus.search(request).should == ["bar"] + end - request = Puppet::Indirector::Request.new(:facts, :search, nil, - {'facts.uptime_days.ge' => '30', - 'facts.uptime_days.le' => '60'}) + it "should return node names whose facts are not from a specific time" do + request = search_request('meta.timestamp.ne' => @now - 3600*1) + terminus.search(request).should == ["bar","bat","baz"] + end + + it "should perform strict searches on nodes by timestamp" do + request = search_request('meta.timestamp.gt' => @now - 3600*5, + 'meta.timestamp.lt' => @now - 3600*1) + terminus.search(request).should == ["bar"] + end - terminus.search(request).should =~ ["foo","bar"] + it "should search nodes based on both facts and timestamp values" do + request = search_request('facts.uptime_days.gt' => '45', + 'meta.timestamp.lt' => @now - 3600*4) + terminus.search(request).should == ["baz"] end end end -- cgit From 7764412aacb4132d40561e2ba47d52f5e333c16e Mon Sep 17 00:00:00 2001 From: Max Martin Date: Tue, 8 Mar 2011 16:20:53 -0800 Subject: maint:Refactor of mount provider integration tests When adding a test for #6309, decided to refactor mount provider integration tests by adding return value to check_fstab method. Paired-with:Paul Berry --- spec/integration/provider/mount_spec.rb | 38 ++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/spec/integration/provider/mount_spec.rb b/spec/integration/provider/mount_spec.rb index a62505d6d..d6f25fe1d 100644 --- a/spec/integration/provider/mount_spec.rb +++ b/spec/integration/provider/mount_spec.rb @@ -16,6 +16,7 @@ describe "mount provider (integration)" do before :each do @fake_fstab = tmpfile('fstab') @current_options = "local" + @current_device = "/dev/disk1s1" Puppet::Type.type(:mount).defaultprovider.stubs(:default_target).returns(@fake_fstab) Facter.stubs(:value).with(:operatingsystem).returns('Darwin') Puppet::Util::ExecutionStub.set do |command, options| @@ -23,7 +24,7 @@ describe "mount provider (integration)" do when %r{/s?bin/mount} if command.length == 1 if @mounted - "/dev/disk1s1 on /Volumes/foo_disk (msdos, #{@current_options})\n" + "#{@current_device} on /Volumes/foo_disk (msdos, #{@current_options})\n" else '' end @@ -33,7 +34,7 @@ describe "mount provider (integration)" do command[3].should == '/Volumes/foo_disk' @mounted.should == false # verify that we don't try to call "mount" redundantly @current_options = command[2] - check_fstab(true) + @current_device = check_fstab(true) @mounted = true '' end @@ -55,8 +56,16 @@ describe "mount provider (integration)" do def check_fstab(expected_to_be_present) # Verify that the fake fstab has the expected data in it - expected_data = expected_to_be_present ? ["/dev/disk1s1\t/Volumes/foo_disk\tmsdos\t#{@desired_options}\t0\t0"] : [] - File.read(@fake_fstab).lines.map(&:chomp).reject { |x| x =~ /^#|^$/ }.should == expected_data + fstab_contents = File.read(@fake_fstab).lines.map(&:chomp).reject { |x| x =~ /^#|^$/ } + if expected_to_be_present + fstab_contents.length().should == 1 + device, rest_of_line = fstab_contents[0].split(/\t/,2) + rest_of_line.should == "/Volumes/foo_disk\tmsdos\t#{@desired_options}\t0\t0" + device + else + fstab_contents.length().should == 0 + nil + end end def run_in_catalog(settings) @@ -101,7 +110,11 @@ describe "mount provider (integration)" do @desired_options = options_setting run_in_catalog(:ensure=>ensure_setting, :options => options_setting) @mounted.should == expected_final_state - check_fstab(expected_fstab_data) + if expected_fstab_data + check_fstab(expected_fstab_data).should == "/dev/disk1s1" + else + check_fstab(expected_fstab_data).should == nil + end if @mounted if ![:defined, :present].include?(ensure_setting) @current_options.should == @desired_options @@ -120,4 +133,19 @@ describe "mount provider (integration)" do end end end + + describe "When the wrong device is mounted" do + it "should remount the correct device" do + pending "Due to bug 6309" + @mounted = true + @current_device = "/dev/disk2s2" + create_fake_fstab(true) + @desired_options = "local" + run_in_catalog(:ensure=>:mounted, :options=>'local') + @current_device.should=="/dev/disk1s1" + @mounted.should==true + @current_options.should=='local' + check_fstab(true).should == "/dev/disk1s1" + end + end end -- cgit From b4f1b9891fead7c79f13e639df433e65340c950b Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 8 Mar 2011 15:43:56 -0800 Subject: (#6641) fix mount provider tests broken in the 2.6 merge. A number of fixture-related changes were made in next, but not 2.6, which resulted in extra tests added during 2.6 being broken. The main thrust of this change is to fix those tests by porting the fixture support code to the newer helpers. This also highlighted some shortfalls in our platform fixtures, which we extend to add a bunch of additional fixtures, and to uniformly walk those to perform fstab vs mount testing. --- spec/fixtures/unit/provider/mount/parsed/aix.mount | 7 ++++++ .../unit/provider/mount/parsed/darwin.mount | 6 +++++ .../unit/provider/mount/parsed/freebsd.fstab | 1 + .../unit/provider/mount/parsed/freebsd.mount | 3 +++ .../fixtures/unit/provider/mount/parsed/hpux.mount | 17 +++++++++++++ .../unit/provider/mount/parsed/linux.mount | 5 ++++ .../unit/provider/mount/parsed/netbsd.fstab | 9 +++++++ .../unit/provider/mount/parsed/netbsd.mount | 8 ++++++ .../unit/provider/mount/parsed/openbsd.fstab | 4 +++ .../unit/provider/mount/parsed/openbsd.mount | 4 +++ .../unit/provider/mount/parsed/solaris.mount | 6 +++++ spec/unit/provider/mount/parsed_spec.rb | 29 ++++++++++------------ 12 files changed, 83 insertions(+), 16 deletions(-) create mode 100644 spec/fixtures/unit/provider/mount/parsed/aix.mount create mode 100644 spec/fixtures/unit/provider/mount/parsed/darwin.mount create mode 100644 spec/fixtures/unit/provider/mount/parsed/freebsd.mount create mode 100644 spec/fixtures/unit/provider/mount/parsed/hpux.mount create mode 100644 spec/fixtures/unit/provider/mount/parsed/linux.mount create mode 100644 spec/fixtures/unit/provider/mount/parsed/netbsd.fstab create mode 100644 spec/fixtures/unit/provider/mount/parsed/netbsd.mount create mode 100644 spec/fixtures/unit/provider/mount/parsed/openbsd.fstab create mode 100644 spec/fixtures/unit/provider/mount/parsed/openbsd.mount create mode 100644 spec/fixtures/unit/provider/mount/parsed/solaris.mount diff --git a/spec/fixtures/unit/provider/mount/parsed/aix.mount b/spec/fixtures/unit/provider/mount/parsed/aix.mount new file mode 100644 index 000000000..380dbc5ae --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/aix.mount @@ -0,0 +1,7 @@ +node mounted mounted over vfs date options +---- ------- ------------ --- ------------ ------------------- + /dev/hd0 / jfs Dec 17 08:04 rw, log =/dev/hd8 + /dev/hd3 /tmp jfs Dec 17 08:04 rw, log =/dev/hd8 + /dev/hd1 /home jfs Dec 17 08:06 rw, log =/dev/hd8 + /dev/hd2 /usr jfs Dec 17 08:06 rw, log =/dev/hd8 +sue /home/local/src /usr/code nfs Dec 17 08:06 ro, log =/dev/hd8 diff --git a/spec/fixtures/unit/provider/mount/parsed/darwin.mount b/spec/fixtures/unit/provider/mount/parsed/darwin.mount new file mode 100644 index 000000000..1bdfcf89a --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/darwin.mount @@ -0,0 +1,6 @@ +/dev/disk0s2 on / (hfs, local, journaled) +devfs on /dev (devfs, local, nobrowse) +map -hosts on /net (autofs, nosuid, automounted, nobrowse) +map auto_home on /home (autofs, automounted, nobrowse) +/dev/disk0s3 on /usr (hfs, local, journaled) +/dev/fake on /ghost (hfs, local, journaled) diff --git a/spec/fixtures/unit/provider/mount/parsed/freebsd.fstab b/spec/fixtures/unit/provider/mount/parsed/freebsd.fstab index a41104236..41b749bff 100644 --- a/spec/fixtures/unit/provider/mount/parsed/freebsd.fstab +++ b/spec/fixtures/unit/provider/mount/parsed/freebsd.fstab @@ -4,4 +4,5 @@ /dev/ad0s1e /tmp ufs rw 2 2 /dev/ad0s1f /usr ufs rw 2 2 /dev/ad0s1d /var ufs rw 2 2 +/dev/ad0s1g /boot ufs rw 2 2 /dev/acd0 /cdrom cd9660 ro,noauto 0 0 diff --git a/spec/fixtures/unit/provider/mount/parsed/freebsd.mount b/spec/fixtures/unit/provider/mount/parsed/freebsd.mount new file mode 100644 index 000000000..89c518c5d --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/freebsd.mount @@ -0,0 +1,3 @@ +/dev/ad0s1a on / (ufs, local, soft-updates) +/dev/ad0s1d on /ghost (ufs, local, soft-updates) +devfs on /dev (devfs, local, multilabel) diff --git a/spec/fixtures/unit/provider/mount/parsed/hpux.mount b/spec/fixtures/unit/provider/mount/parsed/hpux.mount new file mode 100644 index 000000000..d414fa47a --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/hpux.mount @@ -0,0 +1,17 @@ +/ on rpool/ROOT/opensolaris read/write/setuid/devices/dev=2d90002 on Wed Dec 31 16:00:00 1969 +/devices on /devices read/write/setuid/devices/dev=4a00000 on Thu Feb 17 14:34:02 2011 +/dev on /dev read/write/setuid/devices/dev=4a40000 on Thu Feb 17 14:34:02 2011 +/system/contract on ctfs read/write/setuid/devices/dev=4ac0001 on Thu Feb 17 14:34:02 2011 +/proc on proc read/write/setuid/devices/dev=4b00000 on Thu Feb 17 14:34:02 2011 +/etc/mnttab on mnttab read/write/setuid/devices/dev=4b40001 on Thu Feb 17 14:34:02 2011 +/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4b80001 on Thu Feb 17 14:34:02 2011 +/system/object on objfs read/write/setuid/devices/dev=4bc0001 on Thu Feb 17 14:34:02 2011 +/etc/dfs/sharetab on sharefs read/write/setuid/devices/dev=4c00001 on Thu Feb 17 14:34:02 2011 +/lib/libc.so.1 on /usr/lib/libc/libc_hwcap1.so.1 read/write/setuid/devices/dev=2d90002 on Thu Feb 17 14:34:14 2011 +/dev/fd on fd read/write/setuid/devices/dev=4d00001 on Thu Feb 17 14:34:18 2011 +/tmp on swap read/write/setuid/devices/xattr/dev=4b80002 on Thu Feb 17 14:34:19 2011 +/var/run on swap read/write/setuid/devices/xattr/dev=4b80003 on Thu Feb 17 14:34:19 2011 +/export on rpool/export read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90006 on Thu Feb 17 14:37:48 2011 +/export/home on rpool/export/home read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90007 on Thu Feb 17 14:37:48 2011 +/rpool on rpool read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90009 on Thu Feb 17 14:37:48 2011 +/ghost on /dev/fake read/write/setuid/devices/nonbmand/exec/xattr/atime/dev=2d90009 on Thu Feb 17 14:37:48 2011 diff --git a/spec/fixtures/unit/provider/mount/parsed/linux.mount b/spec/fixtures/unit/provider/mount/parsed/linux.mount new file mode 100644 index 000000000..75dd71fd4 --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/linux.mount @@ -0,0 +1,5 @@ +/dev/root on / type jfs (rw,noatime) +rc-svcdir on /lib64/rc/init.d type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1024k,mode=755) +sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) +/dev/sda9 on /usr/portage type jfs (rw) +/dev/fake on /ghost type jfs (rw) diff --git a/spec/fixtures/unit/provider/mount/parsed/netbsd.fstab b/spec/fixtures/unit/provider/mount/parsed/netbsd.fstab new file mode 100644 index 000000000..ca3ca8450 --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/netbsd.fstab @@ -0,0 +1,9 @@ +# Device Mountpoint FStype Options Dump Pass# +/dev/ad0s1b none swap sw 0 0 +/dev/ad0s1a / ufs rw 1 1 +/dev/ad0s1e /tmp ufs rw 2 2 +/dev/ad0s1f /usr ufs rw 2 2 +/dev/ad0s1d /var ufs rw 2 2 +/dev/ad3s1b none swap sw 0 0 +/dev/ad3s1e /data ufs rw 2 2 +/dev/ad3s1g /boot ufs rw 2 2 diff --git a/spec/fixtures/unit/provider/mount/parsed/netbsd.mount b/spec/fixtures/unit/provider/mount/parsed/netbsd.mount new file mode 100644 index 000000000..dfdc26a34 --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/netbsd.mount @@ -0,0 +1,8 @@ +/dev/ad0s1a on / (ufs, local) +devfs on /dev (devfs, local) +/dev/ad0s1e on /tmp (ufs, local, soft-updates) +/dev/ad0s1f on /usr (ufs, local, soft-updates) +/dev/ad0s1d on /var (ufs, local, soft-updates) +/dev/ad3s1e on /data (ufs, local, soft-updates) +/dev/ad3s1h on /ghost (ufs, local, soft-updates) +devfs on /var/named/dev (devfs, local) diff --git a/spec/fixtures/unit/provider/mount/parsed/openbsd.fstab b/spec/fixtures/unit/provider/mount/parsed/openbsd.fstab new file mode 100644 index 000000000..44c83eed1 --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/openbsd.fstab @@ -0,0 +1,4 @@ +/dev/wd0a / ffs rw 1 1 +/dev/wd0e /home ffs rw,nodev,nosuid 1 2 +/dev/wd0d /usr ffs rw,nodev 1 2 +/dev/wd0f /boot ffs rw,nodev 1 2 diff --git a/spec/fixtures/unit/provider/mount/parsed/openbsd.mount b/spec/fixtures/unit/provider/mount/parsed/openbsd.mount new file mode 100644 index 000000000..367475783 --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/openbsd.mount @@ -0,0 +1,4 @@ +/dev/wd0a on / type ffs (local) +/dev/wd0e on /home type ffs (local, nodev, nosuid) +/dev/wd0d on /usr type ffs (local, nodev) +/dev/wd0g on /ghost type ffs (local, nodev) diff --git a/spec/fixtures/unit/provider/mount/parsed/solaris.mount b/spec/fixtures/unit/provider/mount/parsed/solaris.mount new file mode 100644 index 000000000..26fabc575 --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/solaris.mount @@ -0,0 +1,6 @@ +/ on /dev/dsk/c0t0d0s0 read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200000 on Mon Mar 18 08:48:45 2002 +/proc on /proc read/write/setuid/dev=4300000 on Mon Mar 18 08:48:44 2002 +/etc/mnttab on mnttab read/write/setuid/dev=43c0000 on Mon Mar 18 08:48:44 2002 +/tmp on swap read/write/setuid/xattr/dev=2 on Mon Mar 18 08:48:52 2002 +/export/home on /dev/dsk/c0t0d0s7 read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Mon Mar 18 +/ghost on /dev/dsk/c0t1d0s7 read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Mon Mar 18 diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index 216680e6d..3bc5b9864 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -111,9 +111,8 @@ FSTAB describe "mountinstances" do it "should get name from mountoutput found on Solaris" do - pending Facter.stubs(:value).with(:operatingsystem).returns 'Solaris' - @provider.stubs(:mountcmd).returns(File.read(fake_mountoutput)) + @provider.stubs(:mountcmd).returns(File.read(my_fixture('solaris.mount'))) mounts = @provider.mountinstances mounts.size.should == 6 mounts[0].should == { :name => '/', :mounted => :yes } @@ -125,9 +124,8 @@ FSTAB end it "should get name from mountoutput found on HP-UX" do - pending Facter.stubs(:value).with(:operatingsystem).returns 'HP-UX' - @provider.stubs(:mountcmd).returns(File.read(fake_mountoutput)) + @provider.stubs(:mountcmd).returns(File.read(my_fixture('hpux.mount'))) mounts = @provider.mountinstances mounts.size.should == 17 mounts[0].should == { :name => '/', :mounted => :yes } @@ -150,9 +148,8 @@ FSTAB end it "should get name from mountoutput found on Darwin" do - pending Facter.stubs(:value).with(:operatingsystem).returns 'Darwin' - @provider.stubs(:mountcmd).returns(File.read(fake_mountoutput)) + @provider.stubs(:mountcmd).returns(File.read(my_fixture('darwin.mount'))) mounts = @provider.mountinstances mounts.size.should == 6 mounts[0].should == { :name => '/', :mounted => :yes } @@ -164,9 +161,8 @@ FSTAB end it "should get name from mountoutput found on Linux" do - pending Facter.stubs(:value).with(:operatingsystem).returns 'Gentoo' - @provider.stubs(:mountcmd).returns(File.read(fake_mountoutput)) + @provider.stubs(:mountcmd).returns(File.read(my_fixture('linux.mount'))) mounts = @provider.mountinstances mounts[0].should == { :name => '/', :mounted => :yes } mounts[1].should == { :name => '/lib64/rc/init.d', :mounted => :yes } @@ -176,9 +172,8 @@ FSTAB end it "should get name from mountoutput found on AIX" do - pending Facter.stubs(:value).with(:operatingsystem).returns 'AIX' - @provider.stubs(:mountcmd).returns(File.read(fake_mountoutput)) + @provider.stubs(:mountcmd).returns(File.read(my_fixture('aix.mount'))) mounts = @provider.mountinstances mounts[0].should == { :name => '/', :mounted => :yes } mounts[1].should == { :name => '/tmp', :mounted => :yes } @@ -195,9 +190,12 @@ FSTAB end my_fixtures('*.fstab').each do |fstab| - describe "when prefetching #{fstab}" do + platform = File.basename(fstab, '.fstab') + describe "when prefetching on #{platform}" do before :each do - pending "need to rework how testing mount output works after this merge is complete" + pending "solaris seems ... odd" if platform == "solaris" + @platform = platform + # Note: we have to stub default_target before creating resources # because it is used by Puppet::Type::Mount.new to populate the # :target property. @@ -214,7 +212,7 @@ FSTAB @resource_hash[resource.name] = resource end - @provider.stubs(:mountcmd).returns File.read(fake_mountoutput) + @provider.stubs(:mountcmd).returns File.read(my_fixture(@platform + '.mount')) end it "should set :ensure to :unmounted if found in fstab but not mounted" do @@ -222,12 +220,12 @@ FSTAB @res_unmounted.provider.get(:ensure).should == :unmounted end - it "should set :ensure to :mounted if found in fstab and mounted" do + it "should set :ensure to :ghost if not found in fstab but mounted" do @provider.prefetch(@resource_hash) @res_ghost.provider.get(:ensure).should == :ghost end - it "should set :ensure to :ghost if not found in fstab but mounted" do + it "should set :ensure to :mounted if found in fstab and mounted" do @provider.prefetch(@resource_hash) @res_mounted.provider.get(:ensure).should == :mounted end @@ -238,5 +236,4 @@ FSTAB end end end - end -- cgit From 6a96584ea92afc83383dad85d1a2db956a58c323 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 8 Mar 2011 16:38:02 -0800 Subject: (#6441) Mark solaris tests pending, because we can't stub it. In the final combination test we need to mark Solaris pending, because we genuinely have a bug where we can't test due to stubbing order. --- spec/unit/provider/mount/parsed_spec.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index 3bc5b9864..e8a862fdb 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -193,8 +193,13 @@ FSTAB platform = File.basename(fstab, '.fstab') describe "when prefetching on #{platform}" do before :each do - pending "solaris seems ... odd" if platform == "solaris" - @platform = platform + if Facter[:operatingsystem] == "Solaris" then + platform == 'solaris' or + pending "We need to stub the operatingsystem fact at load time, but can't" + else + platform != 'solaris' or + pending "We need to stub the operatingsystem fact at load time, but can't" + end # Note: we have to stub default_target before creating resources # because it is used by Puppet::Type::Mount.new to populate the @@ -212,7 +217,7 @@ FSTAB @resource_hash[resource.name] = resource end - @provider.stubs(:mountcmd).returns File.read(my_fixture(@platform + '.mount')) + @provider.stubs(:mountcmd).returns File.read(my_fixture(platform + '.mount')) end it "should set :ensure to :unmounted if found in fstab but not mounted" do -- cgit From 349f6f2f25f4e13c2bf7c16a54f2d1c3ae85ac5f Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Tue, 8 Mar 2011 17:05:01 -0800 Subject: (#6641) Make it easier to add future platforms to the suite. When a new fstab fixture is added, we also want to try to test mount output. If that fixture is missing, we would have failed a test, but now mark it pending. This is more correct when, for example, we don't yet have that fixture: it isn't technically a failure, just an incomplete set of test data. --- spec/unit/provider/mount/parsed_spec.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index e8a862fdb..43defbe87 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -201,6 +201,14 @@ FSTAB pending "We need to stub the operatingsystem fact at load time, but can't" end + # Stub the mount output to our fixture. + begin + mount = my_fixture(platform + '.mount') + @provider.stubs(:mountcmd).returns File.read(mount) + rescue + pending "is #{platform}.mount missing at this point?" + end + # Note: we have to stub default_target before creating resources # because it is used by Puppet::Type::Mount.new to populate the # :target property. @@ -216,8 +224,6 @@ FSTAB [@res_ghost, @res_mounted, @res_unmounted, @res_absent].each do |resource| @resource_hash[resource.name] = resource end - - @provider.stubs(:mountcmd).returns File.read(my_fixture(platform + '.mount')) end it "should set :ensure to :unmounted if found in fstab but not mounted" do -- cgit From a3f2357215b15f318500d6637f393dad0d4a4181 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Tue, 8 Mar 2011 16:59:12 -0800 Subject: maint: Remove spec run noise There were some warnings and stack traces in the spec output that aren't necessary. The only interesting fix is of the message: lib/puppet/module.rb:79 warning: multiple values for a block parameter (0 for 1) from lib/puppet/util/logging.rb:30 If you call any form of logging on a module you end calling the file method on the module just because logging always checks for that method and calls it if it's defined, but in this case it's not defined in the way that logging expected so passes the wrong paramters. The easy solution is just to call logging on Puppet, which makes sense in this case anyway, and I don't think it's worth a separate ticket to deal with that logging warning. Reviewed-by: Nick Lewis --- lib/puppet/module.rb | 2 +- spec/unit/indirector/queue_spec.rb | 3 +++ spec/unit/module_spec.rb | 4 ++-- spec/unit/network/handler/fileserver_spec.rb | 2 +- spec/unit/parser/parser_spec.rb | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb index 8da19c2ce..43266b2b5 100644 --- a/lib/puppet/module.rb +++ b/lib/puppet/module.rb @@ -191,7 +191,7 @@ class Puppet::Module def backward_compatible_plugins_dir if dir = File.join(path, "plugins") and FileTest.exist?(dir) - warning "using the deprecated 'plugins' directory for ruby extensions; please move to 'lib'" + Puppet.warning "using the deprecated 'plugins' directory for ruby extensions; please move to 'lib'" return dir else return File.join(path, "lib") diff --git a/spec/unit/indirector/queue_spec.rb b/spec/unit/indirector/queue_spec.rb index 00463ee0f..bbe00c75f 100755 --- a/spec/unit/indirector/queue_spec.rb +++ b/spec/unit/indirector/queue_spec.rb @@ -114,6 +114,9 @@ describe Puppet::Indirector::Queue, :if => Puppet.features.pson? do @store_class.client.expects(:subscribe).yields("foo") @store_class.expects(:intern).raises ArgumentError Puppet.expects(:err) + + @store_class.expects(:puts) + @store_class.subscribe {|o| o } end end diff --git a/spec/unit/module_spec.rb b/spec/unit/module_spec.rb index 37dad7e25..0b4873f5f 100755 --- a/spec/unit/module_spec.rb +++ b/spec/unit/module_spec.rb @@ -367,9 +367,9 @@ describe Puppet::Module do mod.stubs(:path).returns "/a/foo" FileTest.expects(:exist?).with("/a/foo/plugins").returns true - mod.expects(:warning) - mod.plugin_directory.should == "/a/foo/plugins" + @logs.first.message.should == "using the deprecated 'plugins' directory for ruby extensions; please move to 'lib'" + @logs.first.level.should == :warning end it "should default to 'lib' for the plugins directory" do diff --git a/spec/unit/network/handler/fileserver_spec.rb b/spec/unit/network/handler/fileserver_spec.rb index b37d4f551..9d34e9cdd 100644 --- a/spec/unit/network/handler/fileserver_spec.rb +++ b/spec/unit/network/handler/fileserver_spec.rb @@ -158,7 +158,7 @@ describe Puppet::Network::Handler::FileServer do end it "should not fail for inexistant plugins type" do - lambda { @mount.list("puppet/parser",true,false) }.should_not raise_error + @mount.list("puppet/parser",true,false) end end diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb index 6cc393d91..2ed279fd9 100755 --- a/spec/unit/parser/parser_spec.rb +++ b/spec/unit/parser/parser_spec.rb @@ -259,7 +259,7 @@ describe Puppet::Parser do before do @lexer = stub 'lexer', :line => 50, :file => "/foo/bar", :getcomment => "whev" @parser.stubs(:lexer).returns @lexer - @class = stub 'class', :use_docs => false + @class = Puppet::Resource::Type.new(:hostclass, "myclass", :use_docs => false) end it "should return a new instance of the provided class created with the provided options" do -- cgit From 4bd54939ceb4c588b1633117d88472fe48e9dfdf Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Wed, 9 Mar 2011 17:56:37 +1100 Subject: Fixed #2645 - Added support for creating system users On Red Hat, Ubuntu, Debian and deriatives the -r flag allows creation of "system" users with a UID below that defined in /etc/login.defs. This commit adds support for a system parameter and a system_users feature which can be used like so: user { "foo": system => true, ensure => present, } This will create a user with a lower UID. The system parameter defaults to false. --- lib/puppet/provider/user/useradd.rb | 7 +++++- lib/puppet/type/user.rb | 11 ++++++++++ spec/unit/provider/user/useradd_spec.rb | 39 ++++++++++++++++++++++++++++++--- spec/unit/type/user_spec.rb | 4 ++++ 4 files changed, 57 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/user/useradd.rb b/lib/puppet/provider/user/useradd.rb index ba406cc63..b87971738 100644 --- a/lib/puppet/provider/user/useradd.rb +++ b/lib/puppet/provider/user/useradd.rb @@ -19,7 +19,7 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ value !~ /\s/ end - has_features :manages_homedir, :allows_duplicates, :manages_expiry + has_features :manages_homedir, :allows_duplicates, :manages_expiry, :system_users has_features :manages_passwords, :manages_password_age if Puppet.features.libshadow? @@ -46,6 +46,10 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ cmd end + def check_system_users + @resource.system? ? ["-r"] : [] + end + def add_properties cmd = [] Puppet::Type.type(:user).validproperties.each do |property| @@ -66,6 +70,7 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ cmd += check_allow_dup cmd += check_manage_home cmd += check_manage_expiry + cmd += check_system_users cmd << @resource[:name] end diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index e7389a0d1..dcba181fe 100755 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -34,6 +34,9 @@ module Puppet feature :manages_expiry, "The provider can manage the expiry date for a user." + feature :system_users, + "The provider allows you to create system users with lower UIDs." + newproperty(:ensure, :parent => Puppet::Property::Ensure) do newvalue(:present, :event => :user_created) do provider.create @@ -230,6 +233,14 @@ module Puppet defaultto :minimum end + newparam(:system, :boolean => true) do + desc "Whether the user is a system user with lower UID." + + newvalues(:true, :false) + + defaultto false + end + newparam(:allowdupe, :boolean => true) do desc "Whether to allow duplicate UIDs." diff --git a/spec/unit/provider/user/useradd_spec.rb b/spec/unit/provider/user/useradd_spec.rb index 9ebba596c..81ad7d400 100755 --- a/spec/unit/provider/user/useradd_spec.rb +++ b/spec/unit/provider/user/useradd_spec.rb @@ -15,6 +15,7 @@ describe provider_class do # #1360 it "should add -o when allowdupe is enabled and the user is being created" do @resource.expects(:allowdupe?).returns true + @resource.expects(:system?).returns true @provider.stubs(:execute) @provider.expects(:execute).with { |args| args.include?("-o") } @provider.create @@ -27,6 +28,14 @@ describe provider_class do @provider.uid = 150 end + it "should add -r when system is enabled" do + @resource.expects(:allowdupe?).returns true + @resource.expects(:system?).returns true + @provider.stubs(:execute) + @provider.expects(:execute).with { |args| args.include?("-r") } + @provider.create + end + it "should set password age rules" do provider_class.has_feature :manages_password_age @resource = Puppet::Type.type(:user).new :name => "myuser", :password_min_age => 5, :password_max_age => 10, :provider => :useradd @@ -53,6 +62,23 @@ describe provider_class do end end + describe "when checking to add system users" do + it "should check system users" do + @resource.expects(:system?) + @provider.check_system_users + end + + it "should return an array with a flag if it's a system user" do + @resource.stubs(:system?).returns true + @provider.check_system_users.must == ["-r"] + end + + it "should return an empty array if it's not a system user" do + @resource.stubs(:system?).returns false + @provider.check_system_users.must == [] + end + end + describe "when checking manage home" do it "should check manage home" do @resource.expects(:managehome?) @@ -88,6 +114,7 @@ describe provider_class do before do @resource.stubs(:allowdupe?).returns true @resource.stubs(:managehome?).returns true + @resource.stubs(:system?).returns true end it "should call command with :add" do @@ -105,6 +132,11 @@ describe provider_class do @provider.addcmd end + it "should check and add if it's a system user" do + @provider.expects(:check_system_users).returns([]) + @provider.addcmd + end + it "should check and add if home is managed" do @provider.expects(:check_manage_home).returns([]) @provider.addcmd @@ -120,15 +152,15 @@ describe provider_class do @provider.stubs(:add_properties).returns(["-G", "somegroup"]) @resource.stubs(:[]).with(:name).returns("someuser") @resource.stubs(:[]).with(:expiry).returns("somedate") - @provider.addcmd.must == ["useradd", "-G", "somegroup", "-o", "-m", '-e somedate', "someuser"] + @provider.addcmd.must == ["useradd", "-G", "somegroup", "-o", "-m", '-e somedate', "-r", "someuser"] end - it "should return an array without -e if expery is undefined full command" do + it "should return an array without -e if expiry is undefined full command" do @provider.stubs(:command).with(:add).returns("useradd") @provider.stubs(:add_properties).returns(["-G", "somegroup"]) @resource.stubs(:[]).with(:name).returns("someuser") @resource.stubs(:[]).with(:expiry).returns nil - @provider.addcmd.must == ["useradd", "-G", "somegroup", "-o", "-m", "someuser"] + @provider.addcmd.must == ["useradd", "-G", "somegroup", "-o", "-m", "-r", "someuser"] end end @@ -136,6 +168,7 @@ describe provider_class do before do @resource.stubs(:allowdupe?).returns true @resource.stubs(:managehome?).returns true + @resource.stubs(:system?).returns true end it "should call command with :pass" do diff --git a/spec/unit/type/user_spec.rb b/spec/unit/type/user_spec.rb index 297134446..5a84af443 100755 --- a/spec/unit/type/user_spec.rb +++ b/spec/unit/type/user_spec.rb @@ -43,6 +43,10 @@ describe user do user.provider_feature(:manages_password_age).should_not be_nil end + it "should have a system_users feature" do + user.provider_feature(:system_users).should_not be_nil + end + describe "instances" do it "should have a valid provider" do user.new(:name => "foo").provider.class.ancestors.should be_include(Puppet::Provider) -- cgit From 682686f7cb6c1b400f04297ebf606d3b555858ce Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Wed, 9 Mar 2011 10:51:01 -0800 Subject: (#6441) Add mount fixture for AIX's /etc/filesystems This fixture is currently unused, largely due to the mount type being based on parsedfile, which is incapable of parsing /etc/filesystems. Paired-with: Daniel Pittman --- .../unit/provider/mount/parsed/aix.filesystems | 144 +++++++++++++++++++++ spec/unit/provider/mount/parsed_spec.rb | 2 + 2 files changed, 146 insertions(+) create mode 100644 spec/fixtures/unit/provider/mount/parsed/aix.filesystems diff --git a/spec/fixtures/unit/provider/mount/parsed/aix.filesystems b/spec/fixtures/unit/provider/mount/parsed/aix.filesystems new file mode 100644 index 000000000..7347f2b8c --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/aix.filesystems @@ -0,0 +1,144 @@ +* IBM_PROLOG_BEGIN_TAG +* This is an automatically generated prolog. +* +* bos61B src/bos/etc/filesystems/filesystems 1.23 +* +* Licensed Materials - Property of IBM +* +* COPYRIGHT International Business Machines Corp. 1985,1993 +* All Rights Reserved +* +* US Government Users Restricted Rights - Use, duplication or +* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. +* +* @(#)filesystems @(#)29 1.23 src/bos/etc/filesystems/filesystems, cmdfs, bos61B, b2007_38A8 8/16/07 17:18:35 +* IBM_PROLOG_END_TAG +* +* COMPONENT_NAME: CMDFS +* +* FUNCTIONS: none +* +* ORIGINS: 27 +* +* (C) COPYRIGHT International Business Machines Corp. 1985, 1993 +* All Rights Reserved +* Licensed Materials - Property of IBM +* +* US Government Users Restricted Rights - Use, duplication or +* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. +* +* +* +* This version of /etc/filesystems assumes that only the root file system +* is created and ready. As new file systems are added, change the check, +* mount, free, log, vol and vfs entries for the appropriate stanza. +* + +/: + dev = /dev/hd4 + vfs = jfs2 + log = /dev/hd8 + mount = automatic + check = false + type = bootfs + vol = root + free = true + quota = no + +/home: + dev = /dev/hd1 + vfs = jfs2 + log = /dev/hd8 + mount = true + check = true + vol = /home + free = false + quota = no + +/usr: + dev = /dev/hd2 + vfs = jfs2 + log = /dev/hd8 + mount = automatic + check = false + type = bootfs + vol = /usr + free = false + quota = no + +/var: + dev = /dev/hd9var + vfs = jfs2 + log = /dev/hd8 + mount = automatic + check = false + type = bootfs + vol = /var + free = false + quota = no + +/tmp: + dev = /dev/hd3 + vfs = jfs2 + log = /dev/hd8 + mount = automatic + check = false + vol = /tmp + free = false + quota = no + +/admin: + dev = /dev/hd11admin + vfs = jfs2 + log = /dev/hd8 + mount = true + check = false + vol = /admin + free = false + quota = no + +/proc: + dev = /proc + vol = "/proc" + mount = true + check = false + free = false + vfs = procfs + +/opt: + dev = /dev/hd10opt + vfs = jfs2 + log = /dev/hd8 + mount = true + check = true + vol = /opt + free = false + quota = no + +/var/adm/ras/livedump: + dev = /dev/livedump + vfs = jfs2 + log = /dev/hd8 + mount = true + account = false + quota = no + + +/stage/middleware: + dev = "/stage/middleware" + vfs = nfs + nodename = 192.168.1.11 + mount = true + type = nfs + options = ro,bg,hard,intr,sec=sys + account = false + +/home/u0010689: + dev = "/userdata/20010689" + vfs = nfs + nodename = 192.168.1.11 + mount = true + type = nfs + options = bg,hard,intr + account = false + diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index 43defbe87..b63c0751f 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -189,6 +189,8 @@ FSTAB end + it "should support AIX's paragraph based /etc/filesystems" + my_fixtures('*.fstab').each do |fstab| platform = File.basename(fstab, '.fstab') describe "when prefetching on #{platform}" do -- cgit From 3489412a03fec009bc42222f449077e6f14998a4 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Wed, 9 Mar 2011 12:55:03 -0800 Subject: maint: Rename InventoryHost to InventoryNode This had been conflating hosts and nodes, when nodes is the most accurate. --- .../indirector/facts/inventory_active_record.rb | 48 +++++++++++----------- .../database/004_add_inventory_service_tables.rb | 18 ++++---- lib/puppet/rails/database/schema.rb | 8 ++-- lib/puppet/rails/inventory_fact.rb | 4 +- lib/puppet/rails/inventory_host.rb | 37 ----------------- lib/puppet/rails/inventory_node.rb | 37 +++++++++++++++++ .../facts/inventory_active_record_spec.rb | 28 ++++++------- 7 files changed, 90 insertions(+), 90 deletions(-) delete mode 100644 lib/puppet/rails/inventory_host.rb create mode 100644 lib/puppet/rails/inventory_node.rb diff --git a/lib/puppet/indirector/facts/inventory_active_record.rb b/lib/puppet/indirector/facts/inventory_active_record.rb index 5b8606839..2c2597f81 100644 --- a/lib/puppet/indirector/facts/inventory_active_record.rb +++ b/lib/puppet/indirector/facts/inventory_active_record.rb @@ -1,13 +1,13 @@ -require 'puppet/rails/inventory_host' +require 'puppet/rails/inventory_node' require 'puppet/rails/inventory_fact' require 'puppet/indirector/active_record' class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRecord def find(request) - host = Puppet::Rails::InventoryHost.find_by_name(request.key) - return nil unless host - facts = Puppet::Node::Facts.new(host.name, host.facts_to_hash) - facts.timestamp = host.timestamp + node = Puppet::Rails::InventoryNode.find_by_name(request.key) + return nil unless node + facts = Puppet::Node::Facts.new(node.name, node.facts_to_hash) + facts.timestamp = node.timestamp facts.values.each do |key,value| facts.values[key] = value.first if value.is_a?(Array) && value.length == 1 end @@ -16,18 +16,18 @@ class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRec def save(request) facts = request.instance - host = Puppet::Rails::InventoryHost.find_by_name(request.key) || Puppet::Rails::InventoryHost.create(:name => request.key, :timestamp => facts.timestamp) - host.timestamp = facts.timestamp + node = Puppet::Rails::InventoryNode.find_by_name(request.key) || Puppet::Rails::InventoryNode.create(:name => request.key, :timestamp => facts.timestamp) + node.timestamp = facts.timestamp ActiveRecord::Base.transaction do - Puppet::Rails::InventoryFact.delete_all(:inventory_host_id => host.id) + Puppet::Rails::InventoryFact.delete_all(:inventory_node_id => node.id) # We don't want to save internal values as facts, because those are - # metadata that belong on the host + # metadata that belong on the node facts.values.each do |name,value| next if name.to_s =~ /^_/ - host.facts.build(:name => name, :value => value) + node.facts.build(:name => name, :value => value) end - host.save + node.save end end @@ -46,21 +46,21 @@ class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRec end end - matching_hosts = hosts_matching_fact_filters(fact_filters) + hosts_matching_meta_filters(meta_filters) + matching_nodes = nodes_matching_fact_filters(fact_filters) + nodes_matching_meta_filters(meta_filters) # to_a because [].inject == nil - matching_hosts.inject {|hosts,this_set| hosts & this_set}.to_a.sort + matching_nodes.inject {|nodes,this_set| nodes & this_set}.to_a.sort end private - def hosts_matching_fact_filters(fact_filters) - host_sets = [] + def nodes_matching_fact_filters(fact_filters) + node_sets = [] fact_filters['eq'].each do |name,value| - host_sets << Puppet::Rails::InventoryHost.has_fact_with_value(name,value).map {|host| host.name} + node_sets << Puppet::Rails::InventoryNode.has_fact_with_value(name,value).map {|node| node.name} end fact_filters['ne'].each do |name,value| - host_sets << Puppet::Rails::InventoryHost.has_fact_without_value(name,value).map {|host| host.name} + node_sets << Puppet::Rails::InventoryNode.has_fact_without_value(name,value).map {|node| node.name} end { 'gt' => '>', @@ -69,15 +69,15 @@ class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRec 'le' => '<=' }.each do |operator_name,operator| fact_filters[operator_name].each do |name,value| - hosts_with_fact = Puppet::Rails::InventoryHost.has_fact(name) - host_sets << hosts_with_fact.select {|h| h.value_for(name).to_f.send(operator, value.to_f)}.map {|host| host.name} + nodes_with_fact = Puppet::Rails::InventoryNode.has_fact(name) + node_sets << nodes_with_fact.select {|h| h.value_for(name).to_f.send(operator, value.to_f)}.map {|node| node.name} end end - host_sets + node_sets end - def hosts_matching_meta_filters(meta_filters) - host_sets = [] + def nodes_matching_meta_filters(meta_filters) + node_sets = [] { 'eq' => '=', 'ne' => '!=', @@ -87,9 +87,9 @@ class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRec 'le' => '<=' }.each do |operator_name,operator| meta_filters[operator_name].each do |name,value| - host_sets << Puppet::Rails::InventoryHost.find(:all, :conditions => ["timestamp #{operator} ?", value]).map {|host| host.name} + node_sets << Puppet::Rails::InventoryNode.find(:all, :conditions => ["timestamp #{operator} ?", value]).map {|node| node.name} end end - host_sets + node_sets end end diff --git a/lib/puppet/rails/database/004_add_inventory_service_tables.rb b/lib/puppet/rails/database/004_add_inventory_service_tables.rb index 22298437a..a819cac1a 100644 --- a/lib/puppet/rails/database/004_add_inventory_service_tables.rb +++ b/lib/puppet/rails/database/004_add_inventory_service_tables.rb @@ -1,35 +1,35 @@ class AddInventoryServiceTables < ActiveRecord::Migration def self.up - unless ActiveRecord::Base.connection.tables.include?("inventory_hosts") - create_table :inventory_hosts do |t| + unless ActiveRecord::Base.connection.tables.include?("inventory_nodes") + create_table :inventory_nodes do |t| t.column :name, :string, :null => false t.column :timestamp, :datetime, :null => false t.column :updated_at, :datetime t.column :created_at, :datetime end - add_index :inventory_hosts, :name, :unique => true + add_index :inventory_nodes, :name, :unique => true end unless ActiveRecord::Base.connection.tables.include?("inventory_facts") create_table :inventory_facts, :id => false do |t| - t.column :inventory_host_id, :integer, :null => false + t.column :inventory_node_id, :integer, :null => false t.column :name, :string, :null => false t.column :value, :text, :null => false end - add_index :inventory_facts, [:inventory_host_id, :name], :unique => true + add_index :inventory_facts, [:inventory_node_id, :name], :unique => true end end def self.down - unless ActiveRecord::Base.connection.tables.include?("inventory_hosts") - remove_index :inventory_hosts, :name - drop_table :inventory_hosts + unless ActiveRecord::Base.connection.tables.include?("inventory_nodes") + remove_index :inventory_nodes, :name + drop_table :inventory_nodes end if ActiveRecord::Base.connection.tables.include?("inventory_facts") - remove_index :inventory_facts, [:inventory_host_id, :name] + remove_index :inventory_facts, [:inventory_node_id, :name] drop_table :inventory_facts end end diff --git a/lib/puppet/rails/database/schema.rb b/lib/puppet/rails/database/schema.rb index 5e455d6c0..9fd640fe4 100644 --- a/lib/puppet/rails/database/schema.rb +++ b/lib/puppet/rails/database/schema.rb @@ -104,22 +104,22 @@ class Puppet::Rails::Schema end add_index :param_names, :name - create_table :inventory_hosts do |t| + create_table :inventory_nodes do |t| t.column :name, :string, :null => false t.column :timestamp, :datetime, :null => false t.column :updated_at, :datetime t.column :created_at, :datetime end - add_index :inventory_hosts, :name, :unique => true + add_index :inventory_nodes, :name, :unique => true create_table :inventory_facts, :id => false do |t| - t.column :inventory_host_id, :integer, :null => false + t.column :inventory_node_id, :integer, :null => false t.column :name, :string, :null => false t.column :value, :text, :null => false end - add_index :inventory_facts, [:inventory_host_id, :name], :unique => true + add_index :inventory_facts, [:inventory_node_id, :name], :unique => true end end ensure diff --git a/lib/puppet/rails/inventory_fact.rb b/lib/puppet/rails/inventory_fact.rb index ecb6e41ee..033943358 100644 --- a/lib/puppet/rails/inventory_fact.rb +++ b/lib/puppet/rails/inventory_fact.rb @@ -1,6 +1,6 @@ -require 'puppet/rails/inventory_host' +require 'puppet/rails/inventory_node' class Puppet::Rails::InventoryFact < ::ActiveRecord::Base - belongs_to :host, :class_name => "Puppet::Rails::InventoryHost" + belongs_to :node, :class_name => "Puppet::Rails::InventoryNode" serialize :value end diff --git a/lib/puppet/rails/inventory_host.rb b/lib/puppet/rails/inventory_host.rb deleted file mode 100644 index 10dd62083..000000000 --- a/lib/puppet/rails/inventory_host.rb +++ /dev/null @@ -1,37 +0,0 @@ -require 'puppet/rails/inventory_fact' - -class Puppet::Rails::InventoryHost < ::ActiveRecord::Base - has_many :facts, :class_name => "Puppet::Rails::InventoryFact", :dependent => :delete_all - - named_scope :has_fact_with_value, lambda { |name,value| - { - :conditions => ["inventory_facts.name = ? AND inventory_facts.value = ?", name, value], - :joins => :facts - } - } - - named_scope :has_fact_without_value, lambda { |name,value| - { - :conditions => ["inventory_facts.name = ? AND inventory_facts.value != ?", name, value], - :joins => :facts - } - } - - named_scope :has_fact, lambda { |name| - { - :conditions => ["inventory_facts.name = ?", name], - :joins => :facts - } - } - - def value_for(fact_name) - fact = facts.find_by_name(fact_name) - fact ? fact.value : nil - end - - def facts_to_hash - facts.inject({}) do |fact_hash,fact| - fact_hash.merge(fact.name => fact.value) - end - end -end diff --git a/lib/puppet/rails/inventory_node.rb b/lib/puppet/rails/inventory_node.rb new file mode 100644 index 000000000..b3e321f94 --- /dev/null +++ b/lib/puppet/rails/inventory_node.rb @@ -0,0 +1,37 @@ +require 'puppet/rails/inventory_fact' + +class Puppet::Rails::InventoryNode < ::ActiveRecord::Base + has_many :facts, :class_name => "Puppet::Rails::InventoryFact", :dependent => :delete_all + + named_scope :has_fact_with_value, lambda { |name,value| + { + :conditions => ["inventory_facts.name = ? AND inventory_facts.value = ?", name, value], + :joins => :facts + } + } + + named_scope :has_fact_without_value, lambda { |name,value| + { + :conditions => ["inventory_facts.name = ? AND inventory_facts.value != ?", name, value], + :joins => :facts + } + } + + named_scope :has_fact, lambda { |name| + { + :conditions => ["inventory_facts.name = ?", name], + :joins => :facts + } + } + + def value_for(fact_name) + fact = facts.find_by_name(fact_name) + fact ? fact.value : nil + end + + def facts_to_hash + facts.inject({}) do |fact_hash,fact| + fact_hash.merge(fact.name => fact.value) + end + end +end diff --git a/spec/unit/indirector/facts/inventory_active_record_spec.rb b/spec/unit/indirector/facts/inventory_active_record_spec.rb index 69d614023..ca16606b2 100644 --- a/spec/unit/indirector/facts/inventory_active_record_spec.rb +++ b/spec/unit/indirector/facts/inventory_active_record_spec.rb @@ -32,23 +32,23 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r end describe "#save" do - it "should use an existing host if possible" do - host = Puppet::Rails::InventoryHost.new(:name => "foo", :timestamp => Time.now) - host.save + it "should use an existing node if possible" do + node = Puppet::Rails::InventoryNode.new(:name => "foo", :timestamp => Time.now) + node.save Puppet::Node::Facts.new("foo", "uptime_days" => "60", "kernel" => "Darwin").save - Puppet::Rails::InventoryHost.count.should == 1 - Puppet::Rails::InventoryHost.first.should == host + Puppet::Rails::InventoryNode.count.should == 1 + Puppet::Rails::InventoryNode.first.should == node end - it "should create a new host if one can't be found" do - # This test isn't valid if there are hosts to begin with - Puppet::Rails::InventoryHost.count.should == 0 + it "should create a new node if one can't be found" do + # This test isn't valid if there are nodes to begin with + Puppet::Rails::InventoryNode.count.should == 0 Puppet::Node::Facts.new("foo", "uptime_days" => "60", "kernel" => "Darwin").save - Puppet::Rails::InventoryHost.count.should == 1 - Puppet::Rails::InventoryHost.first.name.should == "foo" + Puppet::Rails::InventoryNode.count.should == 1 + Puppet::Rails::InventoryNode.first.name.should == "foo" end it "should save the facts" do @@ -57,7 +57,7 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r Puppet::Rails::InventoryFact.all.map{|f| [f.name,f.value]}.should =~ [["uptime_days","60"],["kernel","Darwin"]] end - it "should remove the previous facts for an existing host" do + it "should remove the previous facts for an existing node" do Puppet::Node::Facts.new("foo", "uptime_days" => "30", "kernel" => "Darwin").save bar_facts = Puppet::Node::Facts.new("bar", "uptime_days" => "35", "kernel" => "Linux") foo_facts = Puppet::Node::Facts.new("foo", "uptime_days" => "60", "is_virtual" => "false") @@ -81,12 +81,12 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r @bar_facts.save end - it "should identify facts by host name" do + it "should identify facts by node name" do Puppet::Node::Facts.find("foo").should == @foo_facts end - it "should return nil if no host instance can be found" do - Puppet::Node::Facts.find("non-existent host").should == nil + it "should return nil if no node instance can be found" do + Puppet::Node::Facts.find("non-existent node").should == nil end it "should convert all single-member arrays into non-arrays" do -- cgit From 531e25836e1313cd508ab8394e16cf438a62ac7b Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Wed, 9 Mar 2011 12:55:52 -0800 Subject: maint: Remove serialization of InventoryFact values This is not necessary because fact values are always strings, and it wasn't doing the unnecessary job it was expected to do anyway. --- lib/puppet/indirector/facts/inventory_active_record.rb | 3 --- lib/puppet/rails/inventory_fact.rb | 1 - spec/unit/indirector/facts/inventory_active_record_spec.rb | 6 ------ 3 files changed, 10 deletions(-) diff --git a/lib/puppet/indirector/facts/inventory_active_record.rb b/lib/puppet/indirector/facts/inventory_active_record.rb index 2c2597f81..89edaf332 100644 --- a/lib/puppet/indirector/facts/inventory_active_record.rb +++ b/lib/puppet/indirector/facts/inventory_active_record.rb @@ -8,9 +8,6 @@ class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRec return nil unless node facts = Puppet::Node::Facts.new(node.name, node.facts_to_hash) facts.timestamp = node.timestamp - facts.values.each do |key,value| - facts.values[key] = value.first if value.is_a?(Array) && value.length == 1 - end facts end diff --git a/lib/puppet/rails/inventory_fact.rb b/lib/puppet/rails/inventory_fact.rb index 033943358..aa6334eef 100644 --- a/lib/puppet/rails/inventory_fact.rb +++ b/lib/puppet/rails/inventory_fact.rb @@ -2,5 +2,4 @@ require 'puppet/rails/inventory_node' class Puppet::Rails::InventoryFact < ::ActiveRecord::Base belongs_to :node, :class_name => "Puppet::Rails::InventoryNode" - serialize :value end diff --git a/spec/unit/indirector/facts/inventory_active_record_spec.rb b/spec/unit/indirector/facts/inventory_active_record_spec.rb index ca16606b2..c29e58400 100644 --- a/spec/unit/indirector/facts/inventory_active_record_spec.rb +++ b/spec/unit/indirector/facts/inventory_active_record_spec.rb @@ -88,12 +88,6 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r it "should return nil if no node instance can be found" do Puppet::Node::Facts.find("non-existent node").should == nil end - - it "should convert all single-member arrays into non-arrays" do - Puppet::Node::Facts.new("array", "fact1" => ["value1"]).save - - Puppet::Node::Facts.find("array").values["fact1"].should == "value1" - end end describe "#search" do -- cgit From 86c60354da1d5a2a54baf6dbd92677a12701423d Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Wed, 9 Mar 2011 14:35:19 -0800 Subject: Update CHANGELOG for 2.6.6 --- CHANGELOG | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index c08d7e72f..7f5ff355f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ -2.6.6rc1 +2.6.6 ======== +d24e32a Update CHANGELOG and version for 2.6.6rc1 7c2a980 (#6541) Fix content with checksum truncation bug 63e911f (#6418) Recursive files shouldn't be audited -- cgit From cd5deda8f9eefbe55c63c97c81293d01ca05c110 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Wed, 9 Mar 2011 16:00:17 -0800 Subject: (#2645) Adding a less-stubby test to verify the "system" attribute's behavior Paired-with: Jacob Helwig --- spec/unit/provider/user/user_role_add_spec.rb | 1 + spec/unit/provider/user/useradd_spec.rb | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/spec/unit/provider/user/user_role_add_spec.rb b/spec/unit/provider/user/user_role_add_spec.rb index 9cf649267..f73942389 100644 --- a/spec/unit/provider/user/user_role_add_spec.rb +++ b/spec/unit/provider/user/user_role_add_spec.rb @@ -115,6 +115,7 @@ describe provider_class do describe "when allow duplicate is enabled" do before do @resource.expects(:allowdupe?).returns true + @resource.stubs(:system?) @provider.stubs(:is_role?).returns(false) @provider.stubs(:execute) @provider.expects(:execute).with { |args| args.include?("-o") } diff --git a/spec/unit/provider/user/useradd_spec.rb b/spec/unit/provider/user/useradd_spec.rb index 81ad7d400..fd75c43f3 100755 --- a/spec/unit/provider/user/useradd_spec.rb +++ b/spec/unit/provider/user/useradd_spec.rb @@ -132,11 +132,6 @@ describe provider_class do @provider.addcmd end - it "should check and add if it's a system user" do - @provider.expects(:check_system_users).returns([]) - @provider.addcmd - end - it "should check and add if home is managed" do @provider.expects(:check_manage_home).returns([]) @provider.addcmd @@ -147,6 +142,18 @@ describe provider_class do @provider.addcmd end + it "should return an array with -r if system? is true" do + resource = Puppet::Type.type(:user).new( :name => "bob", :system => true) + + provider_class.new( resource ).addcmd.should include("-r") + end + + it "should return an array without -r if system? is false" do + resource = Puppet::Type.type(:user).new( :name => "bob", :system => false) + + provider_class.new( resource ).addcmd.should_not include("-r") + end + it "should return an array with full command" do @provider.stubs(:command).with(:add).returns("useradd") @provider.stubs(:add_properties).returns(["-G", "somegroup"]) -- cgit From 285c4cc4b056b9c4990738c3d479d1a8993cf959 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Wed, 9 Mar 2011 16:17:17 -0800 Subject: (#5392) Give a better error when realizing a non-existant resource You can reproduce the error with a simple manifest Bogus_type <| title == 'foo' |> We used to fail because find_resource_type returned nil and we never checked if it was nil before calling methods on it. Reviewed-by: Max Martin --- lib/puppet/parser/ast/collection.rb | 9 +++++---- spec/unit/parser/ast/collection_spec.rb | 28 ++++++++++++++++------------ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/puppet/parser/ast/collection.rb b/lib/puppet/parser/ast/collection.rb index ef36b7143..565b83195 100644 --- a/lib/puppet/parser/ast/collection.rb +++ b/lib/puppet/parser/ast/collection.rb @@ -16,6 +16,7 @@ class Puppet::Parser::AST str, code = query && query.safeevaluate(scope) resource_type = scope.find_resource_type(@type) + fail "Resource type #{@type} doesn't exist" unless resource_type newcoll = Puppet::Parser::Collector.new(scope, resource_type.name, str, code, self.form) scope.compiler.add_collection(newcoll) @@ -26,10 +27,10 @@ class Puppet::Parser::AST params = @override.collect { |param| param.safeevaluate(scope) } newcoll.add_override( :parameters => params, - :file => @file, - :line => @line, - :source => scope.source, - :scope => scope + :file => @file, + :line => @line, + :source => scope.source, + :scope => scope ) end diff --git a/spec/unit/parser/ast/collection_spec.rb b/spec/unit/parser/ast/collection_spec.rb index 392a2c0f0..cc33075b7 100755 --- a/spec/unit/parser/ast/collection_spec.rb +++ b/spec/unit/parser/ast/collection_spec.rb @@ -4,20 +4,21 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::Collection do before :each do - @scope = stub_everything 'scope' - @mytype = stub_everything('mytype') - @scope.stubs(:find_resource_type).returns @mytype - @compiler = stub_everything 'compile' - @scope.stubs(:compiler).returns(@compiler) + @mytype = Puppet::Resource::Type.new(:definition, "mytype") + @environment = Puppet::Node::Environment.new + @environment.known_resource_types.add @mytype + + @compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("foonode", :environment => @environment)) + @scope = Puppet::Parser::Scope.new(:compiler => @compiler) @overrides = stub_everything 'overrides' @overrides.stubs(:is_a?).with(Puppet::Parser::AST).returns(true) - end it "should evaluate its query" do query = mock 'query' collection = Puppet::Parser::AST::Collection.new :query => query, :form => :virtual + collection.type = 'mytype' query.expects(:safeevaluate).with(@scope) @@ -26,8 +27,8 @@ describe Puppet::Parser::AST::Collection do it "should instantiate a Collector for this type" do collection = Puppet::Parser::AST::Collection.new :form => :virtual, :type => "test" - @test_type = stub 'type', :name => 'test' - @scope.expects(:find_resource_type).with('test').returns @test_type + @test_type = Puppet::Resource::Type.new(:definition, "test") + @environment.known_resource_types.add @test_type Puppet::Parser::Collector.expects(:new).with(@scope, "test", nil, nil, :virtual) @@ -35,7 +36,7 @@ describe Puppet::Parser::AST::Collection do end it "should tell the compiler about this collector" do - collection = Puppet::Parser::AST::Collection.new :form => :virtual, :type => "test" + collection = Puppet::Parser::AST::Collection.new :form => :virtual, :type => "mytype" Puppet::Parser::Collector.stubs(:new).returns("whatever") @compiler.expects(:add_collection).with("whatever") @@ -45,7 +46,7 @@ describe Puppet::Parser::AST::Collection do it "should evaluate overriden paramaters" do collector = stub_everything 'collector' - collection = Puppet::Parser::AST::Collection.new :form => :virtual, :type => "test", :override => @overrides + collection = Puppet::Parser::AST::Collection.new :form => :virtual, :type => "mytype", :override => @overrides Puppet::Parser::Collector.stubs(:new).returns(collector) @overrides.expects(:safeevaluate).with(@scope) @@ -55,7 +56,7 @@ describe Puppet::Parser::AST::Collection do it "should tell the collector about overrides" do collector = mock 'collector' - collection = Puppet::Parser::AST::Collection.new :form => :virtual, :type => "test", :override => @overrides + collection = Puppet::Parser::AST::Collection.new :form => :virtual, :type => "mytype", :override => @overrides Puppet::Parser::Collector.stubs(:new).returns(collector) collector.expects(:add_override) @@ -63,5 +64,8 @@ describe Puppet::Parser::AST::Collection do collection.evaluate(@scope) end - + it "should fail when evaluating undefined resource types" do + collection = Puppet::Parser::AST::Collection.new :form => :virtual, :type => "bogus" + lambda { collection.evaluate(@scope) }.should raise_error "Resource type bogus doesn't exist" + end end -- cgit From 0a2a58c8650e8956a4ae464d364310ced244303b Mon Sep 17 00:00:00 2001 From: Derek Olsen Date: Thu, 13 Jan 2011 14:07:00 -0800 Subject: (#5479) Autorequire zfs filesystem when zone dataset is configured A zone dataset is just a zfs filesystem in the global zone. This zfs filesystem needs to exist before it can be given to a zone as a dataset. It seemed to make sense to autorequire the zfs filesystem. This patch just autorequires the zfs filesystem which will be the dataset and let's the zfs type manage autorequiring the parent zfs filesystems and zpool. Reviewed-By: Daniel Pittman Reviewed-By: Matt Robinson --- lib/puppet/type/zone.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/puppet/type/zone.rb b/lib/puppet/type/zone.rb index fc524a541..c7c2aa143 100644 --- a/lib/puppet/type/zone.rb +++ b/lib/puppet/type/zone.rb @@ -413,6 +413,23 @@ Puppet::Type.newtype(:zone) do end end + # If Puppet is also managing the zfs filesystem which is the zone dataset + # then list it as a prerequisite. Zpool's get autorequired by the zfs + # type. We just need to autorequire the dataset zfs itself as the zfs type + # will autorequire all of the zfs parents and zpool. + autorequire(:zfs) do + + # Check if we have datasets in our zone configuration + if @parameters.include? :dataset + reqs = [] + # Autorequire each dataset + self[:dataset].each { |value| + reqs << value + } + reqs + end + end + def validate_ip(ip, name) IPAddr.new(ip) if ip rescue ArgumentError -- cgit From 1a55c7a4c225dc022fa640bf46f7bc940013151d Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 10 Mar 2011 16:08:26 -0800 Subject: (#5479) Test that we auto-require the zone dataset. This adds a test at the catalog level to ensure that we generate the right graph relationships; this indirectly tests that the underlying code does the right thing, but importantly also makes us fairly immune to low level changes. Reviewed-By: Daniel Pittman Reviewed-By: Matt Robinson --- spec/unit/type/zone_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/unit/type/zone_spec.rb b/spec/unit/type/zone_spec.rb index 726ccc28d..a3e748bde 100755 --- a/spec/unit/type/zone_spec.rb +++ b/spec/unit/type/zone_spec.rb @@ -57,4 +57,24 @@ describe zone do zone.new(:name => "dummy", :path => "/dummy", :ip => "if", :iptype => :exclusive) end + it "should auto-require :dataset entries" do + fs = 'random-pool/some-zfs' + + # ick + provider = stub 'zfs::provider' + provider.stubs(:name).returns(:solaris) + Puppet::Type.type(:zfs).stubs(:defaultprovider).returns(provider) + + catalog = Puppet::Resource::Catalog.new + zfs_instance = Puppet::Type.type(:zfs).new(:name => fs) + catalog.add_resource zfs_instance + + zone_instance = zone.new(:name => "dummy", + :path => "/foo", + :ip => 'en1:1.0.0.0', + :dataset => fs) + catalog.add_resource zone_instance + + catalog.relationship_graph.dependencies(zone_instance).should == [zfs_instance] + end end -- cgit From 8858e40839bd693420ddc791df6b51de79356d2a Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Fri, 11 Mar 2011 15:22:23 -0800 Subject: (#6689) Make inventory_active_record terminus search quickly This terminus behaves the same on all supported DB platforms, by performing a limited portion of its query in SQL, and the rest of the comparison in Ruby. Its results are consistent with the YAML terminus. Paired-With: Jesse Wolfe --- lib/puppet/indirector/facts/inventory_active_record.rb | 14 ++++++++++---- .../rails/database/004_add_inventory_service_tables.rb | 6 +++--- lib/puppet/rails/database/schema.rb | 4 ++-- lib/puppet/rails/inventory_node.rb | 14 +------------- spec/unit/indirector/facts/inventory_active_record_spec.rb | 3 --- 5 files changed, 16 insertions(+), 25 deletions(-) diff --git a/lib/puppet/indirector/facts/inventory_active_record.rb b/lib/puppet/indirector/facts/inventory_active_record.rb index 89edaf332..5d130eae2 100644 --- a/lib/puppet/indirector/facts/inventory_active_record.rb +++ b/lib/puppet/indirector/facts/inventory_active_record.rb @@ -1,8 +1,10 @@ +require 'puppet/rails' require 'puppet/rails/inventory_node' require 'puppet/rails/inventory_fact' require 'puppet/indirector/active_record' class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRecord + include Puppet::Util def find(request) node = Puppet::Rails::InventoryNode.find_by_name(request.key) return nil unless node @@ -17,7 +19,7 @@ class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRec node.timestamp = facts.timestamp ActiveRecord::Base.transaction do - Puppet::Rails::InventoryFact.delete_all(:inventory_node_id => node.id) + Puppet::Rails::InventoryFact.delete_all(:node_id => node.id) # We don't want to save internal values as facts, because those are # metadata that belong on the node facts.values.each do |name,value| @@ -30,6 +32,7 @@ class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRec def search(request) return [] unless request.options + matching_nodes = [] fact_names = [] fact_filters = Hash.new {|h,k| h[k] = []} meta_filters = Hash.new {|h,k| h[k] = []} @@ -66,8 +69,11 @@ class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRec 'le' => '<=' }.each do |operator_name,operator| fact_filters[operator_name].each do |name,value| - nodes_with_fact = Puppet::Rails::InventoryNode.has_fact(name) - node_sets << nodes_with_fact.select {|h| h.value_for(name).to_f.send(operator, value.to_f)}.map {|node| node.name} + facts = Puppet::Rails::InventoryFact.find_by_sql(["SELECT inventory_facts.value, inventory_nodes.name AS node_name + FROM inventory_facts INNER JOIN inventory_nodes + ON inventory_facts.node_id = inventory_nodes.id + WHERE inventory_facts.name = ?", name]) + node_sets << facts.select {|fact| fact.value.to_f.send(operator, value.to_f)}.map {|fact| fact.node_name} end end node_sets @@ -84,7 +90,7 @@ class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRec 'le' => '<=' }.each do |operator_name,operator| meta_filters[operator_name].each do |name,value| - node_sets << Puppet::Rails::InventoryNode.find(:all, :conditions => ["timestamp #{operator} ?", value]).map {|node| node.name} + node_sets << Puppet::Rails::InventoryNode.find(:all, :select => "name", :conditions => ["timestamp #{operator} ?", value]).map {|node| node.name} end end node_sets diff --git a/lib/puppet/rails/database/004_add_inventory_service_tables.rb b/lib/puppet/rails/database/004_add_inventory_service_tables.rb index a819cac1a..6e6b28c0c 100644 --- a/lib/puppet/rails/database/004_add_inventory_service_tables.rb +++ b/lib/puppet/rails/database/004_add_inventory_service_tables.rb @@ -13,12 +13,12 @@ class AddInventoryServiceTables < ActiveRecord::Migration unless ActiveRecord::Base.connection.tables.include?("inventory_facts") create_table :inventory_facts, :id => false do |t| - t.column :inventory_node_id, :integer, :null => false + t.column :node_id, :integer, :null => false t.column :name, :string, :null => false t.column :value, :text, :null => false end - add_index :inventory_facts, [:inventory_node_id, :name], :unique => true + add_index :inventory_facts, [:node_id, :name], :unique => true end end @@ -29,7 +29,7 @@ class AddInventoryServiceTables < ActiveRecord::Migration end if ActiveRecord::Base.connection.tables.include?("inventory_facts") - remove_index :inventory_facts, [:inventory_node_id, :name] + remove_index :inventory_facts, [:node_id, :name] drop_table :inventory_facts end end diff --git a/lib/puppet/rails/database/schema.rb b/lib/puppet/rails/database/schema.rb index 9fd640fe4..7b75f4216 100644 --- a/lib/puppet/rails/database/schema.rb +++ b/lib/puppet/rails/database/schema.rb @@ -114,12 +114,12 @@ class Puppet::Rails::Schema add_index :inventory_nodes, :name, :unique => true create_table :inventory_facts, :id => false do |t| - t.column :inventory_node_id, :integer, :null => false + t.column :node_id, :integer, :null => false t.column :name, :string, :null => false t.column :value, :text, :null => false end - add_index :inventory_facts, [:inventory_node_id, :name], :unique => true + add_index :inventory_facts, [:node_id, :name], :unique => true end end ensure diff --git a/lib/puppet/rails/inventory_node.rb b/lib/puppet/rails/inventory_node.rb index b3e321f94..52f8621a4 100644 --- a/lib/puppet/rails/inventory_node.rb +++ b/lib/puppet/rails/inventory_node.rb @@ -1,7 +1,7 @@ require 'puppet/rails/inventory_fact' class Puppet::Rails::InventoryNode < ::ActiveRecord::Base - has_many :facts, :class_name => "Puppet::Rails::InventoryFact", :dependent => :delete_all + has_many :facts, :class_name => "Puppet::Rails::InventoryFact", :foreign_key => :node_id, :dependent => :delete_all named_scope :has_fact_with_value, lambda { |name,value| { @@ -17,18 +17,6 @@ class Puppet::Rails::InventoryNode < ::ActiveRecord::Base } } - named_scope :has_fact, lambda { |name| - { - :conditions => ["inventory_facts.name = ?", name], - :joins => :facts - } - } - - def value_for(fact_name) - fact = facts.find_by_name(fact_name) - fact ? fact.value : nil - end - def facts_to_hash facts.inject({}) do |fact_hash,fact| fact_hash.merge(fact.name => fact.value) diff --git a/spec/unit/indirector/facts/inventory_active_record_spec.rb b/spec/unit/indirector/facts/inventory_active_record_spec.rb index c29e58400..9558abde2 100644 --- a/spec/unit/indirector/facts/inventory_active_record_spec.rb +++ b/spec/unit/indirector/facts/inventory_active_record_spec.rb @@ -68,9 +68,6 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r Puppet::Node::Facts.find("foo").should == foo_facts Puppet::Rails::InventoryFact.all.map{|f| [f.name,f.value]}.should_not include(["uptime_days", "30"], ["kernel", "Darwin"]) end - - it "should not replace the node's facts if something goes wrong" do - end end describe "#find" do -- cgit From 02626335b5e7fdbecf46639e4a4efe8e18ead982 Mon Sep 17 00:00:00 2001 From: nfagerlund Date: Mon, 14 Mar 2011 13:19:17 -0700 Subject: (#6707) Fix typo in rest_authconfig.rb "Where" -> "were." Capitalize "ACL." --- lib/puppet/network/rest_authconfig.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/network/rest_authconfig.rb b/lib/puppet/network/rest_authconfig.rb index 7a6147a82..e6067612a 100644 --- a/lib/puppet/network/rest_authconfig.rb +++ b/lib/puppet/network/rest_authconfig.rb @@ -61,7 +61,7 @@ module Puppet def insert_default_acl DEFAULT_ACL.each do |acl| unless rights[acl[:acl]] - Puppet.info "Inserting default '#{acl[:acl]}'(#{acl[:authenticated] ? "auth" : "non-auth"}) acl because #{( !exists? ? "#{Puppet[:rest_authconfig]} doesn't exist" : "none where found in '#{@file}'")}" + Puppet.info "Inserting default '#{acl[:acl]}'(#{acl[:authenticated] ? "auth" : "non-auth"}) ACL because #{( !exists? ? "#{Puppet[:rest_authconfig]} doesn't exist" : "none were found in '#{@file}'")}" mk_acl(acl) end end -- cgit From ff9e2425a58bb2b1ab836e440c3344b4012623c5 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Fri, 25 Feb 2011 17:03:56 -0800 Subject: (#5428) More fully "stub" Puppet::Resource::Reference for use with storedconfigs The Puppet::Resource::Reference class wasn't stubbing enough of the 0.25.x behavior to satisfy the needs of storedconfigs. Since P::R::Reference, and Puppet::Resource were merged as part of 2.6.x, we can pretend that P::Resource is P::R::Reference for the purposes of loading data from storedconfigs. This should still satisfy the over-the-wire serialization needs of 0.25.x. This also changes internal references to @parameters in Puppet::Resource(::Reference) to go through a parameters method. This allows us to "initialize" this instance variable lazily, since loading via YAML bypasses the normal initialize method. Paired-with: Daniel Pittman Reviewed-by: Markus Roberts --- lib/puppet/resource.rb | 35 +++++++++++++++++++---------------- spec/unit/resource_spec.rb | 26 ++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index e832804f5..e47fc7ecc 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -5,6 +5,11 @@ require 'puppet/util/pson' # The simplest resource class. Eventually it will function as the # base class for all resource-like behaviour. class Puppet::Resource + # This stub class is only needed for serialization compatibility with 0.25.x. + # Specifically, it exists to provide a compatibility API when using YAML + # serialized objects loaded from StoreConfigs. + Reference = Puppet::Resource + include Puppet::Util::Tagging require 'puppet/resource/type_collection_helper' @@ -104,7 +109,7 @@ class Puppet::Resource # be overridden at some point, but this works for now. %w{has_key? keys length delete empty? <<}.each do |method| define_method(method) do |*args| - @parameters.send(method, *args) + parameters.send(method, *args) end end @@ -112,13 +117,13 @@ class Puppet::Resource # to lower-case symbols. def []=(param, value) validate_parameter(param) if validate_parameters - @parameters[parameter_name(param)] = value + parameters[parameter_name(param)] = value end # Return a given parameter's value. Converts all passed names # to lower-case symbols. def [](param) - @parameters[parameter_name(param)] + parameters[parameter_name(param)] end def ==(other) @@ -140,11 +145,11 @@ class Puppet::Resource # Iterate over each param/value pair, as required for Enumerable. def each - @parameters.each { |p,v| yield p, v } + parameters.each { |p,v| yield p, v } end def include?(parameter) - super || @parameters.keys.include?( parameter_name(parameter) ) + super || parameters.keys.include?( parameter_name(parameter) ) end # These two methods are extracted into a Helper @@ -170,14 +175,6 @@ class Puppet::Resource end end - # This stub class is only needed for serialization compatibility with 0.25.x - class Reference - attr_accessor :type,:title - def initialize(type,title) - @type,@title = type,title - end - end - # Create our resource. def initialize(type, title = nil, attributes = {}) @parameters = {} @@ -204,7 +201,7 @@ class Puppet::Resource tag(self.type) tag(self.title) if valid_tag?(self.title) - @reference = Reference.new(@type,@title) # for serialization compatibility with 0.25.x + @reference = self # for serialization compatibility with 0.25.x if strict? and ! resource_type if @type == 'Class' raise ArgumentError, "Could not find declared class #{title}" @@ -234,7 +231,7 @@ class Puppet::Resource # Produce a simple hash of our parameters. def to_hash - parse_title.merge @parameters + parse_title.merge parameters end def to_s @@ -256,7 +253,7 @@ class Puppet::Resource # Convert our resource to Puppet code. def to_manifest "%s { '%s':\n%s\n}" % [self.type.to_s.downcase, self.title, - @parameters.collect { |p, v| + parameters.collect { |p, v| if v.is_a? Array " #{p} => [\'#{v.join("','")}\']" else @@ -422,4 +419,10 @@ class Puppet::Resource return { :name => title.to_s } end end + + def parameters + # @parameters could have been loaded from YAML, causing it to be nil (by + # bypassing initialize). + @parameters ||= {} + end end diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index ff31b2492..4c1dc4952 100755 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -99,11 +99,11 @@ describe Puppet::Resource do end it 'should fail if strict is set and type does not exist' do - lambda { Puppet::Resource.new('foo', 'title', {:strict=>true}) }.should raise_error(ArgumentError, 'Invalid resource type foo') + lambda { Puppet::Resource.new('foo', 'title', {:strict=>true}) }.should raise_error(ArgumentError, 'Invalid resource type foo') end it 'should fail if strict is set and class does not exist' do - lambda { Puppet::Resource.new('Class', 'foo', {:strict=>true}) }.should raise_error(ArgumentError, 'Could not find declared class foo') + lambda { Puppet::Resource.new('Class', 'foo', {:strict=>true}) }.should raise_error(ArgumentError, 'Could not find declared class foo') end it "should fail if the title is a hash and the type is not a valid resource reference string" do @@ -463,6 +463,28 @@ describe Puppet::Resource do end end + describe "when loading 0.25.x storedconfigs YAML" do + before :each do + @old_storedconfig_yaml = %q{--- !ruby/object:Puppet::Resource::Reference +builtin_type: +title: /tmp/bar +type: File +} + end + + it "should deserialize a Puppet::Resource::Reference without exceptions" do + lambda { YAML.load(@old_storedconfig_yaml) }.should_not raise_error + end + + it "should deserialize as a Puppet::Resource::Reference as a Puppet::Resource" do + YAML.load(@old_storedconfig_yaml).class.should == Puppet::Resource + end + + it "should to_hash properly" do + YAML.load(@old_storedconfig_yaml).to_hash.should == { :path => "/tmp/bar" } + end + end + describe "when converting to a RAL resource" do it "should use the resource type's :new method to create the resource if the resource is of a builtin type" do resource = Puppet::Resource.new("file", @basepath+"/my/file") -- cgit From 4c1929952e7239f14aa1ab6a317d445a05d770c3 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Fri, 25 Feb 2011 18:11:47 -0800 Subject: Remove extra trailing whitespace from lib/puppet/resource.rb Paired-with: Daniel Pittman --- lib/puppet/resource.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index e47fc7ecc..45ee2e990 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -92,7 +92,7 @@ class Puppet::Resource def yaml_property_munge(x) case x when Hash - x.inject({}) { |h,kv| + x.inject({}) { |h,kv| k,v = kv h[k] = self.class.value_to_pson_data(v) h -- cgit From 093f1627025a69f1c0a1b570139147e6fc843d2c Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Fri, 11 Mar 2011 16:36:07 -0800 Subject: (#6689) Remove extraneous include of Puppet::Util in InventoryActiveRecord This was added while developing in order to benchmark, but wasn't removed before committing. Reviewed-By: Jacob Helwig --- lib/puppet/indirector/facts/inventory_active_record.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/puppet/indirector/facts/inventory_active_record.rb b/lib/puppet/indirector/facts/inventory_active_record.rb index 5d130eae2..db4c63f00 100644 --- a/lib/puppet/indirector/facts/inventory_active_record.rb +++ b/lib/puppet/indirector/facts/inventory_active_record.rb @@ -4,7 +4,6 @@ require 'puppet/rails/inventory_fact' require 'puppet/indirector/active_record' class Puppet::Node::Facts::InventoryActiveRecord < Puppet::Indirector::ActiveRecord - include Puppet::Util def find(request) node = Puppet::Rails::InventoryNode.find_by_name(request.key) return nil unless node -- cgit From 25926d1922a9b75bc87ed7feed30693a69cdea9a Mon Sep 17 00:00:00 2001 From: Max Martin Date: Tue, 15 Mar 2011 15:52:37 -0700 Subject: (#6723) Fix withenv environment restoration bug Ensured that withenv properly restores the environment after it runs a block and added testing for the method. Reviewed-by: Matt Robinson and Daniel Pittman --- lib/puppet/util/execution.rb | 9 ++++---- spec/unit/util/execution_spec.rb | 49 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 spec/unit/util/execution_spec.rb diff --git a/lib/puppet/util/execution.rb b/lib/puppet/util/execution.rb index dd820f856..69f4f2c15 100644 --- a/lib/puppet/util/execution.rb +++ b/lib/puppet/util/execution.rb @@ -4,16 +4,15 @@ module Puppet::Util::Execution # Run some code with a specific environment. Resets the environment back to # what it was at the end of the code. def withenv(hash) - oldvals = {} + saved = ENV.to_hash hash.each do |name, val| - name = name.to_s - oldvals[name] = ENV[name] - ENV[name] = val + ENV[name.to_s] = val end yield ensure - oldvals.each do |name, val| + ENV.clear + saved.each do |name, val| ENV[name] = val end end diff --git a/spec/unit/util/execution_spec.rb b/spec/unit/util/execution_spec.rb new file mode 100644 index 000000000..312dd3b8e --- /dev/null +++ b/spec/unit/util/execution_spec.rb @@ -0,0 +1,49 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../spec_helper' + +describe Puppet::Util::Execution do + include Puppet::Util::Execution + describe "#withenv" do + before :each do + @original_path = ENV["PATH"] + @new_env = {:PATH => "/some/bogus/path"} + end + + it "should change environment variables within the block then reset environment variables to their original values" do + withenv @new_env do + ENV["PATH"].should == "/some/bogus/path" + end + ENV["PATH"].should == @original_path + end + + it "should reset environment variables to their original values even if the block fails" do + begin + withenv @new_env do + ENV["PATH"].should == "/some/bogus/path" + raise "This is a failure" + end + rescue + end + ENV["PATH"].should == @original_path + end + + it "should reset environment variables even when they are set twice" do + # Setting Path & Environment parameters in Exec type can cause weirdness + @new_env["PATH"] = "/someother/bogus/path" + withenv @new_env do + # When assigning duplicate keys, can't guarantee order of evaluation + ENV["PATH"].should =~ /\/some.*\/bogus\/path/ + end + ENV["PATH"].should == @original_path + end + + it "should remove any new environment variables after the block ends" do + @new_env[:FOO] = "bar" + withenv @new_env do + ENV["FOO"].should == "bar" + end + ENV["FOO"].should == nil + end + end +end -- cgit From 9781032736a34f577241828bcf812a648b4f42e9 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Tue, 15 Mar 2011 17:28:52 -0700 Subject: Revert "Merge branch 'ticket/2.6.x/5605' of git://github.com/stschulte/puppet into 2.6.next" This reverts commit 658bdb72bee3ad664627a71793213e6540afd5cb, reversing changes made to 4c9bd43bc2f5fde9d86196e8689dced929d39aad. See comment at http://projects.puppetlabs.com/issues/5605#note-9 --- lib/puppet/resource.rb | 9 ++------- lib/puppet/transaction.rb | 2 +- lib/puppet/type.rb | 8 +------- spec/unit/resource_spec.rb | 11 ++--------- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index 0f4e24cc4..214516908 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -243,16 +243,11 @@ class Puppet::Resource h = self.to_hash h[namevar] ||= h[:name] h[:name] ||= h[namevar] - # Simulate the same behaviour like Type#uniqueness_key - if key_attributes.size == 1 - h[namevar] - else - h.values_at(*key_attributes) - end + h.values_at(*key_attributes.sort_by { |k| k.to_s }) end def key_attributes - resource_type.respond_to?(:key_attributes) ? resource_type.key_attributes : [:name] + return(resource_type.respond_to? :key_attributes) ? resource_type.key_attributes : [:name] end # Convert our resource to Puppet code. diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 6c816f130..aa650eea1 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -245,7 +245,7 @@ class Puppet::Transaction @catalog.vertices.each do |resource| if provider = resource.provider and provider.class.respond_to?(:prefetch) prefetchers[provider.class] ||= {} - prefetchers[provider.class][resource.uniqueness_key] = resource + prefetchers[provider.class][resource.name] = resource end end diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index c8d8688b0..205d809c1 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -200,13 +200,7 @@ class Type end def uniqueness_key - # If we have only one namevar use that one (res.uniqueness_key behaves - # like res[:name] in that case). Otherwise use an array of all keyattributes - if name_var - self[:name] - else - @parameters.values_at(*self.class.key_attributes).collect {|p| p.value } - end + to_resource.uniqueness_key end # Create a new parameter. Requires a block and a name, stores it in the diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 6f94409ab..345ccd06e 100755 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -276,7 +276,7 @@ describe Puppet::Resource do describe "when referring to a resource with name canonicalization" do it "should canonicalize its own name" do res = Puppet::Resource.new("file", "/path/") - res.uniqueness_key.should == "/path" + res.uniqueness_key.should == ["/path"] res.ref.should == "File[/path/]" end end @@ -800,14 +800,7 @@ type: File end describe "when generating the uniqueness key" do - - it "should use namevar if there is only one key_attribute" do - Puppet::Type.type(:file).stubs(:key_attributes).returns [:path] - res = Puppet::Resource.new("file", "/my/file", :parameters => {:owner => 'root', :content => 'hello'}) - res.uniqueness_key.should == '/my/file' - end - - it "should include all of the key_attributes" do + it "should include all of the key_attributes in alphabetical order by attribute name" do Puppet::Type.type(:file).stubs(:key_attributes).returns [:myvar, :owner, :path] Puppet::Type.type(:file).stubs(:title_patterns).returns( [ [ /(.*)/, [ [:path, lambda{|x| x} ] ] ] ] -- cgit From 4f34dbf206e591614c2fc06ce9bed1628ee85715 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Tue, 15 Mar 2011 15:29:01 -0700 Subject: Fix #5610: Prevent unnecessary RAL lookups Reviewed-By: Paul Berry --- lib/puppet/type.rb | 2 +- spec/unit/type_spec.rb | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 205d809c1..d24cc8554 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -200,7 +200,7 @@ class Type end def uniqueness_key - to_resource.uniqueness_key + self.class.key_attributes.sort_by { |attribute_name| attribute_name.to_s }.map{ |attribute_name| self[attribute_name] } end # Create a new parameter. Requires a block and a name, stores it in the diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb index b7a08977e..6d9d0b234 100755 --- a/spec/unit/type_spec.rb +++ b/spec/unit/type_spec.rb @@ -434,7 +434,7 @@ describe Puppet::Type do patterns.length.should == 1 patterns[0].length.should == 2 end - + it "should have a regexp that captures the entire string" do patterns = @type_class.title_patterns string = "abc\n\tdef" @@ -570,4 +570,15 @@ describe Puppet::Type.metaparamclass(:audit) do @resource[:audit] = :noop @resource.parameter(:noop).should be_nil end + + describe "when generating the uniqueness key" do + it "should include all of the key_attributes in alphabetical order by attribute name" do + Puppet::Type.type(:file).stubs(:key_attributes).returns [:path, :mode, :owner] + Puppet::Type.type(:file).stubs(:title_patterns).returns( + [ [ /(.*)/, [ [:path, lambda{|x| x} ] ] ] ] + ) + res = Puppet::Type.type(:file).new( :title => '/my/file', :path => '/my/file', :owner => 'root', :content => 'hello' ) + res.uniqueness_key.should == [ nil, 'root', '/my/file'] + end + end end -- cgit From 852fb9744320c253772c85e52b262b0290fb7dd4 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Tue, 15 Mar 2011 16:13:15 -0700 Subject: (#5073) Download plugins even if you're filtering on tags When we eval a resource in transaction.rb it was being skipped when filtering on tags and downloading the plugins. There's a lot of complicated conditions for whether to skip a resource, but this is a condensed version of the path that was causing plugins not to be downloaded. skip? missing_tags? !ignore_tags? !host_config The Puppet::Configurer::Downloader creates separate catalogs and applies them to get custom facts and plugins, so should be setting host_config to false. Puppet::Util::Settings also sets host_config to false when you call use on settings, while normal catalog application defaults to true. Thanks to Stefan Schulte for suggesting the implementation fix. --- lib/puppet/configurer/downloader.rb | 1 + lib/puppet/configurer/plugin_handler.rb | 9 ++++++++- spec/unit/configurer/downloader_spec.rb | 32 ++++++++++++++++++++++---------- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/lib/puppet/configurer/downloader.rb b/lib/puppet/configurer/downloader.rb index 1b587ed4b..b3696201a 100644 --- a/lib/puppet/configurer/downloader.rb +++ b/lib/puppet/configurer/downloader.rb @@ -50,6 +50,7 @@ class Puppet::Configurer::Downloader def catalog catalog = Puppet::Resource::Catalog.new + catalog.host_config = false catalog.add_resource(file) catalog end diff --git a/lib/puppet/configurer/plugin_handler.rb b/lib/puppet/configurer/plugin_handler.rb index cfc6b5a0b..ae088f26f 100644 --- a/lib/puppet/configurer/plugin_handler.rb +++ b/lib/puppet/configurer/plugin_handler.rb @@ -9,7 +9,14 @@ module Puppet::Configurer::PluginHandler # Retrieve facts from the central server. def download_plugins return nil unless download_plugins? - Puppet::Configurer::Downloader.new("plugin", Puppet[:plugindest], Puppet[:pluginsource], Puppet[:pluginsignore]).evaluate.each { |file| load_plugin(file) } + plugin_downloader = Puppet::Configurer::Downloader.new( + "plugin", + Puppet[:plugindest], + Puppet[:pluginsource], + Puppet[:pluginsignore] + ) + + plugin_downloader.evaluate.each { |file| load_plugin(file) } end def load_plugin(file) diff --git a/spec/unit/configurer/downloader_spec.rb b/spec/unit/configurer/downloader_spec.rb index c57f39fb5..4080263e7 100755 --- a/spec/unit/configurer/downloader_spec.rb +++ b/spec/unit/configurer/downloader_spec.rb @@ -5,6 +5,8 @@ require File.dirname(__FILE__) + '/../../spec_helper' require 'puppet/configurer/downloader' describe Puppet::Configurer::Downloader do + require 'puppet_spec/files' + include PuppetSpec::Files it "should require a name" do lambda { Puppet::Configurer::Downloader.new }.should raise_error(ArgumentError) end @@ -96,25 +98,35 @@ describe Puppet::Configurer::Downloader do describe "when creating the catalog to do the downloading" do before do - @dler = Puppet::Configurer::Downloader.new("foo", "path", "source") + @dler = Puppet::Configurer::Downloader.new("foo", "/download/path", "source") end it "should create a catalog and add the file to it" do - file = mock 'file' - catalog = mock 'catalog' - - @dler.expects(:file).returns file - - Puppet::Resource::Catalog.expects(:new).returns catalog - catalog.expects(:add_resource).with(file) + catalog = @dler.catalog + catalog.resources.size.should == 1 + catalog.resources.first.class.should == Puppet::Type::File + catalog.resources.first.name.should == "/download/path" + end - @dler.catalog.should equal(catalog) + it "should specify that it is not managing a host catalog" do + @dler.catalog.host_config.should == false end + end describe "when downloading" do before do - @dler = Puppet::Configurer::Downloader.new("foo", "path", "source") + @dl_name = tmpfile("downloadpath") + source_name = tmpfile("source") + File.open(source_name, 'w') {|f| f.write('hola mundo') } + @dler = Puppet::Configurer::Downloader.new("foo", @dl_name, source_name) + end + + it "should not skip downloaded resources when filtering on tags" do + Puppet[:tags] = 'maytag' + @dler.evaluate + + File.exists?(@dl_name).should be_true end it "should log that it is downloading" do -- cgit From 17f673dd6fee08309970f8ff721855cf1644b45f Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Wed, 16 Mar 2011 11:38:36 -0700 Subject: Updated CHANGELOG for 2.6.7rc1 --- CHANGELOG | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- lib/puppet.rb | 2 +- 2 files changed, 107 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7f5ff355f..2885596e3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,110 @@ -2.6.6 +2.6.7rc1 ======== +852fb97 (#5073) Download plugins even if you're filtering on tags +4f34dbf Fix #5610: Prevent unnecessary RAL lookups +9781032 Revert "Merge branch 'ticket/2.6.x/5605' of git://github.com/stschulte/puppet into 2.6.next" +25926d1 (#6723) Fix withenv environment restoration bug +093f162 (#6689) Remove extraneous include of Puppet::Util in InventoryActiveRecord +4c19299 Remove extra trailing whitespace from lib/puppet/resource.rb +ff9e242 (#5428) More fully "stub" Puppet::Resource::Reference for use with storedconfigs +0262633 (#6707) Fix typo in rest_authconfig.rb +8858e40 (#6689) Make inventory_active_record terminus search quickly +285c4cc (#5392) Give a better error when realizing a non-existant resource +cd5deda (#2645) Adding a less-stubby test to verify the "system" attribute's behavior +531e258 maint: Remove serialization of InventoryFact values +3489412 maint: Rename InventoryHost to InventoryNode +4bd5493 Fixed #2645 - Added support for creating system users +a3f2357 maint: Remove spec run noise +7764412 maint:Refactor of mount provider integration tests +880d0c6 (#6338) Support searching on metadata in InventoryActiveRecord terminus +f836366 (#6338) Implement search for InventoryActiveRecord facts terminus +8ce30c8 (#6338) Add an InventoryActiveRecord terminus for Facts +1ef83cb Added integration tests for the mount provider +64440e5 (#6513) Propagate the environment when doing variable lookup in settings +92dffb2 (#6513) Adjust P::U::Settings test name to reflect what it tests +5ef1031 (#6632) Adding a new mount no longer causes error with umount +bd5517d Adjust Darwin mount provider tests to pass on Linux +9d2fceb Maint: Begin adding integration tests for the mount provider +23d1c03 Maint: Added the ability to replace the behavior of Puppet::Util.execute with an arbitrary code block for ease in spec testing. +455a891 (#5794) create reports directory when creating host specific directory +1b1e803 (5724) Prep for deprecation of DESTDIR +f4a0af1 Refactoring duplicate code and logic in prep for DESTDIR deprecation. +7a00d6b (#6606) Inline docs: Document all autorequire relationships +e3aec14 (#5148) Fix failing spec due to timezone +8bd80a9 (#5148) Add support for PSON to facts +c3baa28 (#6338) Remove inventory indirection, and move to facts indirection +6c53eb3 (#6445) Fix inline docs: puppet agent does not accept --mkusers +4e29f43 (#6541) maint: whitespace cleanup on the file integration spec +b907ba3 (#6541) Fix content with checksum truncation bug +422399b (#5466) Write specs for output of puppet resource +8cc390c (#5466) Monkey patch Symbol so that you can sort them +24eacb7 (#5466) Fixed puppet resource bug with trailing , +743e039 (#4922) Don't truncate remotely-sourced files on 404 +bb69011 (#6338) Remove unused version control tags +e2a5085 Maint: Align tabs in a code block in the Augeas type. +65a5496 (#6509) Inline docs: Fix erroneous code block in directoryservice provider for computer type +ea9f1f0 Maint: Rewrite comments about symlinks to reflect best practice. +94f8ead (#6509) Inline docs: Fix broken lists in Launchd provider. +c80a77d (#6509) Inline docs: Fix broken code blocks in zpool type +27863c3 (#6509) Inline docs: Fix code blocks in service type. +f4034f7 (#6509) Inline docs: fix broken code blocks in schedule.rb. +6f6c4b5 (#6509) Inline docs: Fix broken code block in file type (content attribute) +a949a83 Revert "(#6309) Ensure the correct device is mounted when managing mounts" +23a510a (#4914) Improved stubbing in mount/parsed_spec tests. +ac2262d (#3999) Allow disabling of default SELinux context detection for files +23eb77d (#6322) --noop should not suppress error codes +439115e (#6499) Make puppet respond identically to -h and --help +23b7119 Maint: Add an assertion mechanism to Puppet +e3dfe41 (#6418) Recursive files shouldn't be audited +0e9858f (#6407) Fix spec test hang with Mocha >= 0.9.11 in zlib testing +309b932 (#5552) Display help when no subcommand is given. +de6a205 (#5552) Clean up subcommand handling inside puppet cert. +bb31c3d (#6376) Add test case for facts find request +2ecf913 Revert "(#5935) Allow functions to accept negated values" +c57c508 (#4914) Improved parsed_spec for mount +ec33a09 (#4914) Remove mount specs +e854205 Remove pending tests from parsed mount provider +6cb365a (#6309) Ensure the correct device is mounted when managing mounts +d1f1858 (#6376) Add support and testing for _search GET requests +3b41d44 Clean up whitespace, and commented out code in parsed mount provider +a7cebf8 (#6337) Fix Ruby warning on 1.8.6 about "future compatibility" +8a48560 (#5150) Make fact REST terminus configurable to connect to inventory service +e6870f6 (#5166) Inventory service is now searchable by timestamp. +2d2f9ab Maint: backport timestamp accessor for facts from 2.7 branch +fa0ed63 Refactored Puppet::Node::Inventory::Yaml tests in preparation for adding freshness check +67f24e4 Refactor Puppet::Node::Inventory::Yaml in preparation for adding freshness +23fc4db (#5132) Provide a query REST interface for inventory +e3c59df (#5935) Allow functions to accept negated values +7cb884e (#6346) Move the trap calls onto Signal so they're easier to stub +b5bae9f (#6331) Remove final special :trac: link from the file content property +4d25d90 (#6331) Inline documentation: Fix rotted links pointing at the Trac wiki +b25d9e4 maint: make rspec exit with status 1 when there are failures +5c26f68 (#5516) Rebuild parser.rb after merge. +e512e3e (#5977) fix spec test failure when new applications are introduced. +b5b5923 misc: ast_context has two arguments, not one. +414e3a5 Fix #5516 - Hashes can't be used in selectors +c373b62 Fix #6269 - Hashes only work with two levels of access +9090507 Fix #6267 - puppetdoc embedded links to puppet entities are not hyperlinked +b4a171e Fix #5720 - puppetdoc misses some class comments +cfa0c32 Fix #6281 - Make sure puppetdoc analyzes all files +48bc7d0 Fix #6280 - puppetdoc crashing on string interpolation +0b7faa6 (#6270) Fix formatting in split function's doc string +637e139 (#6270) Fix formatting in regsubst function's doc string +e9ee621 (6130) Change header level on metaparameter reference +d6e4ffe (#4914) Specs for mounted? match new behaviour +f534470 (#4914) Add specs for modified mount provider +b753038 (#4914) Add specs for modified mount type +9f40608 (#4914) Update property blocks +fd111f2 (#4914) Query property_hash for mountstate +2884660 (#4914) Prefetch mountstate +ade951a (#4914) Join lines for better readability +8b98526 (#5662) Fixed tests that didnt stub key_attributes +02b3111 (#5605) Prefetch doesnt work with composite keys +2a0c970 (#5662) Parsedfile doesnt work with mult keyattr +35dd070 (#5661) Creating types dont work with >1 namevar + +2.6.6 +===== d24e32a Update CHANGELOG and version for 2.6.6rc1 7c2a980 (#6541) Fix content with checksum truncation bug 63e911f (#6418) Recursive files shouldn't be audited diff --git a/lib/puppet.rb b/lib/puppet.rb index b13e06b9d..ef5fb7f06 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -24,7 +24,7 @@ require 'puppet/util/run_mode' # it's also a place to find top-level commands like 'debug' module Puppet - PUPPETVERSION = '2.6.6' + PUPPETVERSION = '2.6.7' def Puppet.version PUPPETVERSION -- cgit From f4401d34c106654d8af1f774d0b0bba27c5d4445 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Wed, 16 Mar 2011 14:25:10 -0700 Subject: (#6722) load all functions before testing... We historically had a state-dependency across tests in the parser function support area; the first test caused the function to be loaded, and other tests would then fail as a consequence of that. We now autoload all functions at the top of each test suite, allowing us to correctly and sensibly test on them as we should. This theoretically prevents us from testing the autoloader implicitly in these tests, but that should be tested independently. Paired-With: Nick Lewis --- spec/unit/parser/functions/defined_spec.rb | 3 +++ spec/unit/parser/functions/extlookup_spec.rb | 5 +++-- spec/unit/parser/functions/fqdn_rand_spec.rb | 3 +++ spec/unit/parser/functions/generate_spec.rb | 3 +++ spec/unit/parser/functions/include_spec.rb | 3 +++ spec/unit/parser/functions/inline_template_spec.rb | 5 ++++- spec/unit/parser/functions/realize_spec.rb | 3 +++ spec/unit/parser/functions/regsubst_spec.rb | 3 +++ spec/unit/parser/functions/require_spec.rb | 3 +++ spec/unit/parser/functions/shellquote_spec.rb | 3 +++ spec/unit/parser/functions/split_spec.rb | 3 +++ spec/unit/parser/functions/sprintf_spec.rb | 3 +++ spec/unit/parser/functions/tag_spec.rb | 3 +++ spec/unit/parser/functions/template_spec.rb | 5 ++++- spec/unit/parser/functions/versioncmp_spec.rb | 3 +++ 15 files changed, 47 insertions(+), 4 deletions(-) mode change 100644 => 100755 spec/unit/parser/functions/fqdn_rand_spec.rb mode change 100644 => 100755 spec/unit/parser/functions/include_spec.rb diff --git a/spec/unit/parser/functions/defined_spec.rb b/spec/unit/parser/functions/defined_spec.rb index 0dd1dadb8..0113c3233 100755 --- a/spec/unit/parser/functions/defined_spec.rb +++ b/spec/unit/parser/functions/defined_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the 'defined' function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do Puppet::Node::Environment.stubs(:current).returns(nil) diff --git a/spec/unit/parser/functions/extlookup_spec.rb b/spec/unit/parser/functions/extlookup_spec.rb index a476dc844..46cd3cc27 100755 --- a/spec/unit/parser/functions/extlookup_spec.rb +++ b/spec/unit/parser/functions/extlookup_spec.rb @@ -4,12 +4,13 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'tempfile' describe "the extlookup function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new - @scope.stubs(:environment).returns(Puppet::Node::Environment.new('production')) - Puppet::Parser::Functions.function("extlookup") end it "should exist" do diff --git a/spec/unit/parser/functions/fqdn_rand_spec.rb b/spec/unit/parser/functions/fqdn_rand_spec.rb old mode 100644 new mode 100755 index 151ebac9a..be2e6fa76 --- a/spec/unit/parser/functions/fqdn_rand_spec.rb +++ b/spec/unit/parser/functions/fqdn_rand_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the fqdn_rand function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/generate_spec.rb b/spec/unit/parser/functions/generate_spec.rb index 12f454210..d25015b56 100755 --- a/spec/unit/parser/functions/generate_spec.rb +++ b/spec/unit/parser/functions/generate_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the generate function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/include_spec.rb b/spec/unit/parser/functions/include_spec.rb old mode 100644 new mode 100755 index 67227e7d9..cfaadfbb6 --- a/spec/unit/parser/functions/include_spec.rb +++ b/spec/unit/parser/functions/include_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the 'include' function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do Puppet::Node::Environment.stubs(:current).returns(nil) diff --git a/spec/unit/parser/functions/inline_template_spec.rb b/spec/unit/parser/functions/inline_template_spec.rb index 36d53778d..712c68c69 100755 --- a/spec/unit/parser/functions/inline_template_spec.rb +++ b/spec/unit/parser/functions/inline_template_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the inline_template function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new @@ -56,4 +59,4 @@ describe "the inline_template function" do lambda { @scope.function_inline_template("1") }.should raise_error(Puppet::ParseError) end -end \ No newline at end of file +end diff --git a/spec/unit/parser/functions/realize_spec.rb b/spec/unit/parser/functions/realize_spec.rb index 899f69b01..3106c42b6 100755 --- a/spec/unit/parser/functions/realize_spec.rb +++ b/spec/unit/parser/functions/realize_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the realize function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @collector = stub_everything 'collector' diff --git a/spec/unit/parser/functions/regsubst_spec.rb b/spec/unit/parser/functions/regsubst_spec.rb index 09aa92d28..1fb8e410c 100755 --- a/spec/unit/parser/functions/regsubst_spec.rb +++ b/spec/unit/parser/functions/regsubst_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the regsubst function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/require_spec.rb b/spec/unit/parser/functions/require_spec.rb index 4afbd5a63..edcbc4ae6 100755 --- a/spec/unit/parser/functions/require_spec.rb +++ b/spec/unit/parser/functions/require_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the require function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @catalog = stub 'catalog' diff --git a/spec/unit/parser/functions/shellquote_spec.rb b/spec/unit/parser/functions/shellquote_spec.rb index c8b0d650d..55302b97b 100755 --- a/spec/unit/parser/functions/shellquote_spec.rb +++ b/spec/unit/parser/functions/shellquote_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the shellquote function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/split_spec.rb b/spec/unit/parser/functions/split_spec.rb index 39710003b..b892a5c2a 100755 --- a/spec/unit/parser/functions/split_spec.rb +++ b/spec/unit/parser/functions/split_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the split function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/sprintf_spec.rb b/spec/unit/parser/functions/sprintf_spec.rb index 4f29012b3..69fbb5e97 100755 --- a/spec/unit/parser/functions/sprintf_spec.rb +++ b/spec/unit/parser/functions/sprintf_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the sprintf function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/tag_spec.rb b/spec/unit/parser/functions/tag_spec.rb index e9b5122c7..b6bb45252 100755 --- a/spec/unit/parser/functions/tag_spec.rb +++ b/spec/unit/parser/functions/tag_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the 'tag' function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/template_spec.rb b/spec/unit/parser/functions/template_spec.rb index 9dd5cc947..7eaf3554d 100755 --- a/spec/unit/parser/functions/template_spec.rb +++ b/spec/unit/parser/functions/template_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the template function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new @@ -59,4 +62,4 @@ describe "the template function" do lambda { @scope.function_template("1") }.should raise_error(Puppet::ParseError) end -end \ No newline at end of file +end diff --git a/spec/unit/parser/functions/versioncmp_spec.rb b/spec/unit/parser/functions/versioncmp_spec.rb index 2bc7be801..ddc79cd85 100755 --- a/spec/unit/parser/functions/versioncmp_spec.rb +++ b/spec/unit/parser/functions/versioncmp_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the versioncmp function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new -- cgit