On Thursday, October 6, 2016 at 9:03:26 AM UTC-5, Prunk Dump wrote:
>
>
> Can you help me on a more simpler and concrete example ?  
>
> 1) My apt::client class have a defined type :
>
>

Your apt::client class does not *have* such a defined type.  Even if the 
type's definition appears lexically within the class's (which it ought not 
to do), that does not imply any meaningful ownership or scope.

 

> define apt::client::source
>
> that allow to add sources to /etc/apt/sources.list.d. As an "apt-get 
> update" is needed after adding sources, all the resources defined in my 
> apt::client::source type :
> => require Class['apt::client::audit'] (that check if there are not 
> pending install)
> => notify Class['apt::client::update'] (that run apt-get update)
> There as no more dependencies. And the two class (  apt::client::audit and 
> apt::client::update ) are contained in the apt::client class.
>
> 2) Now I want to build a "wine" class that install wine from "backports".
>
> => the wine class require that apt is ready to install packages so 
> naturally wine class need to be run after the apt::client class.
>
> => But wine also need that the backports sources are added to 
> sources.list. So in the the wine::install class manifest I declare a 
> apt::client::source(...backports sources...) that is required by the 
> Package['wine'] resource.
>
> 3) Finally I got a dependency cycle :
>
> apt::client::update => wine::install  (because apt need to be ready)
> wine::install => apt::client::source(...backports sources...)  (because 
> the resource is declared inside the wine class and required by 
> Package['wine'])
> apt::client::source(...backports sources...) => apt::client::update (as 
> the source need to be added before apt-get update)
>
> You can say to me that I can create a specific 
> apt::client::backports_source class and include it instead of declaring it. 
> But I have many other modules that need many other specific sources.
>
> You can say that I can put the apt::client::source(...backports 
> sources...) in the apt module. But I don't want that this sources be added 
> on node that don't have wine.
>
> I there a way to achieve what I want with puppet ? Maybe with class 
> parameters ?
>

 
The cycle you describe occurs because your relationships are too 
coarse-grained.  It's not *all* of class wine::install that must be applied 
after apt::client::update, nor all of it that must be applied before 
apt::client::update.  You have one part that must be applied after, one 
part that must be applied before, and maybe a part that can be applied 
either before or after.  To resolve that situation you need to split the 
class into at least two classes, and apply the relationships with each one 
that are appropriate for it.


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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/59a532fb-bb93-478b-9a7a-b84b6bdf7648%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to