Hi everyone,

Here's a requirement I'm trying to meet:

  No package installation should be attempted before "apt-get update"
  runs. (Because it may need to pick up custom package repositories).
  However I do not want to repeat:
    requires => Exec["apt-get update"]
  every time I create a package instance.

Specifying
  Package { require => Exec["apt-get update"] }
at the top level does not work when you specify another "require"
explicitly in some package instances.  You would have to either:

  1) repeat the default every time a "require" is set explicitly.
  Obviously, that is error-prone and violates the DRY principle.

  2) use the +> operator instead of => but it seems to work only for
  amending resources of inherited classes?

So currently the only way to have this is to create a define.

However

 - I'm reluctant to create one (since I was burnt by
   http://reductivelabs.com/trac/puppet/ticket/446).

 - Even though this would probably work, (since #446 is now fixed), I
   still feel that it may be good if puppet natively provided such
   feature, without forcing nearly everyone to create their own, but
   identical "my_package()".


The idea would be to create some new syntax, which would work just like:
  File { require => blah }
does, but make the "require" stick, instead of being replaced when you
specify one explicitly.


Maybe an example will make it easier to show what I mean. The following
manifest (where =>> is the hypotethical operator):
------------------------------------------------------------------------
File { require => $default }
file { a1: }
file { a2: require => $a }

class a {
        File { require =>> $b1 }
        include b
}

class b {
        file { b1: }
        file { b2: require => $b2 }
}

------------------------------------------------------------------------

.. should create the following dependency graph:

File[a1] -> $default
File[a2] -> $a
File[b1] -> $b1
File[b2] -> $b1
File[b2] -> $b2

I'm not sure about the exact syntax, but I do think that there should be
a "sticky" relation feature (possibly with another feature to "unstick"
that).

What do you think?

-- 
Marcin Owsiany <[EMAIL PROTECTED]>              http://marcin.owsiany.pl/
GnuPG: 1024D/60F41216  FE67 DA2D 0ACA FC5E 3F75  D6F6 3A0D 8AA0 60F4 1216
 
"Every program in development at MIT expands until it can read mail."
                                                              -- Unknown

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to