Skip to content

Commit a40d145

Browse files
author
Marcin Przepiorowski
committed
v2.4.8
2 parents 1d4e316 + aed413b commit a40d145

File tree

7 files changed

+81
-72
lines changed

7 files changed

+81
-72
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -46,49 +46,6 @@ jobs:
4646
- name: checkout dxtoolkit code
4747
uses: actions/checkout@master
4848

49-
# - name: Set up a Perl container
50-
# run: |
51-
# sudo apt-get update || exit 0
52-
# sudo apt-get install -y libpar-packer-perl
53-
# sudo apt-get install -y libjson-pp-perl
54-
# sudo apt-get install -y libdate-manip-perl
55-
# sudo apt-get install -y libdatetime-format-dateparse-perl
56-
# sudo apt-get install -y libcrypt-cbc-perl
57-
# sudo apt-get install -y libcrypt-blowfish-perl
58-
# sudo apt-get install -y libtext-csv-perl
59-
# sudo apt-get install -y libtry-tiny-perl
60-
# sudo apt-get install -y libparse-http-useragent-perl
61-
# sudo apt-get install -y libnet-ssleay-perl
62-
# sudo apt-get install -y libio-socket-ssl-perl
63-
# sudo apt-get install -y libfilter-perl
64-
# sudo apt-get install -y libterm-readkey-perl
65-
# sudo apt-get install -y cpanminus
66-
# sudo apt-get install -y make
67-
# sudo apt-get install -y gcc
68-
# sudo apt-get install -y libssl-dev
69-
# sudo apt-get install -y libwww-perl
70-
# sudo cpanm DateTime::Event::Cron::Quartz
71-
# sudo cpanm Log::Syslog::Fast@0.65
72-
# sudo cpanm Filter::Crypto::Decrypt
73-
74-
# - name: Compile
75-
# run: |
76-
# mkdir /home/runner/work/dxtoolkit/dxtoolkit/dxtoolkit2
77-
78-
# cd /home/runner/work/dxtoolkit/dxtoolkit/lib
79-
# mv dbutils.pm dbutils.orig.pm
80-
# cat dbutils.orig.pm | sed -e "s/put your encryption key here/${INPUT_ENCKEY}/" > dbutils.pm
81-
82-
# cd /home/runner/work/dxtoolkit/dxtoolkit/bin
83-
# pp -u -l /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 -l /usr/lib/x86_64-linux-gnu/libssl.so.1.1 -I /home/runner/work/dxtoolkit/dxtoolkit/lib -M Text::CSV_PP -M List::MoreUtils::PP -M Crypt::Blowfish \
84-
# -F Crypto=dbutils\.pm$ -M Filter::Crypto::Decrypt -o /home/runner/work/dxtoolkit/dxtoolkit/dxtoolkit2/runner `ls dx_*.pl | xargs`
85-
86-
# cd /home/runner/work/dxtoolkit/dxtoolkit/dxtoolkit2
87-
# for i in /home/runner/work/dxtoolkit/dxtoolkit/bin/dx_*.pl ; do name=`basename -s .pl $i`; ln -s runner $name; done
88-
# ls -l /home/runner/work/dxtoolkit/dxtoolkit/dxtoolkit2
89-
# cd /home/runner/work/dxtoolkit/dxtoolkit/
90-
# tar czvf /home/runner/work/dxtoolkit/dxtoolkit/dxtoolkit.tar.gz dxtoolkit2/
91-
9249
- name: Set up a Perl container
9350
#uses: pioro/dxtoolkit@develop
9451
uses: docker://pioro/dxperlubuntu18:5.26
@@ -172,12 +129,6 @@ jobs:
172129
cd D:\a\dxtoolkit\dxtoolkit\
173130
shell: powershell
174131

175-
# - name: Upload enc
176-
# uses: actions/upload-artifact@v1
177-
# with:
178-
# name: windowsbuild-enc
179-
# path: D:\a\dxtoolkit\dxtoolkit\lib\dbutils.pm
180-
181132
- name: download perl
182133
run: |
183134
mkdir d:\a\perldownload
@@ -230,6 +181,9 @@ jobs:
230181
231182
- name: install perl
232183
run: |
184+
# have a static version of perl 5.30.2_1
185+
brew uninstall --ignore-dependencies perl
186+
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8ff2935985d6da4f2f463ea2666545e6017c4d54/Formula/perl.rb
233187
brew install cpanminus
234188
# brew install openssl
235189
cpanm Crypt::CBC

.github/workflows/develop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ jobs:
213213
214214
- name: install perl
215215
run: |
216+
# have a static version of perl 5.30.2_1
217+
brew uninstall --ignore-dependencies perl
218+
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8ff2935985d6da4f2f463ea2666545e6017c4d54/Formula/perl.rb
216219
brew install cpanminus
217220
# brew install openssl
218221
cpanm Crypt::CBC
@@ -235,6 +238,7 @@ jobs:
235238
cpanm LWP::Protocol::https
236239
cpanm Term::ReadKey
237240
cpanm -f Archive::Zip
241+
cpanm utf8
238242
cpanm PAR::Packer
239243
cpanm List::MoreUtils::PP
240244

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 2.4.8
2+
3+
4+
### Changed
5+
- [fix for #149](https://github.com/delphix/dxtoolkit/issues/149) - dx_ctl_js_bookmarks appends date to bookmark name specified
6+
- [fix for #152](https://github.com/delphix/dxtoolkit/issues/152) - dx_ctl_js_bookmarks: time point for -snapshots uses creationTime but that is before the first datapoint
7+
- [fix for #153](https://github.com/delphix/dxtoolkit/issues/153) - "13-07-2020 isdigit is removed from perl"
8+
- [fix for #154](https://github.com/delphix/dxtoolkit/issues/154) - "2020-07-16 -all switch is not working with different users"
9+
10+
111
## 2.4.7
212

313

bin/dx_ctl_js_bookmarks.pl

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
'template_name=s' => \(my $template_name),
5858
'container_name=s' => \(my $container_name),
5959
'bookmark_name=s' => \(my $bookmark_name),
60+
'usefullname' => \(my $usefullname),
6061
'branch_name=s' => \(my $branch_name),
6162
'bookmark_branchname=s' => \(my $full_branchname),
6263
'bookmark_time=s' => \(my $bookmark_time),
@@ -95,8 +96,8 @@
9596

9697
if (lc $action eq 'create') {
9798

98-
if (!defined($template_name) || (!defined($bookmark_name))) {
99-
print "Options template_name and bookmark_name are required \n";
99+
if (!defined($template_name) || (!(defined($bookmark_name)))) {
100+
print "Options template_name and bookmark_name or bookmark_prefix are required \n";
100101
pod2usage(-verbose => 1, -input=>\*DATA);
101102
exit (1);
102103
}
@@ -126,6 +127,12 @@
126127
exit (1);
127128
}
128129

130+
if ((( lc $snapshots eq 'all' ) || ( lc $snapshots eq 'both' )) && (defined($usefullname))) {
131+
print "Snapshot option all or both can't run with usefullname flag \n";
132+
pod2usage(-verbose => 1, -input=>\*DATA);
133+
exit (1);
134+
}
135+
129136
if (defined($snapshots) && (!defined($source))) {
130137
print "Option snapshot require a source to be defined \n";
131138
pod2usage(-verbose => 1, -input=>\*DATA);
@@ -385,7 +392,7 @@ sub generate_snapshot_mapping {
385392
if ((lc $snapshots eq 'first') || (lc $snapshots eq 'both')) {
386393
# find a first snapshot which can be used for bookmark ( has been taken after template was created )
387394
for my $snapitem ( @{ $snapshot->getSnapshots() }) {
388-
my $time = $snapshot->getSnapshotCreationTime($snapitem);
395+
my $time = $snapshot->getStartPoint($snapitem);
389396
my $goodtime;
390397
if (version->parse($engine_obj->getApi()) < version->parse(1.8.0)) {
391398
$goodtime = $datasources->checkTime($datalayout_ref, $time);
@@ -396,7 +403,12 @@ sub generate_snapshot_mapping {
396403
my $timename = $time;
397404
$timename =~ s/T/ /;
398405
$timename =~ s/\....Z//;
399-
$bookmark_times_hash{$bookmark_name . '-' . $timename} = $time;
406+
if (defined($usefullname)) {
407+
$timename = $bookmark_name;
408+
} else {
409+
$timename = $bookmark_name . "-" . $timename
410+
}
411+
$bookmark_times_hash{$timename} = $time;
400412
last;
401413
}
402414
}
@@ -405,7 +417,7 @@ sub generate_snapshot_mapping {
405417
if ((lc $snapshots eq 'last') || (lc $snapshots eq 'both')) {
406418
my $last_time = (@{ $snapshot->getSnapshots() })[-1];
407419

408-
my $time = $snapshot->getSnapshotCreationTime($last_time);
420+
my $time = $snapshot->getStartPoint($last_time);
409421
my $goodtime;
410422
if (version->parse($engine_obj->getApi()) < version->parse(1.8.0)) {
411423
$goodtime = $datasources->checkTime($datalayout_ref, $time);
@@ -417,13 +429,18 @@ sub generate_snapshot_mapping {
417429
my $timename = $time;
418430
$timename =~ s/T/ /;
419431
$timename =~ s/\....Z//;
420-
$bookmark_times_hash{$bookmark_name . '-' . $timename} = $time;
432+
if (defined($usefullname)) {
433+
$timename = $bookmark_name;
434+
} else {
435+
$timename = $bookmark_name . "-" . $timename
436+
}
437+
$bookmark_times_hash{$timename} = $time;
421438
}
422439
}
423440

424441
if (lc $snapshots eq 'all') {
425442
for my $snapitem ( @{ $snapshot->getSnapshots() }) {
426-
my $time = $snapshot->getSnapshotCreationTime($snapitem);
443+
my $time = $snapshot->getStartPoint($snapitem);
427444
my $goodtime;
428445
if (version->parse($engine_obj->getApi()) < version->parse(1.8.0)) {
429446
$goodtime = $datasources->checkTime($datalayout_ref, $time);
@@ -458,6 +475,7 @@ =head1 SYNOPSIS
458475
[-source source_name]
459476
[-container_name container_name]
460477
[-expireat timestamp ]
478+
[-usefullname]
461479
[ --help|? ] [ -debug ]
462480
463481
=head1 DESCRIPTION
@@ -507,7 +525,18 @@ =head2 Options
507525
Set container for bookmark using container name
508526
509527
=item B<-bookmark_name bookmark_name>
510-
Set bookmark name
528+
Set bookmark name if bookmark is created using bookmark_time.
529+
When bookmarks are created using snapshot option,
530+
names will be generated using bookmark name as a prefix
531+
and snapshot time.
532+
533+
This behaviour can be modified using usefullname flag
534+
535+
=item B<-usefullname>
536+
If bookmarks are created using a snapshot last or snapshot first
537+
option, this flag will force a bookmark name to be set without
538+
adding a time of the snapshot
539+
511540
512541
=item B<-bookmark_time time>
513542
Set bookmark time. Allowed values:
@@ -536,14 +565,25 @@ =head2 Options
536565
537566
=over 3
538567
539-
=item B<-all> - create bookmarks for all snapshot of source created after template was created
568+
=item B<-all> - create bookmarks for all snapshot of source created after template was created.
569+
Bookmark names will be generated using this pattern: bookname_name-YYYY-MM-DDTHH:MI:SS.SSSZ
540570
541571
=item B<-first> - create bookmark for a first snapshot of source after template was created
572+
Bookmark name will be generated using this pattern: bookname_name-YYYY-MM-DDTHH:MI:SS.SSSZ
573+
If the -usefullname parameter is used, bookmark name will be created without adding a snapshot time
542574
543575
=item B<-last> - create bookmark for a last snapshot of source after template was created
576+
Bookmark name will be generated using this pattern: bookname_name-YYYY-MM-DDTHH:MI:SS.SSSZ
577+
If the -usefullname parameter is used, bookmark name will be created without adding a snapshot time
578+
579+
=item B<-both> - create bookmark for a first and last snapshot of source after template was created
580+
Bookmark names will be generated using this pattern: bookname_name-YYYY-MM-DDTHH:MI:SS.SSSZ
544581
545582
=back
546583
584+
Bookmark will be created with a name following this pattern:
585+
586+
547587
=item B<-expireat timestamp>
548588
Set a bookmark expiration time using format "YYYY-MM-DD"
549589
or "YYYY-MM-DD HH24:MI:SS"

bin/dx_ctl_snapshots.pl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,17 @@
8686
exit (1);
8787
}
8888

89+
my $w = ($retention =~ /^[[:digit:]]+$/);
90+
print Dumper !$w;
91+
92+
93+
8994
if (defined($retention)) {
9095
if (lc $retention eq 'forever') {
9196
$retention = -1;
9297
} elsif (lc $retention eq 'policy') {
9398
$retention = 0;
94-
} elsif (! isdigit($retention) ) {
99+
} elsif (! ($retention =~ /^[[:digit:]]+$/x )) {
95100
print "Retention parameter has to be a integer or word 'forever' \n";
96101
pod2usage(-verbose => 1, -input=>\*DATA);
97102
exit(1);

lib/Engine.pm

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -766,19 +766,15 @@ sub getCurrentUser {
766766

767767
logger($self->{_debug}, "Entering Engine::getCurrentUser",1);
768768

769-
if ($self->{_currentuser} eq '') {
770-
771-
my $operation = "resources/json/delphix/user/current";
772-
my ($result, $result_fmt) = $self->getJSONResult($operation);
773-
774-
if (defined($result->{status}) && ($result->{status} eq 'OK')) {
775-
$ret = $result->{result};
776-
$self->{_currentuser} = $ret->{name};
777-
$self->{_currentusertype} = $ret->{userType};
778-
} else {
779-
print "No data returned for $operation. Try to increase timeout \n";
780-
}
769+
my $operation = "resources/json/delphix/user/current";
770+
my ($result, $result_fmt) = $self->getJSONResult($operation);
781771

772+
if (defined($result->{status}) && ($result->{status} eq 'OK')) {
773+
$ret = $result->{result};
774+
$self->{_currentuser} = $ret->{name};
775+
$self->{_currentusertype} = $ret->{userType};
776+
} else {
777+
print "No data returned for $operation. Try to increase timeout \n";
782778
}
783779

784780
return $self->{_currentuser};

lib/Toolkit_helpers.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use File::Spec;
2929

3030
use lib '../lib';
3131

32-
our $version = '2.4.7-rc1';
32+
our $version = '2.4.8';
3333

3434
my $tz = new Date::Manip::TZ;
3535
my $dt = new Date::Manip::Date;

0 commit comments

Comments
 (0)