During the works on stdmod naming conventions I wondered if we could find a 
non intrusive and standard way to allow management of monitoring and 
firewalling for modules.
Since there's not a single solution to that and it would be quite hard to 
find a shared approach in a reasonable time I thought that it could/should 
be enough to define few basic parameters, to be included in a stdmod 
compliant module, leaving the actual implementation outside the module.

I thought about having parameters like:

  $monitor_class         = undef,
  $monitor_options_hash  = { } ,

  $firewall_class        = undef,
  $firewall_options_hash = { } ,


and inside the module just this ( <%= metadata.name %> is the module name):


  if $<%= metadata.name %>::monitor_class {
    class { $<%= metadata.name %>::monitor_class:
      options_hash => $<%= metadata.name %>::monitor_options_hash,
      scope_hash   => {}, # TODO: Find a good way to inject class' scope
    }
  }

  if $<%= metadata.name %>::firewall_class {
    class { $<%= metadata.name %>::firewall_class:
      options_hash => $<%= metadata.name %>::firewall_options_hash,
      scope_hash   => {},
    }
  }

$monitor_class is therefore the name of a custom class, external to the module, 
where all the monitoring stuff is managed in whatever way.
$monitor_options_hash is an hash of custom configurations that the 
$monitor_class knows how to manage .
$scope_hash should be automatically populated by the class's scope variables so 
that informations like name of services, port numbers, names of processes 
(which should have a standard naming either if expressed as class parameters or 
if defined internally in the class) which are generally used for 
monitoring/firewalling are automatically provided to the $monitor_class

What do you think of a similar approach?
Does it make sense?
Would you use it in your modules? (even if you don't plan to have monitoring 
classes? They could be provided by third party modules)  
Would you make it in a different way or with different naming? How?

To populate the $scope_hash it could be used something like 
https://github.com/example42/puppi/blob/master/lib/puppet/parser/functions/get_class_args.rb
 (is there something similar in stdlib? Would it make sense to add it, also 
considering  that the original code is by Ken Barber?)


Al

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to