-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathdrs_main.py
2507 lines (2048 loc) · 116 KB
/
drs_main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
"""
This is the top-level entry point for the MAA DR Setup (DRS) framework.
See the README.md file in this directory for details on how to configure and use this framework.
"""
__author__ = "Oracle Corp."
__version__ = '19.0'
__copyright__ = """ Copyright (c) 2022 Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ """
# ====================================================================================================================
# Imports
# ====================================================================================================================
try:
import os
except ImportError:
print("ERROR: Could not import python's os module")
os = None
exit(-1)
try:
import sys
except ImportError:
print("ERROR: Could not import python's sys module")
sys = None
exit(-1)
try:
import logging
except ImportError:
print("ERROR: Could not import python's logging module")
logging = None
exit(-1)
try:
import time
except ImportError:
print("ERROR: Could not import python's time module")
time = None
exit(-1)
try:
import argparse
except ImportError:
print("ERROR: Could not import python's argparse module")
argparse = None
exit(-1)
try:
import re
except ImportError:
print("ERROR: Could not import python's re module")
re = None
exit(-1)
try:
import fileinput
except ImportError:
print("ERROR: Could not import python's fileinput module")
fileinput = None
exit(-1)
try:
import copy
except ImportError:
print("ERROR: Could not import python's copy module")
copy = None
exit(-1)
try:
from datetime import datetime
except ImportError:
print("ERROR: Could not import python's datetime module")
datetime = None
exit(-1)
try:
import xmltodict
except ImportError:
print("ERROR: Could not import python's xmldict module")
xmltodict = None
exit(-1)
try:
import pprint
except ImportError:
print("ERROR: Could not import python's pprint module")
pprint = None
exit(-1)
try:
import getpass
except ImportError:
print("ERROR: Could not import python's getpass module")
getpass = None
exit(-1)
try:
from drs_config import DRS_CONFIG
except ImportError:
print("ERROR: Could not import DRS drs_config module")
DRS_CONFIG = None
exit(-1)
try:
from drs_const import DRS_CONSTANTS as CONSTANT
except ImportError:
print("ERROR: Could not import DRS drs_const module")
CONSTANT = None
exit(-1)
try:
from drs_lib import DRSLogger, DRSConfiguration, DRSHost, DRSDatabase, DRSWls, DRSUtil
log_header = DRSUtil.log_header
except ImportError:
print("ERROR: Could not import one or more DRS drs_lib modules")
DRSLogger = None
DRSConfiguration = None
DRSHost = None
DRSDatabase = None
DRSWls = None
DRSUtil = None
exit(-1)
# ====================================================================================================================
# Global vars
# ====================================================================================================================
logger = None
parser = None
parser_args = None
user_config_dict = None
# ====================================================================================================================
# Local Methods
# ====================================================================================================================
def parse_arguments():
""""
Parse command line arguments
"""
global parser
global parser_args
# set up parser
parser = argparse.ArgumentParser(description='''
This framework configures and tests DR between the SOA Primary and Standby sites.
Specify either
the "--checks_only" or "-CH" to run the prerrequisite checks only,
or the "--config_dr" or "-C" option to only configure DR,
or the "--config_test_dr" or "-T" option to configure and then test DR after setup (the DR test involves
switching over the full SOA stack to the Standby site and then switching it back to the Primary site).
The optional switch "--skip_checks" can be used to make the framework skip
certain optional checks. For example: checking if all the WLS components
are running at the standby site.
The optional switch "--do_not_start" cane used to make the framework skip the
start and validation of the standby WLS processes during the DR Setup"
'''
)
parser.add_argument("-CH", "--checks_only", help="Run initialy checks only", action="store_true")
parser.add_argument("-C", "--config_dr", help="Configure DR only", action="store_true")
parser.add_argument("-T", "--config_test_dr", help="Configure and Test DR", action="store_true")
parser.add_argument("-S", "--skip_checks", help="Skip certain optional checks", action="store_true")
parser.add_argument("-N", "--do_not_start", help="Do not start standby WLS processes during the DR setup", action="store_true")
# get arguments from the command line
parser_args, unknown = parser.parse_known_args()
if unknown:
parser.print_help()
print('\nERROR: Unknown option specified {}\n'.format(unknown))
sys.exit(1)
def setup_logging():
""""
Set up logging
"""
global logger
# Set up handler for file and stdout
log_filename = datetime.now().strftime(format(CONSTANT.DRS_LOGFILE_NAME))
logfile_handler = logging.FileHandler(log_filename)
logfile_handler.setLevel(CONSTANT.DRS_LOGFILE_LOG_LEVEL) # DEBUG - Log verbosely to log file
stdout_handler = logging.StreamHandler(sys.stdout)
stdout_handler.setLevel(CONSTANT.DRS_STDOUT_LOG_LEVEL) # INFO - More terse logging to stdout
logging.basicConfig(
level=CONSTANT.DRS_LOGGING_DEFAULT_LOG_LEVEL,
format=CONSTANT.DRS_LOGFILE_STATEMENT_FORMAT,
handlers=[logfile_handler, stdout_handler])
logger = logging.getLogger("main")
print("\nLog output will be sent to file [{}]\n".format(log_filename))
# Change logfile permissions so only framework user can read/write file
os.chmod(log_filename, 0o600)
def create_local_tempdir():
"""
Create a local temp dir to use for storing temp files
:return:
"""
tempdir_name = CONSTANT.DRS_INTERNAL_TEMP_DIR
if not os.path.isdir(tempdir_name):
os.mkdir(tempdir_name)
logger.info("Created local temp directory [{}]".format(tempdir_name))
else:
logger.info("Local temp directory [{}] already exists".format(tempdir_name))
def prompt_user_config_empty_values(dict_name, d):
"""
Check the configuration dictionary for empty (uninitialized) config values and prompt the user to provide
values for missing values. For missing passwords, use 'getpass' to get password values.
NOTE: This is a recursive function
:param d: the config dict to check.
:param dict_name: the name of the dictionary we are checking
:return:
"""
for k, v in d.items():
if isinstance(v, dict):
v = prompt_user_config_empty_values(k, v)
d[k] = v
else:
if not v:
logger.warning("\nATTENTION: Configuration value for [{}] was NOT found in user configuration file".
format(dict_name + '::' + k))
# NOTE: RAC settings are left blank for a single instance setup, so don't prompt for them
if 'rac_' in k:
logger.info("Ignoring blank value for [{}] because this must not be a RAC setup".
format(dict_name + '::' + k))
continue
elif 'password' in k:
i = getpass.getpass('\nEnter password for configuration item [{}]: '.format(dict_name + '::' + k))
# Valid for password starting with # and works with all the scripts. If used, the char $ needs to be escaped as \$ when provided
i = '"' + i + '"'
else:
i = input('\nEnter value for configuration item [{}]: '.format(dict_name + '::' + k))
d[k] = i
else:
d[k] = v
return d
def read_user_yaml_configuration():
"""
Reads and loads configuration from user configuration YAML file
:return:
"""
global user_config_dict
# =============================================================================================================
logger.info(" ")
logger.info("========== READING USER CONFIGURATION FILE ==========")
user_configuration = DRSConfiguration(CONSTANT.DRS_USER_CONFIG_FILE)
# =============================================================================================================
logger.info(" ")
logger.info("=========== READING & CHECKING USER CONFIGURATION ==========")
user_config_dict = user_configuration.get_configuration_dict()
user_config_dict = prompt_user_config_empty_values('user_config', user_config_dict)
# FOR DEBUG ONLY... prints secure info
#print("Updated config dict is: \n[{}]".format(user_config_dict))
# =============================================================================================================
# logger.info(" ")
# logger.info("=========== PRINTING CONFIGURATION TO LOGFILE ==========")
# user_configuration.print_configuration_to_logfile() -- DO NOT DO THIS! IT TRASHES CONFIG PASSWORDS !!!
# total_len = len(user_config_dict) + sum(len(v) for v in user_config_dict.items() if isinstance(v, dict))
# logger.info("Printed [{}] configuration lines to logfile".format(total_len))
# logger.info("Printed configuration to logfile")
# =============================================================================================================
logger.info(" ")
logger.info("=========== INITIALIZING LOCAL CONFIGURATION ==========")
yaml_boolean_true = ['True', 'true', 'TRUE', 'Yes', 'yes', 'YES']
yaml_boolean_false = ['False', 'false', 'FALSE', 'No', 'no', 'NO']
# GENERAL
CONFIG.GENERAL.ssh_user_name = user_config_dict['general']['ssh_user_name']
CONFIG.GENERAL.ssh_key_file = user_config_dict['general']['ssh_key_file']
CONFIG.GENERAL.ora_user_name = user_config_dict['general']['ora_user_name']
# CONFIG.GENERAL.dataguard_use_private_ip = user_config_dict['general']['dataguard_use_private_ip']
assert user_config_dict['general']['dataguard_use_private_ip'] in yaml_boolean_true \
or user_config_dict['general']['dataguard_use_private_ip'] in yaml_boolean_false, \
"dataguard_use_private_ip: %s is not valid, should be True or False" % \
user_config_dict['general']['dataguard_use_private_ip']
if user_config_dict['general']['dataguard_use_private_ip'] in yaml_boolean_true:
CONFIG.GENERAL.dataguard_use_private_ip = True
elif user_config_dict['general']['dataguard_use_private_ip'] in yaml_boolean_false:
CONFIG.GENERAL.dataguard_use_private_ip = False
CONFIG.GENERAL.uri_to_check = user_config_dict['general']['uri_to_check']
assert user_config_dict['general']['dr_method'] in "RSYNC" \
or user_config_dict['general']['dr_method'] in "DBFS", \
"dr_method: %s is not valid, should be RSYNC or DBFS" % \
user_config_dict['general']['dr_method']
CONFIG.GENERAL.dr_method = user_config_dict['general']['dr_method']
CONFIG.GENERAL.fss_mount = user_config_dict['general']['fss_mount']
CONFIG.GENERAL.add_aliases_to_etc_hosts = user_config_dict['general']['add_aliases_to_etc_hosts']
assert user_config_dict['general']['add_aliases_to_etc_hosts'] in yaml_boolean_true \
or user_config_dict['general']['add_aliases_to_etc_hosts'] in yaml_boolean_false, \
"add_aliases_to_etc_hosts: %s is not valid, should be True or False" % \
user_config_dict['general']['add_aliases_to_etc_hosts']
if user_config_dict['general']['add_aliases_to_etc_hosts'] in yaml_boolean_true:
CONFIG.GENERAL.add_aliases_to_etc_hosts = True
elif user_config_dict['general']['add_aliases_to_etc_hosts'] in yaml_boolean_false:
CONFIG.GENERAL.add_aliases_to_etc_hosts = False
# DB PRIMARY
CONFIG.DB_PRIM.host_ip = user_config_dict['db_prim']['host_ip']
CONFIG.DB_PRIM.db_port = user_config_dict['db_prim']['port']
CONFIG.DB_PRIM.sysdba_user_name = user_config_dict['db_prim']['sysdba_user_name']
CONFIG.DB_PRIM.sysdba_password = user_config_dict['db_prim']['sysdba_password']
CONFIG.DB_PRIM.pdb_name = user_config_dict['db_prim']['pdb_name']
CONFIG.DB_PRIM.rac_scan_ip = user_config_dict['db_prim']['rac_scan_ip'] # NOTE: value can be empty if DB is not RAC
# DB STANDBY
CONFIG.DB_STBY.host_ip = user_config_dict['db_stby']['host_ip']
CONFIG.DB_STBY.db_port = user_config_dict['db_stby']['port']
CONFIG.DB_STBY.sysdba_user_name = user_config_dict['db_prim']['sysdba_user_name']
CONFIG.DB_STBY.sysdba_password = user_config_dict['db_prim']['sysdba_password']
CONFIG.DB_STBY.pdb_name = user_config_dict['db_prim']['pdb_name']
# WLS PRIMARY
CONFIG.WLS_PRIM.node_manager_host_ips = user_config_dict['wls_prim']['wls_ip_list']
CONFIG.WLS_PRIM.wlsadm_host_ip = user_config_dict['wls_prim']['wls_ip_list'][0]
CONFIG.WLS_PRIM.wlsadm_user_name = user_config_dict['wls_prim']['wlsadm_user_name']
CONFIG.WLS_PRIM.wlsadm_password = user_config_dict['wls_prim']['wlsadm_password']
CONFIG.WLS_PRIM.front_end_ip = user_config_dict['wls_prim']['front_end_ip']
# WLS STANDBY
CONFIG.WLS_STBY.node_manager_host_ips = user_config_dict['wls_stby']['wls_ip_list']
CONFIG.WLS_STBY.wlsadm_host_ip = user_config_dict['wls_stby']['wls_ip_list'][0]
CONFIG.WLS_STBY.wlsadm_user_name = user_config_dict['wls_prim']['wlsadm_user_name']
CONFIG.WLS_STBY.wlsadm_password = user_config_dict['wls_prim']['wlsadm_password']
CONFIG.WLS_STBY.front_end_ip = user_config_dict['wls_stby']['front_end_ip']
logger.info("Local configuration is initialized")
def get_db_host_fqdn_and_ips(site_role):
"""
Get FQDNs and Local IP addresses for DB host for the specified site
:param site_role: THe site site_role for which to populate info ("PRIMARY" or "STANDBY")
:return:
"""
if site_role == CONSTANT.DRS_SITE_ROLE_PRIMARY:
SITE_CONFIG = CONFIG.DB_PRIM
elif site_role == CONSTANT.DRS_SITE_ROLE_STANDBY:
SITE_CONFIG = CONFIG.DB_STBY
else:
raise Exception("Unknown site_role {}".format(site_role))
logger.info(" ")
logger.info("========== GET DB HOST NAME & FQDN ===========")
host = DRSHost()
host.connect_host(SITE_CONFIG.host_ip, CONFIG.GENERAL.ssh_user_name, CONFIG.GENERAL.ssh_key_file)
host_fqdn, local_ip, os_version = host.get_host_osinfo()
# Make sure we didn't get empty values
assert re.match('\S+\.\S+\.oraclevcn\.com', host_fqdn), "%s appears to be a malformed host FQDN" % host_fqdn
assert re.match('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$', local_ip), "%s is not a valid IP address" % local_ip
assert re.match('\d{1}\.\d{1,2}', os_version), "%s is not a valid OS version" % os_version
SITE_CONFIG.host_fqdn = host_fqdn
SITE_CONFIG.local_ip = local_ip
SITE_CONFIG.os_version = os_version
logger.info("DB host FQDN is [{}]".format(host_fqdn))
logger.info("DB host local IP is [{}]".format(local_ip))
logger.info("DB host OS version is [{}]".format(os_version))
host.disconnect_host()
# Extract DB host and domain name from FQDN
parts = SITE_CONFIG.host_fqdn.split(".", 1)
SITE_CONFIG.db_hostname = parts[0]
SITE_CONFIG.db_host_domain = parts[1]
logger.info("Extracted {} DB Hostname [{}]".format(site_role, parts[0]))
logger.info("Extracted {} DB Domain Name [{}]".format(site_role, parts[1]))
def get_all_wls_host_fqdn_and_ips(site_role):
"""
Get FQDNs and Local IP addresses for all WLS cluster hosts for the specified site
:param site_role: THe site site_role for which to populate info ("PRIMARY" or "STANDBY")
:return:
"""
if site_role == CONSTANT.DRS_SITE_ROLE_PRIMARY:
SITE_CONFIG = CONFIG.WLS_PRIM
site_name = 'wls_prim'
elif site_role == CONSTANT.DRS_SITE_ROLE_STANDBY:
SITE_CONFIG = CONFIG.WLS_STBY
site_name = 'wls_stby'
else:
raise Exception("Unknown site_role {}".format(site_role))
logger.info(" ")
logger.info("========== GET WLS HOST NAMES & FQDNS -- ALL {} CLUSTER NODES ===========".format(site_role))
# Walk the PRIMARY hosts list and get the info
for host_ip in user_config_dict[site_name]['wls_ip_list']:
host = DRSHost()
host.connect_host(host_ip, CONFIG.GENERAL.ssh_user_name, CONFIG.GENERAL.ssh_key_file)
host_fqdn, local_ip, os_version = host.get_host_osinfo()
# Make sure we didn't get empty values
assert re.match('\S+\.\S+\.oraclevcn\.com', host_fqdn), "%s appears to be a malformed host FQDN" % host_fqdn
assert re.match('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', local_ip), "%s is not a valid IP address" % local_ip
assert re.match('\d{1}\.\d{1,2}', os_version), "%s is not a valid OS version" % os_version
SITE_CONFIG.cluster_node_fqdns.append(host_fqdn)
SITE_CONFIG.cluster_node_local_ips.append(local_ip)
SITE_CONFIG.cluster_node_public_ips.append(host_ip)
SITE_CONFIG.cluster_node_os_versions.append(os_version)
logger.info("Added host FQDN [{}] to our {} cluster FQDN list".format(host_fqdn, site_role))
logger.info("Added host local IP [{}] to our {} cluster local IPs list".format(local_ip, site_role))
logger.info("Added host public IP [{}] to our {} cluster public IPs list".format(host_ip, site_role))
logger.info("Added OS version [{}] to our {} cluster OS versions list".format(os_version, site_role))
host.disconnect_host()
# Extract WLS admin host and domain names
parts = SITE_CONFIG.cluster_node_fqdns[0].split(".", 1)
SITE_CONFIG.wlsadm_hostname = parts[0]
SITE_CONFIG.wlsadm_host_domain = parts[1]
logger.info("Extracted {} Admin Server Hostname [{}]".format(parts[0], site_role))
logger.info("Extracted {} Admin Server Domain Name [{}]".format(parts[1], site_role))
def patch_all_wls_etc_hosts(site_role):
"""
Patch /etc/hosts on each WLS cluster node to create aliases for SOA DR
:param site_role: THe site site_role for which to populate info ("PRIMARY" or "STANDBY")
:return:
"""
if site_role == CONSTANT.DRS_SITE_ROLE_PRIMARY:
THIS_SITE_CONFIG = CONFIG.WLS_PRIM
OTHER_SITE_CONFIG = CONFIG.WLS_STBY
elif site_role == CONSTANT.DRS_SITE_ROLE_STANDBY:
THIS_SITE_CONFIG = CONFIG.WLS_STBY
OTHER_SITE_CONFIG = CONFIG.WLS_PRIM
else:
raise Exception("Unknown site_role {}".format(site_role))
logger.info(" ")
logger.info("========== PATCH /ETC/HOSTS -- ALL {} CLUSTER NODES ===========".format(site_role))
# Create a patching dictionary containing all entries to find and replace (or add) for this site
# Patching dictionary entries use the format:
# {
# # regexp to use to find entry : # new entry which will replace existing entry
# '^\s*10.0.0.1\s+hostA1.prim.com\s+hostA1.*$' : '10.0.0.1 hostA1.prim.com hostA1 hostB1.stby.com hostB1'
# }
#
patching_dict = dict()
for i in range(len(THIS_SITE_CONFIG.cluster_node_local_ips)):
this_host_name = THIS_SITE_CONFIG.cluster_node_fqdns[i].split('.', 1)[0]
this_local_ip = THIS_SITE_CONFIG.cluster_node_local_ips[i]
this_fqdn = THIS_SITE_CONFIG.cluster_node_fqdns[i]
other_fqdn = OTHER_SITE_CONFIG.cluster_node_fqdns[i]
other_host_name = OTHER_SITE_CONFIG.cluster_node_fqdns[i].split('.', 1)[0]
regexp = r'^\s*{}\s+{}\s+{}.*$'.format(this_local_ip, this_fqdn, this_host_name)
new_entry = '{} {} {} {} {}'.format(this_local_ip, this_fqdn, this_host_name, other_fqdn, other_host_name)
patching_dict[regexp] = new_entry
logger.debug("Created patching dictionary: \n{}".format(str(patching_dict)))
etc_hosts_file = '/etc/hosts'
for host_ip in THIS_SITE_CONFIG.cluster_node_public_ips:
host = DRSHost()
host.connect_host(host_ip, CONFIG.GENERAL.ssh_user_name, CONFIG.GENERAL.ssh_key_file)
logger.info("Begin processing /etc/hosts file for host {}.".format(host_ip))
# 1) Fetch the remote hosts file; place in our temp working directory; and rename it
logger.info("--- Step 1: Fetch remote /etc/hosts file")
local_file_name = 'hosts' + '_' + host_ip + '_' + DRSUtil.generate_unique_filename()
local_full_path = CONSTANT.DRS_INTERNAL_TEMP_DIR + '/' + local_file_name
host.copy_remote_file_from_host(etc_hosts_file, local_full_path)
# 2) Comment out all lines from the file that match regexps in our patching dictionary
logger.info("--- Step 2: Generating entries for patching dictionary")
for search_expr in patching_dict.keys():
logger.debug("=== Searching for regexp:: {}".format(search_expr))
regexp = re.compile(search_expr)
for line in fileinput.input(local_full_path, inplace=True):
logger.debug("=== read input line:: {}".format(line))
if regexp.search(line):
logger.debug("*** regexp matches line !!!")
logger.debug("=== commented out line in file:: {}".format(line))
sys.stdout.write("### Commented out by DRS ### " + line)
else:
logger.debug("=== writing same line back to file:: {}".format(line))
sys.stdout.write(line)
fileinput.close() # WARNING! FileInput has global scope. Must close() to reset.
# 3) Append all lines from our patching dictionary to the file
logger.info("--- Step 3: Append all lines from our patching dictionary to /etc/hosts file")
f = open(local_full_path, "a")
f.write("\n### BEGIN DRS SECTION -- lines below this added by DRS ### \n")
logger.debug("Wrote: [### BEGIN DRS SECTION -- lines below this added by DRS ###] to file")
for append_line in patching_dict.values():
f.write(append_line + "\n")
logger.debug("=== appended new line:: {}".format(append_line))
f.write("### END DRS SECTION -- lines above this added by DRS ### \n")
logger.debug("Wrote: [### END DRS SECTION -- lines above this added by DRS ###] to file")
f.close()
logger.info("Done processing /etc/hosts file for host {}. See debug log for details.".format(host_ip))
# 4) Save a backup of the existing hosts file before we overwrite it
logger.info("--- Step 4: Save a backup of the existing hosts file before we overwrite it")
result = host.backup_remote_file_on_host(etc_hosts_file)
logger.info("Backed up file [{}] on host [{}]".format(result.stdout.strip(), host_ip))
# 5) Copy the edited /etc/hosts file back to the host
# NOTE: we do this by first writing it to /tmp on the host because fabric.Connection.put
# has no 'sudo' capability. So we first 'put' the file to an allowed location (like /tmp)
# and then cp it using a remote 'sudo' command
# TODO: Create a helper function for this type of sudo remote copy
logger.info("--- Step 5: Copy the edited /etc/hosts file back to the host")
dest_tmp_file = '/tmp/' + local_file_name
host.copy_local_file_to_host(local_full_path, dest_tmp_file)
logger.info("Copied edited file to [{}] on host [{}]".format(dest_tmp_file, host_ip))
remote_cp_cmd = '/bin/cp -v --no-preserve=mode,ownership,timestamps'
remote_sudo_cmd = CONSTANT.DRS_CMD_EXECUTE_SUDO_CMD_ONLY_FMT. \
format(remote_cp_cmd + ' ' + dest_tmp_file + ' /etc/hosts')
host.execute_host_cmd_sudo_root(remote_sudo_cmd)
# TODO: Do we really need this?
"""
# 6) Convert CR-LF to LF (dos2unix) for remotely copied /etc/hosts file
logger.info("Process CR+LF for /etc/hosts file on host {}".format(host_ip))
remote_dos2unix_cmd = CONSTANT.DRS_CMD_PERL_DOS2UNIX.format('/etc/hosts')
remote_sudo_cmd = CONSTANT.DRS_CMD_EXECUTE_SUDO_CMD_ONLY_FMT.format(remote_dos2unix_cmd)
host.execute_host_cmd_sudo_root(remote_sudo_cmd)
"""
# 6) Remove the hosts file we temporarily stored locally in /tmp
logger.info("--- Step 6: Remove the hosts file we temporarily stored locally in /tmp on remote host")
host.delete_remote_file_from_host(dest_tmp_file, host.user_name)
def patch_all_wls_etc_oci_hostname_conf(site_role):
"""
Patch /etc/oci-hostname.conf on each WLS cluster node on specified site
We add "PRESERVE_HOSTINFO=2" or "PRESERVE_HOSTINFO=3" to the conf file so our config
changes to /etc/hosts are preserved
:param site_role: THe site site_role for which to populate info ("PRIMARY" or "STANDBY")
:return:
"""
if site_role == CONSTANT.DRS_SITE_ROLE_PRIMARY:
SITE_CONFIG = CONFIG.WLS_PRIM
elif site_role == CONSTANT.DRS_SITE_ROLE_STANDBY:
SITE_CONFIG = CONFIG.WLS_STBY
else:
raise Exception("Unknown site_role {}".format(site_role))
logger.info(" ")
logger.info("========== PATCH /ETC/OCI-HOSTNAME.CONF -- ALL {} CLUSTER NODES ===========".format(site_role))
config_file = '/etc/oci-hostname.conf'
for host_ip, os_version in zip(SITE_CONFIG.cluster_node_public_ips, SITE_CONFIG.cluster_node_os_versions):
host = DRSHost()
host.connect_host(host_ip, CONFIG.GENERAL.ssh_user_name, CONFIG.GENERAL.ssh_key_file)
ph_value = '3'
logger.info("Begin processing {} file for host {}.".format(config_file, host_ip))
logger.info("Will set PRESERVE_HOSTINFO={} since OS version is {}".format(ph_value, os_version))
# 1) Fetch the remote file; place in our temp working directory; and rename it
logger.info("--- Step 1: Fetch remote {} file".format(config_file))
local_file_name = 'oci-hostname.conf' + '_' + host_ip + '_' + DRSUtil.generate_unique_filename()
local_full_path = CONSTANT.DRS_INTERNAL_TEMP_DIR + '/' + local_file_name
host.copy_remote_file_from_host(config_file, local_full_path)
# 2) Comment out all lines from the file that match our regexp
logger.info("--- Step 2: Patching file")
search_expr = r'^PRESERVE_HOSTINFO[ ]*='
logger.debug("=== Searching for regexp:: {}".format(search_expr))
regexp = re.compile(search_expr)
for line in fileinput.input(local_full_path, inplace=True):
logger.debug("=== read input line:: {}".format(line))
if regexp.search(line):
logger.debug("*** regexp matches line !!!")
logger.debug("=== commented out line in file:: {}".format(line))
sys.stdout.write("### Commented out by DRS ### " + line)
else:
logger.debug("=== writing same line back to file:: {}".format(line))
sys.stdout.write(line)
fileinput.close() # WARNING! FileInput has global scope. Must close() to reset.
# 3) Append 'PRESERVE_HOSTINFO=<ph_value>' to the oci-hostname.conf file
logger.info("--- Step 3: Append 'PRESERVE_HOSTINFO={}' to {} file".format(ph_value, config_file))
f = open(local_full_path, "a")
f.write("\n### BEGIN DRS SECTION -- lines below this added by DRS ### \n")
logger.debug("Wrote: [#### BEGIN DRS SECTION -- lines below this added by DRS ####] to file")
append_line = 'PRESERVE_HOSTINFO={}'.format(ph_value)
f.write(append_line + "\n")
logger.debug("=== appended new line:: {}".format(append_line))
f.write("### END DRS SECTION -- lines above this added by DRS ### \n")
logger.debug("Wrote: [#### END DRS SECTION -- lines above this added by DRS ####] to file")
f.close()
logger.info("Done processing {} file for host {}. See debug log for details.".format(config_file, host_ip))
# 4) Save a backup of the existing config file before we overwrite it
logger.info("--- Step 4: Save a backup of the existing hosts file before we overwrite it")
result = host.backup_remote_file_on_host(config_file)
logger.info("Backed up file [{}] on host [{}]".format(result.stdout.strip(), host_ip))
# 5) Copy the edited file back to the host
# NOTE: we do this by first writing it to /tmp on the host because fabric.Connection.put
# has no 'sudo' capability. So we first 'put' the file to an allowed location (like /tmp)
# and then cp it using a remote 'sudo' command
# TODO: Create a helper function for this type of sudo remote copy
logger.info("--- Step 5: Copy the edited file back to the host")
dest_tmp_file = '/tmp/' + local_file_name
host.copy_local_file_to_host(local_full_path, dest_tmp_file)
logger.info("Copied edited file to [{}] on host [{}]".format(dest_tmp_file, host_ip))
remote_cp_cmd = '/bin/cp -v --no-preserve=mode,ownership,timestamps'
remote_sudo_cmd = CONSTANT.DRS_CMD_EXECUTE_SUDO_CMD_ONLY_FMT. \
format(remote_cp_cmd + ' ' + dest_tmp_file + ' /etc/oci-hostname.conf')
host.execute_host_cmd_sudo_root(remote_sudo_cmd)
# 6) Remove the temp file we temporarily stored on host in /tmp
logger.info("--- Step 6: Remove the file we temporarily stored locally in /tmp on remote host")
host.delete_remote_file_from_host(dest_tmp_file, host.user_name)
def get_wls_domain_configuration(role, domain_home):
"""
Get the WLS domain configuration file from the specified domain home and parse
it's contents. Then, load our local config with those parsed contents.
:param role: THe site role for which to populate info ("PRIMARY" or "STANDBY")
:param domain_home: The domain home for
:return:
"""
if role == CONSTANT.DRS_SITE_ROLE_PRIMARY:
SITE_CONFIG = CONFIG.WLS_PRIM
elif role == CONSTANT.DRS_SITE_ROLE_STANDBY:
SITE_CONFIG = CONFIG.WLS_STBY
else:
raise Exception("Unknown role {}".format(role))
logger.info(" ")
logger.info("========== GET WLS DOMAIN CONFIGURATION FILE -- {} SITE ===========".format(role))
prim_wls = DRSWls()
prim_wls.connect_host(SITE_CONFIG.wlsadm_host_ip, CONFIG.GENERAL.ssh_user_name, CONFIG.GENERAL.ssh_key_file)
domain_config_file = domain_home + CONSTANT.DRS_WLS_CONFIG_FILE_RELATIVE_PATH_NAME
domain_config_file_contents = prim_wls.get_wls_domain_config_file_contents(domain_config_file,
CONFIG.GENERAL.ora_user_name)
# Save the domain info file contents to our local temp dir in case we need it again.
# Reason: At some point the standby domain info will get trashed during DR wiring. If DRS setup fails after this
# point, and we re-run it to try and setup DR again, there is no standby domain info file to get. In that case,
# we will need to rely on this local saved copy.
local_file_name = 'wls_domain_config' + '_' + role + '_' + SITE_CONFIG.wlsadm_host_ip + '.xml'
local_full_path = CONSTANT.DRS_INTERNAL_TEMP_DIR + '/' + local_file_name
fh = open(local_full_path, mode='wt')
fh.write(domain_config_file_contents)
fh.flush()
fh.close()
# Parse the XML file contents
xml_config_dict = xmltodict.parse(domain_config_file_contents)
# pprint.pprint(xml_config_dict)
SITE_CONFIG.cluster_size = len(xml_config_dict['domain']['machine'])
# pprint.pprint(xml_server_list)
logger.info(" ")
logger.info("========== GET ADMIN SERVER CONFIG FROM CONFIG FILE -- {} SITE ===========".format(role))
# V16 - remove dependency from the adminserver suffix
# to get the admin server as the first node of the list (not used)
#xml_server_list = xml_config_dict['domain']['server']
#SITE_CONFIG.wlsadm_server_name = xml_server_list[0]['name']
#try:
# SITE_CONFIG.wlsadm_listen_port = xml_server_list[0]['listen-port']
#except KeyError:
# SITE_CONFIG.wlsadm_listen_port = CONSTANT.DRS_WLS_ADMIN_DEFAULT_LISTEN_PORT
#logger.info("Admin server name is [{}]".format(SITE_CONFIG.wlsadm_server_name))
#logger.info("Admin server listen port is [{}]".format(SITE_CONFIG.wlsadm_listen_port))
######################################
# V16 we get the admin server from the em target
#############################################
xml_server_list = xml_config_dict['domain']['server']
deployment_list = xml_config_dict['domain']['app-deployment']
# to get the admin server name
found = False
for deployment in deployment_list:
if deployment['name'] == "em":
SITE_CONFIG.wlsadm_server_name = deployment['target']
found = True
break
else:
# only executed if we do NOT break out of inner for loop
continue
if not found:
raise Exception("ERROR: Could not find em deployment name in domain config file")
# Now we have the admin server name, get the port
################################################
found = False
for xml_server in xml_server_list:
if SITE_CONFIG.wlsadm_server_name == xml_server['name']:
# we've found the admin server entry now check for a listen-port
try:
SITE_CONFIG.wlsadm_listen_port = xml_server['listen-port']
except KeyError:
SITE_CONFIG.wlsadm_listen_port = CONSTANT.DRS_WLS_ADMIN_DEFAULT_LISTEN_PORT
logger.info("Admin server name is [{}]".format(SITE_CONFIG.wlsadm_server_name))
logger.info("Admin server listen port is [{}]".format(SITE_CONFIG.wlsadm_listen_port))
found = True
break
else:
# only executed if we do NOT break out of inner for loop
continue
if not found:
raise Exception("ERROR: Could not find admin server name in domain config file")
logger.info(" ")
logger.info("========== GET NODE MANAGER CONFIG FROM CONFIG FILE -- {} SITE ===========".format(role))
machine_list = xml_config_dict['domain']['machine']
machine_count = len(machine_list)
found = False
for machine in machine_list:
nm = machine['node-manager']
parts = nm['listen-address'].split('.', 1)
nm_hostname = parts[0]
if nm_hostname == SITE_CONFIG.wlsadm_hostname:
# we've found the NM entry for the admin host
SITE_CONFIG.wlsadm_nm_hostname = nm_hostname
SITE_CONFIG.wlsadm_nm_port = nm['listen-port']
SITE_CONFIG.wlsadm_nm_type = nm['nm-type']
logger.info("NM host name is [{}]".format(SITE_CONFIG.wlsadm_nm_hostname))
logger.info("NM listen port is [{}]".format(SITE_CONFIG.wlsadm_nm_port))
logger.info("NM connection type is [{}]".format(SITE_CONFIG.wlsadm_nm_type))
found = True
break
if not found:
raise Exception("ERROR: Could not find node manager configuration in domain config file")
###########
logger.info(" ")
logger.info("========== GET MANAGED SERVER CONFIG FROM CONFIG FILE -- {} SITE ===========".format(role))
xml_server_list = xml_config_dict['domain']['server']
# Fix managed servers not correctly ordered
SITE_CONFIG.managed_server_names = ["None"] * SITE_CONFIG.cluster_size
SITE_CONFIG.managed_server_hosts = ["None"] * SITE_CONFIG.cluster_size
# This needs to be improved. As it is now, this breaks the idempotency because it looks for the stby manager using
# the standby fqdn names, and this does not work if DRS as been run previously and the config has been already
# copied from primary
for xml_server in xml_server_list:
if SITE_CONFIG.wlsadm_server_name not in xml_server['name']:
# this must be a managed server entry
managed_server_fqdn = xml_server['listen-address']
index = SITE_CONFIG.cluster_node_fqdns.index(managed_server_fqdn)
# SITE_CONFIG.managed_server_names.insert(index, xml_server['name'])
# SITE_CONFIG.managed_server_hosts.insert(index, xml_server['listen-address'].split('.', 1)[0])
# Fix managed servers not correctly ordered
SITE_CONFIG.managed_server_names[index] = xml_server['name']
SITE_CONFIG.managed_server_hosts[index] = xml_server['listen-address'].split('.', 1)[0]
logger.info("Managed server [{}] is deployed on host [{}]".
format(SITE_CONFIG.managed_server_names[index], SITE_CONFIG.managed_server_hosts[index]))
# Make sure here that the number of parsed nodes (from config) and those specified by the user in the
# YAML config match each other
if len(SITE_CONFIG.node_manager_host_ips) != machine_count:
raise Exception(
"ERROR: Number of user-specified cluster nodes [{}] does not match machine count [{}] "
"obtained from WLS config file".format(len(SITE_CONFIG.node_manager_host_ips), machine_count))
print("Successfully parsed WLS XML configuration file. Machine count [{}] matches".format(machine_count))
# v13 Get the configured frontend name
# we will use later to check that primary fronted is resolvable from standby
try:
cluster_frontend=xml_config_dict['domain']['cluster']['frontend-host']
logger.info("Cluster frontend-host name is [{}]".format(cluster_frontend))
SITE_CONFIG.cluster_frontend_host=cluster_frontend
except Exception as e:
# It should be configured (needed for soa) but we catch the error in case it is not defined
logger.warning("WARNING: Cluster frontend hostname is NOT configured!")
logger.warning("WARNING: Continuing with DR setup, but it should be configured with a virtual frontend name")
SITE_CONFIG.cluster_frontend_host="no-frontend"
def get_wls_domain_name_and_home(role):
"""
Get WLS Domain name and home for specified site
:param role: THe site role for which to populate info ("PRIMARY" or "STANDBY")
:return:
"""
if role == CONSTANT.DRS_SITE_ROLE_PRIMARY:
SITE_CONFIG = CONFIG.WLS_PRIM
elif role == CONSTANT.DRS_SITE_ROLE_STANDBY:
SITE_CONFIG = CONFIG.WLS_STBY
else:
raise Exception("Unknown role {}".format(role))
logger.info(" ")
logger.info("========== GET WLS DOMAIN NAME & HOME FROM {} WLS ADMIN SERVER HOST ===========".format(role))
wls_admin = DRSWls()
wls_admin.connect_host(SITE_CONFIG.wlsadm_host_ip, CONFIG.GENERAL.ssh_user_name, CONFIG.GENERAL.ssh_key_file)
domain_home = wls_admin.get_wls_domain_home(CONFIG.GENERAL.ora_user_name)
domain_name = os.path.basename(domain_home)
wls_admin.disconnect_host()
logger.info("WLS domain home at {} site is [{}]".format(role, domain_home))
logger.info("WLS domain name at {} site is [{}]".format(role, domain_name))
SITE_CONFIG.domain_home = domain_home
SITE_CONFIG.domain_name = domain_name
def get_wls_home(role):
"""
Get WLS home for specified site
:param role: THe site role for which to populate info ("PRIMARY" or "STANDBY")
:return:
"""
if role == CONSTANT.DRS_SITE_ROLE_PRIMARY:
SITE_CONFIG = CONFIG.WLS_PRIM
elif role == CONSTANT.DRS_SITE_ROLE_STANDBY:
SITE_CONFIG = CONFIG.WLS_STBY
else:
raise Exception("Unknown role {}".format(role))
logger.info(" ")
logger.info("========== GET WLS HOME -- {} SITE ===========".format(role))
wls_admin = DRSWls()
wls_admin.connect_host(SITE_CONFIG.wlsadm_host_ip, CONFIG.GENERAL.ssh_user_name, CONFIG.GENERAL.ssh_key_file)
wls_home = wls_admin.get_wls_home(CONFIG.GENERAL.ora_user_name)
wl_home = os.path.dirname(wls_home)
mw_home = os.path.dirname(wl_home)
SITE_CONFIG.wls_home = wls_home
SITE_CONFIG.wl_home = wl_home
SITE_CONFIG.mw_home = mw_home
logger.info(" WebLogic Server Home ($WLS_HOME) at {} site is [{}]".format(role, wls_home))
logger.info(" WebLogic Home ($WL_HOME) at {} site is [{}]".format(role, wl_home))
logger.info(" Middleware Home ($MW_HOME) at {} site is [{}]".format(role, mw_home))
def verify_internal_configuration():
"""
Check consistency of configuration.
This should only be called after the configuration has been read and initialized.
:raises: Exception if errors found in configuration
:return:
"""
logger.info(" ")
logger.info("========== VERIFYING CONFIGURATION CONSISTENCY ===========")
logger.info(" ")
logger.info("========== VERIFYING CONFIGURATION CONSISTENCY ===========")
logger.info("\n------------------- BEGIN CONFIG DUMP ------------------------\n ")
logger.info("CONFIG.GENERAL.database_is_rac : " + str(CONFIG.GENERAL.database_is_rac))
logger.info("CONFIG.GENERAL.dataguard_use_private_ip : " + str(CONFIG.GENERAL.dataguard_use_private_ip))
logger.info("CONFIG.GENERAL.ora_user_name : " + (CONFIG.GENERAL.ora_user_name))
logger.info("CONFIG.GENERAL.ssh_user_name : " + (CONFIG.GENERAL.ssh_user_name))
logger.info("CONFIG.GENERAL.uri_to_check : " + (CONFIG.GENERAL.uri_to_check))
logger.info("CONFIG.GENERAL.dr_method : " + (CONFIG.GENERAL.dr_method))
logger.info("CONFIG.DB_PRIM.db_host_domain : " + (CONFIG.DB_PRIM.db_host_domain))
logger.info("CONFIG.DB_PRIM.db_hostname : " + (CONFIG.DB_PRIM.db_hostname))
logger.info("CONFIG.DB_PRIM.db_name : " + (CONFIG.DB_PRIM.db_name))
logger.info("CONFIG.DB_PRIM.db_port : " + (CONFIG.DB_PRIM.db_port))
logger.info("CONFIG.DB_PRIM.db_unique_name : " + (CONFIG.DB_PRIM.db_unique_name))
logger.info("CONFIG.DB_PRIM.host_fqdn : " + (CONFIG.DB_PRIM.host_fqdn))
logger.info("CONFIG.DB_PRIM.host_ip : " + (CONFIG.DB_PRIM.host_ip))
logger.info("CONFIG.DB_PRIM.local_ip : " + (CONFIG.DB_PRIM.local_ip))
logger.info("CONFIG.DB_PRIM.os_version : " + (CONFIG.DB_PRIM.os_version))
logger.info("CONFIG.DB_PRIM.pdb_name : " + (CONFIG.DB_PRIM.pdb_name))
# logger.info("CONFIG.DB_PRIM.rac_scan_ip : " + str(CONFIG.DB_PRIM.rac_scan_ip))
logger.info("CONFIG.DB_PRIM.sysdba_user_name: " + (CONFIG.DB_PRIM.sysdba_user_name))
logger.info("CONFIG.DB_STBY.db_host_domain: " + (CONFIG.DB_STBY.db_host_domain))
logger.info("CONFIG.DB_STBY.db_hostname : " + (CONFIG.DB_STBY.db_hostname))
logger.info("CONFIG.DB_STBY.db_name : " + (CONFIG.DB_STBY.db_name))
logger.info("CONFIG.DB_STBY.db_port : " + (CONFIG.DB_STBY.db_port))
logger.info("CONFIG.DB_STBY.db_unique_name : " + (CONFIG.DB_STBY.db_unique_name))
logger.info("CONFIG.DB_STBY.host_fqdn : " + (CONFIG.DB_STBY.host_fqdn))
logger.info("CONFIG.DB_STBY.host_ip : " + (CONFIG.DB_STBY.host_ip))
logger.info("CONFIG.DB_STBY.local_ip : " + (CONFIG.DB_STBY.local_ip))
logger.info("CONFIG.DB_STBY.os_version : " + (CONFIG.DB_STBY.os_version))
logger.info("CONFIG.DB_STBY.pdb_name : " + (CONFIG.DB_STBY.pdb_name))
logger.info("CONFIG.DB_STBY.sysdba_user_name : " + (CONFIG.DB_STBY.sysdba_user_name))
logger.info("CONFIG.WLS_PRIM.cluster_node_fqdns : " + str(CONFIG.WLS_PRIM.cluster_node_fqdns))
logger.info("CONFIG.WLS_PRIM.cluster_node_local_ips : " + str(CONFIG.WLS_PRIM.cluster_node_local_ips))
logger.info("CONFIG.WLS_PRIM.cluster_node_os_versions : " + str(CONFIG.WLS_PRIM.cluster_node_os_versions))
logger.info("CONFIG.WLS_PRIM.cluster_node_public_ips : " + str(CONFIG.WLS_PRIM.cluster_node_public_ips))
logger.info("CONFIG.WLS_PRIM.cluster_size : " + str(CONFIG.WLS_PRIM.cluster_size))
logger.info("CONFIG.WLS_PRIM.domain_home :" + (CONFIG.WLS_PRIM.domain_home))
logger.info("CONFIG.WLS_PRIM.domain_name : " + (CONFIG.WLS_PRIM.domain_name))
logger.info("CONFIG.WLS_PRIM.front_end_ip : " + (CONFIG.WLS_PRIM.front_end_ip))
logger.info("CONFIG.WLS_PRIM.managed_server_hosts : " + str(CONFIG.WLS_PRIM.managed_server_hosts))
logger.info("CONFIG.WLS_PRIM.managed_server_names : " + str(CONFIG.WLS_PRIM.managed_server_names))
logger.info("CONFIG.WLS_PRIM.mw_home : " + (CONFIG.WLS_PRIM.mw_home))
logger.info("CONFIG.WLS_PRIM.node_manager_host_ips : " + str(CONFIG.WLS_PRIM.node_manager_host_ips))
logger.info("CONFIG.WLS_PRIM.wl_home : " + (CONFIG.WLS_PRIM.wl_home))
logger.info("CONFIG.WLS_PRIM.wls_home : " + (CONFIG.WLS_PRIM.wls_home))
logger.info("CONFIG.WLS_PRIM.wlsadm_host_domain : " + (CONFIG.WLS_PRIM.wlsadm_host_domain))
logger.info("CONFIG.WLS_PRIM.wlsadm_host_ip : " + (CONFIG.WLS_PRIM.wlsadm_host_ip))
logger.info("CONFIG.WLS_PRIM.wlsadm_hostname : " + (CONFIG.WLS_PRIM.wlsadm_hostname))
logger.info("CONFIG.WLS_PRIM.wlsadm_listen_port : " + (CONFIG.WLS_PRIM.wlsadm_listen_port))
logger.info("CONFIG.WLS_PRIM.wlsadm_nm_hostname : " + (CONFIG.WLS_PRIM.wlsadm_nm_hostname))
logger.info("CONFIG.WLS_PRIM.wlsadm_nm_port : " + (CONFIG.WLS_PRIM.wlsadm_nm_port))
logger.info("CONFIG.WLS_PRIM.wlsadm_nm_type :" + (CONFIG.WLS_PRIM.wlsadm_nm_type))
logger.info("CONFIG.WLS_PRIM.wlsadm_server_name : " + (CONFIG.WLS_PRIM.wlsadm_server_name))
logger.info("CONFIG.WLS_STBY.wlsadm_user_name : " + (CONFIG.WLS_STBY.wlsadm_user_name))
logger.info("CONFIG.WLS_STBY.cluster_node_fqdns :" + str(CONFIG.WLS_STBY.cluster_node_fqdns))
logger.info("CONFIG.WLS_STBY.cluster_node_local_ips :" + str(CONFIG.WLS_STBY.cluster_node_local_ips))
logger.info("CONFIG.WLS_STBY.cluster_node_os_versions : " + str(CONFIG.WLS_STBY.cluster_node_os_versions))
logger.info("CONFIG.WLS_STBY.cluster_node_public_ips :" + str(CONFIG.WLS_STBY.cluster_node_public_ips))
logger.info("CONFIG.WLS_STBY.cluster_size :" + str(CONFIG.WLS_STBY.cluster_size))
logger.info("CONFIG.WLS_STBY.domain_home : " + (CONFIG.WLS_STBY.domain_home))
logger.info("CONFIG.WLS_STBY.domain_name : " + (CONFIG.WLS_STBY.domain_name))
logger.info("CONFIG.WLS_STBY.front_end_ip : " + (CONFIG.WLS_STBY.front_end_ip))
logger.info("CONFIG.WLS_STBY.managed_server_hosts : " + str(CONFIG.WLS_STBY.managed_server_hosts))
logger.info("CONFIG.WLS_STBY.managed_server_names : " + str(CONFIG.WLS_STBY.managed_server_names))
logger.info("CONFIG.WLS_STBY.mw_home : " + (CONFIG.WLS_STBY.mw_home))
logger.info("CONFIG.WLS_STBY.node_manager_host_ips : " + str(CONFIG.WLS_STBY.node_manager_host_ips))
logger.info("CONFIG.WLS_STBY.wl_home : " + (CONFIG.WLS_STBY.wl_home))
logger.info("CONFIG.WLS_STBY.wls_home : " + (CONFIG.WLS_STBY.wls_home))
logger.info("CONFIG.WLS_STBY.wlsadm_host_domain : " + (CONFIG.WLS_STBY.wlsadm_host_domain))
logger.info("CONFIG.WLS_STBY.wlsadm_host_ip : " + (CONFIG.WLS_STBY.wlsadm_host_ip))
logger.info("CONFIG.WLS_STBY.wlsadm_hostname : " + (CONFIG.WLS_STBY.wlsadm_hostname))
logger.info("CONFIG.WLS_STBY.wlsadm_listen_port : " + (CONFIG.WLS_STBY.wlsadm_listen_port))
logger.info("CONFIG.WLS_STBY.wlsadm_nm_hostname : " + (CONFIG.WLS_STBY.wlsadm_nm_hostname))
logger.info("CONFIG.WLS_STBY.wlsadm_nm_port : " + (CONFIG.WLS_STBY.wlsadm_nm_port))
logger.info("CONFIG.WLS_STBY.wlsadm_nm_type : " + (CONFIG.WLS_STBY.wlsadm_nm_type))
logger.info("CONFIG.WLS_STBY.wlsadm_server_name : " + (CONFIG.WLS_STBY.wlsadm_server_name))
logger.info("CONFIG.WLS_STBY.wlsadm_user_name : " + (CONFIG.WLS_STBY.wlsadm_user_name))
logger.info("\n------------------- END CONFIG DUMP ------------------------\n\n")
DRSUtil.test_config_object_fully_initialized(CONFIG.GENERAL)
DRSUtil.test_config_object_fully_initialized(CONFIG.DB_PRIM)
DRSUtil.test_config_object_fully_initialized(CONFIG.DB_STBY)
DRSUtil.test_config_object_fully_initialized(CONFIG.WLS_PRIM)
DRSUtil.test_config_object_fully_initialized(CONFIG.WLS_STBY)
A = CONFIG.WLS_PRIM
B = CONFIG.WLS_STBY
error_stack = list()
raise_exception = False
if A.domain_name != B.domain_name:
raise_exception = True
error_stack.append("ERROR: Primary WLS domain name [{}] not equal to Standby WLS domain name [{}]".
format(A.domain_name, B.domain_name))