Commit 7805eea3 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Refactor old formad handling in lib/ci/api/entities.rb

parent fa0a326b
...@@ -45,15 +45,13 @@ module Ci ...@@ -45,15 +45,13 @@ module Ci
expose :artifacts_expire_at, if: ->(build, _) { build.artifacts? } expose :artifacts_expire_at, if: ->(build, _) { build.artifacts? }
expose :options do |model| expose :options do |model|
options = model.options
# This part ensures that output of old API is still the same after adding support # This part ensures that output of old API is still the same after adding support
# for extended docker configuration options, used by new API # for extended docker configuration options, used by new API
# #
# I'm leaving this here, not in the model, because it should be removed at the same time # I'm leaving this here, not in the model, because it should be removed at the same time
# when old API will be removed (planned for August 2017). # when old API will be removed (planned for August 2017).
options[:image] = options[:image][:name] if options[:image].present? && options[:image].is_a?(Hash) model.options.dup.tap do |options|
if options[:services].present? options[:image] = options[:image][:name] if options[:image].is_a?(Hash)
options[:services].map! do |service| options[:services].map! do |service|
if service.is_a?(Hash) if service.is_a?(Hash)
service[:name] service[:name]
...@@ -62,8 +60,6 @@ module Ci ...@@ -62,8 +60,6 @@ module Ci
end end
end end
end end
options
end end
expose :timeout do |model| expose :timeout do |model|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment