diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-06-07 14:50:38 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-06-09 16:00:24 +0800 |
commit | 781d35c191be62366f6c7855f3314a9c371aa0e6 (patch) | |
tree | 1b5d1edaed93805cc85ba7cee5e7510da40397ab /lib | |
parent | 894d22f49a24377aad7e693d0343397bc349e412 (diff) | |
download | gitlab-ce-781d35c191be62366f6c7855f3314a9c371aa0e6.tar.gz |
Prefer attributes_for_keys so that it ignores nils
Also add a test for setting locked.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ci/api/runners.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/ci/api/runners.rb b/lib/ci/api/runners.rb index b4b7261fa3b..bcc82969eb3 100644 --- a/lib/ci/api/runners.rb +++ b/lib/ci/api/runners.rb @@ -28,13 +28,9 @@ module Ci post "register" do required_attributes! [:token] - attributes = { description: params[:description], - tag_list: params[:tag_list], - locked: !!params[:locked] } - - unless params[:run_untagged].nil? - attributes[:run_untagged] = params[:run_untagged] - end + attributes = attributes_for_keys( + [:description, :tag_list, :run_untagged, :locked] + ) runner = if runner_registration_token_valid? |