Benoit BARTHELEMY
2013-Jan-24 08:16 UTC
[Puppet Users] Dependency Cycle with puppetlabs-mrepo
Hi, I''m gettinng a dependency cycle when using PE 2.7, puppetlabs::mrepo, "role classes" and hiera : I''m trying to mirror RHN repos : # ROLE CLASS> class site::yum_repository{ > > $repos = hiera(''site::yum_repository::repos'') > create_resources(mrepo::repo::rhn, $repos) > } ># HIERA DEFAULTS> mrepo::params::src_root : ''/srv/mrepo'' > mrepo::params::www_root : ''/srv/www/mrepo'' > mrepo::params::user : ''apache'' > mrepo::params::group : ''apache'' > mrepo::params::mailto : ''UNSET'' > mrepo::params::source : ''package'' > mrepo::params::selinux : false > mrepo::params::rhn : true > mrepo::params::rhn_username: ''user'' > mrepo::params::rhn_password: ''pass'' ># NODE-SPECIFIC HIERA VALUES> mrepo::params::src_root : ''/srv/mrepo'' > mrepo::params::www_root : ''/srv/www/mrepo'' > mrepo::params::user : ''apache'' > mrepo::params::group : ''apache'' > mrepo::params::source : ''package'' > mrepo::params::rhn : true > mrepo::params::rhn_username: ''mytrueaccount'' > mrepo::params::rhn_password: ''mytruepassword'' > mrepo::params::selinux : false > > # Repositories yumrepo > site::yum_repository::repos: > "rhel6-x86_64": > ensure : present > update : ''now'' > arch : ''x86_64'' > release : ''6'' > rhnrelease : ''6Server'' > repotitle : ''RHEL 6.3 64 Bits'' > urls : > rhn-tools : ''rhns:///rhn-tools-rhel-$arch-server-6''And I use the dashboard as an ENC to attach the site::yum_repository class to the node puppet-node. When I''m trying to run a *puppet agent --test* I got the following output : *err: Could not apply complete catalog: Found 1 dependency cycle:* *(File[/srv/www/mrepo] => File[10-mrepo.conf] => Service[httpd] => Class[Apache] => File[/srv/www/mrepo])* *Cycle graph written to /var/opt/lib/pe-puppet/state/graphs/cycles.dot.* Any lead on what''s wrong in my manifests or on how to debug the dependency cycle ? Thanks for your help, Benoit BARTHELEMY -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/zOj3_eIidJIJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Benoit BARTHELEMY
2013-Jan-24 10:08 UTC
[Puppet Users] Re: Dependency Cycle with puppetlabs-mrepo
Correction, the class is the following : class site::yum_repository{ class{''mrepo::params'': src_root => hiera(''mrepo::params::src_root''), www_root => hiera(''mrepo::params::www_root''), user => hiera(''mrepo::params::user''), group => hiera(''mrepo::params::group''), source => hiera(''mrepo::params::source''), selinux => hiera(''mrepo::params::selinux''), rhn => hiera(''mrepo::params::rhn''), rhn_username => hiera(''mrepo::params::rhn_username''), rhn_password => hiera(''mrepo::params::rhn_password''), mailto => hiera(''mrepo::params::mailto'') } $repos = hiera(''site::yum_repository::repos'') create_resources(mrepo::repo::rhn, $repos) } -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/vrGcE6x5VJsJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
jcbollinger
2013-Jan-24 15:34 UTC
[Puppet Users] Re: Dependency Cycle with puppetlabs-mrepo
On Thursday, January 24, 2013 4:08:21 AM UTC-6, Benoit BARTHELEMY wrote:> > Correction, the class is the following : > > class site::yum_repository{ > > class{''mrepo::params'': > src_root => hiera(''mrepo::params::src_root''), > www_root => hiera(''mrepo::params::www_root''), > user => hiera(''mrepo::params::user''), > group => hiera(''mrepo::params::group''), > source => hiera(''mrepo::params::source''), > selinux => hiera(''mrepo::params::selinux''), > rhn => hiera(''mrepo::params::rhn''), > rhn_username => hiera(''mrepo::params::rhn_username''), > rhn_password => hiera(''mrepo::params::rhn_password''), > mailto => hiera(''mrepo::params::mailto'') > } >Never, ever do that. It''s awful. You''ve gone to all the trouble hierify your class parameters, and then thrown away the biggest advantages of doing so. If you''re going to rely on hiera for class parameters (a good thing) then declare that class via the ''include'' function: include ''mrepo::params'' The advantages go far beyond brevity, but I''ll leave the rest for some other post.> $repos = hiera(''site::yum_repository::repos'') > create_resources(mrepo::repo::rhn, $repos) > } > >The cycle is not (directly) in the manifests and data you presented. It appears to be a problem in the mrepo module, whether in defined type mrepo::repo::rhn or some other component used by that definition. I find this step of the dependency cycle particularly suspect: Service[httpd] => Class[Apache]. Supposing that Class[apache] manages installing and configuring the apache server, one would normally expect to require it to be applied *before* Service[httpd], not after. Supposing that Class[apache] provides for the parent directory of File[/srv/mrepo], and that it, in turn, is the parent directory of File[ 10-mrepo.conf], the relationships should probably be like this instead (expressed via Puppet chaining operators): Class[Apache] -> File[/srv/www/mrepo] -> File[10-mrepo.conf] ~> Service[httpd] Class[Apache] ~> Service[httpd] Except as discussed above, that''s consistent with the relationships Puppet reports, and it does not contain a cycle. The second chain is not (wholly) redundant. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/4AhYYAwHtwkJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Adrien Thebo
2013-Jan-24 21:48 UTC
[Puppet Users] Re: Dependency Cycle with puppetlabs-mrepo
Hi Benoit, I''m the author of the puppetlabs-mrepo module, what version of this module are you using? On Thursday, January 24, 2013 12:16:05 AM UTC-8, Benoit BARTHELEMY wrote:> > Hi, I''m gettinng a dependency cycle when using PE 2.7, puppetlabs::mrepo, > "role classes" and hiera : > > I''m trying to mirror RHN repos : > > # ROLE CLASS > >> class site::yum_repository{ >> >> $repos = hiera(''site::yum_repository::repos'') >> create_resources(mrepo::repo::rhn, $repos) >> } >> > > # HIERA DEFAULTS > >> mrepo::params::src_root : ''/srv/mrepo'' >> mrepo::params::www_root : ''/srv/www/mrepo'' >> mrepo::params::user : ''apache'' >> mrepo::params::group : ''apache'' >> mrepo::params::mailto : ''UNSET'' >> mrepo::params::source : ''package'' >> mrepo::params::selinux : false >> mrepo::params::rhn : true >> mrepo::params::rhn_username: ''user'' >> mrepo::params::rhn_password: ''pass'' >> > > > # NODE-SPECIFIC HIERA VALUES > >> mrepo::params::src_root : ''/srv/mrepo'' >> mrepo::params::www_root : ''/srv/www/mrepo'' >> mrepo::params::user : ''apache'' >> mrepo::params::group : ''apache'' >> mrepo::params::source : ''package'' >> mrepo::params::rhn : true >> mrepo::params::rhn_username: ''mytrueaccount'' >> mrepo::params::rhn_password: ''mytruepassword'' >> mrepo::params::selinux : false >> >> # Repositories yumrepo >> site::yum_repository::repos: >> "rhel6-x86_64": >> ensure : present >> update : ''now'' >> arch : ''x86_64'' >> release : ''6'' >> rhnrelease : ''6Server'' >> repotitle : ''RHEL 6.3 64 Bits'' >> urls : >> rhn-tools : ''rhns:///rhn-tools-rhel-$arch-server-6'' > > > And I use the dashboard as an ENC to attach the site::yum_repository > class to the node puppet-node. > > When I''m trying to run a *puppet agent --test* I got the following output > : > > *err: Could not apply complete catalog: Found 1 dependency cycle:* > *(File[/srv/www/mrepo] => File[10-mrepo.conf] => Service[httpd] => > Class[Apache] => File[/srv/www/mrepo])* > *Cycle graph written to /var/opt/lib/pe-puppet/state/graphs/cycles.dot.* > > Any lead on what''s wrong in my manifests or on how to debug the dependency > cycle ? > > Thanks for your help, > > Benoit BARTHELEMY >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/eKBUDkPN-90J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Benoit BARTHELEMY
2013-Jan-25 08:31 UTC
[Puppet Users] Re: Dependency Cycle with puppetlabs-mrepo
Hi Adrien, I''m using the version of the puppet forge (1.1.0), I''ve had most difficulties to make it work on RHEL 6 to mirror RHN repos... - There is a test in manifest/rhn.pp that evaluates if the server is Centos to create missing ressources, in fact those values are absent from RHEL6 as well. - The server is behind a proxy, it''s not supported in the current forge module (had to hack the Exec ressource in manifest/repo/rhn to add environment variable http_proxy). - If the /var/log/up2date file is not writable (it''s not managed by , the module tries to write it''s log in /root/up2date. - I think I''ve managed to find where the cycle is : manifest/webservice.pp => the docroot require Apache, the apache::vhost require the docroot and trigger an Apache refresh... All on the same stage : Class[''apache''] -> File[''$docroot''] -> Apache::Vhost[''mrepo''] ~> Service[''Apache''] = cycle (as Class[''apache''] -> Service[''Apache'']. I''ve removed the dependency Class[''apache''] -> File[''$docroot'']. - Finally I''ve added this to site::yum_repository : Class[''apache''] -> Class[''mrepo::params''] -> Mrepo::Repo::Rhn<||> I''ve not found any new version on github so I may have used the module incorrectly... Regards, Benoit BARTHELEMY ( Le jeudi 24 janvier 2013 22:48:26 UTC+1, Adrien Thebo a écrit :> > Hi Benoit, > > I''m the author of the puppetlabs-mrepo module, what version of this module > are you using? > > On Thursday, January 24, 2013 12:16:05 AM UTC-8, Benoit BARTHELEMY wrote: >> >> Hi, I''m gettinng a dependency cycle when using PE 2.7, puppetlabs::mrepo, >> "role classes" and hiera : >> >> I''m trying to mirror RHN repos : >> >> # ROLE CLASS >> >>> class site::yum_repository{ >>> >>> $repos = hiera(''site::yum_repository::repos'') >>> create_resources(mrepo::repo::rhn, $repos) >>> } >>> >> >> # HIERA DEFAULTS >> >>> mrepo::params::src_root : ''/srv/mrepo'' >>> mrepo::params::www_root : ''/srv/www/mrepo'' >>> mrepo::params::user : ''apache'' >>> mrepo::params::group : ''apache'' >>> mrepo::params::mailto : ''UNSET'' >>> mrepo::params::source : ''package'' >>> mrepo::params::selinux : false >>> mrepo::params::rhn : true >>> mrepo::params::rhn_username: ''user'' >>> mrepo::params::rhn_password: ''pass'' >>> >> >> >> # NODE-SPECIFIC HIERA VALUES >> >>> mrepo::params::src_root : ''/srv/mrepo'' >>> mrepo::params::www_root : ''/srv/www/mrepo'' >>> mrepo::params::user : ''apache'' >>> mrepo::params::group : ''apache'' >>> mrepo::params::source : ''package'' >>> mrepo::params::rhn : true >>> mrepo::params::rhn_username: ''mytrueaccount'' >>> mrepo::params::rhn_password: ''mytruepassword'' >>> mrepo::params::selinux : false >>> >>> # Repositories yumrepo >>> site::yum_repository::repos: >>> "rhel6-x86_64": >>> ensure : present >>> update : ''now'' >>> arch : ''x86_64'' >>> release : ''6'' >>> rhnrelease : ''6Server'' >>> repotitle : ''RHEL 6.3 64 Bits'' >>> urls : >>> rhn-tools : ''rhns:///rhn-tools-rhel-$arch-server-6'' >> >> >> And I use the dashboard as an ENC to attach the site::yum_repository >> class to the node puppet-node. >> >> When I''m trying to run a *puppet agent --test* I got >> the following output : >> >> *err: Could not apply complete catalog: Found 1 dependency cycle:* >> *(File[/srv/www/mrepo] => File[10-mrepo.conf] => Service[httpd] => >> Class[Apache] => File[/srv/www/mrepo])* >> *Cycle graph written to /var/opt/lib/pe-puppet/state/graphs/cycles.dot.* >> >> Any lead on what''s wrong in my manifests or on how to debug the >> dependency cycle ? >> >> Thanks for your help, >> >> Benoit BARTHELEMY >> >-- 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 puppet-users+unsubscribe@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.