summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2017-06-12 12:56:14 +0200
committerTomasz Maczukin <tomasz@maczukin.pl>2017-06-12 12:58:36 +0200
commit7805eea3c705669f9a46bfabf25d550cd7422745 (patch)
treeea91684c48dc96d761c18435eeea4e58ffbd9eb5
parentfa0a326bf2678b9386a79dfd5281dee1e5ee8af8 (diff)
downloadgitlab-ce-7805eea3c705669f9a46bfabf25d550cd7422745.tar.gz
Refactor old formad handling in lib/ci/api/entities.rb
-rw-r--r--lib/ci/api/entities.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/ci/api/entities.rb b/lib/ci/api/entities.rb
index 6733d1a33aa..6b82b2b4f13 100644
--- a/lib/ci/api/entities.rb
+++ b/lib/ci/api/entities.rb
@@ -45,15 +45,13 @@ module Ci
expose :artifacts_expire_at, if: ->(build, _) { build.artifacts? }
expose :options do |model|
- options = model.options
-
# This part ensures that output of old API is still the same after adding support
# 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
# when old API will be removed (planned for August 2017).
- options[:image] = options[:image][:name] if options[:image].present? && options[:image].is_a?(Hash)
- if options[:services].present?
+ model.options.dup.tap do |options|
+ options[:image] = options[:image][:name] if options[:image].is_a?(Hash)
options[:services].map! do |service|
if service.is_a?(Hash)
service[:name]
@@ -62,8 +60,6 @@ module Ci
end
end
end
-
- options
end
expose :timeout do |model|