Only filter regex matches

and a spec test for it.

Previously using the example shown in vmpooler.yaml.example was failing
to tag strings WITHOUT a '/' in them.
This commit is contained in:
Scott Schneider 2015-06-02 19:12:30 -07:00
parent ccede2780e
commit 1f62379be8
2 changed files with 12 additions and 1 deletions

View file

@ -544,7 +544,7 @@ module Vmpooler
arg.keys.each do |tag|
if Vmpooler::API.settings.config[:tagfilter] and Vmpooler::API.settings.config[:tagfilter][tag]
filter = Vmpooler::API.settings.config[:tagfilter][tag]
arg[tag] = arg[tag].match(filter).captures.join
arg[tag] = arg[tag].match(filter).captures.join if arg[tag].match(filter)
end
backend.hset('vmpooler__vm__' + params[:hostname], 'tag:' + tag, arg[tag])