From 079c4266fd3f6cbfbf5e97a249859d8da9e11d8d Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 17 Aug 2017 11:31:43 +0200 Subject: [PATCH] install virt-what and use facter's default virtual facts Discussion in #d-a suggests that on jessie facter needs the virt-what package installed for the virtual and is_virtual facts to work. Install it on jessie (and purge on stretch and later), and revert to using the facter's default facts about virtualization. Also remove our own systemd based virt fact. --- modules/debian_org/lib/facter/virt.rb | 10 ---------- modules/debian_org/manifests/init.pp | 7 +++++++ modules/grub/manifests/init.pp | 2 +- modules/time/manifests/init.pp | 3 +-- 4 files changed, 9 insertions(+), 13 deletions(-) delete mode 100644 modules/debian_org/lib/facter/virt.rb diff --git a/modules/debian_org/lib/facter/virt.rb b/modules/debian_org/lib/facter/virt.rb deleted file mode 100644 index b5b318bc9..000000000 --- a/modules/debian_org/lib/facter/virt.rb +++ /dev/null @@ -1,10 +0,0 @@ -Facter.add("virt") do - setcode do - begin - `systemd-detect-virt`.chomp() - rescue Errno::ENOENT - nil - end - end -end -p diff --git a/modules/debian_org/manifests/init.pp b/modules/debian_org/manifests/init.pp index 416d3d061..eb0c4255e 100644 --- a/modules/debian_org/manifests/init.pp +++ b/modules/debian_org/manifests/init.pp @@ -12,6 +12,13 @@ class debian_org { $servicefiles = 'absent' } + # the virtual facter needs virt-what on jessie to work + if versioncmp($::lsbmajdistrelease, '9') < 0 { + package { 'virt-what': ensure => installed } + } else { + package { 'virt-what': ensure => purged } + } + $debianadmin = [ 'debian-archive-debian-samhain-reports@master.debian.org', 'debian-admin@ftbfs.de', diff --git a/modules/grub/manifests/init.pp b/modules/grub/manifests/init.pp index 1f6e7e6be..1ef9ec783 100644 --- a/modules/grub/manifests/init.pp +++ b/modules/grub/manifests/init.pp @@ -1,5 +1,5 @@ class grub { - if ($::kernel == 'Linux' and $::virt == 'kvm') { + if ($::kernel == 'Linux' and $::is_virtual and $::virtual == 'kvm') { file { '/etc/default/grub': # restore to default source => 'puppet:///modules/grub/etc-default-grub', diff --git a/modules/time/manifests/init.pp b/modules/time/manifests/init.pp index 808ef2816..9f1ec6032 100644 --- a/modules/time/manifests/init.pp +++ b/modules/time/manifests/init.pp @@ -3,9 +3,8 @@ class time { $localtimeservers = hiera('local-timeservers', []) $physicalHost = $site::allnodeinfo[$fqdn]['physicalHost'] - # if ($::kernel == 'Linux' and $::is_virtual and $::virtual == 'kvm' #if ($systemd and $physicalHost and size($localtimeservers) > 0) { - if ($systemd and size($localtimeservers) > 0 and $::virt == 'kvm') { + if ($systemd and size($localtimeservers) > 0 and $::is_virtual and $::virtual == 'kvm') { include ntp::purge include systemdtimesyncd } else { -- 2.20.1