#680: done
This commit is contained in:
parent
85cb61e6b5
commit
f9b9682c6d
@ -35,8 +35,6 @@ module Devops
|
||||
# {"name" : "project_1"}
|
||||
# ]
|
||||
app.get_with_headers "/projects", :headers => [:accept] do
|
||||
puts env.inspect
|
||||
puts env["app"].inspect
|
||||
check_privileges("project", "r")
|
||||
json Devops::API2_0::Handler::Project.new(request).projects.map(&:to_hash_list)
|
||||
end
|
||||
|
||||
@ -131,7 +131,6 @@ module Devops
|
||||
|
||||
# all exceptions are handled in @validate! method
|
||||
def validate_model(model)
|
||||
DevopsLogger.logger.debug validators.inspect
|
||||
validators.each do |validator|
|
||||
validator.new(model).validate!
|
||||
end
|
||||
|
||||
@ -16,6 +16,8 @@ require "lib/knife/knife_factory"
|
||||
class Worker
|
||||
include Sidekiq::Worker
|
||||
|
||||
attr_accessor :out
|
||||
|
||||
module STATUS
|
||||
INIT = "init"
|
||||
RUNNING = "running"
|
||||
@ -34,12 +36,14 @@ class Worker
|
||||
uri.to_s
|
||||
end
|
||||
|
||||
def self.start_sync(worker_class, request, job_options)
|
||||
def self.start_sync(worker_class, request, job_options, out)
|
||||
stringified_options = {}
|
||||
job_options.each do |key, value|
|
||||
stringified_options[key.to_s] = value
|
||||
end
|
||||
worker_class.new.perform(stringified_options)
|
||||
w = worker_class.new
|
||||
w.out = out
|
||||
w.perform(stringified_options)
|
||||
end
|
||||
|
||||
def self.set_status id, status
|
||||
@ -81,8 +85,9 @@ class Worker
|
||||
File.open(file, "w") do |out|
|
||||
begin
|
||||
update_job_status(STATUS::RUNNING)
|
||||
self.out = out
|
||||
|
||||
job_result = yield(provider, out, file)
|
||||
job_result = yield(provider, file)
|
||||
canonical_status = (job_result == 0 ? STATUS::COMPLETED : STATUS::FAILED)
|
||||
update_job_status(canonical_status)
|
||||
rescue StandardError, RecordNotFound => e
|
||||
@ -124,7 +129,6 @@ class Worker
|
||||
def convert_config conf
|
||||
config = {}
|
||||
conf.each {|k,v| config[k.is_a?(String) ? k.to_sym : k] = v}
|
||||
DevopsLogger.logger.debug "Config: #{config.inspect}"
|
||||
config
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user