On Tue, May 24, 2011 at 12:12:20AM +0200, Stefan Schulte wrote:
> On Mon, May 23, 2011 at 02:39:40PM -0700, Dan Bode wrote:
> > :name is special (and hardcoded) in several parts of the Puppet code. Could
> > you try using some other name that :name and see if it resolves those
> > issues?
> > 
> 
> Doesnt resolve the issue. The test did pass before I applied your
> patch. Here are the modified namevar_join and title_patterns methods
> (replaced :name with :path)

I have to correct myself because I havent done the renaming everywhere:
Renaming makes everything a lot worse. I guess it's because puppet still
does a lot of lookups with resource[:name]. Now in type.rb we do the following:

    def [](name) # name = :name
      name = attr_alias(name)

      ### in validattr :name is always considered to be a valid attribute ###
      fail("Invalid parameter #{name}(#{name.inspect})") unless 
self.class.validattr?(name)

      ### This is always false because name_var returns false if we have more 
than one namevar ###
      if name == :name && nv = name_var
        name = nv
      end

      ### name is still :name because we havent found a namevar ###

      if obj = @parameters[name] ### this is nil
        # Note that if this is a property, then the value is the "should" value,
        # not the current value.
        obj.value
      else
        return nil
      end
    end

Heres a branch that includes your patches (without the renaming of the
:name parameter)

https://github.com/stschulte/puppet/tree/feature/next/5660_with_7629


Just run the following specs

# rspec -c -f d spec/unit/type/port_spec.rb
# rspec -c -f d spec/unit/provider/port/parsed_spec.rb
# rspec -c -f d spec/integration/provider/port_spec.rb
# puppet resource port

-Stefan

Attachment: pgpSwtaU5y8Iv.pgp
Description: PGP signature

Reply via email to