41 lines
1.0 KiB
Ruby
41 lines
1.0 KiB
Ruby
|
|
module Devops
|
|
module Version2_0
|
|
module Routes
|
|
module DeployRoutes
|
|
|
|
def self.registered(app)
|
|
app.after "/deploy" do
|
|
statistic
|
|
end
|
|
|
|
app.before "/deploy" do
|
|
check_headers :content_type
|
|
check_privileges("server", "x")
|
|
broadcast(:devops_deploy, "deploy")
|
|
end
|
|
|
|
# Run chef-client on reserved server
|
|
#
|
|
# * *Request*
|
|
# - method : POST
|
|
# - headers :
|
|
# - Content-Type: application/json
|
|
# - body :
|
|
# {
|
|
# "names": [], -> array of servers names to run chef-client
|
|
# "tags": [], -> array of tags to apply on each server before running chef-client
|
|
# "trace": true -> return output in stream
|
|
# }
|
|
#
|
|
# * *Returns* : text stream
|
|
app.post "/deploy", &Devops::Version2_0::Handler::Deploy.deploy
|
|
|
|
puts "Deploy routes initialized"
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|
|
end
|