Using ```puppetlabs/apt``` in a puppet provisioner for vagrant. the module is installed in puppet/modules and I''m getting a strange Dependency cycle error. the code in the manifest file: # Run apt-get update when anything beneath /etc/apt/ changes #taken from https://blog.kumina.nl/2010/11/puppet-tipstricks-running-apt-get-update-only-when-needed/ exec { "apt-get update": command => "/usr/bin/apt-get update", onlyif => "/bin/sh -c ''[ ! -f /var/cache/apt/pkgcache.bin ] || /usr/bin/find /etc/apt/* -cnewer /var/cache/apt/pkgcache.bin | /bin/grep .> /dev/null''",} package { ["build-essential","apache2","git","python","python-dev","python-setuptools", "python-pip"]: ensure => present, require => Exec["apt-get update"], } class { ''apt'': } include apt apt::builddep { ["python-imaging","python-lxml"]: require => Class[''apt''] } class {''nodejs'': } include nodejs package {"less": ensure => present, provider => ''npm'', require => Package[''npm''], } I actually noticed similiar questions [here](http://stackoverflow.com/questions/13568748/dependency-cycle-with-apt-source) and [here](http://stackoverflow.com/questions/15384733/puppet-issue-with-aptsource-and-stages), but not with a satisfying answer. The error message: ←[0;37mdebug: /Stage[main]//Package[python-virtualenv]/require: requires Package [python-pip]←[0m ←[0;37mdebug: /Stage[main]//Package[python-virtualenv]/require: requires Package [python-setuptools]←[0m ←[0;37mdebug: /Stage[main]/Apt/File[configure-apt-proxy]/notify: subscribes to E xec[apt_update]←[0m ←[0;37mdebug: /Stage[main]/Apt/Anchor[apt::update]/require: requires Class[Apt:: Update]←[0m ←[0;37mdebug: /Stage[main]/Apt/File[sources.list.d]/notify: subscribes to Exec[a pt_update]←[0m ←[0;37mdebug: /Stage[main]//Package[python-pip]/require: requires Exec[apt-get u pdate]←[0m ←[0;37mdebug: /Stage[main]//Apt::Builddep[python-lxml]/Exec[apt-builddep-python- lxml]/notify: subscribes to Exec[apt_update]←[0m ←[0;37mdebug: /Stage[main]//Package[apache2]/require: requires Exec[apt-get upda te]←[0m ←[0;37mdebug: /Stage[main]//Package[python-dev]/require: requires Exec[apt-get u pdate]←[0m ←[0;37mdebug: /Stage[main]/Nodejs/Package[npm]/require: requires Anchor[nodejs:: repo]←[0m ←[0;37mdebug: /Stage[main]/Nodejs/Package[nodejs]/require: requires Anchor[nodej s::repo]←[0m ←[0;37mdebug: /Stage[main]//Package[python]/require: requires Exec[apt-get updat e]←[0m ←[0;37mdebug: /Stage[main]//Package[build-essential]/require: requires Exec[apt- get update]←[0m ←[0;37mdebug: /Stage[main]//Apt::Builddep[python-imaging]/require: requires Clas s[Apt]←[0m ←[0;37mdebug: /Stage[main]//Package[git]/require: requires Exec[apt-get update]← [0m ←[0;37mdebug: /Stage[main]//Package[less]/require: requires Package[npm]←[0m ←[0;37mdebug: /Stage[main]//Package[sphinx]/require: requires Package[python-pip ]←[0m ←[0;37mdebug: /Stage[main]//Apt::Builddep[python-imaging]/Anchor[apt::builddep:: python-imaging]/require: requires Class[Apt::Update]←[0m ←[0;37mdebug: /Stage[main]//Package[python-setuptools]/require: requires Exec[ap t-get update]←[0m ←[0;37mdebug: /Stage[main]/Apt/File[sources.list]/notify: subscribes to Exec[apt _update]←[0m ←[0;37mdebug: /Stage[main]//Apt::Builddep[python-imaging]/Exec[apt-builddep-pyth on-imaging]/notify: subscribes to Exec[apt_update]←[0m ←[0;37mdebug: /Stage[main]//Apt::Builddep[python-lxml]/Anchor[apt::builddep::pyt hon-lxml]/require: requires Class[Apt::Update]←[0m ←[0;37mdebug: /Stage[main]//Apt::Builddep[python-lxml]/require: requires Class[A pt]←[0m ←[1;35merr: Could not apply complete catalog: Found 1 dependency cycle: (Anchor[apt::update] => Class[Apt] => Apt::Builddep[python-lxml] => Exec[apt-bui lddep-python-lxml] => Exec[apt_update] => Class[Apt::Update] => Anchor[apt::upda te]) Try the ''--graph'' option and opening the resulting ''.dot'' file in OmniGraffle or GraphViz←[0m any known workaound? solution? -- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-Jul-18 21:38 UTC
[Puppet Users] Re: Puppetlabs Apt module: dependency cycle
On Thursday, July 18, 2013 3:38:25 PM UTC-5, Alon Nisser wrote:> > Using ```puppetlabs/apt``` in a puppet provisioner for vagrant. the > module is installed in puppet/modules and I''m getting a strange Dependency > cycle error. > the code in the manifest file: > > # Run apt-get update when anything beneath /etc/apt/ changes > #taken from > https://blog.kumina.nl/2010/11/puppet-tipstricks-running-apt-get-update-only-when-needed/ > exec { "apt-get update": > command => "/usr/bin/apt-get update", > onlyif => "/bin/sh -c ''[ ! -f /var/cache/apt/pkgcache.bin ] || > /usr/bin/find /etc/apt/* -cnewer /var/cache/apt/pkgcache.bin | /bin/grep . > > /dev/null''", > } > > package { > ["build-essential","apache2","git","python","python-dev","python-setuptools", > "python-pip"]: > ensure => present, > require => Exec["apt-get update"], > } > > class { ''apt'': > > } > include apt > > apt::builddep { ["python-imaging","python-lxml"]: > require => Class[''apt''] > } > > class {''nodejs'': > > } > include nodejs > > package {"less": > ensure => present, > provider => ''npm'', > require => Package[''npm''], > > } > > I actually noticed similiar questions [here]( > http://stackoverflow.com/questions/13568748/dependency-cycle-with-apt-source) > and [here]( > http://stackoverflow.com/questions/15384733/puppet-issue-with-aptsource-and-stages), > but not with a satisfying answer. > The error message: > > [...] > (Anchor[apt::update] => Class[Apt] => Apt::Builddep[python-lxml] => > Exec[apt-bui > lddep-python-lxml] => Exec[apt_update] => Class[Apt::Update] => > Anchor[apt::upda > te]) > Try the ''--graph'' option and opening the resulting ''.dot'' file in > OmniGraffle or > GraphViz←[0m > > any known workaound? solution? >You are trying too hard. This module goes to considerable effort to avoid making you declare relationships among its classes and resources. The relationships you are manually declaring run afoul of the ones declared by the module itself. In particular, it is incorrect for an apt::builddep to ''require'' Class[''apt'']. Also, the module has its own provision for running "apt-get update" when needed, so your Exec for that purpose may be superfluous. However, the Apt module will only run "apt-get update" when it modifies an Apt resource itself, so if you contemplate managing some sources via Puppet but not others (not recommended), then perhaps you do need something like that. And as a trivial matter, it is redundant to declare class ''apt'' via both the ''include'' function and a parameterized-style declaration. I think your code should instead look like this: ---- include ''apt'' package { [''build-essential'',''apache2'',''git'',''python'',''python-dev'',''python-setuptools'',''python-pip'']: ensure => present, require => Class[''apt''], } apt::builddep { [''python-imaging'',''python-lxml'']: } ---- (omitting the irrelevant ''nodejs'' and ''less'' stuff). If you were to claim that it is unintuitive that apt::builddep instances must avoid ''require''ing class ''apt'' then you would not get an argument from me. Or if you complained that these details were not well documented, then I would not object. 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Alon Nisser
2013-Jul-21 18:02 UTC
[Puppet Users] Re: Puppetlabs Apt module: dependency cycle
Thanks for the detailed answer! I''ll try that right away On Thursday, July 18, 2013 11:38:25 PM UTC+3, Alon Nisser wrote:> > Using ```puppetlabs/apt``` in a puppet provisioner for vagrant. the > module is installed in puppet/modules and I''m getting a strange Dependency > cycle error. > the code in the manifest file: > > # Run apt-get update when anything beneath /etc/apt/ changes > #taken from > https://blog.kumina.nl/2010/11/puppet-tipstricks-running-apt-get-update-only-when-needed/ > exec { "apt-get update": > command => "/usr/bin/apt-get update", > onlyif => "/bin/sh -c ''[ ! -f /var/cache/apt/pkgcache.bin ] || > /usr/bin/find /etc/apt/* -cnewer /var/cache/apt/pkgcache.bin | /bin/grep . > > /dev/null''", > } > > package { > ["build-essential","apache2","git","python","python-dev","python-setuptools", > "python-pip"]: > ensure => present, > require => Exec["apt-get update"], > } > > class { ''apt'': > > } > include apt > > apt::builddep { ["python-imaging","python-lxml"]: > require => Class[''apt''] > } > > class {''nodejs'': > > } > include nodejs > > package {"less": > ensure => present, > provider => ''npm'', > require => Package[''npm''], > > } > > I actually noticed similiar questions [here]( > http://stackoverflow.com/questions/13568748/dependency-cycle-with-apt-source) > and [here]( > http://stackoverflow.com/questions/15384733/puppet-issue-with-aptsource-and-stages), > but not with a satisfying answer. > The error message: > > ←[0;37mdebug: /Stage[main]//Package[python-virtualenv]/require: > requires Package > [python-pip]←[0m > ←[0;37mdebug: /Stage[main]//Package[python-virtualenv]/require: > requires Package > [python-setuptools]←[0m > ←[0;37mdebug: /Stage[main]/Apt/File[configure-apt-proxy]/notify: > subscribes to E > xec[apt_update]←[0m > ←[0;37mdebug: /Stage[main]/Apt/Anchor[apt::update]/require: requires > Class[Apt:: > Update]←[0m > ←[0;37mdebug: /Stage[main]/Apt/File[sources.list.d]/notify: subscribes > to Exec[a > pt_update]←[0m > ←[0;37mdebug: /Stage[main]//Package[python-pip]/require: requires > Exec[apt-get u > pdate]←[0m > ←[0;37mdebug: > /Stage[main]//Apt::Builddep[python-lxml]/Exec[apt-builddep-python- > lxml]/notify: subscribes to Exec[apt_update]←[0m > ←[0;37mdebug: /Stage[main]//Package[apache2]/require: requires > Exec[apt-get upda > te]←[0m > ←[0;37mdebug: /Stage[main]//Package[python-dev]/require: requires > Exec[apt-get u > pdate]←[0m > ←[0;37mdebug: /Stage[main]/Nodejs/Package[npm]/require: requires > Anchor[nodejs:: > repo]←[0m > ←[0;37mdebug: /Stage[main]/Nodejs/Package[nodejs]/require: requires > Anchor[nodej > s::repo]←[0m > ←[0;37mdebug: /Stage[main]//Package[python]/require: requires > Exec[apt-get updat > e]←[0m > ←[0;37mdebug: /Stage[main]//Package[build-essential]/require: requires > Exec[apt- > get update]←[0m > ←[0;37mdebug: /Stage[main]//Apt::Builddep[python-imaging]/require: > requires Clas > s[Apt]←[0m > ←[0;37mdebug: /Stage[main]//Package[git]/require: requires > Exec[apt-get update]← > [0m > ←[0;37mdebug: /Stage[main]//Package[less]/require: requires > Package[npm]←[0m > ←[0;37mdebug: /Stage[main]//Package[sphinx]/require: requires > Package[python-pip > ]←[0m > ←[0;37mdebug: > /Stage[main]//Apt::Builddep[python-imaging]/Anchor[apt::builddep:: > python-imaging]/require: requires Class[Apt::Update]←[0m > ←[0;37mdebug: /Stage[main]//Package[python-setuptools]/require: > requires Exec[ap > t-get update]←[0m > ←[0;37mdebug: /Stage[main]/Apt/File[sources.list]/notify: subscribes > to Exec[apt > _update]←[0m > ←[0;37mdebug: > /Stage[main]//Apt::Builddep[python-imaging]/Exec[apt-builddep-pyth > on-imaging]/notify: subscribes to Exec[apt_update]←[0m > ←[0;37mdebug: > /Stage[main]//Apt::Builddep[python-lxml]/Anchor[apt::builddep::pyt > hon-lxml]/require: requires Class[Apt::Update]←[0m > ←[0;37mdebug: /Stage[main]//Apt::Builddep[python-lxml]/require: > requires Class[A > pt]←[0m > ←[1;35merr: Could not apply complete catalog: Found 1 dependency cycle: > (Anchor[apt::update] => Class[Apt] => Apt::Builddep[python-lxml] => > Exec[apt-bui > lddep-python-lxml] => Exec[apt_update] => Class[Apt::Update] => > Anchor[apt::upda > te]) > Try the ''--graph'' option and opening the resulting ''.dot'' file in > OmniGraffle or > GraphViz←[0m > > any known workaound? solution? >-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.