Issue #2033 has been updated by James Turnbull.

Status changed from Ready for Testing to Closed
Target version changed from unplanned to 0.25.0
Keywords changed from if, regex to if, regex, behaviourchange

Pushed in commit:"ef68967f2b72e609a9d69e53771a61fd9f522149" in branch master.
----------------------------------------
Feature #2033: Regex matching in 'if' statements.
http://projects.reductivelabs.com/issues/2033

Author: Trevor Vaughan
Status: Closed
Priority: Low
Assigned to: Brice Figureau
Category: newfeature
Target version: 0.25.0
Complexity: Medium
Affected version: 0.24.6
Keywords: if, regex, behaviourchange


Now that the if/else constructor has more powerful types (>, <, etc...) it 
would be nice to go one step further and include the "=~" operator for regular 
expression matching.

For example:

if $foo =~ /*.bar\.com$/ {
  notice("I found bar!")
}
else {
  notice("No bars :-(")
}

There is a workaround for doing this now using either custom functions or 
templates, but it's a huge hack and probably shouldn't be used.

Workaround:

if template("parse.erb") == "bar.com\n" {
  notice("I found bar!")
}
else {
  notice("No bars :-(")
}

--- parse.erb ---
<% if foo =~ /*.bar\.com$/ then %>bar.com<% else %>default<% end %>
--- end parse.erb ---


-- 
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://reductivelabs.com/redmine/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
-~----------~----~----~----~------~----~------~--~---

Reply via email to