From 62b4476db480bdddb3b3953cc4a88529a1bb55f1 Mon Sep 17 00:00:00 2001 From: "Matthew J. Black" Date: Wed, 6 Jul 2016 14:04:17 -0400 Subject: [PATCH] Horizon django cache compress on ubuntu Change splits the exec for the manage.py to be split into collectstatic and compress. Previously, both actions were only executed on redhat but ubuntu requires compress on config change too. Change-Id: Ib7238f9bc107c372759d1ebbeb88469806267769 Closes-Bug: #1599536 --- manifests/init.pp | 15 ++++++++++++--- ...go_cache_compress_ubuntu-e1807c69e52048fd.yaml | 4 ++++ spec/classes/horizon_init_spec.rb | 10 +++++++++- 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/horizon_django_cache_compress_ubuntu-e1807c69e52048fd.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 329fb665..7b6faa95 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -433,13 +433,22 @@ class horizon( } exec { 'refresh_horizon_django_cache': - command => "${::horizon::params::manage_py} collectstatic --noinput --clear && ${::horizon::params::manage_py} compress --force", + command => "${::horizon::params::manage_py} collectstatic --noinput --clear", refreshonly => true, require => Package['horizon'], } - if $::os_package_type == 'rpm' and $compress_offline { - Concat[$::horizon::params::config_file] ~> Exec['refresh_horizon_django_cache'] + exec { 'refresh_horizon_django_compress': + command => "${::horizon::params::manage_py} compress --force", + refreshonly => true, + require => Package['horizon'], + } + + if $compress_offline { + Concat[$::horizon::params::config_file] ~> Exec['refresh_horizon_django_compress'] + if $::os_package_type == 'rpm' { + Concat[$::horizon::params::config_file] ~> Exec['refresh_horizon_django_cache'] -> Exec['refresh_horizon_django_compress'] + } } if $configure_apache { diff --git a/releasenotes/notes/horizon_django_cache_compress_ubuntu-e1807c69e52048fd.yaml b/releasenotes/notes/horizon_django_cache_compress_ubuntu-e1807c69e52048fd.yaml new file mode 100644 index 00000000..166184e8 --- /dev/null +++ b/releasenotes/notes/horizon_django_cache_compress_ubuntu-e1807c69e52048fd.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - Horizon Offline Generation Error on ubuntu systems. Previously, the 'manage.py compress' only ran on redhat. This change + allows the command to be executed on ubuntu also. diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index 84aa2621..876bae1a 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -31,14 +31,20 @@ describe 'horizon' do ) } it { is_expected.to contain_exec('refresh_horizon_django_cache').with({ - :command => '/usr/share/openstack-dashboard/manage.py collectstatic --noinput --clear && /usr/share/openstack-dashboard/manage.py compress --force', + :command => '/usr/share/openstack-dashboard/manage.py collectstatic --noinput --clear', + :refreshonly => true, + })} + it { is_expected.to contain_exec('refresh_horizon_django_compress').with({ + :command => '/usr/share/openstack-dashboard/manage.py compress --force', :refreshonly => true, })} it { if facts[:os_package_type] == 'rpm' is_expected.to contain_concat(platforms_params[:config_file]).that_notifies('Exec[refresh_horizon_django_cache]') + is_expected.to contain_concat(platforms_params[:config_file]).that_notifies('Exec[refresh_horizon_django_compress]') else is_expected.to_not contain_concat(platforms_params[:config_file]).that_notifies('Exec[refresh_horizon_django_cache]') + is_expected.to contain_concat(platforms_params[:config_file]).that_notifies('Exec[refresh_horizon_django_compress]') end } @@ -175,6 +181,7 @@ describe 'horizon' do end it { is_expected.not_to contain_file(platforms_params[:config_file]).that_notifies('Exec[refresh_horizon_django_cache]') } + it { is_expected.not_to contain_file(platforms_params[:config_file]).that_notifies('Exec[refresh_horizon_django_compress]') } it { is_expected.to contain_file(params[:file_upload_temp_dir]) } end @@ -193,6 +200,7 @@ describe 'horizon' do end it { is_expected.to contain_exec('refresh_horizon_django_cache') } + it { is_expected.to contain_exec('refresh_horizon_django_compress') } end context 'installs python memcache library when cache_backend is set to memcache' do