On Mon, May 23, 2011 at 11:45:45AM -0700, Dan Bode wrote:
> This is an experimental set of patches that I wrote for composite namevars 
> to work with parsedfile and to support purging.
> 
> This is not ready to be merged, I would just like to get some input on the 
> following:
>   - does this work (for people who have pending composite namevar work)
>   - will this break anything? although it has passed the unit test,
>     it touches Puppet in scary places that I mostly, but do not fully 
>     understand
>   - is the design agreeable enough for everyone?
> 

I applied your patches to my port type and implemented the namevar_join
method:

    def self.namevar_join(hash)
      "#{hash[:name]}/#{hash[:protocol]}"
    end

two comments:

1) resource[:name] seems to never be empty
I have the following validate method in my type:

    validate do
      unless @parameters[:name] and @parameters[:protocol]
        raise Puppet::Error, "Attributes 'name' and 'protocol' are mandatory"
      end
    end

But the error is never raised when name is not set
    proc{ @class.new(:protocol => :tcp) }.should raise_error(Puppet::Error)

The name is just an empty string now. I havent looked into it but you
may generate a title from the namevars (:title => '/tcp') and then use
title_patterns to generate the name from the title again?

2) puppet resource doesnt work
The integration tests pass now (so prefetching seems to work) and I also
did a few tests with the following sample manifest (setting one resource
to absent and one to present, changing portnumbers etc)

    port { 'foo/tcp':
      number => 10000,
      ensure => absent,
    }
    port { 'foo/udp':
      number => 11000,
      ensure => present,
    }

However »puppet resource mount port« does currently NOT work

# puppet resource port|grep telnet
warning: Port telnet found in both parsed and parsed; skipping the parsed 
version
warning: Port rtelnet found in both parsed and parsed; skipping the parsed 
version
warning: Port telnets found in both parsed and parsed; skipping the parsed 
version
warning: Port ktelnet found in both parsed and parsed; skipping the parsed 
version
port { 'ktelnet/tcp':
  description => 'remote login a la telnet',
port { 'rtelnet/tcp':
port { 'telnet/tcp':
port { 'telnets/tcp':
  description => 'telnet protocol over TLS/SSL',

expected output: same number of resources with udp as protocol

-Stefan

Attachment: pgpz97tZVydkt.pgp
Description: PGP signature

Reply via email to