Le 21/09/2018 à 13:54:59+0200, Henrik Lindberg a écrit
> On 2018-09-20 10:17, Albert Shih wrote:
> > Le 19/09/2018 à 16:00:20+0200, Henrik Lindberg a écrit
> >
> > I know that, and generaly that's would be my solution, but the point is
> > apache::vhost got a *lot* of attributes......and it's very boring to add
> > all attributes or change my module each time I need a new attributes from
> > apache::vhost.
> >
>
> Do you know that you can apply a hash of attribute-name to value at once?
> Here is a simple example with a notify setting the message in a hash (just
> to show you how). You can have as many attributes to value mappings you
> like.
>
> $hash = { 'message' => 'set via a wildcard' }
> notify { example:
>   * => $hash
> }
>
> This way, you can look things up from hiera and apply all of the attributes
> at once.

Thanks, but yes I know that. The point is if you pass inside the $hash, a
parameter who not manage by the ressource like apache, puppet complaint
about that

So I cannot do something like

fqdn.yaml

  profile::apache::vhosts:
    'vhost1':
      attribute_from_apache_vhost_class
      attribute_from_apache_vhost_class
      attribute_from_apache_vhost_class
      my_attribute_not_in_apache_vhost_class


class  'profile::apache' (
  Hash $vhosts
  )
  {
    apache::vhosts::vhosts {'all'
      * => $vhosts
      }
  }

so that's why I need to « cleanup »  the hash and remove

  my_attribute_not_in_apache_vhost_class

Currently I do something no very clean IMHO : I got a another parameter in
the hiera :

  profile::apache::vhosts_my_thing:
    'vhost1':
      my_attribute_not_in_apache_vhost_class


But in my point of view it's not a good solution because the information
vhost1 should be unique. And not in two place.

Regards



--
Albert SHIH
DIO bâtiment 15
Observatoire de Paris
xmpp: [email protected]
Heure local/Local time:
Fri Sep 21 14:13:43 CEST 2018

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20180921122107.GF2328%40io.chezmoi.fr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to