Bug #11133
Regex captures don't work in node definitions
| Status: | Duplicate | Start date: | 12/02/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | node | |||
| Target version: | - | |||
| Affected Puppet version: | 2.7.1 | Branch: | ||
| Keywords: | node regex capture | |||
| Votes: | 0 |
Description
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
Related issues
History
Updated by Neil Hemingway 6 months ago
Grr. horrible wiki formatting there. Try again…
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
I’m working on a patch
Updated by Neil Hemingway 6 months ago
Note: No tests because (as the commit makes clear) I’m uncertain whether this is the best place for the fix. I need a better understanding of the architecture of puppet.
Updated by Josh Cooper 5 months ago
- Description updated (diff)
Updated by Josh Cooper 5 months ago
- Status changed from Unreviewed to Duplicate
Updated by Daniel Pittman 2 months ago
- Target version deleted (
2.7.x)