1
1
"""
2
- Copyright (c) 2017, 2019 , Oracle Corporation and/or its affiliates. All rights reserved.
2
+ Copyright (c) 2017, 2022 , Oracle Corporation and/or its affiliates. All rights reserved.
3
3
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4
4
5
5
6
6
"""
7
7
import re
8
8
from xml .dom .minidom import parse
9
+ from wlsdeploy .exception import exception_helper
9
10
11
+ from wlsdeploy .logging .platform_logger import PlatformLogger
12
+
13
+ _logger = PlatformLogger ('wlsdeploy.create' )
10
14
11
15
def set_ssl_properties (xmlDoc , atp_creds_path , keystore_password , truststore_password ):
12
16
'''
@@ -63,7 +67,6 @@ def fix_jps_config(rcu_db_info, model_context):
63
67
64
68
65
69
def get_atp_connect_string (tnsnames_ora_path , tns_sid_name ):
66
-
67
70
try :
68
71
f = open (tnsnames_ora_path , "r+" )
69
72
try :
@@ -76,17 +79,24 @@ def get_atp_connect_string(tnsnames_ora_path, tns_sid_name):
76
79
pattern = tns_sid_name + '\s*=\s*([(].*\n .*)'
77
80
match = re .search (pattern , text )
78
81
if match :
79
- str = match .group (1 )
80
- tnsConnectString = str .replace ('\r ' ,'' ).replace ('\n ' ,'' )
81
- str = format_connect_string (tnsConnectString )
82
- return str
83
- except :
84
- pass
85
-
86
- return None
87
-
88
-
89
- def format_connect_string (connect_string ):
82
+ connect_string = match .group (1 )
83
+ tnsConnectString = connect_string .replace ('\r ' ,'' ).replace ('\n ' ,'' )
84
+ connect_string = cleanup_connect_string (tnsConnectString )
85
+ return connect_string , None
86
+ else :
87
+ ex = exception_helper .create_create_exception ("WLSDPLY-12563" , tns_sid_name )
88
+ _logger .throwing (ex , class_name = 'atp_helper' , method_name = 'get_atp_connect_string' )
89
+ raise ex
90
+ except IOError , ioe :
91
+ ex = exception_helper .create_create_exception ("WLSDPLY-12570" , str (ioe ))
92
+ _logger .throwing (ex , class_name = 'atp_helper' , method_name = 'get_atp_connect_string' )
93
+ raise ex
94
+ except Exception , ex :
95
+ ex = exception_helper .create_create_exception ("WLSDPLY-12570" , str (ex ))
96
+ _logger .throwing (ex , class_name = 'atp_helper' , method_name = 'get_atp_connect_string' )
97
+ raise ex
98
+
99
+ def cleanup_connect_string (connect_string ):
90
100
"""
91
101
Formats connect string for ATP DB by removing unwanted whitespaces.
92
102
Input:
@@ -109,5 +119,5 @@ def format_connect_string(connect_string):
109
119
part3 = match .group (3 )
110
120
part4 = match .group (4 ).replace (' ' , '' )
111
121
connect_string = "%s%s%s%s" % (part1 , part2 , part3 , part4 )
112
-
122
+ # if no match then return original one
113
123
return connect_string
0 commit comments