Sven Mueller wrote:

I really hate replying to myself when i don't actually have anything to
add. But I'm still at a loss about the solution to the problems below.
Can't anyone help?

Regards,
Sven

> I tried writing a type to handle a cobbler repository (because it is the
> first thing cobbler wants to see if you start to define a system).
> However, I have two problems:
> 
> 1) (this is a theoretical question for now)
> 
> If I understand types (for now without providers) correctly, if I have a
> property ensure, it needs a "def retrieve" which returns the current
> state of the resource. These returned states should match the "newvalue"
> definitions I provide in the source. So if I have
> 
> newvalue :present
> newvalue :absent
> newvalue :insync
> 
> with accompanying code, the following should work for retrieve:
> 
> def retrieve
>  ret=`cobbler repo list | \
>       grep -qE '(^|[[:space:]])#{resource[:name]}([[:space:]]|$)';\
>       echo $?`
>  if ( not ret == 0)
>     :absent
>  else
>    if insync?
>      :insync
>    else
>      :present
>    end
>  end
> end
> 
> (As long as I have a working insync? definition)
> Is this correct so far? If I defined insync? inside the same newproperty
> (:ensure in this case), should I access it as done above, or should I
> use "self.insync?" or something else?
> 
> 2)
> I defined retrieve as listed above (full source of the cobbler_repo.rb
> is at http://mail.incase.de/cobbler_repo.rb, it surely isn't the best
> code I ever wrote, but I can't see why it shouldn't work) and I get:
> 
> Tue Oct 07 15:14:02 +0200 2008
> //Node[testinst01]/cobbler/Cobbler_repo[CentOS5_i386] (err): Failed to
> retrieve current state of resource: wrong number of arguments (1 for 0)
> 
> 
> Any hint what I did wrong? What passes one argument to which
> function/method and what do I have to do to resolve this. I'm really at
> a loss here.
> 
> regards,
> Sven


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

Reply via email to