From cb1ed62563af554302cd0fdcde39a1f88c4b3c8f Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Thu, 12 May 2016 16:48:01 -0400 Subject: [PATCH] stop managing eventlet service on RedHat RedHat packaging dropped the eventlet service (openstack-keystone) so we no longer need to manage it (we used to stop the service before starting httpd to make sure apache can start without binding issue). So we still maintain the service stop for Debian & Ubuntu, since they sitll provide the scripts. Once they'll drop it, we'll drop the Service resource and deprecate keystone::service class that will be useless. Change-Id: Iecef6f2829ef4bf9162e77ef024d53eedf485726 --- manifests/init.pp | 20 +++++++++++--------- spec/classes/keystone_spec.rb | 29 ++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 4235c9c6a..7ae2b5b98 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -925,16 +925,18 @@ class keystone( warning('Keystone under Eventlet has been deprecated during the Kilo cycle. Support for deploying under eventlet will be dropped as of the M-release of OpenStack.') } elsif $service_name == 'httpd' { include ::apache::params - class { '::keystone::service': - ensure => 'stopped', - service_name => $::keystone::params::service_name, - enable => false, - validate => false, - } $service_name_real = $::apache::params::service_name - # leave this here because Ubuntu packages will start Keystone and we need it stopped - # before apache can run - Service['keystone'] -> Service[$service_name_real] + if $::osfamily == 'Debian' { + class { '::keystone::service': + ensure => 'stopped', + service_name => $::keystone::params::service_name, + enable => false, + validate => false, + } + # leave this here because Ubuntu packages will start Keystone and we need it stopped + # before apache can run + Service['keystone'] -> Service[$service_name_real] + } } else { fail('Invalid service_name. Either keystone/openstack-keystone for running as a standalone service, or httpd for being run by a httpd server') } diff --git a/spec/classes/keystone_spec.rb b/spec/classes/keystone_spec.rb index 2f4fd38da..6b48954f2 100644 --- a/spec/classes/keystone_spec.rb +++ b/spec/classes/keystone_spec.rb @@ -270,7 +270,7 @@ describe 'keystone' do end end - shared_examples_for "when using default class parameters for httpd" do + shared_examples_for "when using default class parameters for httpd on Debian" do let :params do httpd_params end @@ -299,6 +299,29 @@ describe 'keystone' do ) } end + shared_examples_for "when using default class parameters for httpd on RedHat" do + let :params do + httpd_params + end + + let :pre_condition do + 'include ::keystone::wsgi::apache' + end + + it_configures 'core keystone examples', httpd_params + + it do + expect { + is_expected.to contain_service(platform_parameters[:service_name]).with('ensure' => 'running') + }.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected that the catalogue would contain Service\[#{platform_parameters[:service_name]}\]/) + end + + it { is_expected.to contain_service('httpd').with_before(/Anchor\[keystone::service::end\]/) } + it { is_expected.to contain_exec('restart_keystone').with( + 'command' => "service #{platform_parameters[:httpd_service_name]} restart", + ) } + end + describe 'when using invalid service name for keystone' do let (:params) { {'service_name' => 'foo'}.merge(default_params) } @@ -918,7 +941,7 @@ describe 'keystone' do } end - it_configures 'when using default class parameters for httpd' + it_configures 'when using default class parameters for httpd on RedHat' it_configures 'when configuring default domain' end @@ -938,7 +961,7 @@ describe 'keystone' do } end - it_configures 'when using default class parameters for httpd' + it_configures 'when using default class parameters for httpd on Debian' it_configures 'when configuring default domain' end