#755: update PublishBuildListContainerObserver, some refactoring
This commit is contained in:
parent
8ef5129e00
commit
f00b168b20
|
@ -1,10 +1,6 @@
|
||||||
module AbfWorker
|
module AbfWorker
|
||||||
class IsoWorkerObserver
|
class IsoWorkerObserver
|
||||||
BUILD_COMPLETED = 0
|
extend AbfWorker::ObserverHelper
|
||||||
BUILD_FAILED = 1
|
|
||||||
BUILD_PENDING = 2
|
|
||||||
BUILD_STARTED = 3
|
|
||||||
BUILD_CANCELED = 4
|
|
||||||
@queue = :iso_worker_observer
|
@queue = :iso_worker_observer
|
||||||
|
|
||||||
def self.perform(options)
|
def self.perform(options)
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
module AbfWorker
|
||||||
|
module ObserverHelper
|
||||||
|
BUILD_COMPLETED = 0
|
||||||
|
BUILD_FAILED = 1
|
||||||
|
BUILD_PENDING = 2
|
||||||
|
BUILD_STARTED = 3
|
||||||
|
BUILD_CANCELED = 4
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,9 +1,33 @@
|
||||||
module AbfWorker
|
module AbfWorker
|
||||||
class PublishBuildListContainerObserver
|
class PublishBuildListContainerObserver
|
||||||
|
extend AbfWorker::ObserverHelper
|
||||||
@queue = :publish_build_list_container_observer
|
@queue = :publish_build_list_container_observer
|
||||||
|
|
||||||
def self.perform(options)
|
def self.perform(options)
|
||||||
# TODO: ...
|
bl = BuildList.find options['id']
|
||||||
|
status = options['status'].to_i
|
||||||
|
case status
|
||||||
|
when BUILD_COMPLETED
|
||||||
|
bl.published
|
||||||
|
update_results(bl, options)
|
||||||
|
when BUILD_FAILED
|
||||||
|
bl.fail_publish
|
||||||
|
update_results(bl, options)
|
||||||
|
when BUILD_CANCELED
|
||||||
|
bl.fail_publish
|
||||||
|
update_results(bl, options)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class << self
|
||||||
|
protected
|
||||||
|
|
||||||
|
def update_results(bl, options)
|
||||||
|
results = bl.results + options['results']
|
||||||
|
bl.results = results.sort_by{ |r| r['file_name'] }
|
||||||
|
bl.save!
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
module AbfWorker
|
module AbfWorker
|
||||||
class RpmWorkerObserver
|
class RpmWorkerObserver
|
||||||
BUILD_COMPLETED = 0
|
extend AbfWorker::ObserverHelper
|
||||||
BUILD_FAILED = 1
|
|
||||||
BUILD_PENDING = 2
|
|
||||||
BUILD_STARTED = 3
|
|
||||||
BUILD_CANCELED = 4
|
|
||||||
|
|
||||||
@queue = :rpm_worker_observer
|
@queue = :rpm_worker_observer
|
||||||
|
|
||||||
def self.perform(options)
|
def self.perform(options)
|
||||||
|
|
Loading…
Reference in New Issue