From d8098793ea571231d6668eac2973831e1d2fbb4b Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 9 Jan 2024 23:45:52 +0900 Subject: [PATCH] Restart httpd after config change This fixes the missing notifications so that the httpd service is properly restarted after config files are updated. This also realigns package resources for separate dasobhards to the global install phase because these packages should be installed before config phase. Related-Bug: #2048037 Change-Id: I8331c6c528391401c57b450be6bf75829179a9f8 --- manifests/dashboard.pp | 2 +- manifests/deps.pp | 16 ++++++++-------- manifests/init.pp | 2 -- manifests/wsgi/apache.pp | 3 +-- spec/defines/horizon_dashboard_spec.rb | 8 ++++---- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/manifests/dashboard.pp b/manifests/dashboard.pp index 2ae4658c..4f858fad 100644 --- a/manifests/dashboard.pp +++ b/manifests/dashboard.pp @@ -56,6 +56,6 @@ The class allows more flexible customization of the ${dashboard} dashboard.") ensure_packages($dashboard_package_name, { 'ensure' => $ensure, - 'tag' => ['horizon-dashboard-package'] + 'tag' => ['horizon-package'] }) } diff --git a/manifests/deps.pp b/manifests/deps.pp index 720a521b..0414ad78 100644 --- a/manifests/deps.pp +++ b/manifests/deps.pp @@ -25,15 +25,13 @@ class horizon::deps { -> Package<| tag == 'horizon-package' |> ~> anchor { 'horizon::install::end': } -> anchor { 'horizon::config::begin': } + -> Concat<| tag == 'django-config' |> ~> anchor { 'horizon::config::end': } - -> anchor { 'horizon::compress::begin': } - -> Exec<| tag == 'horizon-compress' |> + ~> anchor { 'horizon::compress::begin': } + ~> Exec<| tag == 'horizon-compress' |> ~> anchor { 'horizon::compress::end': } - -> anchor { 'horizon::dashboard::begin': } - -> Package<| tag == 'horizon-dashboard-package' |> - ~> anchor { 'horizon::dashboard::end': } - -> anchor { 'horizon::service::begin': } - -> Service<| title == 'httpd' |> + ~> anchor { 'horizon::service::begin': } + ~> Service<| title == 'httpd' |> ~> anchor { 'horizon::service::end': } # policy config should occur in the config block @@ -41,8 +39,10 @@ class horizon::deps { -> Openstacklib::Policy<| tag == 'horizon' |> -> Anchor['horizon::config::end'] + # Regenerate django cache after package update + Anchor['horizon::install::end'] ~> Anchor['horizon::compress::begin'] + # Installation or config changes will always restart services. Anchor['horizon::install::end'] ~> Anchor['horizon::service::begin'] Anchor['horizon::config::end'] ~> Anchor['horizon::service::begin'] - Anchor['horizon::dashboard::end'] ~> Anchor['horizon::service::begin'] } diff --git a/manifests/init.pp b/manifests/init.pp index 5f0a250a..63925df8 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -717,7 +717,6 @@ Use PyMemcacheCache backend instead") owner => $::horizon::params::wsgi_user, group => $::horizon::params::wsgi_group, show_diff => false, - require => Anchor['horizon::config::begin'], tag => ['django-config'], } @@ -744,7 +743,6 @@ Use PyMemcacheCache backend instead") refreshonly => true, tag => ['horizon-compress'], } - Concat<| tag == 'django-config' |> ~> Exec['refresh_horizon_django_compress'] } } diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index d91fcfdf..37fa3e30 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -214,8 +214,7 @@ class horizon::wsgi::apache ( fail("Invalid redirect type '${redirect_type} provided.") } - Package['horizon'] -> Package['httpd'] - Concat[$::horizon::params::config_file] ~> Service['httpd'] + Anchor['horizon::install::end'] -> Package['httpd'] $unix_user = $::horizon::params::wsgi_user $unix_group = $::horizon::params::wsgi_group diff --git a/spec/defines/horizon_dashboard_spec.rb b/spec/defines/horizon_dashboard_spec.rb index 33841fca..c814b4f2 100644 --- a/spec/defines/horizon_dashboard_spec.rb +++ b/spec/defines/horizon_dashboard_spec.rb @@ -26,7 +26,7 @@ describe 'horizon::dashboard' do context 'with default' do it { should contain_package(platform_params[:heat_dashboard_package_name]).with( :ensure => 'installed', - :tag => ['horizon-dashboard-package'] + :tag => ['horizon-package'] )} end @@ -39,7 +39,7 @@ describe 'horizon::dashboard' do it { should contain_package(platform_params[:heat_dashboard_package_name]).with( :ensure => 'absent', - :tag => ['horizon-dashboard-package'] + :tag => ['horizon-package'] )} end end @@ -48,7 +48,7 @@ describe 'horizon::dashboard' do context 'with default' do it { should contain_package('python3-heat-dashboard').with( :ensure => 'installed', - :tag => ['horizon-dashboard-package'] + :tag => ['horizon-package'] )} end end @@ -57,7 +57,7 @@ describe 'horizon::dashboard' do context 'with default' do it { should contain_package('python3-heat-dashboard').with( :ensure => 'installed', - :tag => ['horizon-dashboard-package'] + :tag => ['horizon-package'] )} end end