Skip to content

Commit 2516653

Browse files
Merge branch 'master' into Issue#168-Arrays-needed-to-version-folders
2 parents 30520ee + 3b154cd commit 2516653

File tree

14 files changed

+171
-42
lines changed

14 files changed

+171
-42
lines changed

KnownIssues.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,13 @@ ACTION:
1010
Ignore the following messages logged during discover of a 12.2.1 domain.
1111

1212
####<Jan 14, 2019 1:14:21 PM> <SEVERE> <CommandExceptionHandler> <handleException> <> <Error: cd() failed.>
13-
####<Jan 14, 2019 1:14:21 PM> <SEVERE> <CommandExceptionHandler> <handleException> <> <Error: ls() failed.>
13+
####<Jan 14, 2019 1:14:21 PM> <SEVERE> <CommandExceptionHandler> <handleException> <> <Error: ls() failed.>
14+
15+
16+
ISSUE:
17+
The createDomain tool cannot create 11g JRF domains. The tool will issue error messages in the log, and
18+
terminate the create process. The discoverDomain tool can discover 11g JRF domains, and those domains can be
19+
configured with the updateDomain and deploy tools.
20+
21+
ACTION:
22+
Do not use the createDomain tool for 11g JRF domains. This functionality may be available in a future release.

core/src/main/java/oracle/weblogic/deploy/logging/PlatformLogger.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,9 @@ public static List<Logger> getLoggers() {
542542
while (e.hasMoreElements()) {
543543
String loggerName = e.nextElement();
544544
Logger logger = manager.getLogger(loggerName);
545-
topList.add(logger);
545+
if(logger != null) {
546+
topList.add(logger);
547+
}
546548
}
547549
return topList;
548550
}

core/src/main/java/oracle/weblogic/deploy/util/WLSDeployArchive.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ public class WLSDeployArchive {
7474
*/
7575
public static final String ARCHIVE_COHERENCE_TARGET_DIR = WLSDPLY_ARCHIVE_BINARY_DIR + "/coherence";
7676

77+
/**
78+
* The subdirectory where node manager files are stored and extracted (such as keystore file).
79+
*/
80+
public static final String ARCHIVE_NODE_MANAGER_TARGET_DIR = WLSDPLY_ARCHIVE_BINARY_DIR + "/nodeManager";
81+
7782
/**
7883
* The subdirectory to which the scripts are extracted.
7984
*/
@@ -867,6 +872,25 @@ public String addFileStoreDirectory(String fileStoreName) throws
867872
return newName;
868873
}
869874

875+
/**
876+
* Add a Node Manager Identity Key Store file to the node manager directory in the archive.
877+
*
878+
* @param keystoreFile the file to add
879+
* @return the new location of the file to use in the model
880+
* @throws WLSDeployArchiveIOException if an error occurs while archiving the file
881+
* @throws IllegalArgumentException if the file does not exist
882+
*/
883+
public String addNodeManagerKeyStoreFile(File keystoreFile) throws WLSDeployArchiveIOException {
884+
final String METHOD = "addNodeManagerKeyStoreFile";
885+
886+
LOGGER.entering(CLASS, METHOD, keystoreFile);
887+
888+
validateExistingFile(keystoreFile, "keyStoreFile", getArchiveFileName(), METHOD);
889+
String newName = addItemToZip(ARCHIVE_NODE_MANAGER_TARGET_DIR, keystoreFile);
890+
LOGGER.exiting(CLASS, METHOD, newName);
891+
return newName;
892+
}
893+
870894
/**
871895
* This method removes all binaries from the archive. This method is intended to
872896
* be invoked by discovery to remove binaries from a previous run that might

core/src/main/python/create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def main(args):
362362
variable_map = {}
363363
if model_context.get_variable_file():
364364
variable_map = variables.load_variables(model_context.get_variable_file())
365-
variables.substitute(model, variable_map)
365+
variables.substitute(model, variable_map, model_context)
366366
except VariableException, ex:
367367
__logger.severe('WLSDPLY-20004', _program_name, ex.getLocalizedMessage(), error=ex,
368368
class_name=_class_name, method_name=_method_name)

core/src/main/python/deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def main(args):
448448
variable_map = {}
449449
if model_context.get_variable_file():
450450
variable_map = variables.load_variables(model_context.get_variable_file())
451-
variables.substitute(model_dictionary, variable_map)
451+
variables.substitute(model_dictionary, variable_map, model_context)
452452
except VariableException, ex:
453453
__logger.severe('WLSDPLY-20004', _program_name, ex.getLocalizedMessage(), error=ex,
454454
class_name=_class_name, method_name=_method_name)

core/src/main/python/update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ def main(args):
466466
variable_map = {}
467467
if model_context.get_variable_file():
468468
variable_map = variables.load_variables(model_context.get_variable_file())
469-
variables.substitute(model_dictionary, variable_map)
469+
variables.substitute(model_dictionary, variable_map, model_context)
470470
except VariableException, ex:
471471
__logger.severe('WLSDPLY-20004', _program_name, ex.getLocalizedMessage(), error=ex,
472472
class_name=_class_name, method_name=_method_name)

core/src/main/python/wlsdeploy/tool/deploy/applications_deployer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,9 @@ def __get_library_references(self, base_location):
387387
_method_name = '__get_library_references'
388388

389389
self.logger.entering(str(base_location), class_name=self._class_name, method_name=_method_name)
390+
# In 12.1.3 and older release this internal library is accidentally exposed in libraryruntimes mbean
391+
392+
internal_skip_list = ['bea_wls_async_response']
390393

391394
location = LocationContext(base_location).append_location(LIBRARY)
392395
token_name = self.alias_helper.get_name_token(location)
@@ -403,6 +406,8 @@ def __get_library_references(self, base_location):
403406
libs = self.wlst_helper.get_existing_object_list(library_runtime_path)
404407

405408
for lib in libs:
409+
if lib in internal_skip_list:
410+
continue
406411
self.wlst_helper.domain_runtime()
407412
self.wlst_helper.cd(library_runtime_path + lib)
408413
runtime_attributes = self.wlst_helper.lsa()

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

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ def _add_library(self, server_name, classpath_name):
578578

579579
def _add_keystore_file_to_archive(self, model_name, model_value, location):
580580
"""
581-
Add the Server custom trust or identity keystore file to the archive.
581+
Add the custom trust or identity keystore file to the archive.
582582
:param model_name: attribute name in the model
583583
:param model_value: converted model value for the attribute
584584
:param location: context containing the current location information
@@ -591,20 +591,62 @@ def _add_keystore_file_to_archive(self, model_name, model_value, location):
591591
server_name = self._get_server_name_from_location(location)
592592
archive_file = self._model_context.get_archive_file()
593593
file_path = self._convert_path(model_value)
594-
_logger.finer('WLSDPLY-06623', file_path, server_name, class_name=_class_name, method_name=_method_name)
595-
try:
596-
new_name = archive_file.addServerKeyStoreFile(server_name, File(file_path))
597-
except IllegalArgumentException, iae:
598-
_logger.warning('WLSDPLY-06624', server_name, file_path, iae.getLocalizedMessage(),
599-
class_name=_class_name, method_name=_method_name)
600-
except WLSDeployArchiveIOException, wioe:
601-
de = exception_helper.create_discover_exception('WLSDPLY-06625', server_name, file_path,
602-
wioe.getLocalizedMessage())
603-
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
604-
raise de
594+
if server_name:
595+
new_name = self._add_server_keystore_file_to_archive(server_name, archive_file, file_path)
596+
else:
597+
new_name = self._add_node_manager_keystore_file_to_archive(archive_file, file_path)
598+
605599
_logger.exiting(class_name=_class_name, method_name=_method_name, result=new_name)
606600
return new_name
607601

602+
def _add_server_keystore_file_to_archive(self, server_name, archive_file, file_path):
603+
"""
604+
Add the Server custom trust or identity keystore file to the archive.
605+
:param server_name: attribute name in the model
606+
:param archive_file: converted model value for the attribute
607+
:param file_path: context containing the current location information
608+
:return: modified location and name for the model keystore file
609+
"""
610+
_method_name = '_add_server_keystore_file_to_archive'
611+
_logger.entering(server_name, archive_file, file_path, class_name=_class_name, method_name=_method_name)
612+
_logger.finer('WLSDPLY-06623', file_path, server_name, class_name=_class_name, method_name=_method_name)
613+
new_name = None
614+
615+
try:
616+
new_name = archive_file.addServerKeyStoreFile(server_name, File(file_path))
617+
except IllegalArgumentException, iae:
618+
_logger.warning('WLSDPLY-06624', server_name, file_path, iae.getLocalizedMessage(),
619+
class_name=_class_name, method_name=_method_name)
620+
except WLSDeployArchiveIOException, wioe:
621+
de = exception_helper.create_discover_exception('WLSDPLY-06625', server_name, file_path,
622+
wioe.getLocalizedMessage())
623+
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
624+
raise de
625+
return new_name
626+
627+
def _add_node_manager_keystore_file_to_archive(self, archive_file, file_path):
628+
"""
629+
Add the node manager custom trust or identity keystore file to the archive.
630+
:param archive_file: converted model value for the attribute
631+
:param file_path: context containing the current location information
632+
:return: modified location and name for the model keystore file
633+
"""
634+
_method_name = '_add_node_manager_keystore_file_to_archive'
635+
_logger.entering(archive_file, file_path, class_name=_class_name, method_name=_method_name)
636+
_logger.finer('WLSDPLY-06636', file_path, class_name=_class_name, method_name=_method_name)
637+
new_name = None
638+
639+
try:
640+
new_name = archive_file.addNodeManagerKeyStoreFile(File(file_path))
641+
except IllegalArgumentException, iae:
642+
_logger.warning('WLSDPLY-06637', file_path, iae.getLocalizedMessage(), class_name=_class_name,
643+
method_name=_method_name)
644+
except WLSDeployArchiveIOException, wioe:
645+
de = exception_helper.create_discover_exception('WLSDPLY-06638', file_path, wioe.getLocalizedMessage())
646+
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
647+
raise de
648+
return new_name
649+
608650
def _get_server_name_from_location(self, location):
609651
"""
610652
Retrieve the server name from the location context file.

core/src/main/python/wlsdeploy/tool/validate/validator.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,17 @@ def __validate_model_file(self, model_dict, variables_file_name, archive_file_na
222222
if self._model_file_name is not None:
223223
self._logger.info('WLSDPLY-05003', self._model_file_name, class_name=_class_name, method_name=_method_name)
224224

225-
if variables_file_name is not None:
226-
self._logger.info('WLSDPLY-05004', variables_file_name, class_name=_class_name, method_name=_method_name)
227-
try:
225+
try:
226+
if variables_file_name is not None:
227+
self._logger.info('WLSDPLY-05004', variables_file_name, class_name=_class_name, method_name=_method_name)
228228
self._variable_properties = variables.load_variables(variables_file_name)
229-
variables.substitute(model_dict, self._variable_properties)
230-
except VariableException, ve:
231-
ex = exception_helper.create_validate_exception('WLSDPLY-20004', 'validateModel',
232-
ve.getLocalizedMessage(), error=ve)
233-
self._logger.throwing(ex, class_name=_class_name, method_name=_method_name)
234-
raise ex
229+
230+
variables.substitute(model_dict, self._variable_properties, self._model_context)
231+
except VariableException, ve:
232+
ex = exception_helper.create_validate_exception('WLSDPLY-20004', 'validateModel',
233+
ve.getLocalizedMessage(), error=ve)
234+
self._logger.throwing(ex, class_name=_class_name, method_name=_method_name)
235+
raise ex
235236

236237
if archive_file_name is not None:
237238
self._logger.info('WLSDPLY-05005', archive_file_name, class_name=_class_name, method_name=_method_name)

core/src/main/python/wlsdeploy/util/variables.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
_variable_pattern = re.compile("\\$\\{[\w.-]+\\}")
2626
_file_variable_pattern = re.compile("@@FILE:[\w.\\\/:-]+@@")
2727
_property_pattern = re.compile("@@PROP:[\w.-]+@@")
28+
_file_nested_variable_pattern = re.compile("@@FILE:@@[\w]+@@[\w.\\\/:-]+@@")
2829

2930

3031
def load_variables(file_path):
@@ -126,20 +127,22 @@ def get_variable_names(text):
126127
return names
127128

128129

129-
def substitute(dictionary, variables):
130+
def substitute(dictionary, variables, model_context):
130131
"""
131132
Substitute fields in the specified dictionary with variable values.
132133
:param dictionary: the dictionary in which to substitute variables
133134
:param variables: a dictionary of variables for substitution
135+
:param model_context: used to resolve variables in file paths
134136
"""
135-
_process_node(dictionary, variables)
137+
_process_node(dictionary, variables, model_context)
136138

137139

138-
def _process_node(nodes, variables):
140+
def _process_node(nodes, variables, model_context):
139141
"""
140142
Process variables in the node.
141143
:param nodes: the dictionary to process
142144
:param variables: the variables to use
145+
:param model_context: used to resolve variables in file paths
143146
"""
144147
# iterate over copy to avoid concurrent change for add/delete
145148
if type(nodes) is OrderedDict:
@@ -150,22 +153,23 @@ def _process_node(nodes, variables):
150153
value = nodes[key]
151154

152155
# if the key changes with substitution, remove old key and map value to new key
153-
new_key = _substitute(key, variables)
156+
new_key = _substitute(key, variables, model_context)
154157
if new_key is not key:
155158
nodes.pop(key)
156159
nodes[new_key] = value
157160

158161
if isinstance(value, dict):
159-
_process_node(value, variables)
162+
_process_node(value, variables, model_context)
160163
elif type(value) is str:
161-
nodes[key] = _substitute(value, variables)
164+
nodes[key] = _substitute(value, variables, model_context)
162165

163166

164-
def _substitute(text, variables):
167+
def _substitute(text, variables, model_context):
165168
"""
166169
Substitute the variable placeholders with the variable value.
167170
:param text: the text to process for variable placeholders
168171
:param variables: the variables to use
172+
:param model_context: used to resolve variables in file paths
169173
:return: the replaced text
170174
"""
171175
method_name = '_substitute'
@@ -185,6 +189,8 @@ def _substitute(text, variables):
185189

186190
# skip lookups for text with no @@
187191
if '@@' in text:
192+
193+
# do properties first, to cover the case @@FILE:/dir/@@PROP:name@@.txt@@
188194
tokens = _property_pattern.findall(text)
189195
if tokens:
190196
for token in tokens:
@@ -204,6 +210,15 @@ def _substitute(text, variables):
204210
value = _read_value_from_file(path)
205211
text = text.replace(token, value)
206212

213+
# special case for @@FILE:@@ORACLE_HOME@@/dir/name.txt@@
214+
tokens = _file_nested_variable_pattern.findall(text)
215+
if tokens:
216+
for token in tokens:
217+
path = token[7:-2]
218+
path = model_context.replace_token_string(path)
219+
value = _read_value_from_file(path)
220+
text = text.replace(token, value)
221+
207222
return text
208223

209224

0 commit comments

Comments
 (0)