diff --git a/manifests/init.pp b/manifests/init.pp index 66bb6e73..a534575c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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', @@ -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', diff --git a/manifests/prepare.pp b/manifests/prepare.pp index 489e9d92..d831180b 100644 --- a/manifests/prepare.pp +++ b/manifests/prepare.pp @@ -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, diff --git a/spec/classes/prepare_spec.rb b/spec/classes/prepare_spec.rb index ae721744..49fc7f4b 100644 --- a/spec/classes/prepare_spec.rb +++ b/spec/classes/prepare_spec.rb @@ -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