Skip to content

Commit

Permalink
Fix user shell for Debian
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock committed Feb 18, 2024
1 parent 1aaf2fc commit 60d9207
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions data/os/Debian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ slurm::source_dependencies:
- libyaml-dev
slurm::env_dir: /etc/default
slurm::slurmrestd_user_group: nogroup
slurm::slurm_user_shell: /usr/sbin/nologin
1 change: 1 addition & 0 deletions data/os/Ubuntu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
slurm::slurm_user_shell: /sbin/nologin
2 changes: 2 additions & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ defaults: # Used for any hierarchy level that omits these keys.
hierarchy:
- name: 'os name major release'
path: "os/%{facts.os.name}/%{facts.os.release.major}.yaml"
- name: 'os name'
path: "os/%{facts.os.name}.yaml"
- name: 'os family major release'
path: "os/%{facts.os.family}/%{facts.os.release.major}.yaml"
- name: 'os family'
Expand Down
2 changes: 1 addition & 1 deletion spec/shared_examples/slurm_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
it { is_expected.to contain_class('slurm::common::setup').that_comes_before('Class[slurm::common::config]') }
it { is_expected.to contain_class('slurm::common::config') }

it_behaves_like 'slurm::common::user'
it_behaves_like 'slurm::common::user', facts
if facts[:os]['family'] == 'Debian'
it_behaves_like 'slurm::common::install::apt', facts
else
Expand Down
12 changes: 10 additions & 2 deletions spec/shared_examples/slurm_common_user.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# frozen_string_literal: true

shared_examples_for 'slurm::common::user' do
shared_examples_for 'slurm::common::user' do |facts|
let(:slurm_user_shell) do
if facts[:os]['name'] == 'Debian'
'/usr/sbin/nologin'
else
'/sbin/nologin'
end
end

it do
is_expected.to contain_group('slurm').with(ensure: 'present',
name: 'slurm',
Expand All @@ -14,7 +22,7 @@
name: 'slurm',
uid: nil,
gid: 'slurm',
shell: '/sbin/nologin',
shell: slurm_user_shell,
home: '/var/lib/slurm',
managehome: 'true',
comment: 'SLURM User',
Expand Down
2 changes: 1 addition & 1 deletion spec/shared_examples/slurm_slurmctld.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
it { is_expected.to contain_class('slurm::slurmctld::config').that_comes_before('Class[slurm::slurmctld::service]') }
it { is_expected.to contain_class('slurm::slurmctld::service') }

it_behaves_like 'slurm::common::user'
it_behaves_like 'slurm::common::user', facts
if facts[:os]['family'] == 'Debian'
it_behaves_like 'slurm::common::install::apt', facts
it_behaves_like 'slurm::common::install::apt-slurmctld'
Expand Down
2 changes: 1 addition & 1 deletion spec/shared_examples/slurm_slurmd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
it { is_expected.to contain_class('slurm::slurmd::config').that_comes_before('Class[slurm::slurmd::service]') }
it { is_expected.to contain_class('slurm::slurmd::service') }

it_behaves_like 'slurm::common::user'
it_behaves_like 'slurm::common::user', facts
if facts[:os]['family'] == 'Debian'
it_behaves_like 'slurm::common::install::apt', facts
it_behaves_like 'slurm::common::install::apt-slurmd'
Expand Down
2 changes: 1 addition & 1 deletion spec/shared_examples/slurm_slurmdbd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
it { is_expected.to contain_class('slurm::slurmdbd::config').that_comes_before('Class[slurm::slurmdbd::service]') }
it { is_expected.to contain_class('slurm::slurmdbd::service') }

it_behaves_like 'slurm::common::user'
it_behaves_like 'slurm::common::user', facts
if facts[:os]['family'] == 'Debian'
it_behaves_like 'slurm::common::install::apt-slurmdbd'
else
Expand Down
2 changes: 1 addition & 1 deletion spec/shared_examples/slurm_slurmrestd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
it { is_expected.to contain_class('slurm::common::config').that_comes_before('Class[slurm::slurmrestd::service]') }
it { is_expected.to contain_class('slurm::slurmrestd::service') }

it_behaves_like 'slurm::common::user'
it_behaves_like 'slurm::common::user', facts
if facts[:os]['family'] == 'RedHat'
it_behaves_like 'slurm::common::install::rpm-slurmrestd'
end
Expand Down

0 comments on commit 60d9207

Please sign in to comment.