2011-05-03 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/DB.pm, lib/PandoraFMS/DataServer.pm: Check that a group exists before auto-creating an agent. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4297 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
7cee88e20b
commit
ff9b6ecb14
|
@ -1,3 +1,8 @@
|
||||||
|
2011-05-03 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* lib/PandoraFMS/DB.pm, lib/PandoraFMS/DataServer.pm: Check that a group
|
||||||
|
exists before auto-creating an agent.
|
||||||
|
|
||||||
2011-04-29 Miguel de Dios <miguel.dedios@artica.es>
|
2011-04-29 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* util/pandora_xml_stress.pl: added the generate scatter and curve data
|
* util/pandora_xml_stress.pl: added the generate scatter and curve data
|
||||||
|
|
|
@ -152,7 +152,7 @@ sub get_server_id ($$$) {
|
||||||
sub get_group_id ($$) {
|
sub get_group_id ($$) {
|
||||||
my ($dbh, $group_name) = @_;
|
my ($dbh, $group_name) = @_;
|
||||||
|
|
||||||
my $rc = get_db_value ($dbh, "SELECT id_grupo FROM tgrupo WHERE nombre = ?", safe_input($group_name));
|
my $rc = get_db_value ($dbh, 'SELECT id_grupo FROM tgrupo WHERE ' . db_text ('nombre') . ' = ?', safe_input($group_name));
|
||||||
return defined ($rc) ? $rc : -1;
|
return defined ($rc) ? $rc : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,9 +314,17 @@ sub process_xml_data ($$$$$) {
|
||||||
|
|
||||||
# Get OS, group and description
|
# Get OS, group and description
|
||||||
my $os = pandora_get_os ($data->{'os_name'});
|
my $os = pandora_get_os ($data->{'os_name'});
|
||||||
my $group_id = undef;
|
my $group_id = -1;
|
||||||
$group_id = get_db_value ($dbh, 'SELECT id_grupo FROM tgrupo WHERE ' . db_text ('nombre') . ' = ?', $data->{'group'}) if (defined ($data->{'group'}));
|
$group_id = get_group_id ($dbh, $data->{'group'}) if (defined ($data->{'group'}));
|
||||||
$group_id = $pa_config->{'autocreate_group'} unless defined ($group_id);
|
if ($group_id == -1) {
|
||||||
|
$group_id = $pa_config->{'autocreate_group'};
|
||||||
|
if (! defined (get_group_name ($dbh, $group_id))) {
|
||||||
|
logger($pa_config, "Group id $group_id does not exist (check autocreate_group config token)", 3);
|
||||||
|
$AgentSem->up ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my $description = '';
|
my $description = '';
|
||||||
$description = $data->{'description'} if (defined ($data->{'description'}));
|
$description = $data->{'description'} if (defined ($data->{'description'}));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue