On Fri, May 20, 2011 at 07:00:38PM +0200, Florent Paillot wrote:
> Hi all, 
> 
> 
> I try to code a Puppet type that act like this : 
> 
> class1 { 
> 
> mytype { "a name": 
> command => "command = YY" 
> } 
> } 
> 
> class2 { 
> 
> mytype { "a name": 
> command => "command = XX", 
> } 
> } 
> 

You specify two resources here with the same title. That is not allowed.
What does the title mean here? What does the command property/parameter
means here? Why dont you write

  command => 'XX' instead off command => 'command = XX'?
> 
> 
> On the client, it generate a file : 
> 
> myfile.cfg 
> ------------- 
> 
> 
> command = YY 
> command = XX 

I guess one resource should match one »command = « line (like a host
resource describes one entry in /etc/hosts) right? How should puppet
know which line in myfile.cfg is the resource you're describing in your
manifest?


> 
> I want to purge "myfile.cfg" at each run ( I don't want to use someting like 
> ensure => absent to remove old stuff) 
> I don't know where to put the code to delete the file and maintain a state 
> variable to avoid the deletion for each call of the type. 
> 
> Should I use prefetch and flush method ? 
> If someone is able to code the provider, he will have my eternal gratitude :) 
> 

You can use the parsedfile provider. It supports prefetching an the
instances method. This way you can also purge lines with the resources
type:

    resources { 'mytype':
      purge => true,
    }

But I guess you have to provide more info about your type to really be
able to help you here.
> 
> 
> Thanks for your help. 
> Long live Puppet ! 
> 
> 
> 
> 
> -- 
> 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.
> 

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