adding deprecation warning to logs for reroute.rb

This commit is contained in:
Samuel Beaulieu 2022-03-31 13:10:38 -05:00
parent 9a9dfce316
commit ef87fe8db5
No known key found for this signature in database
GPG key ID: 12030F74136D0F34

View file

@ -6,66 +6,82 @@ module Vmpooler
api_version = '1' api_version = '1'
get '/status/?' do get '/status/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called /status/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/status") call env.merge('PATH_INFO' => "/api/v#{api_version}/status")
end end
get '/summary/?' do get '/summary/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called /summary/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/summary") call env.merge('PATH_INFO' => "/api/v#{api_version}/summary")
end end
get '/summary/:route/?:key?/?' do get '/summary/:route/?:key?/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called /summary/:route/?:key?/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/summary/#{params[:route]}/#{params[:key]}") call env.merge('PATH_INFO' => "/api/v#{api_version}/summary/#{params[:route]}/#{params[:key]}")
end end
get '/token/?' do get '/token/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called /token/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/token") call env.merge('PATH_INFO' => "/api/v#{api_version}/token")
end end
post '/token/?' do post '/token/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called post /token/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/token") call env.merge('PATH_INFO' => "/api/v#{api_version}/token")
end end
get '/token/:token/?' do get '/token/:token/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called /token/:token/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/token/#{params[:token]}") call env.merge('PATH_INFO' => "/api/v#{api_version}/token/#{params[:token]}")
end end
delete '/token/:token/?' do delete '/token/:token/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called delete /token/:token/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/token/#{params[:token]}") call env.merge('PATH_INFO' => "/api/v#{api_version}/token/#{params[:token]}")
end end
get '/vm/?' do get '/vm/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called /vm? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/vm") call env.merge('PATH_INFO' => "/api/v#{api_version}/vm")
end end
post '/vm/?' do post '/vm/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called post /vm? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/vm") call env.merge('PATH_INFO' => "/api/v#{api_version}/vm")
end end
post '/vm/:template/?' do post '/vm/:template/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called post /vm/:template/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:template]}") call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:template]}")
end end
get '/vm/:hostname/?' do get '/vm/:hostname/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called /vm/:hostname/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:hostname]}") call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:hostname]}")
end end
delete '/vm/:hostname/?' do delete '/vm/:hostname/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called delete /vm/:hostname/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:hostname]}") call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:hostname]}")
end end
put '/vm/:hostname/?' do put '/vm/:hostname/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called put /vm/:hostname/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:hostname]}") call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:hostname]}")
end end
post '/vm/:hostname/snapshot/?' do post '/vm/:hostname/snapshot/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called post /vm/:hostname/snapshot/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:hostname]}/snapshot") call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:hostname]}/snapshot")
end end
post '/vm/:hostname/snapshot/:snapshot/?' do post '/vm/:hostname/snapshot/:snapshot/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called post /vm/:hostname/snapshot/:snapshot/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:hostname]}/snapshot/#{params[:snapshot]}") call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:hostname]}/snapshot/#{params[:snapshot]}")
end end
put '/vm/:hostname/disk/:size/?' do put '/vm/:hostname/disk/:size/?' do
puts "DEPRECATION WARNING a client (#{request.user_agent}) called put /vm/:hostname/disk/:size/? and got redirected to api_version=1, this behavior will change in the next major version, please modify the client to use v2 in advance"
call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:hostname]}/disk/#{params[:size]}") call env.merge('PATH_INFO' => "/api/v#{api_version}/vm/#{params[:hostname]}/disk/#{params[:size]}")
end end
end end