Skip to content

Commit 39c35f7

Browse files
committed
Merge pull request #190 from rwaffen/change_vmm_exec_kvm_conf
change vmm_exec_kvm.conf handling
2 parents 577dd09 + 1197a2d commit 39c35f7

5 files changed

Lines changed: 44 additions & 69 deletions

File tree

.fixtures.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ fixtures:
44
apt:
55
repo: "https://github.com/puppetlabs/puppetlabs-apt.git"
66
ref: "1.8.0"
7+
inifile: "https://github.com/puppetlabs/puppetlabs-inifile"
78
symlinks:
8-
one: "../../../"
9+
one: "#{source_dir}"

manifests/oned/config.pp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
$sched_log_debug_level = $one::sched_log_debug_level,
5353
$kvm_driver_emulator = $one::kvm_driver_emulator,
5454
$kvm_driver_nic_attrs = $one::kvm_driver_nic_attrs,
55-
) {
55+
) {
5656

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

126-
file { '/etc/one/vmm_exec/vmm_exec_kvm.conf':
127-
ensure => file,
128-
owner => 'root',
129-
mode => '0640',
130-
content => template('one/vmm_exec_kvm.conf.erb'),
126+
if $kvm_driver_emulator != 'undef' {
127+
ini_setting{ 'set_kvm_driver_emulator':
128+
ensure => present,
129+
path => '/etc/one/vmm_exec/vmm_exec_kvm.conf',
130+
setting => 'EMULATOR',
131+
value => $kvm_driver_emulator,
132+
}
133+
}
134+
135+
if $kvm_driver_nic_attrs != 'undef' {
136+
ini_setting{ 'set_kvm_driver_nic':
137+
ensure => present,
138+
path => '/etc/one/vmm_exec/vmm_exec_kvm.conf',
139+
setting => 'NIC',
140+
value => $kvm_driver_nic_attrs,
141+
}
131142
}
132143

133144
if ($backend == 'mysql') {

metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
],
2525
"dependencies": [
2626
{ "name": "puppetlabs/stdlib", "version_requirement": "> 2.2.0" },
27-
{ "name": "puppetlabs/apt", "version_requirement": "< 2.0.0" }
27+
{ "name": "puppetlabs/apt", "version_requirement": "< 2.0.0" },
28+
{ "name": "puppetlabs/inifile", "version_requirement": "< 1.4.0" }
2829
]
2930
}

spec/classes/one__oned__config_spec.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
let(:facts) { f }
99
let (:hiera_config) { hiera_config }
1010
let (:pre_condition) { 'include one' }
11+
1112
context 'general' do
1213
it { should contain_class('one::oned::config') }
1314
it { should contain_file('/etc/one/oned.conf') \
@@ -26,6 +27,7 @@
2627
}
2728
it { should contain_file('/usr/share/one').with_ensure('directory') }
2829
end
30+
2931
context 'with mysql backend' do
3032
let (:params) { {
3133
:backend => 'mysql',
@@ -35,7 +37,28 @@
3537
it { should contain_file('/srv/backup') }
3638
it { should contain_file('/var/lib/one/bin/one_db_backup.sh') }
3739
it { should contain_cron('one_db_backup') }
40+
end
3841

42+
context 'without kvm driver emulator settings' do
43+
it { should_not contain_ini_setting('set_kvm_driver_emulator') }
44+
end
45+
46+
context 'with kvm driver emulator settings' do
47+
let(:params) { {
48+
:kvm_driver_emulator => '/usr/bin/foobar/kvm-bogus'
49+
} }
50+
it { should contain_ini_setting('set_kvm_driver_emulator').with_value('/usr/bin/foobar/kvm-bogus') }
51+
end
52+
53+
context 'without kvm driver nic settings' do
54+
it { should_not contain_ini_setting('set_kvm_driver_nic') }
55+
end
56+
57+
context 'with kvm driver nic settings' do
58+
let(:params) { {
59+
:kvm_driver_nic_attrs => '[ filter="clean-traffic", model="bogus" ]'
60+
} }
61+
it { should contain_ini_setting('set_kvm_driver_nic').with_value('[ filter="clean-traffic", model="bogus" ]') }
3962
end
4063
end
4164
end

templates/vmm_exec_kvm.conf.erb

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)