Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to set the login shell of the wildfly user. #278

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
# @param systemd_template Sets a custom systemd template.
# @param uid Sets managed user ID.
# @param user User to own `JBOSS_HOME`. If `manage_user` is `true`, this user will be managed.
# @param user_home User home directory. Defaults to '/home/wildfly'
# @param user_home User home directory. Defaults to '/home/wildfly'.
# @param user_shell User login shell. Defaults to '/bin/bash'.
# @param version Sets the Wildfly version managed in order to handle small differences among versions.
class wildfly(
Pattern[/^(\d{1,}\.\d{1,}(\.\d{1,})?$)/] $version = '9.0.2',
Expand All @@ -72,6 +73,7 @@
Boolean $manage_user = true,
String $user = 'wildfly',
Stdlib::Unixpath $user_home = '/home/wildfly',
Stdlib::Unixpath $user_shell = '/bin/bash',
String $group = 'wildfly',
String $mode_template = "wildfly/${mode}.conf",
String $mgmt_keystore_pass = 'changeit',
Expand Down
2 changes: 1 addition & 1 deletion manifests/prepare.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
uid => $wildfly::uid,
gid => $wildfly::gid,
groups => $wildfly::group,
shell => '/bin/bash',
shell => $wildfly::user_shell,
home => $wildfly::user_home,
comment => "${wildfly::user} user created by Puppet",
managehome => true,
Expand Down
21 changes: 21 additions & 0 deletions spec/classes/prepare_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,25 @@
.with_home('/opt/wildfly')
end
end

context 'set custom user_shell' do
let(:facts) do
{ :operatingsystem => 'CentOS',
:kernel => 'Linux',
:osfamily => 'RedHat',
:operatingsystemmajrelease => '7',
:initsystem => 'systemd' }
end

let :pre_condition do
"class { 'wildfly':
user_shell => '/bin/false',
}"
end

it do
is_expected.to contain_user('wildfly')
.with_shell('/bin/false')
end
end
end