Move tag-filtering and exporting to API helper methods

This commit is contained in:
Scott Schneider 2015-06-30 12:46:54 -07:00
parent 6523062b62
commit c720f12c05
2 changed files with 22 additions and 11 deletions

View file

@ -497,17 +497,8 @@ module Vmpooler
backend.hset('vmpooler__vm__' + params[:hostname], param, arg)
when 'tags'
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 if arg[tag].match(filter)
end
next if arg[tag].nil? or arg[tag].empty?
backend.hset('vmpooler__vm__' + params[:hostname], 'tag:' + tag, arg[tag])
backend.hset('vmpooler__tag__' + Date.today.to_s, params[:hostname] + ':' + tag, arg[tag])
end
filter_tags(arg)
export_tags(backend, params[:hostname], arg)
end
end