From 4a053718980430101aaa80da24e9157604ea35be Mon Sep 17 00:00:00 2001 From: Christoph Maser Date: Mon, 30 Dec 2024 12:28:03 +0100 Subject: [PATCH] manage homedirectory for prometheus user when manage_user is true fixes #548 --- manifests/install.pp | 2 ++ spec/classes/prometheus_spec.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/manifests/install.pp b/manifests/install.pp index cd63d385b..0bdd5fcee 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -79,6 +79,8 @@ system => true, groups => $prometheus::server::extra_groups, shell => $prometheus::server::usershell, + managehome => true, + home => $prometheus::server::localstorage, }) if $prometheus::server::manage_group { diff --git a/spec/classes/prometheus_spec.rb b/spec/classes/prometheus_spec.rb index 785772f5a..0b81b8298 100644 --- a/spec/classes/prometheus_spec.rb +++ b/spec/classes/prometheus_spec.rb @@ -28,6 +28,18 @@ it { is_expected.to contain_class('prometheus::server') } it { is_expected.to contain_class('prometheus::service_reload') } + if facts[:os]['name'] != 'Archlinux' + it { + is_expected.to contain_user('prometheus').with( + 'ensure' => 'present', + 'system' => true, + 'groups' => [], + 'managehome' => true, + 'home' => '/var/lib/prometheus' + ) + } + end + if facts[:os]['name'] == 'Archlinux' it { expect(subject).not_to contain_file('/var/lib/prometheus') } else