diff --git a/manifests/dashboard.pp b/manifests/dashboard.pp index d6bbbee..1ce87d9 100644 --- a/manifests/dashboard.pp +++ b/manifests/dashboard.pp @@ -91,8 +91,14 @@ class murano::dashboard( path => [ '/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/' ], } + if $::os_package_type == 'ubuntu' { + $collect_static_command = "${collect_static_script} collectstatic --noinput" + } else { + $collect_static_command = "${collect_static_script} collectstatic --noinput --clear" + } + exec { 'django_collectstatic': - command => "${collect_static_script} collectstatic --noinput --clear", + command => $collect_static_command, environment => [ "APACHE_USER=${::apache::params::user}", "APACHE_GROUP=${::apache::params::group}", diff --git a/spec/classes/murano_dashboard_spec.rb b/spec/classes/murano_dashboard_spec.rb index 5530950..d376421 100644 --- a/spec/classes/murano_dashboard_spec.rb +++ b/spec/classes/murano_dashboard_spec.rb @@ -7,6 +7,14 @@ describe 'murano::dashboard' do end shared_examples_for 'with default class parameters' do + let(:collect_static_command) { + if facts[:os_package_type] == 'ubuntu' + "/usr/share/openstack-dashboard/manage.py collectstatic --noinput" + else + "/usr/share/openstack-dashboard/manage.py collectstatic --noinput --clear" + end + } + it { is_expected.to contain_package('murano-dashboard').with({ :ensure => 'present', :name => 'python-murano-dashboard', @@ -39,7 +47,7 @@ describe 'murano::dashboard' do })} it { is_expected.to contain_exec('django_collectstatic').with({ - :command => '/usr/share/openstack-dashboard/manage.py collectstatic --noinput --clear' + :command => collect_static_command })} it { is_expected.to contain_exec('django_compressstatic').with({ @@ -64,6 +72,14 @@ describe 'murano::dashboard' do } end + let(:collect_static_command) { + if facts[:os_package_type] == 'ubuntu' + "/bin/openstack-dashboard/manage.py collectstatic --noinput" + else + "/bin/openstack-dashboard/manage.py collectstatic --noinput --clear" + end + } + it { is_expected.to contain_package('murano-dashboard').with({ :ensure => 'present', :name => 'python-murano-dashboard', @@ -95,7 +111,7 @@ describe 'murano::dashboard' do })} it { is_expected.to contain_exec('django_collectstatic').with({ - :command => '/bin/openstack-dashboard/manage.py collectstatic --noinput --clear' + :command => collect_static_command })} it { is_expected.to contain_exec('django_compressstatic').with({