From e5cc108c003300e1f90ed921e77276537b8e8ff9 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 20 Feb 2022 19:39:39 +0900 Subject: [PATCH] Avoid hard-coding OS user/group in each manifest and replace hard-codes by definition in params.pp . Change-Id: I4fc49eab447ef2b7e4f0d6cbd75f193cff7719b9 --- manifests/cron/purge_deleted.pp | 6 +++--- manifests/db/sync.pp | 3 ++- manifests/params.pp | 1 + manifests/wsgi/apache.pp | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/manifests/cron/purge_deleted.pp b/manifests/cron/purge_deleted.pp index 210cc093..54b4531f 100644 --- a/manifests/cron/purge_deleted.pp +++ b/manifests/cron/purge_deleted.pp @@ -31,7 +31,7 @@ # # [*user*] # (optional) User with access to heat files. -# Defaults to 'heat'. +# Defaults to $::heat::params::user. # # [*age*] # (optional) Age value for $age_type. @@ -54,11 +54,11 @@ class heat::cron::purge_deleted ( $month = '*', $weekday = '*', $maxdelay = 0, - $user = 'heat', + $user = $::heat::params::user, $age = 1, $age_type = 'days', $destination = '/var/log/heat/heat-purge_deleted.log' -) { +) inherits heat::params { if ! member(['days', 'hours', 'minutes', 'seconds'], $age_type) { fail('age_type possible values are only days, hours, minutes, or seconds.') diff --git a/manifests/db/sync.pp b/manifests/db/sync.pp index 2cb05866..dab7f13e 100644 --- a/manifests/db/sync.pp +++ b/manifests/db/sync.pp @@ -19,11 +19,12 @@ class heat::db::sync( ) { include heat::deps + include heat::params exec { 'heat-dbsync': command => "heat-manage ${extra_params} db_sync", path => '/usr/bin', - user => 'heat', + user => $::heat::params::user, refreshonly => true, try_sleep => 5, tries => 10, diff --git a/manifests/params.pp b/manifests/params.pp index 7f8a0792..c8f8605b 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -6,6 +6,7 @@ class heat::params { include openstacklib::defaults $client_package_name = 'python3-heatclient' + $user = 'heat' $group = 'heat' case $::osfamily { diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 97f24a9e..9d59bc28 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -148,7 +148,7 @@ define heat::wsgi::apache ( ::openstacklib::wsgi::apache { "heat_${title}_wsgi": bind_host => $bind_host, bind_port => $port, - group => 'heat', + group => $::heat::params::group, path => $path, priority => $priority, servername => $servername, @@ -161,7 +161,7 @@ define heat::wsgi::apache ( ssl_crl_path => $ssl_crl_path, ssl_key => $ssl_key, threads => $threads, - user => 'heat', + user => $::heat::params::user, workers => $workers, wsgi_daemon_process => "heat_${title}", wsgi_process_display_name => $wsgi_process_display_name,