Skip to content

Commit 190a385

Browse files
committed
MT#64441 return 1 from do_sync_db_timezones() on when ok
* 1 is returned in do_sync_db_timezones() when no errors occured, including version match, to let dependent functions be called properly in the chain. * move mysql_tzinfo_to_sql capture after version comparsion so that the data is not gathered needlessly. Change-Id: I88ab0ef67ee40da064b9884c65b27d542550dd8f (cherry picked from commit 695da48)
1 parent 1c31293 commit 190a385

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

helper/sync-db

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,6 @@ sub do_sync_db_timezones {
315315
my $dbh = $db_conn->{$db_conn_type};
316316
my ($dbhost, $dbport) = @{$db_info->{$db_conn_type}}{qw(host port)};
317317

318-
my ($out, $err, $rc) = capture {
319-
system('/usr/bin/mysql_tzinfo_to_sql /usr/share/zoneinfo');
320-
};
321-
322-
if ($rc) {
323-
print "Error: $err\n";
324-
return;
325-
}
326-
327318
my ($tzinfo_version, undef, undef) = capture {
328319
system('dpkg-query -f "\${Version}" -W tzdata');
329320
};
@@ -343,11 +334,20 @@ SQL
343334
or die "Cannot select from ngcp.tzinfo_version: $DBI::errstr\n";
344335

345336
if ($cur_tzinfo_version eq $tzinfo_version) {
346-
return;
337+
return 1;
347338
}
348339

349340
print "sync db timezones on host=$dbhost port=$dbport old=$cur_tzinfo_version new=$tzinfo_version\n";
350341

342+
my ($out, $err, $rc) = capture {
343+
system("/usr/bin/mysql_tzinfo_to_sql /usr/share/zoneinfo");
344+
};
345+
346+
if ($rc) {
347+
print "Error: $err\n";
348+
return;
349+
}
350+
351351
open(my $sql_stream, "<", \$out)
352352
or die "Cannot open sql stream: $ERRNO\n";
353353
binmode($sql_stream);
@@ -377,7 +377,7 @@ INSERT INTO ngcp.tzinfo_version SET version = ?
377377
SQL
378378
or die "Cannot insert into ngcp.tzinfo_version: $DBI::errstr\n";
379379
};
380-
$err = $EVAL_ERROR;
380+
my $err = $EVAL_ERROR;
381381
if ($err) {
382382
print $err;
383383
$dbh->rollback();
@@ -409,7 +409,7 @@ SQL
409409
or die "Cannot select from ngcp.timezone: $DBI::errstr\n";
410410

411411
if ($cur_tz_version eq $olson_tz_version) {
412-
return;
412+
return 1;
413413
}
414414

415415
my %links = DateTime::TimeZone->links;

0 commit comments

Comments
 (0)