On Thu, May 9, 2013 at 11:52 AM, James Kyle <li...@jameskyle.org> wrote:

> I've run into several incidences where a module attempts to install a
> package before the apt::source is added or an update is run. Result is a
> bunch apt errors and explosions.
>
> Basically what should be done is all the apt::sources are added and and an
> update run _before_ any packages are installed to ensure you're pulling
> from the repos you want.
>
> I've gone through several iterations in my attempt to achieve that
> behavior. The one that works best so far is stages and wrapper classes.
> Here's a terse example of what it looks like:
>
> class myorg::common {
>   include stdlib
>
>   Apt::Source {stage => "setup"}
>
>   apt::source { 'puppetlabs':
>     location   => 'http://apt.puppetlabs.com',
>     repos      => 'main',
>     key        => '4BD6EC30',
>     key_server => 'pgp.mit.edu',
>   }
>
>   Exec['apt_update'] -> Package<|  title != 'ubuntu-cloud-keyring' |>
> }
>
> node 'foo.bar.com' {
>   include stdlib
>
>   class {'myorg::common': stage => "setup"}
> }
>
>
> One thing that bothers me is you have to declare the stage for
> myorg::common in every node that uses it. And as the name implies, that's
> every node.
>
> Is there a way to get rid of that duplication? I've thought of node
> inheritance, but the docs seem to strongly steer you away from that pattern.
>

Doesn't the relationship do the right thing without stages? Does this work?

class myorg::common (
  $staging  = 'setup',
) { ...

Nan

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to