Skip to content

Commit 74bf924

Browse files
author
Marcin Przepiorowski
committed
v2.4.2
2 parents 181381d + 84386f3 commit 74bf924

File tree

7 files changed

+304
-123
lines changed

7 files changed

+304
-123
lines changed

bin/dx_ctl_env.pl

Lines changed: 88 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
'uniquename=s' => \(my $uniquename),
6161
'instancename=s' => \(my $instancename),
6262
'jdbc=s' => \(my $jdbc),
63+
'plugin_params=s' => \(my $plugin_params),
6364
'listenername=s' => \(my $listenername),
6465
'endpoint=s@' => \(my $endpoint),
6566
'bits=n' => \(my $bits),
@@ -134,6 +135,11 @@
134135
}
135136
}
136137

138+
if (!((lc $repotype eq 'oracle') || (lc $repotype eq 'vfiles') || (lc $repotype eq 'postgresql') || (lc $repotype eq 'db2') || (lc $repotype eq 'plugin'))) {
139+
print "Unknown repository type $repotype\n";
140+
exit 1;
141+
}
142+
137143
if (lc $action eq 'adddatabase') {
138144
if (defined($repotype)) {
139145
if (lc $repotype eq 'oracle') {
@@ -158,9 +164,11 @@
158164
print "vfilepath has to be set\n";
159165
exit 1;
160166
}
161-
} else {
162-
print "Repotype parameter $repotype unknown. Use oracle or vfiles\n";
163-
exit 1;
167+
} elsif (lc $repotype eq 'plugin') {
168+
if (!defined($plugin_params)) {
169+
print "plugin_params has to be set\n";
170+
exit 1;
171+
}
164172
}
165173
} else {
166174
print "Repotype parameter is required with adddatabase\n";
@@ -351,26 +359,77 @@
351359
my $sourceconfig_obj = new SourceConfig_obj($engine_obj, $debug);
352360

353361
if (lc $repotype eq 'oracle') {
354-
if ($sourceconfig_obj->createSourceConfig('oracleSI', $repo->{reference}, $dbname, $uniquename, $instancename, $jdbc)) {
362+
my %native_params = (
363+
"uniquename" => $uniquename,
364+
"instancename" => $instancename,
365+
"jdbc" => $jdbc
366+
);
367+
if ($sourceconfig_obj->createSourceConfig('oracleSI', $repo->{reference}, $dbname, \%native_params)) {
355368
print "Can't add database $dbname \n";
356369
$ret = $ret + 1;
357370
} else {
358371
print "Database $dbname added into $repopath\n";
359372
}
360373
} elsif (lc $repotype eq 'vfiles') {
361-
if ($sourceconfig_obj->createSourceConfig('vfiles', $repo->{reference}, $dbname, undef, undef, undef, $vfilepath)) {
374+
my %native_params = (
375+
"path" => $vfilepath
376+
);
377+
378+
my %plugin_params = ();
379+
380+
if ($sourceconfig_obj->createSourceConfig('vfiles', $repo->{reference}, $dbname, \%native_params)) {
362381
print "Can't add directory $vfilepath as $dbname \n";
363382
$ret = $ret + 1;
364383
} else {
365384
print "vFiles source $vfilepath added into environment $env_name\n";
366385
}
386+
} elsif (lc $repotype eq 'db2') {
387+
my %native_params;
388+
my %plugin_params_hash = (
389+
"prettyName" => $dbname,
390+
"dbName" => $dbname
391+
);
392+
if ($sourceconfig_obj->createSourceConfig('plugin', $repo->{reference}, $dbname, \%native_params, \%plugin_params_hash)) {
393+
print "Can't add DB2 $dbname \n";
394+
$ret = $ret + 1;
395+
} else {
396+
print "DB2 $dbname added into environment $env_name\n";
397+
}
398+
} elsif (lc $repotype eq 'postgresql') {
399+
my %native_params;
400+
my %plugin_params_hash = (
401+
"prettyName" => $dbname
402+
);
403+
if ($sourceconfig_obj->createSourceConfig('plugin', $repo->{reference}, $dbname, \%native_params, \%plugin_params_hash)) {
404+
print "Can't add Postgresql $dbname \n";
405+
$ret = $ret + 1;
406+
} else {
407+
print "Postgresql $dbname added into environment $env_name\n";
408+
}
409+
} elsif (lc $repotype eq 'plugin') {
410+
my $native_params;
411+
my $plugin_params_hash;
412+
eval {
413+
$plugin_params_hash = from_json($plugin_params);
414+
} or do {
415+
my $e = $@;
416+
print "Problem with JSON $e\n";
417+
};
418+
419+
if ($sourceconfig_obj->createSourceConfig('plugin', $repo->{reference}, $dbname, $native_params, $plugin_params_hash)) {
420+
print "Can't add plugin database $dbname \n";
421+
$ret = $ret + 1;
422+
} else {
423+
print "Plugin database $dbname added into environment $env_name\n";
424+
}
367425
}
368426

369427

370428
} else {
371429
print "Can't find repository path $repopath \n";
372430
$ret = $ret + 1;
373431
}
432+
374433
}
375434

376435
if ( lc $action eq 'deletedatabase' ) {
@@ -416,9 +475,6 @@
416475
$ret = $ret + 1;
417476
}
418477
}
419-
420-
421-
422478
}
423479

424480
if (defined($parallel) && (scalar(@jobs) > 0)) {
@@ -428,7 +484,7 @@
428484
}
429485
}
430486

431-
if (!defined($hostupdate)) {
487+
if ((lc $action eq 'updatehost') && (!defined($hostupdate))) {
432488
# no environment found with a IP - need to report an error
433489
$ret = $ret + 1;
434490
}
@@ -455,8 +511,9 @@ =head1 SYNOPSIS
455511
[-username name]
456512
[-authtype password|systemkey]
457513
[-password password]
458-
[-repotype oracle|vfiles]
514+
[-repotype oracle|vfiles|db2|postgresql|plugin]
459515
[-repopath ORACLE_HOME]
516+
[-plugin_params JSON_parameters]
460517
[-host name/ip of existing host to update]
461518
[-newhost new name/ip of the host]
462519
[-help|? ]
@@ -536,11 +593,12 @@ =head1 OPTIONS
536593
=item B<-password password>
537594
Password for user (use with adduser)
538595
539-
=item B<-repotype oracle|vfiles>
540-
Repository type to add (only Oracle and vFiles support for now - use with addrepo or adddatabase)
596+
=item B<-repotype oracle|vfiles|db2|postgresql|plugin>
597+
Repository type.
598+
The following types oracle and vfiles can be used to add repository manually.
541599
542600
=item B<-repopath ORACLE_HOME>
543-
Oracle Home to add (use with addrepo)
601+
Repository name (Oracle Home, plugin name, vfiles directory)
544602
545603
=item B<-bits 32|64>
546604
Oracle Home binary bit version (32/64)
@@ -558,6 +616,9 @@ =head1 OPTIONS
558616
=item B<-newhost hostname/IP>
559617
New Host name or IP of host being updated
560618
619+
=item B<-plugin_params JSON_parameters>
620+
New Host name or IP of host being updated
621+
561622
=item B<-help>
562623
Print this screen
563624
@@ -668,4 +729,18 @@ =head1 EXAMPLES
668729
Job JOB-2852 finished with state: COMPLETED
669730
Checking environment for host update linuxtarget Host with IP 172.16.200.130 not found
670731
732+
Adding the Postgresql database posttest into environment
733+
734+
dx_ctl_env -d 53 -name linuxsource -action adddatabase -dbname posttest -repotype postgresql -repopath "Postgres vFiles (9.6)"
735+
Adding database posttest into Postgres vFiles (9.6) on environment linuxsource
736+
Postgresql posttest added into environment linuxsource
737+
738+
Adding the MySQL database using EDSI plugin
739+
740+
dx_ctl_env -d 53 -action adddatabase -repotype plugin -repopath "/usr/sbin (MySQL Community Server (GPL)) 5.6.29" \
741+
-dbname testmysql -name linuxtarget \
742+
-plugin_params '{ "dbName": "testmysql", "baseDir":"/usr/sbin" }'
743+
Adding database testmysql into /usr/sbin (MySQL Community Server (GPL)) 5.6.29 on environment linuxtarget
744+
Plugin database testmysql added into environment linuxtarget
745+
671746
=cut

bin/dx_get_analytics.pl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
'dever=s' => \(my $dever),
5959
'interval|i=s' => \($resolution),
6060
'version' => \(my $print_version),
61+
'stoponinvalid' => \(my $stoponinvalid),
6162
'nohead' => \(my $nohead),
6263
'configfile|c=s' => \(my $config_file)
6364
) or pod2usage(-verbose => 1, -input=>\*DATA);
@@ -152,7 +153,7 @@
152153
my $arguments = "&resolution=$resolution&startTime=$st_timestamp";
153154
my $endTime = $et_timestamp ? "&endTime=$et_timestamp" : "";
154155
$arguments = $arguments . $endTime;
155-
$ret = $ret + $analytic_list->get_perf($type, $outdir, $arguments, $allowedres{$resolution}, $format );
156+
$ret = $ret + $analytic_list->get_perf($type, $outdir, $arguments, $allowedres{$resolution}, $format, $stoponinvalid );
156157

157158
}
158159

@@ -177,6 +178,7 @@ =head1 SYNOPSIS
177178
[-i interval ]
178179
[-st <start_time> ]
179180
[-et <end_time> ]
181+
[-stoponinvalid ]
180182
-format csv|json
181183
-debug
182184
@@ -231,6 +233,11 @@ =head1 OPTIONS
231233
232234
=over 4
233235
236+
=item B<-stoponinvalid>
237+
Stop on the invalid analytic and exit processing.
238+
Invalid analytics are skipped by default. Return code will be not 0
239+
if there were any skipped analytics.
240+
234241
=item B<-format>
235242
Display output in csv or json format
236243
If not specified csv formatting is used.

bin/dx_get_db_env.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@
329329

330330
if (defined($config)) {
331331

332-
my $other = $dbobj->getConfig($templates);
332+
my $other = $dbobj->getConfig($templates, undef, $groups);
333333
$output->addLine(
334334
$engine,
335335
$hostenv_line,

0 commit comments

Comments
 (0)