regular expressions do not work with selectors as shown in documentation

266 views
Skip to first unread message

Bryan Schneiders

unread,
Oct 7, 2009, 6:18:47 PM10/7/09
to Puppet Users
The documentation at:
http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#conditionals

says:
"""
Starting with version 0.25, selectors now support regular expressions:

$owner = $operatingsystem ? {
/(redhat|debian)/ => "bin",
default => undef,
}

In this last example, if $operatingsystem matches either redhat or
debian, then bin will be the selected result.
"""

When I try something like this, I get:
Syntax error at '/'; expected '}'

If I put quotes around it, it doesn't act as a regular expression and
fails to match. If I use just "RedHat" without a regular expression,
then it matches when the operating system is RedHat.

I'm using:
puppet-0.24.8-1.fc10.noarch
puppet-server-0.24.8-1.fc10.noarch

Is the bug in puppet or the documentation? Does anyone know the
correct syntax?

Bryan

unread,
Oct 7, 2009, 6:21:02 PM10/7/09
to Puppet Users
OK. I just noticed I'm not running version 0.25 as is glaringly
obvious from the contents of my email. My mistake. Sorry for the
post.

Todd Zullinger

unread,
Oct 7, 2009, 7:13:31 PM10/7/09
to puppet...@googlegroups.com
Bryan wrote:
> OK. I just noticed I'm not running version 0.25 as is glaringly
> obvious from the contents of my email. My mistake. Sorry for the
> post.

Though if you want to try 0.25.1rc1, there are packages available at:

http://tmz.fedorapeople.org/repo/puppet/

If you grab the puppet.repo file from

http://tmz.fedorapeople.org/repo/puppet/fedora/puppet.repo

and save it in /etc/yum.repos.d, you can easily update via yum.

--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When you make a mistake, make amends immediately. It's easier to eat
crow while it's still warm.

Reply all
Reply to author
Forward
0 new messages