I have a local Puppet installation on which I've done:
# puppet module install puppetlabs/apt
Preparing to install into /etc/puppet/modules ...
Downloading from http://forge.puppetlabs.com ...
Installing -- do not interrupt ...
/etc/puppet/modules
└─┬ puppetlabs-apt (v1.1.0)
└── puppetlabs-stdlib (v3.2.0)
I also have the following nodes.pp
which I want to apply:
node default {
include stdlib
class {'apt':
always_apt_update => true,
disable_keys => true,
stage => 'setup'
}
->
apt::source { "cassandra":
location => "http://debian.datastax.com/community",
release => "stable",
repos => "main",
key => "B999A372",
key_source => "http://debian.datastax.com/debian/repo_key",
include_src => false
}
}
When I try to apply it, I get:
# puppet apply nodes.pp
err: Could not apply complete catalog: Found 1 dependency cycle:
(Anchor[apt::key B999A372 present] => Apt::Key[Add key: B999A372 from Apt::Source cassandra] => File[cassandra.list] => Exec[apt_update] => Class[Apt::Update] => Stage[setup] => Stage[main] => Class[Main] => Node[default] => Apt::Source[cassandra] => File[cassandra.list])
Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz
notice: Finished catalog run in 0.12 seconds
The problem seems to lay in the stage => 'setup'
parameter, but I'd like to understand what's going on and what can I do to solve this issue (I've inherited a large puppet codebase - the above is just a proof of concept - which uses the stage
thing and I don't want to remove it just yet, as I don't get Puppet's inner workings very well atm).
Update #1
Tried moving the apt::source
step to the setup
stage, like this:
class cassandra {
apt::source { "cassandra":
location => "http://debian.datastax.com/community",
release => "stable",
repos => "main",
key => "B999A372",
key_source => "http://debian.datastax.com/debian/repo_key",
include_src => false
}
}
node default {
include stdlib
class {'apt':
always_apt_update => true,
disable_keys => true,
stage => setup
}
->
class {'cassandra': stage => setup}
}
However, this doesn't solve the problem, just generates another dependency cycle.
err: Could not apply complete catalog: Found 1 dependency cycle:
(Anchor[apt::key B999A372 present] => Apt::Key[Add key: B999A372 from Apt::Source cassandra] => File[cassandra.list] => Exec[apt_update] => Class[Apt::Update] => Anchor[apt::update] => Class[Apt] => Class[Cassandra] => Apt::Source[cassandra] => File[cassandra.list])
Full debug output here. The dependency graph is
So it seems to me that trying to enforce the order of operations in a "natural" way (via the ->
operator) leads to this weird dependency cycle.