On Fri, Jul 23, 2010 at 7:22 AM, ScubaDude <brett.ma...@googlemail.com>wrote:
> Can someone point me in the right direction, I've got two "source" > files one 32bit, on 64bit > I've got it to work using the ternary operator but get syntax errors > if I try to use a case: > > Works: > > class audit { > > package { > "audit": > ensure => present, > name => $operatingsystem ? { > default => "auditd", > }, > } > > file { > "auditd.conf": > owner => "root", > group => "root", > mode => "640", > require => Package["audit"], > path => $operatingsystem ? { > default => "/etc/auditd.conf", > }, > source => "puppet://$server/modules/audit/ > auditd.conf", > } > > file { > "audit.rules": > owner => "root", > group => "root", > mode => "600", > path => $operatingsystem ? { > default => "/etc/audit.rules", > }, > source => $hardwaremodel ? { > "x86_64" => "puppet://$server/modules/ > audit/audit.rules.64", > default => "puppet://$server/modules/ > audit/audit.rules.32", > }, > } > > service { > "audit": > enable => "true", > ensure => "running", > hasstatus => "true", > require => File["auditd.conf", "audit.rules"], > subscribe => File["auditd.conf", "audit.rules"], > name => $operatingsystem ? { > default => "auditd", > }, > } > } > > Syntax Error: > > Jul 23 13:20:43 <master> puppetmasterd[14197]: Syntax error at 'case'; > expected '}' at /etc/puppet/modules/audit/manifests/init.pp:32 on node > <client> > Jul 23 13:20:43 <master> puppetmasterd[14197]: Syntax error at 'case'; > expected '}' at /etc/puppet/modules/audit/manifests/init.pp:32 on node > <client> > > class audit { > > package { > "audit": > ensure => present, > name => $operatingsystem ? { > default => "auditd", > }, > } > > file { > "auditd.conf": > owner => "root", > group => "root", > mode => "640", > require => Package["audit"], > path => $operatingsystem ? { > default => "/etc/auditd.conf", > }, > source => "puppet://$server/modules/audit/ > auditd.conf", > } > > file { > "audit.rules": > owner => "root", > group => "root", > mode => "600", > path => $operatingsystem ? { > default => "/etc/audit.rules", > }, > case $hardwaremodel { > "x86_64": { source => "puppet:// > $server/modules/audit/audit.rules.64" } > default: { source => "puppet:// > $server/modules/audit/audit.rules.32" } > }, > } > > service { > "audit": > enable => "true", > ensure => "running", > hasstatus => "true", > require => File["auditd.conf", "audit.rules"], > subscribe => File["auditd.conf", "audit.rules"], > name => $operatingsystem ? { > default => "auditd", > }, > } > } > You might want to add the case statement out of the file resource and assign to a variable for the source: case $hardwaremodel { "x86_64": { $hw_source = "puppet://$server/modules/audit/audit.rules.64" } default: { $hw_source = "puppet://$server/modules/audit/audit.rules.32" } } Then insinde the file resource only add the variable to the source: source => $hw_source, Seems like the parser does not allow case statements in the attributes of the resources. -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-us...@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > -- Tony http://blog.tonyskapunk.net -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@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.