diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2015-12-23 10:48:10 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2015-12-23 10:48:10 +0100 |
commit | aff22e6f7a020fa757bebce7574256925486e381 (patch) | |
tree | 0b7c6aa692d4b5624808348ec03da59949ef2f9b | |
parent | 37731ba1a1a926f1e4bd6dc620066822f3a4b0da (diff) | |
download | gitlab-ce-fix/ci-runners-token-persistence.tar.gz |
Use method that creates runners registration tokenfix/ci-runners-token-persistence
`runners_registration_token` now creates a new token if it is blank.
-rw-r--r-- | app/models/application_setting.rb | 4 | ||||
-rw-r--r-- | app/views/admin/runners/index.html.haml | 2 | ||||
-rw-r--r-- | lib/ci/api/helpers.rb | 2 | ||||
-rw-r--r-- | spec/features/admin/admin_runners_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/ci/api/runners_spec.rb | 1 |
5 files changed, 7 insertions, 4 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 1f4e8b3ef24..724429e7558 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -134,4 +134,8 @@ class ApplicationSetting < ActiveRecord::Base /x) self.restricted_signup_domains.reject! { |d| d.empty? } end + + def runners_registration_token + ensure_runners_registration_token! + end end diff --git a/app/views/admin/runners/index.html.haml b/app/views/admin/runners/index.html.haml index c5fb3c95506..c407972cd08 100644 --- a/app/views/admin/runners/index.html.haml +++ b/app/views/admin/runners/index.html.haml @@ -3,7 +3,7 @@ To register a new runner you should enter the following registration token. With this token the runner will request a unique runner token and use that for future communication. Registration token is - %code{ id: 'runners-token' } #{current_application_settings.ensure_runners_registration_token} + %code{ id: 'runners-token' } #{current_application_settings.runners_registration_token} .bs-callout.clearfix .pull-left diff --git a/lib/ci/api/helpers.rb b/lib/ci/api/helpers.rb index 443563c2e4a..1c91204e98c 100644 --- a/lib/ci/api/helpers.rb +++ b/lib/ci/api/helpers.rb @@ -19,7 +19,7 @@ module Ci end def runner_registration_token_valid? - params[:token] == current_application_settings.ensure_runners_registration_token + params[:token] == current_application_settings.runners_registration_token end def update_runner_last_contact diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index 66a2cc0c157..26d03944b8a 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -63,7 +63,7 @@ describe "Admin Runners" do end describe 'runners registration token' do - let!(:token) { current_application_settings.ensure_runners_registration_token } + let!(:token) { current_application_settings.runners_registration_token } before { visit admin_runners_path } it 'has a registration token' do diff --git a/spec/requests/ci/api/runners_spec.rb b/spec/requests/ci/api/runners_spec.rb index 567da013e6f..5942aa7a1b5 100644 --- a/spec/requests/ci/api/runners_spec.rb +++ b/spec/requests/ci/api/runners_spec.rb @@ -8,7 +8,6 @@ describe Ci::API::API do before do stub_gitlab_calls - stub_application_setting(ensure_runners_registration_token: registration_token) stub_application_setting(runners_registration_token: registration_token) end |