On Jan 24, 2013, at 8:10 AM, Gavin Williams <[email protected]> wrote:
> Afternoon all
>
> Firstly, apologies for posting this directly to the Puppet-dev group, however
> I thought I'd probably get a better response here versus the Puppet-users
> group...
>
> I'm trying to get my head around Parsedfile providers in Puppet.
> The intention is create a new type/provider for processing the oranfstab
> file, in a similar manner to oratab. I've been having a look at the crontab
> provider, trying to digest how it functions, as the oranfstab is a fair
> amount more complex than the standard oratab file...
>
> I've stuck the first stab of my code here.
>
> The type works fine if I run it just with a name:
> $ sudo puppet apply -e 'oranfstab { DBTEST01: ensure => present, }'
> /Stage[main]//Oranfstab[DBTEST01]/ensure: created
> Finished catalog run in 0.23 seconds
>
> $ sudo cat /etc/oranfstab
> # HEADER: This file was autogenerated at Thu Jan 24 16:04:53 +0000 2013 by
> puppet.
> # HEADER: While it can still be managed manually, it is definitely not
> recommended.
> # HEADER: Note particularly that the comments starting with '#' should
> # HEADER: not be deleted, as doing so could cause duplicate database entries.
> # Instance: DBTEST01
>
> However if I try and add the nfsserver option, it fails as follows:
> $ sudo puppet apply -e 'oranfstab { DBTEST01: ensure => present, nfsserver =>
> 'act-star-nactl01' }'
> /Stage[main]//Oranfstab[DBTEST01]/ensure: created
> Error: /Stage[main]//Oranfstab[DBTEST01]: Could not evaluate: undefined local
> variable or method `nfsserver' for
> #<Puppet::Util::FileParsing::FileRecord:0x7f0659233870>
> Finished catalog run in 0.23 seconds
>
> What I'm struggling to get my head around is how should the nfsserver method
> be setup in the parsed.rb???
> Looking at the crontab type/provider, there are several properties in the
> type that don't have a corresponding method in the provider... :environment
> for example...
>
> Any ideas/pointers?
Hi Gavin,
The short answer is that I recommend doing your best not to see the cron
provider as a good example of anything. It's always been less stable than I
would like, and it's just a bit painful overall.
Cron is especially painful because cron records aren't necessarily unique, they
don't have a name-like field, and every single field except command is
optional, but if they're not filled in they get a '*'. Hopefully your file
isn't like that.
What is the actual format you're trying to generate?
The first problem, though, is that you don't have a record_line call in your
tab. Look at the oratab provider - it has a single record_line call that
defines what a single line's record looks like. You should generally not use
text_line for anything other than something you want to duplicate exactly in a
file. The cron provider treats environment specially, even though it's a
text_line, because, again, the cron format absolutely sucks.
Try adding a record_line and see where that gets you.
--
Luke Kanies | http://about.me/lak | http://puppetlabs.com/ | +1-615-594-8199
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.