Commit 3e695048 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Use method that creates runners registration token

`runners_registration_token` now creates a new token if it is blank.
parent 37731ba1
...@@ -134,4 +134,8 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -134,4 +134,8 @@ class ApplicationSetting < ActiveRecord::Base
/x) /x)
self.restricted_signup_domains.reject! { |d| d.empty? } self.restricted_signup_domains.reject! { |d| d.empty? }
end end
def runners_registration_token
ensure_runners_registration_token!
end
end end
...@@ -46,5 +46,4 @@ module TokenAuthenticatable ...@@ -46,5 +46,4 @@ module TokenAuthenticatable
break token unless self.class.unscoped.find_by(token_field => token) break token unless self.class.unscoped.find_by(token_field => token)
end end
end end
end end
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
To register a new runner you should enter the following registration token. 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. With this token the runner will request a unique runner token and use that for future communication.
Registration token is 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 .bs-callout.clearfix
.pull-left .pull-left
......
...@@ -19,7 +19,7 @@ module Ci ...@@ -19,7 +19,7 @@ module Ci
end end
def runner_registration_token_valid? def runner_registration_token_valid?
params[:token] == current_application_settings.ensure_runners_registration_token params[:token] == current_application_settings.runners_registration_token
end end
def update_runner_last_contact def update_runner_last_contact
......
...@@ -63,7 +63,7 @@ describe "Admin Runners" do ...@@ -63,7 +63,7 @@ describe "Admin Runners" do
end end
describe 'runners registration token' do 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 } before { visit admin_runners_path }
it 'has a registration token' do it 'has a registration token' do
......
...@@ -8,7 +8,6 @@ describe Ci::API::API do ...@@ -8,7 +8,6 @@ describe Ci::API::API do
before do before do
stub_gitlab_calls stub_gitlab_calls
stub_application_setting(ensure_runners_registration_token: registration_token)
stub_application_setting(runners_registration_token: registration_token) stub_application_setting(runners_registration_token: registration_token)
end end
......
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