Project

General

Profile

« Previous | Next » 

Revision 7018f7a3

Added by Alexis Mousset about 7 years ago

Fixes #9763: Upgrade fusion agent to 2.3.19

View differences:

rudder-agent/SOURCES/Makefile
RUDDER_MAJOR_VERSION := $(shell echo ${RUDDER_VERSION_TO_PACKAGE} | cut -d'.' -f 1-2)
CFENGINE_RELEASE = 3.10.0
FUSION_RELEASE = 2.3.17
FUSION_RELEASE = 2.3.19
LMDB_RELEASE = 0.9.18
OPENSSL_RELEASE = 1.0.2h
PERL_VERSION = 5.22.0
......
ifeq ($(shell ../../build-caching get ./cfengine-source/ --force-config name=cfengine-src version=$(CFENGINE_RELEASE) >/dev/null 2>&1 || echo KO), KO)
$(eval TMP_DIR := $(shell mktemp -dq /tmp/rudder.XXXXXX))
# Original URL: https://cfengine-package-repos.s3.amazonaws.com/tarballs/cfengine-$(CFENGINE_RELEASE).tar.gz
$(GET) $(TMP_DIR)/cfengine.tgz http://www.normation.com/tarball/cfengine/cfengine-$(CFENGINE_RELEASE).tar.gz
$(GET) $(TMP_DIR)/cfengine.tgz https://www.normation.com/tarball/cfengine/cfengine-$(CFENGINE_RELEASE).tar.gz
gunzip < $(TMP_DIR)/cfengine.tgz | $(TAR) xf -
mv ./cfengine-$(CFENGINE_RELEASE) ./cfengine-source
../../build-caching put ./cfengine-source/ --force-config name=cfengine-src version=$(CFENGINE_RELEASE)
......
ifeq ($(shell ../../build-caching get ./openssl-source/ --force-config name=openssl-src version=$(OPENSSL_RELEASE) >/dev/null 2>&1 || echo KO), KO)
$(eval TMP_DIR := $(shell mktemp -dq /tmp/rudder.XXXXXX))
# Original URL: https://www.openssl.org/source/openssl-$(OPENSSL_RELEASE).tar.gz
$(GET) $(TMP_DIR)/openssl.tgz http://www.normation.com/tarball/openssl/openssl-$(OPENSSL_RELEASE).tar.gz
$(GET) $(TMP_DIR)/openssl.tgz https://www.normation.com/tarball/openssl/openssl-$(OPENSSL_RELEASE).tar.gz
gunzip < $(TMP_DIR)/openssl.tgz | $(TAR) xf -
mv ./openssl-$(OPENSSL_RELEASE) ./openssl-source
../../build-caching put ./openssl-source/ --force-config name=openssl-src version=$(OPENSSL_RELEASE)
......
ifeq ($(shell ../../build-caching get ./lmdb-source/ --force-config name=lmdb-src version=$(LMDB_RELEASE) >/dev/null 2>&1 || echo KO), KO)
$(eval TMP_DIR := $(shell mktemp -dq /tmp/rudder.XXXXXX))
# Original URL: http://ftp.fr.debian.org/debian/pool/main/l/lmdb/lmdb_$(LMDB_RELEASE).orig.tar.xz
$(GET) $(TMP_DIR)/lmdb.tgz http://www.normation.com/tarball/lmdb/lmdb-$(LMDB_RELEASE).tar.gz
$(GET) $(TMP_DIR)/lmdb.tgz https://www.normation.com/tarball/lmdb/lmdb-$(LMDB_RELEASE).tar.gz
gunzip < $(TMP_DIR)/lmdb.tgz | $(TAR) xf -
mv ./lmdb-LMDB_$(LMDB_RELEASE) ./lmdb-source
../../build-caching put ./lmdb-source/ --force-config name=lmdb-src version=$(LMDB_RELEASE)
......
ifeq ($(shell ../../build-caching get ./pcre-source/ --force-config name=pcre-src version=$(PCRE_RELEASE) >/dev/null 2>&1 || echo KO), KO)
$(eval TMP_DIR := $(shell mktemp -dq /tmp/rudder.XXXXXX))
# Original URL: http://vorboss.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.gz
$(GET) $(TMP_DIR)/pcre.tgz http://www.normation.com/tarball/pcre/pcre-$(PCRE_RELEASE).tar.gz
$(GET) $(TMP_DIR)/pcre.tgz https://www.normation.com/tarball/pcre/pcre-$(PCRE_RELEASE).tar.gz
gunzip < $(TMP_DIR)/pcre.tgz | $(TAR) xf -
mv ./pcre-$(PCRE_RELEASE) ./pcre-source
../../build-caching put ./pcre-source/ --force-config name=pcre-src version=$(PCRE_RELEASE)
......
endif
rudder-sources.tar.bz2:
$(GET) rudder-sources.tar.bz2 http://www.rudder-project.org/archives/rudder-sources-$(RUDDER_VERSION_TO_PACKAGE).tar.bz2
$(GET) rudder-sources.tar.bz2 https://www.rudder-project.org/archives/rudder-sources-$(RUDDER_VERSION_TO_PACKAGE).tar.bz2
rudder-sources: rudder-sources.tar.bz2
bunzip2 < rudder-sources.tar.bz2 | $(TAR) xf -
......
rudder.8.gz:
# Get man page from rudder-project.org
$(WGET) http://www.rudder-project.org/rudder-doc-${RUDDER_MAJOR_VERSION}/rudder.8
$(WGET) https://www.rudder-project.org/rudder-doc-${RUDDER_MAJOR_VERSION}/rudder.8
gzip -f rudder.8
initial-promises: ./rudder-sources
......
fusioninventory-agent:
ifeq ($(shell ../../build-caching get ./fusioninventory-agent/ --force-config name=fusioninventory-agent version=$(FUSION_RELEASE) >/dev/null 2>&1 || echo KO), KO)
$(eval TMP_DIR := $(shell mktemp -dq /tmp/rudder.XXXXXX))
#Original URL: http://search.cpan.org/CPAN/authors/id/G/GR/GROUSSE/FusionInventory-Agent-$(FUSION_RELEASE).tar.gz
$(GET) $(TMP_DIR)/fusion.tgz http://www.normation.com/tarball/FusionInventory-Agent-$(FUSION_RELEASE).tar.gz
#Original URL: https://github.com/fusioninventory/fusioninventory-agent/releases/download/2.3.19/FusionInventory-Agent-$(FUSION_RELEASE).tar.gz
$(GET) $(TMP_DIR)/fusion.tgz https://www.normation.com/tarball/fusioninventory/FusionInventory-Agent-$(FUSION_RELEASE).tar.gz
gunzip < $(TMP_DIR)/fusion.tgz | $(TAR) xf -
mv ./FusionInventory-Agent-$(FUSION_RELEASE) ./fusioninventory-agent
../../build-caching put ./fusioninventory-agent/ --force-config name=fusioninventory-agent version=$(FUSION_RELEASE)
......
ifeq ($(shell ../../build-caching get ./perl-$(PERL_VERSION)/ --force-config name=perl-source versions=$(perl_source) >/dev/null 2>&1 || echo KO), KO)
$(eval TMP_DIR := $(shell mktemp -dq /tmp/rudder.XXXXXX))
# Original URL: http://www.cpan.org/src/5.0/perl-5.22.0.tar.gz
$(GET) $(TMP_DIR)/perl.tar.gz http://www.normation.com/tarball/perl/perl-$(PERL_VERSION).tar.gz
$(GET) $(TMP_DIR)/perl.tar.gz https://www.normation.com/tarball/perl/perl-$(PERL_VERSION).tar.gz
gunzip < $(TMP_DIR)/perl.tar.gz | $(TAR) xf -
# Original URL: http://www.cpan.org/modules/by-module/App/App-cpanminus-1.7036.tar.gz
$(GET) ./perl-$(PERL_VERSION)/App-cpanminus.tar.gz http://www.normation.com/tarball/cpan/App-cpanminus-1.7036.tar.gz
$(GET) ./perl-$(PERL_VERSION)/App-cpanminus.tar.gz https://www.normation.com/tarball/cpan/App-cpanminus-1.7036.tar.gz
cd perl-$(PERL_VERSION) && gunzip < App-cpanminus.tar.gz | $(TAR) xf -
mv ./perl-$(PERL_VERSION)/App-cpanminus-1.7036 ./perl-$(PERL_VERSION)/App-cpanminus
# cpanminus+curl have a bug on rhel3+64bits, this is the workaround, see http://www.rudder-project.org/redmine/issues/8533
......
mkdir -p ./perl-$(PERL_VERSION)
$(eval TMP_DIR := $(shell mktemp -dq /tmp/rudder.XXXXXX))
# Original URL: http://www.cpan.org/modules/by-module/App/App-cpanminus-1.7036.tar.gz
$(GET) $(TMP_DIR)/App-cpanminus.tar.gz http://www.normation.com/tarball/cpan/App-cpanminus-1.7036.tar.gz
$(GET) $(TMP_DIR)/App-cpanminus.tar.gz https://www.normation.com/tarball/cpan/App-cpanminus-1.7036.tar.gz
cd perl-$(PERL_VERSION) && gunzip < $(TMP_DIR)/App-cpanminus.tar.gz | $(TAR) xf -
mv ./perl-$(PERL_VERSION)/App-cpanminus-1.7036 ./perl-$(PERL_VERSION)/App-cpanminus
rm -rf $(TMP_DIR)
......
# TODO rework these dependencies, they are not the right ones
# CPAN Modules installation
# Original URL: http://www.cpan.org/modules/by-module/URI/URI-1.67.tar.gz
$(MODULE_INSTALL) http://www.normation.com/tarball/cpan/URI-1.67.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/URI-1.67.tar.gz
$(MODULE_TEST) -MURI
# # Original URL: http://www.cpan.org/modules/by-module/HTML/HTML-Tagset-3.20.tar.gz
# $(MODULE_INSTALL) http://www.normation.com/tarball/cpan/HTML-Tagset-3.20.tar.gz
# $(MODULE_INSTALL) https://www.normation.com/tarball/cpan/HTML-Tagset-3.20.tar.gz
# $(MODULE_TEST) -MHTML::Tagset
# # Original URL: http://www.cpan.org/modules/by-module/HTML/HTML-Parser-3.71.tar.gz
# $(MODULE_INSTALL) http://www.normation.com/tarball/cpan/HTML-Parser-3.71.tar.gz
# $(MODULE_INSTALL) https://www.normation.com/tarball/cpan/HTML-Parser-3.71.tar.gz
# $(MODULE_TEST) -MHTML::Parser
# Original URL: http://www.cpan.org/modules/by-module/LWP/libwww-perl-6.13.tar.gz
$(MODULE_INSTALL) http://www.normation.com/tarball/cpan/libwww-perl-6.13.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/libwww-perl-6.13.tar.gz
$(MODULE_TEST) -MLWP
# # Original URL: http://www.cpan.org/modules/by-module/Compress/Compress-Raw-Bzip2-2.068.tar.gz
# $(MODULE_INSTALL) http://www.normation.com/tarball/cpan/Compress-Raw-Bzip2-2.068.tar.gz
# $(MODULE_INSTALL) https://www.normation.com/tarball/cpan/Compress-Raw-Bzip2-2.068.tar.gz
# $(MODULE_TEST) -MCompress::Raw::Bzip2
# # Original URL: http://www.cpan.org/modules/by-module/Compress/Compress-Raw-Zlib-2.068.tar.gz
# $(MODULE_INSTALL) http://www.normation.com/tarball/cpan/Compress-Raw-Zlib-2.068.tar.gz
# $(MODULE_INSTALL) https://www.normation.com/tarball/cpan/Compress-Raw-Zlib-2.068.tar.gz
# $(MODULE_TEST) -MCompress::Raw::Zlib
# # Original URL: http://www.cpan.org/modules/by-module/IO/IO-Compress-2.068.tar.gz
# $(MODULE_INSTALL) http://www.normation.com/tarball/cpan/IO-Compress-2.068.tar.gz
# $(MODULE_INSTALL) https://www.normation.com/tarball/cpan/IO-Compress-2.068.tar.gz
# #No test: IO::Compress cannot be called directly
# Original URL: http://www.cpan.org/modules/by-module/Digest/Digest-MD5-2.54.tar.gz
$(MODULE_INSTALL) http://www.normation.com/tarball/cpan/Digest-MD5-2.54.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/Digest-MD5-2.54.tar.gz
$(MODULE_TEST) -MDigest::MD5
# Orignal URL: http://www.cpan.org/modules/by-module/Net/Net-IP-1.26.tar.gz
$(MODULE_INSTALL) http://www.normation.com/tarball/cpan/Net-IP-1.26.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/Net-IP-1.26.tar.gz
$(MODULE_TEST) -MNet::IP
# # Original URL: http://www.cpan.org/modules/by-module/XML/XML-NamespaceSupport-1.11.tar.gz
# $(MODULE_INSTALL) http://www.normation.com/tarball/cpan/XML-NamespaceSupport-1.11.tar.gz
# $(MODULE_INSTALL) https://www.normation.com/tarball/cpan/XML-NamespaceSupport-1.11.tar.gz
# $(MODULE_TEST) -MXML::NamespaceSupport
# # Original URL: http://www.cpan.org/modules/by-module/XML/XML-SAX-0.99.tar.gz
# $(MODULE_INSTALL) http://www.normation.com/tarball/cpan/XML-SAX-0.99.tar.gz
# $(MODULE_INSTALL) https://www.normation.com/tarball/cpan/XML-SAX-0.99.tar.gz
# $(MODULE_TEST) -MXML::SAX
# # Original URL: http://www.cpan.org/modules/by-module/XML/XML-Simple-2.20.tar.gz
# $(MODULE_INSTALL) http://www.normation.com/tarball/cpan/XML-Simple-2.20.tar.gz
# $(MODULE_INSTALL) https://www.normation.com/tarball/cpan/XML-Simple-2.20.tar.gz
# $(MODULE_TEST) -MXML::Simple
# Original URL: http://www.cpan.org/modules/by-module/XML/XML-TreePP-0.43.tar.gz
$(MODULE_INSTALL) http://www.normation.com/tarball/cpan/XML-TreePP-0.43.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/XML-TreePP-0.43.tar.gz
$(MODULE_TEST) -MXML::TreePP
# Original URL: http://www.cpan.org/modules/by-module/UNIVERSAL/UNIVERSAL-require-0.18.tar.gz
$(MODULE_INSTALL) http://www.normation.com/tarball/cpan/UNIVERSAL-require-0.18.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/UNIVERSAL-require-0.18.tar.gz
$(MODULE_TEST) -MUNIVERSAL::require
# # Original URL: http://search.cpan.org/CPAN/authors/id/K/KW/KWILLIAMS/Probe-Perl-0.03.tar.gz
# $(MODULE_INSTALL) http://www.normation.com/tarball/cpan/Probe-Perl-0.03.tar.gz
# $(MODULE_INSTALL) https://www.normation.com/tarball/cpan/Probe-Perl-0.03.tar.gz
# $(MODULE_TEST) -MProbe::Perl
# # Original URL: http://www.cpan.org/modules/by-module/IPC/IPC-Run3-0.048.tar.gz
# $(MODULE_INSTALL) http://www.normation.com/tarball/cpan/IPC-Run3-0.048.tar.gz
# $(MODULE_INSTALL) https://www.normation.com/tarball/cpan/IPC-Run3-0.048.tar.gz
# $(MODULE_TEST) -MIPC::Run3
# # Original URL: http://www.cpan.org/modules/by-module/Test/Test-Script-1.10.tar.gz
# $(MODULE_INSTALL) http://www.normation.com/tarball/cpan/Test-Script-1.10.tar.gz
# $(MODULE_INSTALL) https://www.normation.com/tarball/cpan/Test-Script-1.10.tar.gz
# $(MODULE_TEST) -MTest::Script
# Original URL: http://www.cpan.org/modules/by-module/File/File-Which-1.21.tar.gz
$(MODULE_INSTALL) http://www.normation.com/tarball/cpan/File-Which-1.21.tar.gz
$(MODULE_INSTALL) https://www.normation.com/tarball/cpan/File-Which-1.21.tar.gz
$(MODULE_TEST) -MFile::Which
# Replace destdir by prefix in files generated by cpanm
rudder-agent/SOURCES/patches/fusioninventory/0013-fix-vmware-detection-on-debian8.patch
From d781329d9ded0fb7b7609efb72c88eae7bee05a6 Mon Sep 17 00:00:00 2001
From: Nicolas Charles <nicolas.charles@normation.com>
Date: Tue, 26 Jan 2016 10:16:24 +0100
Subject: [PATCH] Fixes #3036: correct detection of vmware on debian jessie
---
lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm b/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
index e827905..100ea42 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
@@ -7,6 +7,7 @@ use FusionInventory::Agent::Tools;
use FusionInventory::Agent::Tools::Solaris;
my @vmware_patterns = (
+ 'Hypervisor detected: VMware',
'VMware vmxnet virtual NIC driver',
'Vendor: VMware\s+Model: Virtual disk',
'Vendor: VMware,\s+Model: VMware Virtual ',
--
1.9.1
rudder-agent/SOURCES/patches/fusioninventory/0014-slackware-package-detection.patch
--- fusioninventory-agent-2.3.6/lib/FusionInventory/Agent/Task/Inventory/Generic/Softwares/Slackware.pm 2016-03-03 11:52:58.309514141 +0100
+++ fusioninventory-agent-2.3.6/lib/FusionInventory/Agent/Task/Inventory/Generic/Softwares/Slackware.pm 2016-03-03 11:53:32.435513507 +0100
@@ -21,7 +21,7 @@
return unless $handle;
while (my $file = readdir($handle)) {
- next unless $file =~ /^(.+)([^-]+-[^-]+-[^-]+)$/;
+ next unless $file =~ /^(.+)-(.+)-(i[0-9]86|noarch|x86_64|x86|fw|npmjs)-(.*)$/;
my $name = $1;
my $version = $2;
rudder-agent/SOURCES/patches/fusioninventory/0017-Fixes-3046-correct-VMware-detection-on-Debian.patch
From b37cf415971fb117752b51f9944b7b1ad840df7b Mon Sep 17 00:00:00 2001
From: Nicolas Charles <nicolas.charles@normation.com>
Date: Wed, 14 Sep 2016 17:59:17 +0200
Subject: [PATCH] Fixes #3046: correct VMware detection on Debian
---
lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm b/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
index e8d361f..6b78023 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
@@ -8,7 +8,7 @@ use FusionInventory::Agent::Tools::Solaris;
my @vmware_patterns = (
'Hypervisor detected: VMware',
- 'VMware vmxnet virtual NIC driver',
+ 'VMware vmxnet3? virtual NIC driver',
'Vendor: VMware\s+Model: Virtual disk',
'Vendor: VMware,\s+Model: VMware Virtual ',
': VMware Virtual IDE CDROM Drive'
--
1.9.1
rudder-agent/SOURCES/patches/fusioninventory/0018-Update-detection-of-KVM-in-guests.patch
From 2f70cb90fd51914718c3a3b6a8d3f8ab39a71296 Mon Sep 17 00:00:00 2001
From: Guillaume Bougard <gbougard@teclib.com>
Date: Wed, 12 Oct 2016 15:22:19 +0200
Subject: [PATCH 1/1] Update detection of KVM in guests
---
lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm b/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
index f12bd34..c637870 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
@@ -19,7 +19,10 @@ my @qemu_patterns = (
' QEMUAPIC ',
'QEMU Virtual CPU',
': QEMU HARDDISK,',
- ': QEMU CD-ROM,'
+ ': QEMU CD-ROM,',
+ ': QEMU Standard PC',
+ 'Hypervisor detected: KVM',
+ 'Booting paravirtualized kernel on KVM'
);
my $qemu_pattern = _assemblePatterns(@qemu_patterns);
--
1.9.1
rudder-agent/SOURCES/patches/fusioninventory/0019-correct-hostname-fqdn-option.patch
diff -upr fusioninventory-agent-b/lib/FusionInventory/Agent/Task/Inventory/Generic/Rudder.pm fusioninventory-agent/lib/FusionInventory/Agent/Task/Inventory/Generic/Rudder.pm
--- fusioninventory-agent-b/lib/FusionInventory/Agent/Task/Inventory/Generic/Rudder.pm 2016-06-07 14:27:15.947453556 +0200
+++ fusioninventory-agent/lib/FusionInventory/Agent/Task/Inventory/Generic/Rudder.pm 2016-06-07 14:27:37.198724339 +0200
@@ -26,7 +26,7 @@ sub doInventory {
logger => $logger, command => 'ls /var/rudder'
);
# get machine hostname
- my $command = $OSNAME eq 'linux' ? 'hostname --fqd' : 'hostname';
+ my $command = $OSNAME eq 'linux' ? 'hostname --fqdn' : 'hostname';
my $hostname = getFirstLine(
logger => $logger, command => $command
);
rudder-agent/SOURCES/patches/fusioninventory/0020-Fix-KVM-detection.patch
From 60bc8a5fbc1f8c8dafe5b5c785514c7253adb25d Mon Sep 17 00:00:00 2001
From: Nicolas Charles <nicolas.charles@normation.com>
Date: Wed, 14 Sep 2016 17:32:15 +0200
Subject: [PATCH] Fix detection of KVM
---
lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm b/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
index d2992a1..8415260 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
@@ -101,6 +101,7 @@ sub _getType {
if ($bios->{SMODEL}) {
return 'VMware' if $bios->{SMODEL} =~ /VMware/;
return 'Virtual Machine' if $bios->{SMODEL} =~ /Virtual Machine/;
+ return 'QEMU' if $bios->{SMODEL} =~ /KVM/;
}
if ($bios->{BVERSION}) {
return 'VirtualBox' if $bios->{BVERSION} =~ /VirtualBox/;
--
1.9.1
rudder-agent/SOURCES/patches/fusioninventory/0021-Fixes-3047-Correct-Rudder-detection-to-detect-server.patch
From 43896dcf092dd0b13ab130c8891845db50137066 Mon Sep 17 00:00:00 2001
From: Matthieu CERDA <matthieu.cerda@normation.com>
Date: Thu, 15 Sep 2016 12:56:49 +0200
Subject: [PATCH] Fixes #3047: Correct Rudder detection to detect server roles,
and work on windows
--- a/lib/FusionInventory/Agent/Inventory.pm
+++ b/lib/FusionInventory/Agent/Inventory.pm
@@ -68,7 +68,7 @@
PROCESSES => [ qw/USER PID CPUUSAGE MEM VIRTUALMEMORY TTY STARTED
CMD/ ],
REGISTRY => [ qw/NAME REGVALUE HIVE/ ],
- RUDDER => [ qw/AGENT UUID HOSTNAME/ ],
+ RUDDER => [ qw/AGENT UUID HOSTNAME SERVER_ROLES/ ],
SLOTS => [ qw/DESCRIPTION DESIGNATION NAME STATUS/ ],
SOFTWARES => [ qw/COMMENTS FILESIZE FOLDER FROM HELPLINK INSTALLDATE
NAME NO_REMOVE RELEASE_TYPE PUBLISHER
--- a/lib/FusionInventory/Agent/Task/Inventory/Generic/Rudder.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Generic/Rudder.pm
@@ -8,7 +8,11 @@
use FusionInventory::Agent::Tools;
sub isEnabled {
- return -r '/opt/rudder/etc/uuid.hive';
+ return -r getUuidFile();
+}
+
+sub getUuidFile {
+ return (($OSNAME eq 'MSWin32') ? 'C:\Program Files\Rudder\etc\uuid.hive' : '/opt/rudder/etc/uuid.hive');
}
sub doInventory {
@@ -17,23 +21,29 @@
my $inventory = $params{inventory};
my $logger = $params{logger};
- # get Rudder UUID
+ my $uuid_hive = getUuidFile();
+
+ # Get Rudder UUID
my $Uuid = getFirstLine(
- logger => $logger, file => '/opt/rudder/etc/uuid.hive'
+ logger => $logger, file => $uuid_hive
);
- # get all agents running on that machine
+ # Get all agents running on that machine
my @agents = _manageAgent(
- logger => $logger, command => 'ls /var/rudder'
+ logger => $logger
);
- # get machine hostname
+ # Get machine hostname
my $command = $OSNAME eq 'linux' ? 'hostname --fqdn' : 'hostname';
my $hostname = getFirstLine(
logger => $logger, command => $command
);
+ # Get server roles
+ my @serverRoles = _listServerRoles();
+
my $rudder = {
HOSTNAME => $hostname,
UUID => $Uuid,
AGENT => \@agents,
+ SERVER_ROLES => { SERVER_ROLE => \@serverRoles },
};
$inventory->addEntry(
@@ -41,23 +51,44 @@
);
}
+sub _listServerRoles {
+ my $server_roles_dir = ($OSNAME eq 'MSWin32') ? 'C:\Program Files\Rudder\etc\server-roles.d' : '/opt/rudder/etc/server-roles.d';
+ my @server_roles;
+
+ if (-d "$server_roles_dir") {
+ opendir(DIR, $server_roles_dir); # or die $!;
+
+ while (my $file = readdir(DIR)) {
+ # Use a regular expression to ignore files beginning with a period
+ next if ($file =~ m/^\./);
+ push @server_roles, $file;
+ }
+ closedir(DIR);
+ }
+ return @server_roles;
+}
+
sub _manageAgent {
- my $handle = getFileHandle(@_);
my %params = @_;
my $logger = $params{logger};
-
my @agents;
- # each line could be a new agent
- while(my $name = <$handle>){
-
- chomp $name;
- # verify agent name
- next unless $name =~ /cfengine/;
-
- my $server_hostname_file = "/var/rudder/$name/policy_server.dat";
- my $uuid_file = "/var/rudder/$name/rudder-server-uuid.txt";
- my $cfengine_key_file = "/var/rudder/$name/ppkeys/localhost.pub";
+ # Potential agent directory candidates
+ my %agent_candidates = ( '/var/rudder/cfengine-community' => 'cfengine-community',
+ '/var/rudder/cfengine-nova' => 'cfengine-nova',
+ 'C:/Program Files/Cfengine' => 'cfengine-nova',
+ );
+
+ foreach my $candidate (keys(%agent_candidates)){
+
+ # Verify if the candidate is installed and configured
+ next unless ( -e "${candidate}/policy_server.dat" );
+
+ # Get a list of useful file paths to key Rudder components
+ my $agent_name = "$agent_candidates{${candidate}}";
+ my $server_hostname_file = "${candidate}/policy_server.dat";
+ my $uuid_file = "${candidate}/rudder-server-uuid.txt";
+ my $cfengine_key_file = "${candidate}/ppkeys/localhost.pub";
# get policy server hostname
my $serverHostname = getFirstLine (
@@ -66,12 +97,12 @@
);
chomp $serverHostname;
- # get policy server uuid
+ # Get the policy server UUID
#
- # the default file is no longer /var/rudder/tmp/uuid.txt since the
+ # The default file is no longer /var/rudder/tmp/uuid.txt since the
# change in http://www.rudder-project.org/redmine/issues/2443.
- # we gracefully fallback to the old default if we can not find the
- # new file.
+ # We gracefully fallback to the old default if the new file cannot
+ # be found.
my $serverUuid = getFirstLine (
logger => $logger,
file => ( -e "$uuid_file" ) ? $uuid_file : "/var/rudder/tmp/uuid.txt"
@@ -91,7 +122,7 @@
# build agent from datas
my $agent = {
- AGENT_NAME => $name,
+ AGENT_NAME => $agent_name,
POLICY_SERVER_HOSTNAME => $serverHostname,
CFENGINE_KEY => $cfengineKey,
OWNER => $owner,
@@ -102,7 +133,6 @@
}
- close $handle;
return @agents;
}
rudder-agent/SOURCES/patches/fusioninventory/0022-Fixes-9131-add-agent-capabilities-to-rudder-inventory.patch
Fixes #9131: Add capabilities in inventory
http://www.rudder-project.org/redmine/issues/9131
--- a/lib/FusionInventory/Agent/Inventory.pm
+++ b/lib/FusionInventory/Agent/Inventory.pm
@@ -68,7 +68,7 @@
PROCESSES => [ qw/USER PID CPUUSAGE MEM VIRTUALMEMORY TTY STARTED
CMD/ ],
REGISTRY => [ qw/NAME REGVALUE HIVE/ ],
- RUDDER => [ qw/AGENT UUID HOSTNAME SERVER_ROLES/ ],
+ RUDDER => [ qw/AGENT UUID HOSTNAME SERVER_ROLES AGENT_CAPABILITIES/ ],
SLOTS => [ qw/DESCRIPTION DESIGNATION NAME STATUS/ ],
SOFTWARES => [ qw/COMMENTS FILESIZE FOLDER FROM HELPLINK INSTALLDATE
NAME NO_REMOVE RELEASE_TYPE PUBLISHER
--- a/lib/FusionInventory/Agent/Task/Inventory/Generic/Rudder.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Generic/Rudder.pm
@@ -39,11 +39,15 @@
# Get server roles
my @serverRoles = _listServerRoles();
+ # Get agent capabilities
+ my @agentCapabilities = _listAgentCapabilities();
+
my $rudder = {
HOSTNAME => $hostname,
UUID => $Uuid,
AGENT => \@agents,
SERVER_ROLES => { SERVER_ROLE => \@serverRoles },
+ AGENT_CAPABILITIES => { AGENT_CAPABILITY => \@agentCapabilities },
};
$inventory->addEntry(
@@ -58,16 +62,35 @@
if (-d "$server_roles_dir") {
opendir(DIR, $server_roles_dir); # or die $!;
+ # List each file in the server-roles directory, each file name is a role
while (my $file = readdir(DIR)) {
# Use a regular expression to ignore files beginning with a period
next if ($file =~ m/^\./);
push @server_roles, $file;
}
closedir(DIR);
+
}
return @server_roles;
}
+sub _listAgentCapabilities {
+ my $capabilities_file = ($OSNAME eq 'MSWin32') ? 'C:\Program Files\Rudder\etc\agent-capabilities' : '/opt/rudder/etc/agent-capabilities';
+ my @capabilities;
+
+ # List agent capabilities, one per line in the file
+ if (-f "$capabilities_file") {
+ if (open(my $fh, '<:encoding(UTF-8)', $capabilities_file)) {
+ while (my $row = <$fh>) {
+ chomp $row;
+ push @capabilities, $row;
+ }
+ close $fh;
+ }
+ }
+ return @capabilities;
+}
+
sub _manageAgent {
my %params = @_;
my $logger = $params{logger};
rudder-agent/SOURCES/patches/fusioninventory/0023-Fixes-9278-add-timezone-information-to-inventory.patch
Fixes #9278: Add Timezone information in inventory
https://www.rudder-project.org/redmine/issues/9278
--- a/README
+++ b/README
@@ -40,6 +40,8 @@
* Net::CUPS, for printers detection
* Parse::EDID, for EDID data parsing
+* DateTime, DateTime::TimeZone and DateTime::TimeZone::Local::{Win32,Unix}
+ for reliable timezone name extraction
Optional programs:
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -59,6 +59,10 @@
# Inventory
recommends 'Parse::EDID' => '0';
recommends 'Net::CUPS' => 0.60 if $OSNAME ne 'MSWin32';
+recommends 'DateTime' => '0';
+recommends 'DateTime::TimeZone' => '0';
+recommends 'DateTime::TimeZone::Local::Unix' => '0' if $OSNAME ne 'MSWin32';
+recommends 'DateTime::TimeZone::Local::Win32' => '0' if $OSNAME eq 'MSWin32';
# Deploy
recommends 'Archive::Extract' => '0';
--- a/lib/FusionInventory/Agent/Inventory.pm
+++ b/lib/FusionInventory/Agent/Inventory.pm
@@ -25,7 +25,7 @@
VMNAME VMHOSTSERIAL/ ],
OPERATINGSYSTEM => [ qw/KERNEL_NAME KERNEL_VERSION NAME VERSION FULL_NAME
SERVICE_PACK INSTALL_DATE FQDN DNS_DOMAIN
- SSH_KEY ARCH BOOT_TIME/ ],
+ SSH_KEY ARCH BOOT_TIME TIMEZONE/ ],
ACCESSLOG => [ qw/USERID LOGDATE/ ],
ANTIVIRUS => [ qw/COMPANY ENABLED GUID NAME UPTODATE VERSION/ ],
--- /dev/null 2016-10-06 11:58:32.025981414 +0200
+++ b/lib/FusionInventory/Agent/Task/Inventory/Generic/Timezone.pm 2016-10-07 17:25:35.261739989 +0200
@@ -0,0 +1,97 @@
+package FusionInventory::Agent::Task::Inventory::Generic::Timezone;
+
+use strict;
+use warnings;
+
+use English qw(-no_match_vars);
+use UNIVERSAL::require;
+
+use POSIX;
+use Time::Local;
+
+use FusionInventory::Agent::Tools;
+
+my $seen;
+
+sub isEnabled {
+
+ # No specific dependencies necessary
+ return 1;
+}
+
+sub doInventory {
+ my (%params) = @_;
+
+ my $inventory = $params{inventory};
+ my $logger = $params{logger};
+
+ # Compute a timezone offset like '+0200' using the difference between UTC and local time
+ # Might require merging with detectLocalTimeOffset (macOS inventory) in the future
+
+ ## Get the local time
+ my @t = localtime(time);
+
+ ## Compute the time offset in seconds between local and UTC time (relative and absolute)
+ my $utc_offset_seconds = timegm(@t) - timelocal(@t);
+ my $utc_offset_seconds_abs = abs($utc_offset_seconds);
+
+ ## If relative and absolute values do not match, it means the offset is negative
+ my $offset_sign =
+ $utc_offset_seconds == $utc_offset_seconds_abs ? '+' : '-';
+
+ ## Format the offset string: sign + H (XX) + M (XX)
+ my $tz_offset =
+ strftime( $offset_sign . "\%H\%M", gmtime($utc_offset_seconds_abs) );
+
+ # Assume by default that the offset is empty (safe default in case something goes wrong below)
+ my $tz_name = '';
+
+ # Timezone name extraction will use one of the following sources:
+ # * DateTime::TimeZone and DateTime::TimeZone::Local::{Win32,Unix} => 'Europe/Paris'
+ # * tzutil (Win 7+, Win 2008+) => 'Romance Standard Time'
+ # * strftime '%Z' => 'CEST'
+ #
+ # strftime will not be used on Windows, as it returns unpredictable localized TZ names. It means
+ # that if reliable timezone name extraction is wanted, DateTime::TimeZone MUST be used.
+ if (
+ ( DateTime::TimeZone->require() )
+ && ( $OSNAME eq 'MSWin32'
+ ? DateTime::TimeZone::Local::Win32->require()
+ : DateTime::TimeZone::Local::Unix->require() )
+ )
+ {
+ $logger->debug("Using DateTime::TimeZone to get the timezone name");
+ $tz_name = DateTime::TimeZone->new( name => 'local' )->name();
+ }
+ elsif ( ( $OSNAME eq 'MSWin32' ) || ( canRun('tzutil') ) ) {
+
+ $logger->debug("Using tzutil to get the timezone name");
+
+ my $handle = getFileHandle(
+ logger => $logger,
+ command => 'tzutil /g',
+ );
+
+ while ( my $line = <$handle> ) {
+ $tz_name = $line;
+ }
+ close $handle;
+
+ }
+ elsif ( $OSNAME ne 'MSWin32' ) {
+ $logger->debug("Using strftime to get the timezone name");
+ $tz_name = strftime( "%Z", localtime() );
+ }
+
+ $inventory->setOperatingSystem(
+ {
+ TIMEZONE => {
+ NAME => $tz_name,
+ OFFSET => $tz_offset,
+ }
+ }
+ );
+
+}
+
+1;
rudder-agent/SOURCES/patches/fusioninventory/9763-fix-timezones-unix-win32.patch
diff -upr FusionInventory-Agent-2.3.19/Makefile.PL FusionInventory-Agent-2.3.19-new/Makefile.PL
--- FusionInventory-Agent-2.3.19/Makefile.PL 2017-02-17 19:46:15.000000000 +0100
+++ FusionInventory-Agent-2.3.19-new/Makefile.PL 2017-02-21 13:45:17.743160028 +0100
@@ -68,6 +68,9 @@ test_requires 'Parallel::ForkManager'
recommends 'Parse::EDID' => '0';
recommends 'Net::CUPS' => 0.60 if $OSNAME ne 'MSWin32';
recommends 'DateTime' => '0';
+recommends 'DateTime::TimeZone' => '0';
+recommends 'DateTime::TimeZone::Local::Unix' => '0' if $OSNAME ne 'MSWin32';
+recommends 'DateTime::TimeZone::Local::Win32' => '0' if $OSNAME eq 'MSWin32';
# Deploy
recommends 'Archive::Extract' => '0';
diff -upr FusionInventory-Agent-2.3.19/README FusionInventory-Agent-2.3.19-new/README
--- FusionInventory-Agent-2.3.19/README 2016-11-10 14:43:41.000000000 +0100
+++ FusionInventory-Agent-2.3.19-new/README 2017-02-21 13:43:46.934255513 +0100
@@ -40,7 +40,8 @@ Optional Perl modules:
* Net::CUPS, for printers detection
* Parse::EDID, for EDID data parsing
-* DateTime, for reliable timezone name extraction
+* DateTime, DateTime::TimeZone and DateTime::TimeZone::Local::{Win32,Unix}
+ for reliable timezone name extraction
Optional programs:

Also available in: Unified diff