root writes: > > Can anyone tell me why this is legal: > > file { "/etc/cron.d": > owner => "root", > group => "root", > mode => $operatingsystem ? { > 'Solaris' => "0755", > default => "0700", > } > } > > > ...And yet if I have any resource attributes below the "mode" selector > statement, it will not parse?
No comma after the conditional? Like this: mode => $operatingsystem ? { 'Solaris' => "0755", default => "0700", }, All resource attributes use comma as a separator. You can optionally leave off the final comma (although style recommendations suggest you should always end an attribute specification with a comma, mainly so that you don't have to remember to add it if you add additional attribute specifications). > (Am I doing the right thing by having a selector in my file resource? I > have a large amount of files to validate, and attributes change for many of > the files, depending on the OS.) That is certainly one way to manage the OS-specific differences in your resources. If you have a lot of things that are always mode 755 in one OS and mode 700 in another, it may be somewhat more concise to declare a variable and use that: $dirmode = $operatingsystem ? { "Solaris" => 0755, default => 0700, } ... file { "/etc/cron.d": owner => "root", group => "root", mode => $dirmode, } -- 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.