Skip to content

Commit e7fc8e5

Browse files
author
Marcin Przepiorowski
committed
Merge branch 'hotfix#79'
2 parents 82b01a3 + bbad3e9 commit e7fc8e5

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

bin/dx_ctl_js_container.pl

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
'd|engine=s' => \(my $dx_host),
5353
'container_name=s' => \(my $container_name),
5454
'template_name=s' => \(my $template_name),
55+
'branch_name=s' => \(my $branch_name),
5556
'container_def=s@' => \(my $container_def),
5657
'container_owner=s@' => \(my $container_owners),
5758
'timestamp=s' => \(my $timestamp),
@@ -142,6 +143,10 @@
142143
} elsif (lc $action eq 'refresh') {
143144
$jobno = $jscontainers->refreshContainer($jscontainer_ref);
144145
} elsif (lc $action eq 'restore') {
146+
if (!defined($timestamp)) {
147+
print "Timestamp is required\n";
148+
exit(1);
149+
}
145150
my $branch_ref;
146151
if (defined($fromtemplate)) {
147152
if (!defined($template_ref)) {
@@ -150,11 +155,15 @@
150155
}
151156
my $branch_obj = new JS_branch_obj ( $engine_obj, $template_ref, $debug);
152157
$branch_ref = $branch_obj->getJSBranchByName('master');
153-
$jobno = $jscontainers->restoreContainer($jscontainer_ref, $branch_ref->[0], $timestamp, $template_ref);
158+
$jobno = $jscontainers->restoreContainer($jscontainer_ref, $branch_ref, $timestamp, $template_ref);
154159
} else {
155-
my $branch_obj = new JS_branch_obj ( $engine_obj, $jscontainer_ref, $debug);
156-
$branch_ref = $branch_obj->getJSBranchByName('default');
157-
$jobno = $jscontainers->restoreContainer($jscontainer_ref, $branch_ref->[0], $timestamp, $jscontainer_ref);
160+
if (defined($branch_name)) {
161+
my $branch_obj = new JS_branch_obj ( $engine_obj, $jscontainer_ref, $debug);
162+
$branch_ref = $branch_obj->getJSBranchByName($branch_name);
163+
} else {
164+
$branch_ref = $jscontainers->getJSActiveBranch($jscontainer_ref);
165+
}
166+
$jobno = $jscontainers->restoreContainer($jscontainer_ref, $branch_ref, $timestamp, $jscontainer_ref);
158167
}
159168
} elsif (lc $action eq 'delete') {
160169
if (!defined($dropvdb) || ( ! ( ( lc $dropvdb eq 'yes' ) || (lc $dropvdb eq 'no' ) ) ) ) {
@@ -351,13 +360,14 @@ =head1 SYNOPSIS
351360
[-container_owner username]
352361
[-template_name template_name]
353362
[-timestamp timestamp]
363+
[-branch_name branch_name]
354364
[-dropvdb yes|no]
355365
[-dontrefresh]
356366
[ -help|? ] [ -debug ]
357367
358368
=head1 DESCRIPTION
359369
360-
Run a action on the JetStream container
370+
Run a action on the JetStream container. If branch is not specified
361371
362372
=head1 ARGUMENTS
363373
@@ -412,6 +422,9 @@ =head1 ARGUMENTS
412422
=item B<-template_name template_name>
413423
Name of container's templates
414424
425+
=item B<-branch_name branch_name>
426+
Container branch name for action - default branch name is "default"
427+
415428
=back
416429
417430
=head1 OPTIONS

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.3.9.1';
32+
our $version = '2.3.9.2';
3333

3434
sub logger {
3535
my $debug = shift;

0 commit comments

Comments
 (0)