Ask Your Question

How can I use a regex in the confine statement of a custom fact?

asked 2014-03-31 10:11:14 -0600

kidrock gravatar image

I am trying to confine a custom fact to a specific set of hostnames using a confine statement (maybe not the best way to do this, but I would like to see it work anyway). The syntax I've tried is this:

confine :hostname => "/brmke\w{3}ifsap/"

The confine statement is being ignored altogether and the logic in setcode is being executed everywhere. Is there a way to accomplish what I'm trying to do here?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-03-31 11:57:05 -0600

lavaman gravatar image

Anything in quotes is a string. Try removing the double quotes so ruby sees it as a regex.

edit flag offensive delete link more


Ah, that was it. Thanks!

kidrock gravatar imagekidrock ( 2014-03-31 12:21:56 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-03-31 10:11:14 -0600

Seen: 1,056 times

Last updated: Jun 26 '14