On Friday, June 27, 2014 3:45:49 AM UTC-5, Andreas Schuster wrote:
>
> Hi all,
>
>  
>
> i have written a own resource type to manage Interfaces, ipaddresses and 
> mor on Solaris systems.
>
> I also enabled purging for the ipaddress resources to destroy no longer 
> included ipaddresses in a catalogue for a system.
>
> All works fine and without problems.
>
> But in some rare situations, he wants to create a Ipinterface with a 
> Ipaddress before he destroys an other, not in catalogue included ipaddress.
>
> Is there a option to configure that he first  always destroys resources 
> that not included in the catalogue?
>
>  
>
> Example:
>
> Ip configure on Interface: e1000g1/v4
>
> Ip in catalogue on Interface: ipmp1/v4
>
> During first Puppet run i got this error:
>
> Error: 
> /Stage[network]/Network::Solaris::Ip_address/Network::Solaris::Def_ipaddress[ipmp1/v4]/Ipaddress[ipmp1/v4]/ensure:
>  
> change from absent to present failed: ip='1.2.3.4' already exists!
>
> Notice: /Ipaddress[e1000g1/v4]/ensure: removed
>
> As you coold see, he tries first to create and then a destroy on the other 
> resource.
> Now i need a second puppet run to create failed resources. :-(
>
>  
> Any idea how to implement such ordering: destroy before create?
>
> Is it true, that Puppet execute Reources of the same resorce type 
> sequential?
>
>

I suppose you are using the Resources meta-resource type to perform your 
purging.  I think you can achieve what you're after by setting up 
appropriate relationships between that meta-resource and your Ipaddress 
resources, either via the 'require' and/or 'before' metaparameters, or via 
the chain operators.  I'd probably try declaring the resource purge 
something like this:

resources { 'ipaddress': purge => true }
  -> Ipaddress<| |>

If for some reason you need to separate declaration of the Resources 
resource from declaration of the relationships, then you could instead put 
this almost anywhere:

Resources['ipaddress'] -> Ipaddress<| |>

You could also make each Ipaddress declaration 'require' 
Resources['ipaddress'], but that's a little lumpier.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/101ff72b-2537-4b9a-900f-245dcf35f29f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to