Project

General

Profile

« Previous | Next » 

Revision 188a91ad

Added by Benoît PECCATTE about 7 years ago

Fixes #9829: Agent inventory generation invalid if hostname is not defined

View differences:

techniques/system/inventory/1.0/fusionAgent.st
"********************************************************************************
* WARNING Generated inventory is not valid, as it is missing mandatory fields. *
* Not sending it to the Rudder Server *
* You can check the invalid inventory in ${g.rudder_var_tmp}/inventory/ *
* You can get a full error message by running: ${perl_command} ${this.promise_dirname}/test-inventory.pl ${inventory_file}
********************************************************************************";
}
techniques/system/inventory/1.0/test-inventory.pl.st
# Test RUDDER/UUID
my $uuid = $rudder->{UUID};
if(!defined $uuid || $uuid eq "" || ($uuid ne "root" \&\& $uuid !~ /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i)) {
print "Inventory ERROR: No valid UUID\n";
print "Inventory ERROR: No valid UUID, is your agent properly installed ?\n";
exit 1;
}
......
my $hostname = $rudder->{HOSTNAME};
my $fqdn = $os->{FQDN};
if( (!defined $hostname || $hostname eq "") \&\& (!defined $fqdn || $fqdn eq "")) {
print "Inventory ERROR: No RUDDER/HOSTNAME or OPERATINGSYSTEM/FQDN\n";
print "Inventory ERROR: No RUDDER/HOSTNAME or OPERATINGSYSTEM/FQDN, set a hostname other than 'localhost' and add its name in /etc/hosts\n";
exit 1;
}

Also available in: Unified diff