Skip to content

Commit 9b79473

Browse files
authored
Merge pull request #299 from oracle/WDT-235-discover-files-with-relative-path
Wdt 235 discover files with relative path
2 parents 1c7aa1e + 850fd66 commit 9b79473

File tree

5 files changed

+37
-28
lines changed

5 files changed

+37
-28
lines changed

core/src/main/python/wlsdeploy/tool/discover/coherence_resources_discoverer.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
The Universal Permissive License (UPL), Version 1.0
44
"""
55
from java.io import File
@@ -86,9 +86,11 @@ def get_coherence_clusters(self):
8686
result[coherence_cluster] = OrderedDict()
8787
self._populate_model_parameters(result[coherence_cluster], location)
8888
model_subfolder_name, subfolder_result = self.get_coherence_cache_config(location)
89-
discoverer.add_to_model_if_not_empty(result[coherence_cluster], model_subfolder_name, subfolder_result)
89+
discoverer.add_to_model_if_not_empty(result[coherence_cluster], model_subfolder_name,
90+
subfolder_result)
9091
model_subfolder_name, subfolder_result = self.get_coherence_resource(location)
91-
discoverer.add_to_model_if_not_empty(result[coherence_cluster], model_subfolder_name, subfolder_result)
92+
discoverer.add_to_model_if_not_empty(result[coherence_cluster], model_subfolder_name,
93+
subfolder_result)
9294
location.remove_name_token(name_token)
9395

9496
_logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
@@ -159,20 +161,21 @@ def _add_custom_configuration_to_archive(self, model_name, model_value, location
159161
new_name = model_value
160162
if model_value is not None:
161163
archive_file = self._model_context.get_archive_file()
164+
file_name_path = self._convert_path(model_value)
162165
config_file = None
163166
try:
164-
config_file = FileUtils.getCanonicalFile(File(model_value))
167+
config_file = FileUtils.getCanonicalFile(File(file_name_path))
165168
except (IOException, SecurityException), se:
166-
_logger.warning('WLSDPLY-06314', cluster_name, model_value, se.getLocalizedMessage(),
169+
_logger.warning('WLSDPLY-06314', cluster_name, file_name_path, se.getLocalizedMessage(),
167170
class_name=_class_name, method_name=_method_name)
168171
new_name = None
169172

170173
if file is not None:
171174
try:
172175
new_name = archive_file.addCoherenceConfigFile(cluster_name, config_file)
173-
_logger.finer('WLSDPLY-06315', model_value, class_name=_class_name, method_name=_method_name)
176+
_logger.finer('WLSDPLY-06315', file_name_path, class_name=_class_name, method_name=_method_name)
174177
except (IllegalArgumentException, WLSDeployArchiveIOException), wioe:
175-
_logger.warning('WLSDPLY-06316', cluster_name, model_value, wioe.getLocalizedMessage(),
178+
_logger.warning('WLSDPLY-06316', cluster_name, file_name_path, wioe.getLocalizedMessage(),
176179
class_name=_class_name, method_name=_method_name)
177180
new_name = None
178181

@@ -209,12 +212,13 @@ def _add_cache_config(self, model_name, model_value, location):
209212
class_name=_class_name, method_name=_method_name)
210213
new_name = None
211214
else:
215+
file_name = self._convert_path(model_value)
212216
try:
213-
new_name = archive_file.addCoherenceConfigFile(cluster_name, File(model_value))
214-
_logger.info('WLSDPLY-06319', cluster_name, model_value, new_name, class_name=_class_name,
217+
new_name = archive_file.addCoherenceConfigFile(cluster_name, File(file_name))
218+
_logger.info('WLSDPLY-06319', cluster_name, file_name, new_name, class_name=_class_name,
215219
method_name=_method_name)
216220
except (IllegalArgumentException, WLSDeployArchiveIOException), wioe:
217-
_logger.warning('WLSDPLY-06318', cluster_name, model_value, 'file', wioe.getLocalizedMessage())
221+
_logger.warning('WLSDPLY-06318', cluster_name, file_name, 'file', wioe.getLocalizedMessage())
218222
new_name = None
219223

220224
_logger.exiting(class_name=_class_name, method_name=_method_name, result=new_name)

core/src/main/python/wlsdeploy/tool/discover/common_resources_discoverer.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def archive_jdbc_create_script(self, jdbc_store_name, jdbc_store_dictionary):
247247
_logger.entering(jdbc_store_name, class_name=_class_name, method_name=_method_name)
248248
if model_constants.CREATE_TABLE_DDL_FILE in jdbc_store_dictionary:
249249
archive_file = self._model_context.get_archive_file()
250-
file_name = jdbc_store_dictionary[model_constants.CREATE_TABLE_DDL_FILE]
250+
file_name = self._convert_path(jdbc_store_dictionary[model_constants.CREATE_TABLE_DDL_FILE])
251251
_logger.info('WLSDPLY-06352', jdbc_store_name, file_name, class_name=_class_name, method_name=_method_name)
252252
try:
253253
new_source_name = archive_file.addScript(File(file_name))
@@ -340,21 +340,22 @@ def _add_wldf_script(self, model_name, model_value, location):
340340
_logger.entering(model_name, class_name=_class_name, method_name=_method_name)
341341
new_script_name = model_value
342342
if model_value is not None:
343-
_logger.info('WLSDPLY-06359', model_value, self._alias_helper.get_model_folder_path(location),
343+
file_name = self._convert_path(model_value)
344+
_logger.info('WLSDPLY-06359', file_name, self._alias_helper.get_model_folder_path(location),
344345
class_name=_class_name, method_name=_method_name)
345346
archive_file = self._model_context.get_archive_file()
346347
# Set model_value to None if unable to add it to archive file
347348
modified_name = None
348349
try:
349-
modified_name = archive_file.addScript(File(model_value))
350+
modified_name = archive_file.addScript(File(file_name))
350351
except IllegalArgumentException, iae:
351-
_logger.warning('WLSDPLY-06360', self._alias_helper.get_model_folder_path(location), model_value,
352+
_logger.warning('WLSDPLY-06360', self._alias_helper.get_model_folder_path(location), file_name,
352353
iae.getLocalizedMessage(), class_name=_class_name,
353354
method_name=_method_name)
354355
except WLSDeployArchiveIOException, wioe:
355356
de = exception_helper.create_discover_exception('WLSDPLY-06354',
356357
self._alias_helper.get_model_folder_path(location),
357-
model_value, wioe.getLocalizedMessage())
358+
file, wioe.getLocalizedMessage())
358359
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
359360
raise de
360361
new_script_name = modified_name

core/src/main/python/wlsdeploy/tool/discover/discoverer.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,14 +546,16 @@ def _convert_path(self, file_name):
546546

547547
def _is_oracle_home_file(self, file_name):
548548
"""
549-
Determine if the absolute file name starts with an oracle home.
549+
Determine if the absolute file name starts with an oracle home. Disregard if the application is
550+
located in the domain home.
550551
551552
:param file_name: to check for oracle home or weblogic home
552553
:return: true if in oracle home location
553554
"""
554555
py_str = str(file_name)
555-
return py_str.startswith(self._model_context.get_oracle_home()) or py_str.startswith(
556-
self._model_context.get_wl_home())
556+
return (not py_str.startswith(self._model_context.get_domain_home())) and \
557+
(py_str.startswith(self._model_context.get_oracle_home()) or
558+
py_str.startswith(self._model_context.get_wl_home()))
557559

558560
def _get_wlst_mode_string(self):
559561
"""

core/src/main/python/wlsdeploy/tool/discover/topology_discoverer.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -629,13 +629,14 @@ def _add_server_keystore_file_to_archive(self, server_name, archive_file, file_p
629629
_logger.finer('WLSDPLY-06623', file_path, server_name, class_name=_class_name, method_name=_method_name)
630630
new_name = None
631631

632+
full_file_path = self._convert_to_path(file_path)
632633
try:
633-
new_name = archive_file.addServerKeyStoreFile(server_name, File(file_path))
634+
new_name = archive_file.addServerKeyStoreFile(server_name, File(full_file_path))
634635
except IllegalArgumentException, iae:
635-
_logger.warning('WLSDPLY-06624', server_name, file_path, iae.getLocalizedMessage(),
636+
_logger.warning('WLSDPLY-06624', server_name, full_file_path, iae.getLocalizedMessage(),
636637
class_name=_class_name, method_name=_method_name)
637638
except WLSDeployArchiveIOException, wioe:
638-
de = exception_helper.create_discover_exception('WLSDPLY-06625', server_name, file_path,
639+
de = exception_helper.create_discover_exception('WLSDPLY-06625', server_name, full_file_path,
639640
wioe.getLocalizedMessage())
640641
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
641642
raise de
@@ -650,16 +651,17 @@ def _add_node_manager_keystore_file_to_archive(self, archive_file, file_path):
650651
"""
651652
_method_name = '_add_node_manager_keystore_file_to_archive'
652653
_logger.entering(archive_file, file_path, class_name=_class_name, method_name=_method_name)
653-
_logger.finer('WLSDPLY-06636', file_path, class_name=_class_name, method_name=_method_name)
654-
new_name = None
654+
full_file_path = self._convert_to_path(file_path)
655+
_logger.finer('WLSDPLY-06636', full_file_path, class_name=_class_name, method_name=_method_name)
655656

657+
new_name = None
656658
try:
657-
new_name = archive_file.addNodeManagerKeyStoreFile(File(file_path))
659+
new_name = archive_file.addNodeManagerKeyStoreFile(File(full_file_path))
658660
except IllegalArgumentException, iae:
659-
_logger.warning('WLSDPLY-06637', file_path, iae.getLocalizedMessage(), class_name=_class_name,
661+
_logger.warning('WLSDPLY-06637', full_file_path, iae.getLocalizedMessage(), class_name=_class_name,
660662
method_name=_method_name)
661663
except WLSDeployArchiveIOException, wioe:
662-
de = exception_helper.create_discover_exception('WLSDPLY-06638', file_path, wioe.getLocalizedMessage())
664+
de = exception_helper.create_discover_exception('WLSDPLY-06638', full_file_path, wioe.getLocalizedMessage())
663665
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
664666
raise de
665667
return new_name

core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/WLDFSystemResource.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"copyright": "Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.",
2+
"copyright": "Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.",
33
"license": "The Universal Permissive License (UPL), Version 1.0",
44
"wlst_type": "WLDFSystemResource${:s}",
55
"child_folders_type": "multiple",
@@ -212,7 +212,7 @@
212212
"folders": {},
213213
"attributes": {
214214
"Enabled": [ {"version": "[12.2.1.1,)", "wlst_mode": "both", "wlst_name": "Enabled", "wlst_path": "WP001", "value": {"default": "true"}, "wlst_type": "boolean" } ],
215-
"Environment": [ {"version": "[12.2.1.1,)", "wlst_mode": "both", "wlst_name": "Environment", "wlst_path": "WP001", "value": {"default": "None"}, "wlst_type": "properties", "preferred_model_type": "dict", "get_method" : "GET" } ],
215+
"Environment": [ {"version": "[12.2.1.1,)", "wlst_mode": "both", "wlst_name": "Environment", "wlst_path": "WP001", "value": {"default": "None"}, "wlst_type": "delimited_semicolon", "preferred_model_type": "dict", "get_method" : "LSA" } ],
216216
"Parameter": [ {"version": "[12.2.1.1,)", "wlst_mode": "both", "wlst_name": "Parameter${:s}", "wlst_path": "WP001", "value": {"default": "[]" }, "wlst_type": "${list:jarray}", "preferred_model_type": "delimited_string", "get_method": "GET", "merge": false } ],
217217
"PathToScript": [ {"version": "[12.2.1.1,)", "wlst_mode": "both", "wlst_name": "PathToScript", "wlst_path": "WP001", "value": {"default": "None"}, "wlst_type": "string", "uses_path_tokens": "true" } ],
218218
"Timeout": [ {"version": "[12.2.1.1,)", "wlst_mode": "both", "wlst_name": "Timeout", "wlst_path": "WP001", "value": {"default": 0 }, "wlst_type": "integer" } ],

0 commit comments

Comments
 (0)