lib/scout/server.rb in scout-5.6.0.alpha.3 vs lib/scout/server.rb in scout-5.6.0.alpha.4
- old
+ new
@@ -34,11 +34,11 @@
@history = Hash.new
@logger = logger
@server_name = server_name
@http_proxy = http_proxy
@https_proxy = https_proxy
- @roles = roles || ''
+ @roles = (roles || '').gsub(/[^a-zA-Z0-9,]/,'')
@plugin_plan = []
@plugins_with_signature_errors = []
@directives = {} # take_snapshots, interval, sleep_interval
@streamer_command = nil
@new_plan = false
@@ -58,13 +58,12 @@
end
def refresh?
return true if !ping_key or account_public_key_changed? # fetch the plan again if the account key is modified/created
- url=URI.join( @server.sub("https://","http://"), "/clients/#{ping_key}/ping.scout")
+ url=URI.join( @server.sub("https://","http://"), "/clients/#{ping_key}/ping.scout?roles=#{@roles}&host=#{Socket.gethostname}")
headers = {"x-scout-tty" => ($stdin.tty? ? 'true' : 'false')}
- headers["x-scout-roles"] = @roles
if @history["plan_last_modified"] and @history["old_plugins"]
headers["If-Modified-Since"] = @history["plan_last_modified"]
end
get(url, "Could not ping #{url} for refresh info", headers) do |res|
@streamer_command = res["x-streamer-command"] # usually will be nil, but can be [start,abcd,1234,5678|stop]