Suggestion for checking puppet version in module?

160 views
Skip to first unread message

Sean Alderman

unread,
Sep 24, 2013, 1:38:08 PM9/24/13
to example42-pu...@googlegroups.com
Hey all,
  So I'm perusing E42 modules looking for a matcher that would do something like so:

process_args = $::operatingsystem ? {
  /(?i:Solaris)/ => $::puppetversion ? {
    '>= 2.7.21'   => '/opt/csw/bin/puppet agent',
    '< 2.7.21'    => '/opt/csw/sbin/puppetd',
  },
  default        => '',
}


The issue I have is that somewhere between 2.7.14 and 2.7.21 puppet agents on Solaris went from the process looking like:
  /opt/csw/bin/ruby18 /opt/csw/sbin/puppetd
to
  /opt/csw/bin/ruby18 /opt/csw/bin/puppet agent

I'm not sure its of great importance, I could probably leave process args empty as is the default, but I fear with the process being ruby18, that we could be monitoring some other process than puppet.  Any ideas?

Thanks!

Alessandro Franceschi

unread,
Sep 24, 2013, 3:00:29 PM9/24/13
to example42-pu...@googlegroups.com
Welcome to the crazy world of puppet agent names on different OS (and versions).
process_args and process params are used only for monitoring stuff (via nagios plugins) so if you want them to be precise you should set them correctly.
I'm not sure you can use operators in a selector, you might eventually calculate a variable with operators and then use it in the selector, with something like (not tested):

if $::puppetversion >= 2.7.21 {
  $solaris_process_args = '/opt/csw/bin/puppet agent'
} else {
  $solaris_process_args = '/opt/csw/sbin/puppetd'
}
process_args = $::operatingsystem ? {
  /(?i:Solaris)/ => $solaris_process_args
  default        => '',
}

If you have puppi as monitor_tool you can quickly test it with 'puppi check'

al

Sean Alderman

unread,
Sep 24, 2013, 3:34:41 PM9/24/13
to example42-pu...@googlegroups.com
Thanks for the suggestion, I'll implement it that way.  I'll cancel that pull request on this module until I get it worked out.

Sean Alderman

unread,
Sep 24, 2013, 4:19:50 PM9/24/13
to example42-pu...@googlegroups.com
p.s. unfortunately puppi doesn't work on solaris afaik.


On Tuesday, September 24, 2013 3:00:29 PM UTC-4, Alessandro Franceschi wrote:
Reply all
Reply to author
Forward
0 new messages