Ask Your Question
2

Apt module: dependency cycle

asked 2013-07-16 13:02:33 -0500

alonisser gravatar image

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

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 ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-07-23 07:16:35 -0500

alonisser gravatar image

updated 2013-07-23 13:35:32 -0500

GregLarkin gravatar image

It was answered In the google puppet group (can't post the link because of strange Karma problems here.

I didn't needed to declare the apt module dependency in apt::builddep seems that the code should be:

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']: }
edit flag offensive delete link more

Comments

1

answered 2013-07-21 19:13:39 -0500

louis gravatar image

updated 2013-07-21 19:14:09 -0500

I will suggest to do the following refactoring to your module.

  1. Your package/update installs should be on its own class. Basically organizing everything related to the package installation on a separate class

    --module -- init.pp (Just a class name and dependencies) -- install.pp (Here your apt-get/package installs) -- configure.pp (Specific files that you need in place) -- nodejs.pp (Specific to nodejs installation and configuration)

Now since install.pp, configure.pp,nodejs.pp need to be executed in a sequential order then i will suggest to manage those dependencies on your init.pp. With this approach you will avoid ... (more)

edit flag offensive delete link more

Comments

How should I manage the dependencies between the different modules?

alonisser gravatar imagealonisser ( 2013-07-22 04:18:45 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-07-16 13:02:33 -0500

Seen: 1,453 times

Last updated: Jul 23 '13