From acce57da8b61a3885fdb20275237de9abdea8b69 Mon Sep 17 00:00:00 2001 From: Mike Dorman Date: Fri, 21 Nov 2014 09:57:46 -0700 Subject: [PATCH] Add service_name parameter to neuron::server class Allow for customizing the name of the neutron-server service. The use case here is for organizations that build their own OpenStack packages, and the service names may differ slightly from the upstream distro defaults. Change-Id: If539c51279a8a675e40e356fb4445b6324b75936 --- manifests/keystone/auth.pp | 4 ++-- manifests/server.pp | 7 ++++++- spec/classes/neutron_server_spec.rb | 10 ++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/manifests/keystone/auth.pp b/manifests/keystone/auth.pp index 7abdbc488..d7de78522 100644 --- a/manifests/keystone/auth.pp +++ b/manifests/keystone/auth.pp @@ -92,10 +92,10 @@ class neutron::keystone::auth ( $real_public_port = $public_port } - Keystone_endpoint["${region}/${real_service_name}"] ~> Service <| name == 'neutron-server' |> + Keystone_endpoint["${region}/${real_service_name}"] ~> Service <| title == 'neutron-server' |> if $configure_user_role { - Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'neutron-server' |> + Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| title == 'neutron-server' |> } keystone::resource::service_identity { $auth_name: diff --git a/manifests/server.pp b/manifests/server.pp index a113f0913..e204d2c23 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -16,6 +16,10 @@ # (optional) Whether to start/stop the service # Defaults to true # +# [*service_name*] +# (optional) The name of the neutron-server service +# Defaults to 'neutron-server' +# # [*log_file*] # REMOVED: Use log_file of neutron class instead. # @@ -189,6 +193,7 @@ class neutron::server ( $package_ensure = 'present', $enabled = true, $manage_service = true, + $service_name = $::neutron::params::server_service, $auth_password = false, $auth_type = 'keystone', $auth_host = 'localhost', @@ -388,7 +393,7 @@ class neutron::server ( service { 'neutron-server': ensure => $service_ensure, - name => $::neutron::params::server_service, + name => $service_name, enable => $enabled, hasstatus => true, hasrestart => true, diff --git a/spec/classes/neutron_server_spec.rb b/spec/classes/neutron_server_spec.rb index fef936633..e365805e6 100644 --- a/spec/classes/neutron_server_spec.rb +++ b/spec/classes/neutron_server_spec.rb @@ -94,6 +94,7 @@ describe 'neutron::server' do should contain_neutron_api_config('filter:authtoken/auth_admin_prefix').with( :ensure => 'absent' ) + should contain_service('neutron-server').with_name('neutron-server') should contain_neutron_config('DEFAULT/api_workers').with_value(facts[:processorcount]) should contain_neutron_config('DEFAULT/rpc_workers').with_value(facts[:processorcount]) should contain_neutron_config('DEFAULT/agent_down_time').with_value(p[:agent_down_time]) @@ -152,6 +153,15 @@ describe 'neutron::server' do expect { subject }.to raise_error(Puppet::Error, /min_l3_agents_per_router should be less than or equal to max_l3_agents_per_router./) end end + + context 'with custom service name' do + before :each do + params.merge!(:service_name => 'custom-service-name') + end + it 'should configure proper service name' do + should contain_service('neutron-server').with_name('custom-service-name') + end + end end shared_examples_for 'a neutron server with auth_admin_prefix set' do