Skip to content

Commit 6385f68

Browse files
fix for pattern issue
1 parent 6d79613 commit 6385f68

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

core/src/main/python/wlsdeploy/tool/util/variable_injector.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@
6767
ADMIN_SERVER: 'admin_server_list'
6868
}
6969
# global variables for functions in VariableInjector
70-
_find_special_names_pattern = re.compile('[\[).+\]]')
70+
_find_special_names_pattern = re.compile('[\[\]]')
7171
_fake_name_marker = 'fakename'
7272
_fake_name_replacement = re.compile('.' + _fake_name_marker)
7373
_white_space_replacement = re.compile('\s')
74+
_split_around_special_names = re.compile('([\w]+\[[\w\.,]+\])|\.')
7475

7576
_wlsdeploy_location = os.environ.get('WLSDEPLOY_HOME')
7677
_class_name = 'variable_injector'
@@ -506,12 +507,9 @@ def _find_special_name(self, mbean):
506507
mbean_name = mbean
507508
mbean_name_list = []
508509
name_list = _find_special_names_pattern.split(mbean)
509-
print 'mbean before split ', mbean
510-
print 'after pattern split ', name_list
511510
if name_list and len(name_list) > 1:
512511
mbean_name = name_list[0]
513512
mbean_name_list = name_list[1].split(',')
514-
print 'after second split ', mbean_name_list
515513
if mbean_name_list:
516514
new_list = []
517515
for entry in mbean_name_list:
@@ -528,7 +526,6 @@ def _find_special_name(self, mbean):
528526
else:
529527
new_list.append(entry)
530528
mbean_name_list = new_list
531-
print 'mbean ', mbean_name, ' mbean_name_list ', mbean_name_list
532529
return mbean_name, mbean_name_list
533530

534531
def _check_insert_attribute_model(self, location, model_section, attribute, injector_values):
@@ -562,7 +559,6 @@ def _load_variable_file(variable_file_location, **kwargs):
562559
append = False
563560
variable_dictionary = dict()
564561
if VARIABLE_FILE_APPEND_ARG in kwargs and kwargs[VARIABLE_FILE_APPEND_ARG] in VARIABLE_FILE_APPEND_VALS:
565-
_logger.fine('append argument found {0}', kwargs[VARIABLE_FILE_APPEND_ARG])
566562
if kwargs[VARIABLE_FILE_APPEND_ARG] == VARIABLE_FILE_APPEND:
567563
_logger.fine('WLSDPLY-19536', variable_file_location, class_name=_class_name, method_name=_method_name)
568564
append = True
@@ -733,18 +729,29 @@ def _format_as_property(prop_name):
733729
return '@@PROP:%s@@' % prop_name
734730

735731

736-
737732
def _split_injector(injector_path):
738733
"""
739734
Split the injector path into an mbean list and an attribute name from the injector path string
740735
:param injector_path:
741736
:return: attribute name:mbean list of mbean folder nodes
742737
"""
738+
_method_name = '_split_injector'
743739
attr = None
744-
ml = injector_path.split('.')
740+
ml = _split_around_special_names.split(injector_path)
741+
mbean_list = []
745742
if len(ml) > 0:
746743
attr = ml.pop()
747-
return ml, attr
744+
for mbean_item in ml:
745+
if mbean_item:
746+
start = 0
747+
end = len(mbean_item)
748+
if mbean_item.startswith('\.'):
749+
start += 1
750+
if mbean_item.endswith('\.'):
751+
end -= 1
752+
mbean_list.append(mbean_item[start:end])
753+
_logger.finer('WLSDPLY-19543', mbean_list, attr, class_name=_class_name, method_name=_method_name)
754+
return mbean_list, attr
748755

749756

750757
def __temporary_fix(injector_dictionary):

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,7 @@ WLSDPLY-19540=Attribute {0} not in the model at location {1} but the force attri
11741174
keyword so the attribute will be added to the model with the default value {2}
11751175
WLSDPLY-19541=Replacement variable value {0} cannot be formatted for the attribute {1} at location {2} : {3}
11761176
WLSDPLY-19542=Variable value has been set to {0} and replaces the model value {1} for attribute {2} at location {3}
1177+
WLSDPLY-19543=Split injector value into mbean list {0} and attribute {1}
11771178

11781179
# wlsdeploy/tool/variable_inject.py
11791180
WLSDPLY-19600=Use model variable injector file {0} from command line arguments

0 commit comments

Comments
 (0)