Skip to content

Commit

Permalink
Merge pull request #190 from rwaffen/change_vmm_exec_kvm_conf
Browse files Browse the repository at this point in the history
change vmm_exec_kvm.conf handling
  • Loading branch information
escalate committed Sep 7, 2015
2 parents 577dd09 + 1197a2d commit 39c35f7
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 69 deletions.
3 changes: 2 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ fixtures:
apt:
repo: "https://github.com/puppetlabs/puppetlabs-apt.git"
ref: "1.8.0"
inifile: "https://github.com/puppetlabs/puppetlabs-inifile"
symlinks:
one: "../../../"
one: "#{source_dir}"
23 changes: 17 additions & 6 deletions manifests/oned/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
$sched_log_debug_level = $one::sched_log_debug_level,
$kvm_driver_emulator = $one::kvm_driver_emulator,
$kvm_driver_nic_attrs = $one::kvm_driver_nic_attrs,
) {
) {

if ! member(['YES', 'NO'], $oned_vm_submit_on_hold) {
fail("oned_vm_submit_on_hold must be one of 'YES' or 'NO'. Actual value: ${oned_vm_submit_on_hold}")
Expand Down Expand Up @@ -123,11 +123,22 @@
source => $hook_scripts_path,
}

file { '/etc/one/vmm_exec/vmm_exec_kvm.conf':
ensure => file,
owner => 'root',
mode => '0640',
content => template('one/vmm_exec_kvm.conf.erb'),
if $kvm_driver_emulator != 'undef' {
ini_setting{ 'set_kvm_driver_emulator':
ensure => present,
path => '/etc/one/vmm_exec/vmm_exec_kvm.conf',
setting => 'EMULATOR',
value => $kvm_driver_emulator,
}
}

if $kvm_driver_nic_attrs != 'undef' {
ini_setting{ 'set_kvm_driver_nic':
ensure => present,
path => '/etc/one/vmm_exec/vmm_exec_kvm.conf',
setting => 'NIC',
value => $kvm_driver_nic_attrs,
}
}

if ($backend == 'mysql') {
Expand Down
3 changes: 2 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
],
"dependencies": [
{ "name": "puppetlabs/stdlib", "version_requirement": "> 2.2.0" },
{ "name": "puppetlabs/apt", "version_requirement": "< 2.0.0" }
{ "name": "puppetlabs/apt", "version_requirement": "< 2.0.0" },
{ "name": "puppetlabs/inifile", "version_requirement": "< 1.4.0" }
]
}
23 changes: 23 additions & 0 deletions spec/classes/one__oned__config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
let(:facts) { f }
let (:hiera_config) { hiera_config }
let (:pre_condition) { 'include one' }

context 'general' do
it { should contain_class('one::oned::config') }
it { should contain_file('/etc/one/oned.conf') \
Expand All @@ -26,6 +27,7 @@
}
it { should contain_file('/usr/share/one').with_ensure('directory') }
end

context 'with mysql backend' do
let (:params) { {
:backend => 'mysql',
Expand All @@ -35,7 +37,28 @@
it { should contain_file('/srv/backup') }
it { should contain_file('/var/lib/one/bin/one_db_backup.sh') }
it { should contain_cron('one_db_backup') }
end

context 'without kvm driver emulator settings' do
it { should_not contain_ini_setting('set_kvm_driver_emulator') }
end

context 'with kvm driver emulator settings' do
let(:params) { {
:kvm_driver_emulator => '/usr/bin/foobar/kvm-bogus'
} }
it { should contain_ini_setting('set_kvm_driver_emulator').with_value('/usr/bin/foobar/kvm-bogus') }
end

context 'without kvm driver nic settings' do
it { should_not contain_ini_setting('set_kvm_driver_nic') }
end

context 'with kvm driver nic settings' do
let(:params) { {
:kvm_driver_nic_attrs => '[ filter="clean-traffic", model="bogus" ]'
} }
it { should contain_ini_setting('set_kvm_driver_nic').with_value('[ filter="clean-traffic", model="bogus" ]') }
end
end
end
Expand Down
61 changes: 0 additions & 61 deletions templates/vmm_exec_kvm.conf.erb

This file was deleted.

0 comments on commit 39c35f7

Please sign in to comment.