deployment - Puppet issue with apt::source and stages -


i have local puppet installation on i've done:

# puppet module install puppetlabs/apt   preparing install /etc/puppet/modules ...             downloading http://forge.puppetlabs.com ...              installing -- not interrupt ...                            /etc/puppet/modules                                           └─┬ puppetlabs-apt (v1.1.0)                                     └── puppetlabs-stdlib (v3.2.0)                              

i have following nodes.pp want 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 try apply it, get:

# puppet apply nodes.pp err: not apply complete catalog: found 1 dependency cycle: (anchor[apt::key b999a372 present] => apt::key[add key: b999a372 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 '--graph' option , opening resulting '.dot' file in omnigraffle or graphviz notice: finished catalog run in 0.12 seconds 

the problem seems lay in stage => 'setup' parameter, i'd understand what's going on , can solve issue (i've inherited large puppet codebase - above proof of concept - uses stage thing , don't want remove yet, don't puppet's inner workings atm).

update #1

tried moving apt::source step setup stage, 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, doesn't solve problem, generates dependency cycle.

err: not apply complete catalog: found 1 dependency cycle: (anchor[apt::key b999a372 present] => apt::key[add key: b999a372 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. dependency graph this

so seems me trying enforce order of operations in "natural" way (via -> operator) leads weird dependency cycle.

basically looks apt::source specifies key. apt::source declaration of apt::key states apt::key needs processed before file cassandra.list added. makes sense right?

but cassandra file resource has notify exec['apt_update'], exists in apt::update. it's refreshonly package , triggered cassandra file resource being executed , notifying it.

that exec['apt_update'] inside apt::update, therefore needs processed class['apt::update'] deemed processed.

now actual problem occurs apt declaration. you've declared apt (the init manifest of apt module) metaparameter stage => 'setup'. you'll find apt includes apt::update, fine - defines anchor 'apt::update' requires class apt::update. because of apt's dependency on apt::update have implicit dependency on apt::update setup stage too.

the main stage depends on setup stage , that's not given stage automatically picks main stage - hence file['cassandra.list'] main stage resource (but needs happen before apt::update implicitly setup stage resource!)

i hope helps, can seem quite complex - anchors.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -