File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9494#
9595# ==== OpenNebula configuration parameters
9696#
97+ # $oned_log_system - default 'file'
98+ # the log subsystem to use, valid values are [file, syslog]
99+ #
97100# ===== OpenNebula Database configuration
98101#
99102# $oned_db - default oned
499502 }
500503 }
501504
505+ # I'd use member() here but the stdlib version we're currently using doesn't know that,
506+ # so feel free to change once the stlib was updated to a more recent version
507+ if (($oned_log_system != ' file' ) and ($oned_log_system != ' syslog' )) {
508+ fail(" \" ${oned_log_system} \" is not a valid logging subsystem. Valid values are [\" file\" , \" syslog\" ]." )
509+ }
510+
502511 # check if version greater than or equal to 4.14 (used in templates)
503512 if ( versioncmp($one_version , ' 4.14' ) >= 0 ) {
504513 $version_gte_4_14 = true
Original file line number Diff line number Diff line change 136136 it { should contain_file ( "#{ onehome } /.ssh/id_dsa.pub" ) . with_content ( sshpubkey ) }
137137 it { should contain_file ( "#{ onehome } /.ssh/authorized_keys" ) . with_content ( sshpubkey ) }
138138 it { should contain_file ( oned_config ) . with_content ( /^LOG = \[ \n \s +system\s +=\s +"file"/m ) }
139-
139+ context 'with syslog logging' do
140+ let ( :params ) { {
141+ :oned => true ,
142+ :oned_log_system => 'syslog'
143+ } }
144+ it { should contain_file ( oned_config ) . with_content ( /^LOG = \[ \n \s +system\s +=\s +"syslog"/m ) }
145+ end
146+ context 'with invalid logging subsystem' do
147+ let ( :params ) { {
148+ :oned => true ,
149+ :oned_log_system => 'invalid'
150+ } }
151+ it do
152+ is_expected . to compile . and_raise_error ( /"invalid" is not a valid logging subsystem. Valid values are \[ "file", "syslog"\] / )
153+ end
154+ end
140155 context 'with sqlite backend' do
141156 it { should contain_file ( oned_config ) . with_content ( /^DB = \[ backend = \" sqlite\" / ) }
142157 end
You can’t perform that action at this time.
0 commit comments