From 5108cb3a75c8df12d644ef26c4a7ca78c14c6d1f Mon Sep 17 00:00:00 2001 From: bodepd Date: Mon, 24 Jun 2013 13:05:44 -0700 Subject: [PATCH] Add configuration for swift auth in controller The openstack::keystone class already supports the ability to configure authorization for swift, but it was not possible to set this configuration in the openstack::controller class. This commits adds two parameters to openstack::controller: - swift - Indicates that swift auth should be configured in keystone - swift_user_password - password to use for swift user in keystone These commits allow swift to be configured together with this controller class. Change-Id: I93455da30786d41ae6e56b32f53f30fa57852df0 --- manifests/controller.pp | 12 ++++++++ manifests/keystone.pp | 3 ++ spec/classes/openstack_controller_spec.rb | 37 +++++++++++++++++------ 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/manifests/controller.pp b/manifests/controller.pp index 8874200..24efe9e 100644 --- a/manifests/controller.pp +++ b/manifests/controller.pp @@ -63,6 +63,13 @@ # [horizon_app_links] array as in '[ ["Nagios","http://nagios_addr:port/path"],["Ganglia","http://ganglia_addr"] ]' # [enabled] Whether services should be enabled. This parameter can be used to # implement services in active-passive modes for HA. Optional. Defaults to true. +# [swift] +# Whether or not to configure keystone for swift authorization. +# (Optional). Defaults to false. +# +# [swift_user_password] +# Auth password for swift. +# (Optional) Defaults to false. Required if swift is set to true. # # === Examples # @@ -101,6 +108,7 @@ class openstack::controller ( $quantum_db_password = false, $cinder_user_password = false, $cinder_db_password = false, + $swift_user_password = false, # Database $db_host = '127.0.0.1', $db_type = 'mysql', @@ -178,6 +186,8 @@ class openstack::controller ( $quantum_auth_url = 'http://127.0.0.1:35357/v2.0', $enable_quantum_server = true, $ovs_local_ip = false, + # swift + $swift = false, $enabled = true ) { @@ -264,6 +274,8 @@ class openstack::controller ( cinder_user_password => $cinder_user_password, quantum => $quantum, quantum_user_password => $quantum_user_password, + swift => $swift, + swift_user_password => $swift_user_password, enabled => $enabled, bind_host => $keystone_bind_address, } diff --git a/manifests/keystone.pp b/manifests/keystone.pp index d763dcc..97396d6 100644 --- a/manifests/keystone.pp +++ b/manifests/keystone.pp @@ -24,6 +24,9 @@ # [glance] Set up glance endpoints and auth. Optional. Defaults to true # [nova] Set up nova endpoints and auth. Optional. Defaults to true # [swift] Set up swift endpoints and auth. Optional. Defaults to false +# [swift_user_password] +# Auth password for swift. +# (Optional) Defaults to false. # [enabled] If the service is active (true) or passive (false). # Optional. Defaults to true # diff --git a/spec/classes/openstack_controller_spec.rb b/spec/classes/openstack_controller_spec.rb index ee690df..1961c81 100644 --- a/spec/classes/openstack_controller_spec.rb +++ b/spec/classes/openstack_controller_spec.rb @@ -175,16 +175,22 @@ describe 'openstack::controller' do default_params end - it { should contain_class('keystone').with( - :verbose => 'False', - :debug => 'False', - :catalog_type => 'sql', - :enabled => true, - :admin_token => 'keystone_admin_token', - :sql_connection => "mysql://keystone:keystone_pass@127.0.0.1/keystone" - ) } + it 'should configure default keystone configuration' do + + should contain_class('openstack::keystone').with( + :swift => false, + :swift_user_password => false + ) + + should contain_class('keystone').with( + :verbose => 'False', + :debug => 'False', + :catalog_type => 'sql', + :enabled => true, + :admin_token => 'keystone_admin_token', + :sql_connection => "mysql://keystone:keystone_pass@127.0.0.1/keystone" + ) - it 'should contain endpoints' do should contain_class('keystone::roles::admin').with( :email => 'some_user@some_fake_email_address.foo', :password => 'ChangeMe', @@ -209,7 +215,18 @@ describe 'openstack::controller' do :admin_address => '10.0.0.1', :region => 'RegionOne' ) - end + end + end + context 'when configuring swift' do + before :each do + params.merge!(:swift => true, :swift_user_password => 'foo') + end + it 'should configure swift auth in keystone' do + should contain_class('openstack::keystone').with( + :swift => true, + :swift_user_password => 'foo' + ) + end end end context 'when not enabled' do