Mohamed Lrhazi
2012-Feb-15  21:46 UTC
[Puppet Users] String matching and case-insensitivity
When I run a puppet apply against this:
notice("operatingsystem: $operatingsystem")
case $operatingsystem {
  redhat: { notice("Matched redhat in switch") }
  default: { notice("Did not match redhat in switch") }
}
if ($operatingsystem == "redhat") {
    notice("Matched redhat in if")
} else {
    notice("Did not match redhat in if")
}
It works as expected:
otice: Scope(Class[main]): operatingsystem: RedHat
notice: Scope(Class[main]): Matched redhat in switch
notice: Scope(Class[main]): Matched redhat in if
But when I have similar code inside my regular manifests, compiled via
puppet master... the code seems to be case sensitive and am forced to
write this to make it work:
if ( $operatingsystem in
["RedHat","OEL","redhat","oel",] ) {
...
}
My client is 2.7.6 and the master is 2.7.7
Is this know issue?
Thanks a lot,
Mohamed,
-- 
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Felix Frank
2012-Feb-22  08:55 UTC
Re: [Puppet Users] String matching and case-insensitivity
Hi, interesting discovery. Of course, you could probably have an easier workaround using regular expressions. Still, it looks like this should be reported as a possible bug. Cheers, Felix On 02/15/2012 10:46 PM, Mohamed Lrhazi wrote:> When I run a puppet apply against this: > > notice("operatingsystem: $operatingsystem") > case $operatingsystem { > redhat: { notice("Matched redhat in switch") } > default: { notice("Did not match redhat in switch") } > } > > if ($operatingsystem == "redhat") { > notice("Matched redhat in if") > } else { > notice("Did not match redhat in if") > } > > It works as expected: > > otice: Scope(Class[main]): operatingsystem: RedHat > notice: Scope(Class[main]): Matched redhat in switch > notice: Scope(Class[main]): Matched redhat in if > > > But when I have similar code inside my regular manifests, compiled via > puppet master... the code seems to be case sensitive and am forced to > write this to make it work: > > if ( $operatingsystem in ["RedHat","OEL","redhat","oel",] ) { > ... > } > > > My client is 2.7.6 and the master is 2.7.7 > > Is this know issue? > > Thanks a lot, > Mohamed, >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.