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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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