60
60
' uniquename=s' => \(my $uniquename ),
61
61
' instancename=s' => \(my $instancename ),
62
62
' jdbc=s' => \(my $jdbc ),
63
+ ' plugin_params=s' => \(my $plugin_params ),
63
64
' listenername=s' => \(my $listenername ),
64
65
' endpoint=s@' => \(my $endpoint ),
65
66
' bits=n' => \(my $bits ),
134
135
}
135
136
}
136
137
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
+
137
143
if (lc $action eq ' adddatabase' ) {
138
144
if (defined ($repotype )) {
139
145
if (lc $repotype eq ' oracle' ) {
158
164
print " vfilepath has to be set\n " ;
159
165
exit 1;
160
166
}
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
+ }
164
172
}
165
173
} else {
166
174
print " Repotype parameter is required with adddatabase\n " ;
351
359
my $sourceconfig_obj = new SourceConfig_obj($engine_obj , $debug );
352
360
353
361
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 )) {
355
368
print " Can't add database $dbname \n " ;
356
369
$ret = $ret + 1;
357
370
} else {
358
371
print " Database $dbname added into $repopath \n " ;
359
372
}
360
373
} 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 )) {
362
381
print " Can't add directory $vfilepath as $dbname \n " ;
363
382
$ret = $ret + 1;
364
383
} else {
365
384
print " vFiles source $vfilepath added into environment $env_name \n " ;
366
385
}
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
+ }
367
425
}
368
426
369
427
370
428
} else {
371
429
print " Can't find repository path $repopath \n " ;
372
430
$ret = $ret + 1;
373
431
}
432
+
374
433
}
375
434
376
435
if ( lc $action eq ' deletedatabase' ) {
416
475
$ret = $ret + 1;
417
476
}
418
477
}
419
-
420
-
421
-
422
478
}
423
479
424
480
if (defined ($parallel ) && (scalar (@jobs ) > 0)) {
428
484
}
429
485
}
430
486
431
- if (!defined ($hostupdate )) {
487
+ if (( lc $action eq ' updatehost ' ) && ( !defined ($hostupdate ) )) {
432
488
# no environment found with a IP - need to report an error
433
489
$ret = $ret + 1;
434
490
}
@@ -455,8 +511,9 @@ =head1 SYNOPSIS
455
511
[-username name]
456
512
[-authtype password|systemkey]
457
513
[-password password]
458
- [-repotype oracle|vfiles]
514
+ [-repotype oracle|vfiles|db2|postgresql|plugin ]
459
515
[-repopath ORACLE_HOME]
516
+ [-plugin_params JSON_parameters]
460
517
[-host name/ip of existing host to update]
461
518
[-newhost new name/ip of the host]
462
519
[-help|? ]
@@ -536,11 +593,12 @@ =head1 OPTIONS
536
593
=item B<-password password >
537
594
Password for user (use with adduser)
538
595
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.
541
599
542
600
=item B<-repopath ORACLE_HOME >
543
- Oracle Home to add (use with addrepo )
601
+ Repository name ( Oracle Home, plugin name, vfiles directory )
544
602
545
603
=item B<-bits 32|64 >
546
604
Oracle Home binary bit version (32/64)
@@ -558,6 +616,9 @@ =head1 OPTIONS
558
616
=item B<-newhost hostname/IP >
559
617
New Host name or IP of host being updated
560
618
619
+ =item B<-plugin_params JSON_parameters >
620
+ New Host name or IP of host being updated
621
+
561
622
=item B<-help >
562
623
Print this screen
563
624
@@ -668,4 +729,18 @@ =head1 EXAMPLES
668
729
Job JOB-2852 finished with state: COMPLETED
669
730
Checking environment for host update linuxtarget Host with IP 172.16.200.130 not found
670
731
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
+
671
746
=cut
0 commit comments