fixed error with meta create vent cli

This commit is contained in:
marcos 2021-04-27 12:14:32 +02:00
parent 8a5f5992ac
commit 9edfe43cb7
1 changed files with 8 additions and 1 deletions

View File

@ -237,8 +237,15 @@ sub get_command_id ($$) {
########################################################################
sub get_agent_id ($$) {
my ($dbh, $agent_name) = @_;
my $is_meta = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token like 'metaconsole'");
my $rc;
if($is_meta == 1) {
$rc = get_db_value ($dbh, "SELECT id_agente FROM tmetaconsole_agent WHERE nombre = ? OR direccion = ?", safe_input($agent_name), $agent_name);
} else {
$rc = get_db_value ($dbh, "SELECT id_agente FROM tagente WHERE nombre = ? OR direccion = ?", safe_input($agent_name), $agent_name);
}
my $rc = get_db_value ($dbh, "SELECT id_agente FROM tagente WHERE nombre = ? OR direccion = ?", safe_input($agent_name), $agent_name);
return defined ($rc) ? $rc : -1;
}