Skip to content

Commit

Permalink
fix: logs: sql dbname was not properly passed through the update logs…
Browse files Browse the repository at this point in the history
… func
  • Loading branch information
speed47 committed Jan 13, 2021
1 parent ecc19db commit c644649
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/perl/OVH/Bastion/log.inc
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,14 @@ sub log_access_insert {
my $accountsql = 'no';
if (OVH::Bastion::config('enableAccountSqlLog')->value()) {
if ($loghome && -d "/home/$loghome") {
my $sqlfile = sprintf("/home/%s/%s-log-%04d%02d.sqlite", $loghome, $remoteaccount || $loghome, $localtime[5] + 1900, $localtime[4] + 1);
$fnret = _sql_log_insert_file(
%params,
sqltype => "local",
file => sprintf("/home/%s/%s-log-%04d%02d.sqlite", $loghome, $remoteaccount || $loghome, $localtime[5] + 1900, $localtime[4] + 1)
file => $sqlfile
);
if ($fnret) {
($insert_id, $db_name) = ($fnret->value->{'id'}, $params{'file'});
($insert_id, $db_name) = ($fnret->value->{'id'}, $sqlfile);
$accountsql = 'ok';
}
else {
Expand Down Expand Up @@ -710,14 +711,14 @@ sub log_access_update {
# 1/3) update the account sql db if enabled. note that the global sql db is NOT updated, as
# it contains less details that the account databases and doesn't have any field that requires
# to wait the end of a connection to be filled.
my $accountsql = 'missing';
if ($insert_id && $db_name) {
if (OVH::Bastion::config('enableAccountSqlLog')->value()) {
my $accountsql = 'no';
if (OVH::Bastion::config('enableAccountSqlLog')->value()) {
if ($insert_id && $db_name) {
$fnret = _sql_log_update_file(%params, file => $db_name, id => $insert_id);
$accountsql = $fnret ? 'ok' : 'error ' . $fnret->msg;
}
else {
$accountsql = 'no';
$accountsql = 'missing';
}
}

Expand Down

0 comments on commit c644649

Please sign in to comment.