Merge branch 'dev' of git.stu.neva.ru:cloudtechlab/devops-service into achuchkalov
Conflicts: devops-service/config.ru devops-service/report.rb
This commit is contained in:
commit
81521ee52b
@ -19,14 +19,14 @@ else
|
||||
raise "No config file '#{config_file}' found"
|
||||
end
|
||||
|
||||
config[:devops_home] = File.join(ENV["HOME"], ".devops")
|
||||
puts "Devops home: #{config[:devops_home]}"
|
||||
unless File.exists?(config[:devops_home])
|
||||
FileUtils.mkdir config[:devops_home]
|
||||
puts "Directory '#{config[:devops_home]}' has been created"
|
||||
config[:devops_dir] = File.join(ENV["HOME"], ".devops") if config[:devops_dir].nil?
|
||||
puts "Devops home: #{config[:devops_dir]}"
|
||||
unless File.exists?(config[:devops_dir])
|
||||
FileUtils.mkdir_p config[:devops_dir]
|
||||
puts "Directory '#{config[:devops_dir]}' has been created"
|
||||
end
|
||||
|
||||
config[:report_dir_v2] = File.expand_path(File.join(config[:devops_home], "report", "v2")) unless config[:report_dir_v2]
|
||||
config[:report_dir_v2] = File.expand_path(File.join(config[:devops_dir], "report", "v2")) unless config[:report_dir_v2]
|
||||
[
|
||||
:report_dir_v2
|
||||
].each {|key| d = config[key]; FileUtils.mkdir_p(d) unless File.exists?(d) }
|
||||
@ -34,7 +34,7 @@ config[:report_dir_v2] = File.expand_path(File.join(config[:devops_home], "repor
|
||||
run Rack::URLMap.new({
|
||||
"#{config[:url_prefix]}/v2.0" => DevopsService.new(config),
|
||||
"#{config[:url_prefix]}/client" => Client.new(config),
|
||||
"#{config[:url_prefix]}/v2.0/report" => ReportServer.new(config, "v2"),
|
||||
"#{config[:url_prefix]}/v2.0/report" => ReportRoutes.new(config, "v2"),
|
||||
"#{config[:url_prefix]}/sidekiq" => Sidekiq::Web,
|
||||
"#{config[:url_prefix]}/version" => DevopsVersion.new
|
||||
})
|
||||
|
||||
@ -364,7 +364,7 @@ class MongoConnector
|
||||
|
||||
def save_report r
|
||||
r.created_at = Time.new
|
||||
@reports.insert(r.to_hash)
|
||||
@reports.insert(r.to_mongo_hash)
|
||||
end
|
||||
|
||||
def reports
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
require 'sinatra/base'
|
||||
|
||||
class ReportServer < Sinatra::Base
|
||||
class ReportRoutes < Sinatra::Base
|
||||
|
||||
def initialize config, version
|
||||
super()
|
||||
|
||||
@ -405,7 +405,7 @@ module Version2_0
|
||||
end
|
||||
end
|
||||
else
|
||||
dir = DevopsService.config[:deploy_report_dir_v2]
|
||||
dir = DevopsService.config[:report_dir_v2]
|
||||
files = []
|
||||
uri = URI.parse(request.url)
|
||||
servers.each do |s|
|
||||
@ -416,7 +416,7 @@ module Version2_0
|
||||
end
|
||||
jid = DeployWorker.perform_async(dir, s.to_hash, [], DevopsService.config)
|
||||
logger.info "Job '#{jid}' has been started"
|
||||
uri.path = "#{DevopsService.config[:url_prefix]}/v2.0/report/deploy/" + jid
|
||||
uri.path = "#{DevopsService.config[:url_prefix]}/v2.0/report/" + jid
|
||||
files.push uri.to_s
|
||||
end
|
||||
json files
|
||||
|
||||
10
devops-service/version.rb
Normal file
10
devops-service/version.rb
Normal file
@ -0,0 +1,10 @@
|
||||
require 'sinatra/base'
|
||||
|
||||
class DevopsVersion < Sinatra::Base
|
||||
|
||||
VERSION = "2.0.1"
|
||||
|
||||
get "/" do
|
||||
VERSION
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue
Block a user