Skip to content

Commit 1f3595c

Browse files
committed
Improve ATP error message
1 parent c9eaca8 commit 1f3595c

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

core/src/main/python/wlsdeploy/tool/create/atp_helper.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"""
77
import re
88
from xml.dom.minidom import parse
9-
9+
from wlsdeploy.exception import exception_helper
1010

1111
def set_ssl_properties(xmlDoc, atp_creds_path, keystore_password, truststore_password):
1212
'''
@@ -63,7 +63,6 @@ def fix_jps_config(rcu_db_info, model_context):
6363

6464

6565
def get_atp_connect_string(tnsnames_ora_path, tns_sid_name):
66-
6766
try:
6867
f = open(tnsnames_ora_path, "r+")
6968
try:
@@ -76,17 +75,21 @@ def get_atp_connect_string(tnsnames_ora_path, tns_sid_name):
7675
pattern = tns_sid_name + '\s*=\s*([(].*\n.*)'
7776
match = re.search(pattern, text)
7877
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):
78+
connect_string = match.group(1)
79+
tnsConnectString = connect_string.replace('\r','').replace('\n','')
80+
connect_string = cleanup_connect_string(tnsConnectString)
81+
return connect_string, None
82+
else:
83+
ex = exception_helper.create_create_exception("WLSDPLY-12563", tns_sid_name)
84+
return None, ex
85+
except IOError, ioe:
86+
ex = exception_helper.create_create_exception("WLSDPLY-12570", str(ioe))
87+
return None, ex
88+
except Exception, ex:
89+
ex = exception_helper.create_create_exception("WLSDPLY-12570", str(ex))
90+
return None, ex
91+
92+
def cleanup_connect_string(connect_string):
9093
"""
9194
Formats connect string for ATP DB by removing unwanted whitespaces.
9295
Input:
@@ -109,5 +112,5 @@ def format_connect_string(connect_string):
109112
part3 = match.group(3)
110113
part4 = match.group(4).replace(' ', '')
111114
connect_string = "%s%s%s%s" % (part1, part2, part3, part4)
112-
115+
# if no match then return original one
113116
return connect_string

core/src/main/python/wlsdeploy/tool/create/domain_creator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,11 +950,11 @@ def __retrieve_atp_rcudbinfo(self, rcu_db_info, checkAdminPwd=False):
950950
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
951951
raise ex
952952

953-
rcu_database = atp_helper.get_atp_connect_string(tns_admin + os.sep + 'tnsnames.ora',
953+
rcu_database, error = atp_helper.get_atp_connect_string(tns_admin + os.sep + 'tnsnames.ora',
954954
rcu_db_info.get_atp_entry())
955955

956956
if rcu_database is None:
957-
ex = exception_helper.create_create_exception('WLSDPLY-12563', rcu_db_info.get_atp_entry())
957+
ex = exception_helper.create_create_exception('WLSDPLY-12571', error)
958958
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
959959
raise ex
960960

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,15 +1322,17 @@ WLSDPLY-12561=Dynamic cluster {0} set to size of {1}
13221322
WLSDPLY-12562=Unable to get ATP database connection info: cannot find ATP tnsnames.ora file. Please make sure \
13231323
you have the correct ATP wallet in the archive file or RCUDbInfo.oracle.net.tns_admin is pointing to an unzipped \
13241324
ATP wallet root directory that contains the tnsnames.ora file.
1325-
WLSDPLY-12563=Unable to retrieve database connection info, please make sure the the entry {0} specified in \
1326-
RCUDbInfo.tns.alias exists in the tnsnames.ora file in the ATP wallet.
1325+
WLSDPLY-12563=Unable to retrieve database connection info, please make sure the RCUDbInfo.tns.alias - {0} specified \
1326+
exists in the tnsnames.ora file in the ATP wallet.
13271327
WLSDPLY-12564=Unable to retrieve database connection string, please make sure it is specified in \
13281328
RCUDbInfo.rcu_db_conn_string field or in command line argument '-rcu_database'.
13291329
WLSDPLY-12565=The archive file was not provided so there are no custom files to extract
13301330
WLSDPLY-12566=Installing {0} user custom files to domain home {1}
13311331
WLSDPLY-12567=The archive file {0} contains no user custom files to install
13321332
WLSDPLY-12568=Creating empty folder {0}. Folder contains no attributes or sub-folders.
13331333
WLSDPLY-12569=Setting the topology profile to {0}
1334+
WLSDPLY-12570=Unable to retrieve database connection info: {0}
1335+
WLSDPLY-12571=Error in setting up ATP connection string: {0}
13341336

13351337
# domain_typedef.py
13361338
WLSDPLY-12300={0} got the domain type {1} but the domain type definition file {2} was not valid: {3}

0 commit comments

Comments
 (0)