Skip to content

Commit 7d00621

Browse files
Merge pull request #1050 from oracle/improve-atp-errmsg
Improve ATP error message
2 parents 59343d1 + b8138df commit 7d00621

File tree

3 files changed

+29
-22
lines changed

3 files changed

+29
-22
lines changed

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

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
"""
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.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
55
66
"""
77
import re
88
from xml.dom.minidom import parse
9+
from wlsdeploy.exception import exception_helper
910

11+
from wlsdeploy.logging.platform_logger import PlatformLogger
12+
13+
_logger = PlatformLogger('wlsdeploy.create')
1014

1115
def set_ssl_properties(xmlDoc, atp_creds_path, keystore_password, truststore_password):
1216
'''
@@ -63,7 +67,6 @@ def fix_jps_config(rcu_db_info, model_context):
6367

6468

6569
def get_atp_connect_string(tnsnames_ora_path, tns_sid_name):
66-
6770
try:
6871
f = open(tnsnames_ora_path, "r+")
6972
try:
@@ -76,17 +79,24 @@ def get_atp_connect_string(tnsnames_ora_path, tns_sid_name):
7679
pattern = tns_sid_name + '\s*=\s*([(].*\n.*)'
7780
match = re.search(pattern, text)
7881
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):
90100
"""
91101
Formats connect string for ATP DB by removing unwanted whitespaces.
92102
Input:
@@ -109,5 +119,5 @@ def format_connect_string(connect_string):
109119
part3 = match.group(3)
110120
part4 = match.group(4).replace(' ', '')
111121
connect_string = "%s%s%s%s" % (part1, part2, part3, part4)
112-
122+
# if no match then return original one
113123
return connect_string

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -950,14 +950,9 @@ 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

956-
if rcu_database is None:
957-
ex = exception_helper.create_create_exception('WLSDPLY-12563', rcu_db_info.get_atp_entry())
958-
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
959-
raise ex
960-
961956
keystore_pwd = rcu_db_info.get_keystore_password()
962957
truststore_pwd = rcu_db_info.get_truststore_password()
963958

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)