Pardon my newbish question, but is there a non-iterative way to compare 
whether an array is a subset of another array?

Something like:

class scratchpad {

  *$config_ciphers = ['aes128-ctr' , 'aes192-ctr', 'aes256-ctr']*

  if ! is_array($config_ciphers) or empty($config_ciphers) {
    fail('"config_ciphers" parameter must be an array of valid ciphers, 
containing at least one element. See base_sshd class documentation for a 
list of valid values.')
  } else {
    if ! (*$config_ciphers in [ '3des-cbc', 'aes128-cbc', 'aes192-cbc',
           'aes256-cbc', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr',
           'arcfour128', 'arcfour256', 'arcfour', 'blowfish-cbc',
           'cast128-cbc'])* {
      fail('"config_ciphers" parameter must be an array of valid ciphers. 
See base_sshd class documentation for a list of valid values.')
    } else {
      notify {'config_ciphers':
        message => "set Ciphers ${$base_sshd::config_ciphers}",
      }
    }
  }

}

This particular bit produces the following error which tells me that Puppet 
'in' only supports string-to-array comparisons.

info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
> info: Loading facts in 
> /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
> info: Loading facts in 
> /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
> info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
> err: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> 'aes128-ctraes192-ctraes256-ctr' from left operand of 'in' expression is 
> not a string at /etc/puppet/manifests/scratchpad.pp:11 on node 
> puppetmaster.localdomain
> warning: Not using cache on failed catalog
> err: Could not retrieve catalog; skipping run
>

Showing how to approach this is appreciated, but links to documentation or 
a post that explains the finer points are preferred.

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/uFDHc9YwTTIJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to