Hi Stefan,

Le 21/05/2011 14:42, Stefan Schulte a écrit :
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


"a name" is an example, i would use a title like "check_load".


   command =>  'XX' instead off command =>  'command = XX'?
Yes, it's a good idea.
But I think that i'ts better too keep 'command = XX' because puppet could search this pattern in the myfile.cfg (for the "exists?" method)


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.

My goal is to manage a nrpe_command.cfg :

npre_commands.cfg:
------------------------------

command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_raid]=/usr/lib64/nagios/plugins/check_megaraid_sas



In my manifest, I would like to use this kind of config :

class nagios::client::base {

    @@nagios_service { "check_load":
        use => "generic-service",
        check_command => "check_nrpe_1arg!check_load",
        service_description => "Check Load",
        host_name => "$fqdn",
    }

    nrpecmd { "check_load_client":
command => "command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20"
    }

}


Florent


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