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
349352 $ha_setup = false ,
350353 $puppetdb = false ,
351354 $debug_level = ' 0' ,
355+ $oned_log_system = $one::params::oned_log_system,
352356 $oned_port = $one::params::oned_port,
353357 $oned_db = $one::params::oned_db,
354358 $oned_db_user = $one::params::oned_db_user,
498502 }
499503 }
500504
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+
501511 # check if version greater than or equal to 4.14 (used in templates)
502512 if ( versioncmp($one_version , ' 4.14' ) >= 0 ) {
503513 $version_gte_4_14 = true
Original file line number Diff line number Diff line change 2121#
2222class one::params {
2323 # OpenNebula parameters
24+ $oned_log_system = hiera(' one::oned::oned_log_system' , ' file' )
2425 $oned_port = hiera(' one::oned::port' , ' 2633' )
2526 $oned_listen_address = hiera(' one::oned_listen_address' , ' 0.0.0.0' )
2627 $oned_db = hiera(' one::oned::db' , ' oned' )
Original file line number Diff line number Diff line change 135135 it { should contain_file ( "#{ onehome } /.ssh/id_dsa" ) . with_content ( sshprivkey ) }
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 ) }
138+ it { should contain_file ( oned_config ) . with_content ( /^LOG = \[ \n \s +system\s +=\s +"file"/m ) }
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
138155 context 'with sqlite backend' do
139156 it { should contain_file ( oned_config ) . with_content ( /^DB = \[ backend = \" sqlite\" / ) }
140157 end
Original file line number Diff line number Diff line change 5555#*******************************************************************************
5656
5757LOG = [
58- system = "file ",
58+ system = "<%= scope.lookupvar('one::oned_log_system') %> ",
5959 debug_level = <%= @debug_level %>
6060]
6161
You can’t perform that action at this time.
0 commit comments