Issue #11133 has been updated by Neil Hemingway.
Grr. horrible wiki formatting there. Try again...
<pre>
node /^ws-([[:digit:]]+)/ {
$hostid = $2
notice("site.pp: Hostid: $hostid")
# Same regex as above
if $hostname =~ /^ws-([[:digit:]]+)/ {
notice("\$2: $2")
}
}
</pre>
When run against a machine ws-01, I get out:
<pre>
puppet-master[29847]: (Scope(Node[ws-:digit:])) site.pp: Hostid:
puppet-master[29847]: (Scope(Node[ws-:digit:])) $2: 01
</pre>
I'm working on a patch
----------------------------------------
Bug #11133: Regex captures don't work in node definitions
https://projects.puppetlabs.com/issues/11133
Author: Neil Hemingway
Status: Unreviewed
Priority: Normal
Assignee: Neil Hemingway
Category: node
Target version: 2.7.x
Affected Puppet version: 2.7.1
Keywords: node regex capture
Branch:
With the following manifest:
node /^ws-([[:digit:]]+)/ {
$hostid = $2
notice("site.pp: Hostid: $hostid")
# Same regex as above
if $hostname =~ /^ws-([[:digit:]]+)/ {
notice("\$2: $2")
}
}
When run against a machine ws-01, I get out:
puppet-master[29847]: (Scope(Node[ws-:digit:])) site.pp: Hostid:
puppet-master[29847]: (Scope(Node[ws-:digit:])) $2: 01
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.