Leam: The reason you are getting the 400 Error is because you don't have $osfamily defined.
You can write your case statement as such: case $::osfamily { 'redhat': { # do something RHEL specific } 'debian': { # do something Debian specific } default: { # ... } } Thanks Joey On Wednesday, February 11, 2015 at 10:55:50 AM UTC-5, leam hall wrote: > > Trying to use a case statement with a setup.pp file that uses hiera and > parameters. We have pulled a module from the forge and are trying to make > it fit our needs. > > The issue I'm trying to resolve is to have the user's home directories > created on /home/$user on Red hat systems and /export/home/$user on Solaris > nodes. So far I've tried to use a case statement based on osfamily, but I'm > getting an error. > > Code: > define sysusers::setup($hash) { > > if(!defined(User[$name])) { > user { $name : > case $osfamily { > 'RedHat': { home => "/home/$hash[$name]['name']"} > 'Solaris': { home => "/export/home/$hash[$name]['name']"} > default: { home => "/home/$hash[$name]['name']"} > } > ensure => $hash[$name]['ensure'], > comment => $hash[$name]['comment'], > expiry => $hash[$name]['expiry'], > gid => $hash[$name]['gid'], > > Error: > > Error: Could not retrieve catalog from remote server: Error 400 on > SERVER: Syntax error at 'osfamily'; expected '}' at > /etc/puppetlabs/puppet/environments/theblack/modules/sysusers/manifests/setup.pp:5 > > Module: > https://forge.puppetlabs.com/mthibaut/users > > Case statement reference: > > https://docs.puppetlabs.com/puppet/latest/reference/lang_conditional.html#case-statements > > On Tuesday, February 10, 2015 at 4:18:05 PM UTC-5, leam hall wrote: >> >> We have a mixed environment. I wrote a module that would only do stuff on >> Red Hat family boxes. Under the class definition I put: >> >> if $::osfamily == 'RedHat' { >> >> and did all the package and file definitions under that. Is there a >> better or cleaner way to do this? >> >> Leam >> >> -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/d3bebaa5-8640-48ed-9a86-9bd6a619afb0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.