Skip to content

Commit a677c74

Browse files
author
Marcin Przepiorowski
committed
Merge branch 'issue#115' into develop
2 parents 7e51277 + e96f76b commit a677c74

File tree

139 files changed

+4035
-10006
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+4035
-10006
lines changed

lib/Bookmark_obj.pm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ sub createBookmark
201201
}
202202
my $db_reference = $db->getReference();
203203

204-
205204
my $current_timeflow = $self->{_timeflows}->getCurrentTimeflowForContainer($db_reference);
206205

207206
my $bookmark_timeflow_type;
@@ -244,7 +243,6 @@ sub createBookmark
244243
# this is to print time stamp of snapshot
245244
my $snapshots = new Snapshot_obj ($self->{_dlpxObject},$db_reference, 1, $self->{_debug});
246245
($temp_time,$temp_timezone) = $snapshots->getLatestSnapshotTime();
247-
248246
my @timesplit = split(' ',$temp_time);
249247

250248
$temp_time = $timesplit[0] . ' ' . $timesplit[1];
@@ -301,6 +299,7 @@ sub createBookmark
301299
return 0;
302300
} else {
303301
print "Creatation of bookmark $name for time $temp_time failed\n";
302+
print $result->{error}->{details} . "\n";
304303
return 1;
305304
}
306305

lib/Snapshot_obj.pm

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,34 @@ sub getSnapshotSize {
962962

963963
}
964964

965+
# Procedure getVDBTimezone
966+
# parameters:
967+
# Load 1 snapshot object for a database from Delphix Engine
968+
969+
sub getVDBTimezone
970+
{
971+
my $self = shift;
972+
logger($self->{_debug}, "Entering Snapshot_obj::getVDBTimezone",1);
973+
974+
my $timezone_op = "resources/json/delphix/snapshot?pageSize=1&database=" . $self->{_container};
975+
my ($result, $result_fmt) = $self->{_dlpxObject}->getJSONResult($timezone_op);
976+
if (defined($result->{status}) && ($result->{status} eq 'OK')) {
977+
my @res = @{$result->{result}};
978+
if (scalar(@res) > 0) {
979+
$self->{_snapshots}->{$res[-1]->{reference}} = $res[-1];
980+
$self->{_timezone} = $self->getSnapshotTimeZone($res[-1]->{reference});
981+
delete $self->{_snapshots}->{$res[-1]->{reference}};
982+
}
983+
} else {
984+
print "Can't check snapshot timezone \n";
985+
exit 1;
986+
}
987+
if (defined($self->{_timezone})) {
988+
return $self->{_timezone};
989+
} else {
990+
return "N/A";
991+
}
992+
}
965993

966994
# Procedure getSnapshotList
967995
# parameters: - none
@@ -984,19 +1012,7 @@ sub getSnapshotList
9841012

9851013
if (defined($self->{_startDate}) || defined($self->{_endDate}) ) {
9861014
# timezone check
987-
my $timezone_op = "resources/json/delphix/snapshot?pageSize=1&database=" . $self->{_container};
988-
my ($result, $result_fmt) = $self->{_dlpxObject}->getJSONResult($timezone_op);
989-
if (defined($result->{status}) && ($result->{status} eq 'OK')) {
990-
my @res = @{$result->{result}};
991-
if (scalar(@res) > 0) {
992-
$self->{_snapshots}->{$res[-1]->{reference}} = $res[-1];
993-
$self->{_timezone} = $self->getSnapshotTimeZone($res[-1]->{reference});
994-
delete $self->{_snapshots}->{$res[-1]->{reference}};
995-
}
996-
} else {
997-
print "Can't check snapshot timezone \n";
998-
exit 1;
999-
}
1015+
$self->getVDBTimezone();
10001016
}
10011017

10021018
if (defined($self->{_startDate}) && defined($self->{_timezone}) ) {
@@ -1065,7 +1081,8 @@ sub getSnapshotList
10651081

10661082
for my $snapitem (@res) {
10671083
$snapshots->{$snapitem->{reference}} = $snapitem;
1068-
push(@snapshot_order, $snapitem->{reference});
1084+
#push(@snapshot_order, $snapitem->{reference});
1085+
unshift @snapshot_order, $snapitem->{reference};
10691086
}
10701087

10711088
$pageoffset = $self->{_snapshots}->{$snapshot_order[-1]}->{latestChangePoint}->{timestamp};
@@ -1078,6 +1095,7 @@ sub getSnapshotList
10781095
exit 1;
10791096
}
10801097
}
1098+
10811099
}
10821100

10831101
1;

lib/VDB_obj.pm

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,16 +420,50 @@ sub getParentContainer
420420

421421
# Procedure getTimezone
422422
# parameters: none
423-
# Return database timezone
423+
# Return database timezone or N/A
424424

425425
sub getTimezone
426426
{
427427
my $self = shift;
428428
logger($self->{_debug}, "Entering VDB_obj::getTimezone",1);
429-
my $tz = $self->{host}->{hostConfiguration}->{operatingSystem}->{timezone};
429+
# my $tz = $self->{host}->{hostConfiguration}->{operatingSystem}->{timezone};
430+
#
431+
# my @tztmp = split(',', $tz);
432+
# return $tztmp[0];
430433

431-
my @tztmp = split(',', $tz);
432-
return $tztmp[0];
434+
my $timezone;
435+
436+
if (defined($self->{_timezone})) {
437+
return $self->{_timezone}
438+
} else {
439+
my $timezone_op = "resources/json/delphix/snapshot?pageSize=1&database=" . $self->getReference();
440+
my ($result, $result_fmt) = $self->{_dlpxObject}->getJSONResult($timezone_op);
441+
if (defined($result->{status}) && ($result->{status} eq 'OK')) {
442+
my @res = @{$result->{result}};
443+
if (scalar(@res) > 0) {
444+
my $snapshot = $res[-1];
445+
$timezone = $snapshot->{timezone};
446+
}
447+
} else {
448+
print "Can't check snapshot timezone \n";
449+
exit 1;
450+
}
451+
if (defined($timezone)) {
452+
chomp($timezone);
453+
my @temp = split(',',$timezone);
454+
my $ret = $temp[0];
455+
456+
if (! ($ret =~ /[a-zA-Z]{3}.\d\d:\d\d/ )) {
457+
# if timezone is not GMT+-00:00 format
458+
# check if this format can be recognized and amended by checkTZ function
459+
$ret = Snapshot_obj::checkTZ(undef, $ret);
460+
}
461+
$self->{_timezone} = $ret;
462+
return $ret;
463+
} else {
464+
return "N/A";
465+
}
466+
}
433467
}
434468

435469

0 commit comments

Comments
 (0)