Bug #5898
Node regex beginning with dash results in invalid tag
| Status: | Accepted | Start date: | 01/14/2011 | |
|---|---|---|---|---|
| Priority: | Urgent | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | - | |||
| Target version: | 2.7.x | |||
| Affected Puppet version: | 2.6.4 | Branch: | ||
| Keywords: | ||||
| Votes: | 3 |
Description
A node regex starting with a dash results in a tag that begins with a dash, which Puppet doesn’t accept as valid:
node /-(abc|def)-/ {
results in the following error when it is matched:
Invalid tag "-abcdef-" on node host-abc-5678.example.com
Removing the initial dash works as expected:
node /(abc|def)-/ {
Related issues
History
Updated by Markus Roberts over 1 year ago
- Status changed from Unreviewed to Accepted
I’m assuming here that a full node name match would have worked (the node contains the pattern in the middle somewhere).
Hmmm. What we may need to do is distinguish the node (name/title) from the pattern in matches.
Updated by Peter Burkholder over 1 year ago
This is bug can really trip up a newbie (like me). I have nodes fl1-md.work.net, fl1-ca.work.net, etc., where -md and -ca indicate the node’s datacenter.
The following
node /.+-md.work.net/ { include base }
results in
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid tag “-md.work.net” on node fl1-md.work.net
I see this is already accepted. Just chiming in. Thanks, Peter
Updated by James Turnbull over 1 year ago
- Status changed from Accepted to Needs Decision
- Assignee set to Nigel Kersten
Updated by Nigel Kersten over 1 year ago
So this may be difficult to answer, as those of you hitting this problem may not actually use tags at all…
When you’re using regex node definitions, what would you expect to happen with the implicit tagging?
- tag with full node name
- tag with part of the name that matches the regex
- tag with a sanitized version of the regex (ie replacing difficult characters)
Updated by LaMont Jones 9 months ago
Nigel Kersten wrote:
So this may be difficult to answer, as those of you hitting this problem may not actually use tags at all…
When you’re using regex node definitions, what would you expect to happen with the implicit tagging?
- tag with full node name
- tag with part of the name that matches the regex
- tag with a sanitized version of the regex (ie replacing difficult characters)
I just spent quite a bit of time finding this bug – it is completely non-obvious to anyone not steeped in the autotagging lore…
To answer your question here: what’s a tag and why would I care about them? – of the 3 options, 1 or 3 makes far more sense than leaving this submarine around to torpedo the unwary, especially since “-foo” seems to be a fairly common way of tagging types of hosts.
lamont
Updated by Nick Moffitt 9 months ago
LaMont Jones wrote:
Nigel Kersten wrote:
- tag with full node name
- tag with part of the name that matches the regex
- tag with a sanitized version of the regex (ie replacing difficult characters)
To answer your question here: what’s a tag and why would I care about them? – of the 3 options, 1 or 3 makes far more sense than leaving this submarine around to torpedo the unwary, especially since “-foo” seems to be a fairly common way of tagging types of hosts.
3 seems to be the option of least surprise for people currently using the autotagging. It would repair this situation without changing behavior for anyone else.
Updated by Nigel Kersten 9 months ago
- Status changed from Needs Decision to Accepted
- Assignee deleted (
Nigel Kersten) - Priority changed from Normal to Urgent
- Target version set to 2.7.x
ok. Lets do it.
We will “tag with a sanitized version of the regex (ie replacing difficult characters)”.
Updated by Duncan McNaught 2 months ago
What’s the status of this – what’s the tag on a regex node? Thanks
Updated by Duncan McNaught about 15 hours ago
Hi Nigel, Thanks for updating this ticket to urgent – is it being worked on? Thanks —Duncan