Merge branch '118-pandora_db-pl-use-uninisialized-config-value' into 'develop'

Resolve "pandora_db.pl use uninisialized config value"

Closes #118

See merge request !361
This commit is contained in:
vgilc 2017-09-18 10:53:17 +02:00
commit d0f8b9d2a5
1 changed files with 6 additions and 5 deletions

View File

@ -93,7 +93,7 @@ sub pandora_purgedb ($$) {
} }
# Delete old inventory data # Delete old inventory data
if (defined($conf->{'_inventory_purge'}) && $conf->{'_inventory_purge'} > 0) { if (defined ($conf->{'_inventory_purge'}) && $conf->{'_inventory_purge'} > 0) {
if (enterprise_load (\%conf) != 0) { if (enterprise_load (\%conf) != 0) {
my $ulimit_timestamp_inventory = time() - (86400 * $conf->{'_inventory_purge'}); my $ulimit_timestamp_inventory = time() - (86400 * $conf->{'_inventory_purge'});
@ -612,6 +612,7 @@ sub pandora_load_config ($) {
$conf->{'dbengine'} = 'mysql' unless defined ($conf->{'dbengine'}); $conf->{'dbengine'} = 'mysql' unless defined ($conf->{'dbengine'});
$conf->{'dbport'} = '3306' unless defined ($conf->{'dbport'}); $conf->{'dbport'} = '3306' unless defined ($conf->{'dbport'});
$conf->{'claim_back_snmp_modules'} = '1' unless defined ($conf->{'claim_back_snmp_modules'}); $conf->{'claim_back_snmp_modules'} = '1' unless defined ($conf->{'claim_back_snmp_modules'});
$conf->{'verbosity'} = '3' unless defined ($conf->{'verbosity'});
# Dynamic interval configuration. # Dynamic interval configuration.
$conf->{"dynamic_constant"} = 0.10 unless defined($conf->{"dynamic_constant"}); $conf->{"dynamic_constant"} = 0.10 unless defined($conf->{"dynamic_constant"});
@ -787,10 +788,10 @@ sub pandora_checkdb_consistency {
log_message ('CHECKDB', "Ignoring not-init data."); log_message ('CHECKDB', "Ignoring not-init data.");
} }
log_message ('CHECKDB',
"Deleting unknown data (More than " . $conf{'_days_delete_unknown'} . " days).");
if (defined($conf{'_days_delete_unknown'}) && $conf{'_days_delete_unknown'} > 0) { if (defined($conf{'_days_delete_unknown'}) && $conf{'_days_delete_unknown'} > 0) {
log_message ('CHECKDB',
"Deleting unknown data (More than " . $conf{'_days_delete_unknown'} . " days).");
my @modules = get_db_rows($dbh, my @modules = get_db_rows($dbh,
'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.id_agente 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.id_agente
FROM tagente_modulo, tagente_estado FROM tagente_modulo, tagente_estado
@ -1060,4 +1061,4 @@ if ($lock == 1) {
db_release_lock ($dbh, 'pandora_db'); db_release_lock ($dbh, 'pandora_db');
} }
exit 0; exit 0;