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

add param for oned log system #239

Merged
Merged
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
10 changes: 10 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@
#
# ==== OpenNebula configuration parameters
#
# $oned_log_system - default 'file'
# the log subsystem to use, valid values are [file, syslog]
#
# ===== OpenNebula Database configuration
#
# $oned_db - default oned
Expand Down Expand Up @@ -349,6 +352,7 @@
$ha_setup = false,
$puppetdb = false,
$debug_level = '0',
$oned_log_system = $one::params::oned_log_system,
$oned_port = $one::params::oned_port,
$oned_db = $one::params::oned_db,
$oned_db_user = $one::params::oned_db_user,
Expand Down Expand Up @@ -498,6 +502,12 @@
}
}

# I'd use member() here but the stdlib version we're currently using doesn't know that,
# so feel free to change once the stlib was updated to a more recent version
if (($oned_log_system != 'file') and ($oned_log_system != 'syslog')) {
fail("\"${oned_log_system}\" is not a valid logging subsystem. Valid values are [\"file\", \"syslog\"].")
}

# check if version greater than or equal to 4.14 (used in templates)
if ( versioncmp($one_version, '4.14') >= 0 ) {
$version_gte_4_14 = true
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#
class one::params {
# OpenNebula parameters
$oned_log_system = hiera('one::oned::oned_log_system', 'file')
$oned_port = hiera('one::oned::port', '2633')
$oned_listen_address = hiera('one::oned_listen_address', '0.0.0.0')
$oned_db = hiera('one::oned::db', 'oned')
Expand Down
17 changes: 17 additions & 0 deletions spec/classes/opennebula_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,23 @@
it { should contain_file("#{onehome}/.ssh/id_dsa").with_content(sshprivkey) }
it { should contain_file("#{onehome}/.ssh/id_dsa.pub").with_content(sshpubkey) }
it { should contain_file("#{onehome}/.ssh/authorized_keys").with_content(sshpubkey) }
it { should contain_file(oned_config).with_content(/^LOG = \[\n\s+system\s+=\s+"file"/m) }
context 'with syslog logging' do
let(:params) { {
:oned => true,
:oned_log_system => 'syslog'
} }
it { should contain_file(oned_config).with_content(/^LOG = \[\n\s+system\s+=\s+"syslog"/m) }
end
context 'with invalid logging subsystem' do
let(:params) { {
:oned => true,
:oned_log_system => 'invalid'
} }
it do
is_expected.to compile.and_raise_error(/"invalid" is not a valid logging subsystem. Valid values are \["file", "syslog"\]/)
end
end
context 'with sqlite backend' do
it { should contain_file(oned_config).with_content(/^DB = \[ backend = \"sqlite\"/) }
end
Expand Down
2 changes: 1 addition & 1 deletion templates/oned.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#*******************************************************************************

LOG = [
system = "file",
system = "<%= scope.lookupvar('one::oned_log_system') %>",
debug_level = <%= @debug_level %>
]

Expand Down