Skip to content

Commit e1c542b

Browse files
author
Marcin Przepiorowski
committed
version 2.4.1
2 parents 58d596f + 7809380 commit e1c542b

24 files changed

+1812
-451
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
## 2.4.1
2+
3+
Configuration files with an encrypted passwords has to be regenerated due
4+
to changes with encryption keys and adding a checksum to password encryption.
5+
6+
### Added
7+
8+
- dx_get_engine_time script to display an engine time using a time zone defined in Delphix Engine
9+
- [fix for #84](https://github.com/delphix/dxtoolkit/issues/84) - shared / unshare action added to dx_ctl_js_bookmarks
10+
- [fix for #94](https://github.com/delphix/dxtoolkit/issues/94) - shared / unshare action added to dx_ctl_js_bookmarks
11+
- [fix for #96](https://github.com/delphix/dxtoolkit/issues/96) - support for changing a host in an environment added
12+
- [fix for #97](https://github.com/delphix/dxtoolkit/issues/97) - dx_ctl_users enhancement - adding a SSH key to user
13+
14+
### Changed
15+
- better support for log in errors ( cookie clean up )
16+
- dx_get_js_snapshots will skip a template bookmarks
17+
- fix for disabled databases
18+
- [fix for #93](https://github.com/delphix/dxtoolkit/issues/93) - fix for file upload in dx_ctl_engine_upgrade. TODO: apply needs to detect engine reboot
19+
- [fix for #98](https://github.com/delphix/dxtoolkit/issues/98) - fix for session user check if user has a domain specified
20+
21+
122
## 2.4.0
223

324
Configuration files with an encrypted passwords has to be regenerated due

bin/dx_ctl_engine_upgrade.pl

Lines changed: 64 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -90,25 +90,26 @@
9090

9191
my $file_version;
9292

93-
if ((lc $action eq 'upload') && (!defined($filename))) {
94-
print "Parameter -filename is required for upload action \n";
95-
pod2usage(-verbose => 1, -input=>\*DATA);
96-
exit (1);
97-
} else {
98-
99-
my $namechek = basename($filename);
100-
if ( ! (($file_version) = $namechek =~ /^delphix_(\d.\d.\d.\d)_\d\d\d\d-\d\d-\d\d-\d\d-\d\d.upgrade.tar.gz$/ )) {
101-
print "Filename is not matching delphix upgrade pattern \n";
93+
if (lc $action eq 'upload') {
94+
if (!defined($filename)) {
95+
print "Parameter -filename is required for upload action \n";
96+
pod2usage(-verbose => 1, -input=>\*DATA);
10297
exit (1);
103-
}
98+
} else {
10499

105-
if (!defined($file_version)) {
106-
print "Filename is not matching delphix upgrade pattern. Can't find version number \n";
107-
exit (1);
108-
}
100+
my $namechek = basename($filename);
101+
if ( ! (($file_version) = $namechek =~ /^delphix_(\d.\d.\d.\d)_\d\d\d\d-\d\d-\d\d-\d\d-\d\d.upgrade.tar.gz$/ )) {
102+
print "Filename is not matching delphix upgrade pattern \n";
103+
exit (1);
104+
}
109105

110-
}
106+
if (!defined($file_version)) {
107+
print "Filename is not matching delphix upgrade pattern. Can't find version number \n";
108+
exit (1);
109+
}
111110

111+
}
112+
}
112113

113114
# this array will have all engines to go through (if -d is specified it will be only one engine)
114115
my $engine_list = Toolkit_helpers::get_engine_list($all, $dx_host, $engine_obj);
@@ -142,40 +143,77 @@
142143
next;
143144
}
144145

145-
$jobstart = Toolkit_helpers::timestamp("-0mins", $engine_obj);
146+
$jobstart = Toolkit_helpers::timestamp("-0min", $engine_obj);
146147

147148
my $rc = $engine_obj->uploadupdate($filename);
148-
if ($rc eq 0) {
149-
print "Checking status of upload verification job\n";
149+
150+
if ($rc ne 0) {
151+
$ret = $ret + $rc;
152+
next;
150153
}
151-
$ret = $ret + $rc;
152154

153-
my $jobs = new Jobs($engine_obj, $jobstart, undef, undef, undef, undef, undef, undef, 1, undef, $debug);
154-
my $joblist = $jobs->getJobList();
155+
print "Checking status of upload verification job\n";
156+
155157

156-
my @refresh = grep { ($jobs->getJob($_)->getJobActionType()) eq 'REFRESH_VERSIONS' } @{$joblist};
158+
my $jobs = new Jobs($engine_obj, $jobstart, undef, undef, undef, undef, undef, undef, 1, undef, $debug);
159+
my $counter = 0;
160+
my @refresh;
161+
my $joblist;
162+
163+
do {
164+
$jobs->loadJobs();
165+
$joblist = $jobs->getJobList();
166+
if (version->parse($engine_obj->getApi()) >= version->parse(1.10.0)) {
167+
@refresh = grep { ($jobs->getJob($_)->getJobActionType()) eq 'UNPACK_VERSION' } @{$joblist};
168+
} else {
169+
@refresh = grep { ($jobs->getJob($_)->getJobActionType()) eq 'REFRESH_VERSIONS' } @{$joblist};
170+
}
171+
sleep 10;
172+
$counter = $counter + 1;
173+
if ($counter > 18) {
174+
print "There is no job started for 3 minutes - exiting. File is uploaded please check GUI for job\n";
175+
$ret = $ret + 1;
176+
next;
177+
}
178+
}
179+
while (scalar(@refresh)<1);
157180

158181
my $job = $jobs->getJob($refresh[-1]);
159182
my $retjob = $job->waitForJob();
160183
if ($retjob eq 'COMPLETED') {
161-
print "Uncompressing job $job finished.\n";
184+
print "Uncompressing job " . $refresh[-1] . " finished.\n";
162185
} else {
163186
$ret = $ret + 1;
187+
next;
164188
}
165189

166-
$jobs = new Jobs($engine_obj, $jobstart, undef, undef, undef, undef, undef, undef, 1, undef, $debug);
167-
$joblist = $jobs->getJobList();
168-
@refresh = grep { ($jobs->getJob($_)->getJobActionType()) eq 'UPGRADE_VERIFY' } @{$joblist};
169190

170191
if (version->parse($engine_obj->getApi()) >= version->parse(1.9.0)) {
171192
# above 5.2 there is a verification job
193+
$counter = 0;
194+
$jobs = new Jobs($engine_obj, $jobstart, undef, undef, undef, undef, undef, undef, 1, undef, $debug);
195+
do {
196+
$jobs->loadJobs();
197+
$joblist = $jobs->getJobList();
198+
@refresh = grep { ($jobs->getJob($_)->getJobActionType()) eq 'UPGRADE_VERIFY' } @{$joblist};
199+
sleep 10;
200+
$counter = $counter + 1;
201+
if ($counter > 18) {
202+
print "There is no verification job started for 3 minutes - exiting. File is uploaded please check GUI for job\n";
203+
$ret = $ret + 1;
204+
next;
205+
}
206+
} while (scalar(@refresh)<1);
207+
172208
$job = $jobs->getJob($refresh[-1]);
173209
$retjob = $job->waitForJob();
174210
if ($retjob eq 'COMPLETED') {
175211
print "Verification job $job finished\n";
176212
} else {
177213
$ret = $ret + 1;
178214
}
215+
216+
179217
}
180218
}
181219

bin/dx_ctl_env.pl

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313
#
14-
# Copyright (c) 2014,2016 by Delphix. All rights reserved.
14+
# Copyright (c) 2014,2019 by Delphix. All rights reserved.
1515
#
1616
# Program Name : dx_ctl_env.pl
1717
# Description : Get database and host information
@@ -48,6 +48,8 @@
4848
'name|n=s' => \(my $envname),
4949
'reference|r=s' => \(my $reference),
5050
'action=s' => \(my $action),
51+
'host=s' => \(my $host),
52+
'newhost=s' => \(my $newhost),
5153
'username=s' => \(my $username),
5254
'authtype=s' => \(my $authtype),
5355
'password=s' => \(my $password),
@@ -98,14 +100,26 @@
98100
(lc $action eq 'addrepo') || (lc $action eq 'deleterepo') ||
99101
(lc $action eq 'adddatabase') || (lc $action eq 'deletedatabase') ||
100102
(lc $action eq 'addlistener') || (lc $action eq 'deletelistener') ||
101-
(lc $action eq 'adduser') || (lc $action eq 'deleteuser')
103+
(lc $action eq 'adduser') || (lc $action eq 'deleteuser') ||
104+
(lc $action eq 'updatehost')
102105
))
103106
{
104107
print "Unknown action $action\n";
105108
pod2usage(-verbose => 1, -input=>\*DATA);
106109
exit (1);
107110
}
108111

112+
if (lc $action eq 'updatehost') {
113+
if (!defined($newhost)) {
114+
print "New host has to be set\n";
115+
exit 1;
116+
}
117+
if ((!defined($envname)) && (!defined($host))) {
118+
print "Environment name or an existing host name has to be set for updatehost action\n";
119+
exit 1;
120+
}
121+
}
122+
109123
if (lc $action eq 'addrepo') {
110124
if (!defined($repotype)) {
111125
print "Repository type has to be set\n";
@@ -203,6 +217,7 @@
203217

204218
my @env_list;
205219
my @jobs;
220+
my $hostupdate;
206221

207222
if (defined($reference)) {
208223
push(@env_list, $reference);
@@ -227,7 +242,8 @@
227242

228243
my $env_name = $environments->getName($envitem);
229244

230-
if ((lc $action eq 'enable') || (lc $action eq 'disable') || (lc $action eq 'refresh')) {
245+
if ((lc $action eq 'enable') || (lc $action eq 'disable') || (lc $action eq 'refresh') ||
246+
(lc $action eq 'updatehost') ) {
231247

232248
if ( $action eq 'enable' ) {
233249
if ( $environments->getStatus($envitem) eq 'enabled' ) {
@@ -254,6 +270,14 @@
254270
$jobno = $environments->refresh($envitem);
255271
}
256272

273+
if ( lc $action eq 'updatehost' ) {
274+
print "Checking environment for host update $env_name ";
275+
$jobno = $environments->updatehost($envitem, $host, $newhost);
276+
if (defined($jobno)) {
277+
$hostupdate = 1;
278+
}
279+
}
280+
257281
if (defined ($jobno) ) {
258282
print "Starting job $jobno for environment $env_name.\n";
259283
my $job = new Jobs_obj($engine_obj, $jobno, 'true', $debug);
@@ -393,6 +417,8 @@
393417
}
394418
}
395419

420+
421+
396422
}
397423

398424
if (defined($parallel) && (scalar(@jobs) > 0)) {
@@ -402,6 +428,11 @@
402428
}
403429
}
404430

431+
if (!defined($hostupdate)) {
432+
# no environment found with a IP - need to report an error
433+
$ret = $ret + 1;
434+
}
435+
405436
}
406437

407438
exit $ret;
@@ -413,7 +444,8 @@ =head1 SYNOPSIS
413444
414445
dx_ctl_env [ -engine|d <delphix identifier> | -all ] [ -configfile file ]
415446
[ -name env_name | -reference reference ]
416-
-acton <enable|disable|refresh|adduser|addrepo|adddatabase|addlistener|deleteuser|deleterepo|deletedatabase|deletelistener>
447+
-acton <enable|disable|refresh|adduser|addrepo|adddatabase|addlistener
448+
|deleteuser|deleterepo|deletedatabase|deletelistener|updatehost>
417449
[-dbname dbname]
418450
[-instancename instancename]
419451
[-uniquename db_unique_name]
@@ -425,6 +457,8 @@ =head1 SYNOPSIS
425457
[-password password]
426458
[-repotype oracle|vfiles]
427459
[-repopath ORACLE_HOME]
460+
[-host name/ip of existing host to update]
461+
[-newhost new name/ip of the host]
428462
[-help|? ]
429463
[-debug ]
430464
@@ -457,7 +491,7 @@ =head2 Actions
457491
458492
=over 1
459493
460-
=item B<-action> <enable|disable|refresh|adduser|addrepo|adddatabase|addlistener|deleteuser|deleterepo|deletedatabase|deletelistener>
494+
=item B<-action> <enable|disable|refresh|adduser|addrepo|adddatabase|addlistener|deleteuser|deleterepo|deletedatabase|deletelistener|updatehost>
461495
Run an action specified for environments selected by filter or all environments deployed on Delphix Engine
462496
463497
=back
@@ -517,6 +551,13 @@ =head1 OPTIONS
517551
=item B<-oraclebase path>
518552
Oracle Base path
519553
554+
=item B<-host hostname/IP>
555+
Host name or IP from an environment to be updated.
556+
Not required if environment name is specified
557+
558+
=item B<-newhost hostname/IP>
559+
New Host name or IP of host being updated
560+
520561
=item B<-help>
521562
Print this screen
522563
@@ -608,4 +649,23 @@ =head1 EXAMPLES
608649
Deleting vfiles swingbench from environment LINUXSOURCE
609650
Database swingbench deleted from Unstructured Files
610651
652+
Chaging an IP of the environment
653+
654+
dx_ctl_env -d 53 -name linuxsource -newhost 172.16.200.130 -action updatehost
655+
Checking environment for host update linuxsource Starting job JOB-2850 for environment linuxsource.
656+
0 - 30 - 40 - 80 - 100
657+
Job JOB-2850 finished with state: COMPLETED
658+
659+
Chaging an IP of particular host
660+
661+
dx_ctl_env -d 53 -host 172.16.200.130 -newhost 172.16.180.129 -action updatehost
662+
Checking environment for host update racattack121 Host with IP 172.16.200.130 not found
663+
Checking environment for host update racattack Host with IP 172.16.200.130 not found
664+
Checking environment for host update oracle18tgt Host with IP 172.16.200.130 not found
665+
Checking environment for host update oracle18 Host with IP 172.16.200.130 not found
666+
Checking environment for host update linuxsource Starting job JOB-2852 for environment linuxsource.
667+
0 - 30 - 40 - 80 - 100
668+
Job JOB-2852 finished with state: COMPLETED
669+
Checking environment for host update linuxtarget Host with IP 172.16.200.130 not found
670+
611671
=cut

0 commit comments

Comments
 (0)