With the change to a single deltacloud-core provider in -configure (not yet in place), we want to default the url parameter for new providers to this value. A user adding a new provider won't have to know where this is -- it's filled in by default in the form. The user can change it, of course. --- aeolus-conductor.spec.in | 2 ++ src/app/controllers/providers_controller.rb | 1 + src/app/models/provider.rb | 5 +++++ src/config/settings.yml | 1 + 4 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 src/config/settings.yml
diff --git a/aeolus-conductor.spec.in b/aeolus-conductor.spec.in index 9ec229b..c74f60c 100644 --- a/aeolus-conductor.spec.in +++ b/aeolus-conductor.spec.in @@ -234,6 +234,7 @@ touch %{buildroot}%{_localstatedir}/run/%{name}/event_log_position %{__ln_s} -f %{app_root}/config/environments/production.rb %{_sysconfdir}/%{name} %{__ln_s} -f %{app_root}/config/environments/test.rb %{_sysconfdir}/%{name} %{__ln_s} -f %{app_root}/config/database.yml %{_sysconfdir}/%{name} +%{__ln_s} -f %{app_root}/config/settings.yml %{_sysconfdir}/%{name}
%postun # kind of a weird construct. There are two cases where postun gets called; @@ -247,6 +248,7 @@ if [ ! -d %{app_root}/app ]; then rm -f %{_sysconfdir}/%{name}/production.rb rm -f %{_sysconfdir}/%{name}/test.rb rm -f %{_sysconfdir}/%{name}/database.yml + rm -f %{_sysconfdir}/%{name}/settings.yml fi
%post daemons diff --git a/src/app/controllers/providers_controller.rb b/src/app/controllers/providers_controller.rb index 6119f96..1f471d7 100644 --- a/src/app/controllers/providers_controller.rb +++ b/src/app/controllers/providers_controller.rb @@ -21,6 +21,7 @@ class ProvidersController < ApplicationController def new require_privilege(Privilege::CREATE, Provider) @provider = Provider.new + @provider.url = Provider::DEFAULT_DELTACLOUD_URL end
def edit diff --git a/src/app/models/provider.rb b/src/app/models/provider.rb index 8eca2b5..a099c56 100644 --- a/src/app/models/provider.rb +++ b/src/app/models/provider.rb @@ -37,6 +37,11 @@ class Provider < ActiveRecord::Base require 'util/conductor' include PermissionedObject
+ # once we're using settings.yml for other things we should move this + # to a more general location + SETTINGS_CONFIG = YAML.load_file("#{::Rails.root.to_s}/config/settings.yml") + DEFAULT_DELTACLOUD_URL = SETTINGS_CONFIG['default_deltacloud_url'] + has_many :provider_accounts, :dependent => :destroy has_many :hardware_profiles, :dependent => :destroy has_many :realms, :dependent => :destroy diff --git a/src/config/settings.yml b/src/config/settings.yml new file mode 100644 index 0000000..336df68 --- /dev/null +++ b/src/config/settings.yml @@ -0,0 +1 @@ +default_deltacloud_url: http://localhost:3002/api