HI Stefan,

I modified and merged your ports code with the latest version of my patch
(which has changed a little from yesterday) comments below:

It could be that I fixed you use cases with some of my changes this morning.

I have still identified that this is causing other things in puppet (namely
puppet resouce) to break, I am still looking into those.

https://github.com/bodepd/puppet/tree/mastercompositenamevar

On Mon, May 23, 2011 at 2:25 PM, Stefan Schulte <
[email protected]> wrote:

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

b/c of the title_pattern matching, it is not possible for :path to be empty:

         /^(.*)$/,
         [
           [ :path, lambda{|x| x} ]
         ]



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

how could this test ever happen in the real world?



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

not sure I follow


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

this works for me


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

this worked for my tests



>
> -Stefan
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to