diff --git a/manifests/database.pp b/manifests/database.pp index f7f4a26c..cfbe9286 100644 --- a/manifests/database.pp +++ b/manifests/database.pp @@ -16,6 +16,12 @@ refreshonly => false, } + pulpcore::admin { 'reset-admin-password --random': + unless => 'python3-django-admin dumpdata auth.User | grep "auth.user"', + refreshonly => false, + require => Pulpcore::Admin['migrate --noinput'], + } + include redis } diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb index 7d734b6f..554b7fe3 100644 --- a/spec/acceptance/basic_spec.rb +++ b/spec/acceptance/basic_spec.rb @@ -54,4 +54,9 @@ class { 'redis::globals': its(:exit_status) { is_expected.to eq 0 } end + describe command("DJANGO_SETTINGS_MODULE=pulpcore.app.settings PULP_SETTINGS=/etc/pulp/settings.py python3-django-admin dumpdata auth.User") do + its(:stdout) { is_expected.to match(/auth\.user/) } + its(:exit_status) { is_expected.to eq 0 } + end + end diff --git a/spec/classes/pulpcore_spec.rb b/spec/classes/pulpcore_spec.rb index 9e919a70..c4b9b29d 100644 --- a/spec/classes/pulpcore_spec.rb +++ b/spec/classes/pulpcore_spec.rb @@ -16,6 +16,7 @@ is_expected.to contain_postgresql__server__db('pulpcore') is_expected.to contain_apache__vhost('pulp') is_expected.to contain_selinux__boolean('httpd_can_network_connect') + is_expected.to contain_pulpcore__admin('reset-admin-password --random') end end