Add a fact to get the name of the libvirt daemon

The name of the libvirt daemon is not the same between MOS 6.1 and MOS
7.0. So we need a fact to know which name is used.

Change-Id: I92f1df73d66b400d3496c6201e96c29a30d208f5
Closes-Bug: #1488517
This commit is contained in:
Guillaume Thouvenin 2015-08-25 16:30:38 +02:00
parent 507c3c229d
commit d497340a0c
2 changed files with 25 additions and 4 deletions

View File

@ -0,0 +1,24 @@
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
Facter.add('libvirt_daemon') do
setcode do
if File.exists? '/etc/init.d/libvirt-bin'
# It is the case for Ubuntu on MOS 6.1
'libvirt-bin'
else
'libvirtd'
end
end
end

View File

@ -22,10 +22,7 @@ class lma_collector::logs::libvirt {
$libvirt_log = 'libvirtd.log'
$libvirt_hooks_dir = '/etc/libvirt/hooks'
$libvirt_hook = "${libvirt_hooks_dir}/daemon"
$libvirt_service = $::osfamily ? {
'debian' => 'libvirt-bin',
default => 'libvirtd'
}
$libvirt_service = $::libvirt_daemon
service {$libvirt_service: }