Skip to content

Commit dbf9917

Browse files
committed
JIRA WDT-50 Pass specific location path to getMBI, rather than working directory
1 parent be632a5 commit dbf9917

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

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

Lines changed: 5 additions & 5 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
import javaos as os
@@ -143,7 +143,7 @@ def _get_attributes_for_current_location_online(self, location):
143143
path = self._alias_helper.get_wlst_attributes_path(location)
144144
try:
145145
lsa_attributes = wlst_helper.lsa(path)
146-
mbi_attributes = _get_mbi_attribute_list()
146+
mbi_attributes = _get_mbi_attribute_list(path)
147147
if mbi_attributes:
148148
for lsa_attribute_name in lsa_attributes:
149149
if lsa_attribute_name in lsa_attributes and lsa_attribute_name not in mbi_attributes:
@@ -659,9 +659,9 @@ def convert_to_absolute_path(relative_to, file_name):
659659
return file_name
660660

661661

662-
def _get_mbi_attribute_list():
662+
def _get_mbi_attribute_list(path):
663663
attribute_list = []
664-
for mbean_attribute_info in wlst_helper.get_mbi().getAttributes():
664+
for mbean_attribute_info in wlst_helper.get_mbi(path).getAttributes():
665665
if _is_attribute(mbean_attribute_info):
666666
attribute_list.append(mbean_attribute_info.getName())
667667
return attribute_list
@@ -705,7 +705,7 @@ def _massage_online_folders(lsc_folders):
705705
location = wlst_helper.get_pwd()
706706
folder_list = []
707707
mbi_folder_list = []
708-
for mbean_attribute_info in wlst_helper.get_mbi().getAttributes():
708+
for mbean_attribute_info in wlst_helper.get_mbi(location).getAttributes():
709709
if _is_containment(mbean_attribute_info):
710710
mbi_folder_list.append(mbean_attribute_info.getName())
711711
for lsc_folder in lsc_folders:

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

Lines changed: 15 additions & 4 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
import com.oracle.cie.domain.script.jython.WLSTException as offlineWLSTException
@@ -1103,9 +1103,20 @@ def _get_wlst_mode():
11031103
return result
11041104

11051105

1106-
def get_mbi():
1106+
def get_mbi(path=None):
11071107
"""
1108-
Get the MBeanInfo for the current MBean location.
1108+
Get the MBeanInfo for the current or specifiec MBean location.
1109+
:param path: optionally specify path to check
11091110
:return: javax.management.modelmbean.ModelMBeanInfo instance for the current location
11101111
"""
1111-
return wlst.getMBI()
1112+
current_path = None
1113+
if path is not None:
1114+
current_path = get_pwd()
1115+
cd(path)
1116+
1117+
result = wlst.getMBI()
1118+
1119+
if current_path is not None:
1120+
cd(current_path)
1121+
1122+
return result

0 commit comments

Comments
 (0)