Skip to content

Issue#152 alias definition fixes #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e60e123
changes for not found
CarolynRountree Sep 5, 2018
b865b6b
Merge branch 'master' into Issue#152-alias-definition-fixes
CarolynRountree Sep 5, 2018
9ba0de1
fix for unit test and new data type
CarolynRountree Sep 6, 2018
cca7e6a
Fixes for alias problems found in system test
CarolynRountree Sep 6, 2018
6497833
Merge branch 'master' into Issue#152-alias-definition-fixes
CarolynRountree Sep 6, 2018
f327da8
continued fixes for alias definitions
CarolynRountree Sep 7, 2018
933ab8c
save changes for wrong types and default values
CarolynRountree Sep 7, 2018
d1b487a
continued changes to alias definitions
CarolynRountree Sep 10, 2018
4bd82f9
Merge branch 'master' into Issue#152-alias-definition-fixes
CarolynRountree Sep 11, 2018
843257a
continued work to correct the alias definitions
CarolynRountree Sep 12, 2018
6ecdbdb
Continuing fixes to alias definitions
CarolynRountree Sep 13, 2018
541678a
Added LogFilter alias definition and continue fix on alias definitions
CarolynRountree Sep 18, 2018
6242872
continue alias changes
CarolynRountree Sep 20, 2018
fea2479
continuing work on alias definition changes
CarolynRountree Sep 21, 2018
243e4e6
ongoing fixes for alias definitions
CarolynRountree Sep 25, 2018
8b8a703
Merge branch 'master' into Issue#152-alias-definition-fixes
CarolynRountree Sep 25, 2018
4f4aecc
continued changes for alias definitions
CarolynRountree Sep 27, 2018
5f0523d
continue fixes for alias definitions
CarolynRountree Sep 27, 2018
7cac064
Ongoing changes to alias definitions
CarolynRountree Sep 29, 2018
efca3e8
All but weird problems through 12.2.1
CarolynRountree Oct 13, 2018
0a0788f
Completed 12.2.1.1 changes
CarolynRountree Oct 19, 2018
90bc0c7
Fixes for 12.2.1.2 alias definitions
CarolynRountree Oct 19, 2018
bcd85b7
Fixes for 12.2.1.3
CarolynRountree Oct 19, 2018
dde9397
Discover in online needs to do more interrogation of attributes
CarolynRountree Oct 22, 2018
dd9597a
WLST lsa does not return correct mbean map for mbeans that have only …
CarolynRountree Oct 22, 2018
995592e
Discover in online needs to do more interrogation of attributes
CarolynRountree Oct 23, 2018
09f3e8b
Alias definition refix after one attribute in list fix
CarolynRountree Oct 23, 2018
4f49bfc
Merge branch 'master' into Issue#152-alias-definition-fixes
CarolynRountree Oct 23, 2018
aab30d0
Fix alias definitions that were not verified by tests
CarolynRountree Oct 23, 2018
e04878e
Fix folder and reference related online discovery issues
CarolynRountree Oct 23, 2018
382139f
Checked in discover code with validation commented out
CarolynRountree Oct 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions core/src/main/python/wlsdeploy/aliases/alias_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class AliasEntries(object):
'JTA': 'JTA',
'Library': 'Library',
'Log': 'Log',
'LogFilter': 'LogFilter',
'Machine': 'Machine',
'MailSession': 'MailSession',
'MessagingBridge': 'MessagingBridge',
Expand All @@ -110,14 +111,18 @@ class AliasEntries(object):
'UnixMachine': 'UnixMachine',
'VirtualHost': 'VirtualHost',
'VirtualTarget': 'VirtualTarget',
'WLDFSystemResource': 'WLDFSystemResource'
'WLDFSystemResource': 'WLDFSystemResource',
'WSReliableDeliveryPolicy': 'WSReliableDeliveryPolicy',
'XMLEntityCache': 'XMLEntityCache',
'XMLRegistry': 'XMLRegistry'
}

__topology_top_level_folders = [
'Cluster',
'JMX',
'JTA',
'Log',
'LogFilter',
'Machine',
'MigratableTarget',
'NMProperties',
Expand All @@ -128,7 +133,10 @@ class AliasEntries(object):
'ServerTemplate',
'UnixMachine',
'VirtualHost',
'VirtualTarget'
'VirtualTarget',
'WSReliableDeliveryPolicy',
'XMLEntityCache',
'XMLRegistry'
]

__resources_top_level_folders = [
Expand Down
12 changes: 8 additions & 4 deletions core/src/main/python/wlsdeploy/aliases/aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,15 @@ def get_wlst_attribute_name_and_value(self, location, model_attribute_name, mode

return wlst_attribute_name, wlst_attribute_value

def get_wlst_attribute_name(self, location, model_attribute_name):
def get_wlst_attribute_name(self, location, model_attribute_name, check_read_only=True):
"""
Returns the WLST attribute name and value for the specified model attribute name and value.

wlst_attribute_value should return the correct type and value, even if the value
is the default value for model_attribute_name.
:param location:
:param model_attribute_name:
:param check_read_only: Defaults to True. If false, return name even if alias definition is read only
:return: the WLST attribute name or None, if it is not relevant
:raises: AliasException: if an error occurs due to a bad location or bad alias data
"""
Expand All @@ -440,7 +441,8 @@ def get_wlst_attribute_name(self, location, model_attribute_name):
class_name=self._class_name, method_name=_method_name)
wlst_attribute_name = None
alias_attr_dict = self._alias_entries.get_alias_attribute_entry_by_model_name(location, model_attribute_name)
if alias_attr_dict is not None and not self.__is_model_attribute_read_only(location, alias_attr_dict):
if alias_attr_dict is not None and (not check_read_only or not
self.__is_model_attribute_read_only(location, alias_attr_dict)):
if WLST_NAME in alias_attr_dict:
wlst_attribute_name = alias_attr_dict[WLST_NAME]
else:
Expand Down Expand Up @@ -908,13 +910,14 @@ def get_model_attribute_name_and_value(self, location, wlst_attribute_name, wlst
result={model_attribute_name: model_attribute_value})
return model_attribute_name, model_attribute_value

def get_model_attribute_name(self, location, wlst_attribute_name):
def get_model_attribute_name(self, location, wlst_attribute_name, check_read_only=True):
"""
Returns the model attribute name for the specified WLST attribute name and value. If the model attribute name
is not valid for the version or the attribute is marked as read-only, return None

:param location: the location
:param wlst_attribute_name: the WLST attribute name
:param check_read_only: Defaults to True. If False, return the WLST attribute name even if read only
:return: matching model attribute name
:raises: AliasException: if an error occurs
"""
Expand All @@ -925,7 +928,8 @@ def get_model_attribute_name(self, location, wlst_attribute_name):
model_attribute_name = None

attribute_info = self._alias_entries.get_alias_attribute_entry_by_wlst_name(location, wlst_attribute_name)
if attribute_info is not None and not self.__is_model_attribute_read_only(location, attribute_info):
if attribute_info is not None and \
(not check_read_only or not self.__is_model_attribute_read_only(location, attribute_info)):
model_attribute_name = attribute_info[MODEL_NAME]

self._logger.exiting(class_name=self._class_name, method_name=_method_name,
Expand Down
4 changes: 4 additions & 0 deletions core/src/main/python/wlsdeploy/aliases/model_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
LIBRARY = 'Library'
LOAD_BALANCING_PARAMS = 'LoadBalancingParams'
LOG = 'Log'
LOG_FILTER = 'LogFilter'
LOG_ACTION = 'LogAction'
MACHINE = 'Machine'
MAIL_SESSION = 'MailSession'
Expand Down Expand Up @@ -251,8 +252,11 @@
WLDF_INSTRUMENTATION_MONITOR = "WLDFInstrumentationMonitor"
WLDF_RESOURCE = "WLDFResource"
WLDF_SYSTEM_RESOURCE = "WLDFSystemResource"
WS_RELIABLE_DELIVERY_POLICY = 'WSReliableDeliveryPolicy'
XACML_AUTHORIZER = 'XACMLAuthorizer'
XACML_ROLE_MAPPER = 'XACMLRoleMapper'
XML_ENTITY_CACHE = 'XMLEntityCache'
XML_REGISTRY = 'XMLRegistry'

# names of attributes, alphabetically

Expand Down
85 changes: 85 additions & 0 deletions core/src/main/python/wlsdeploy/tool/create/domain_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from wlsdeploy.aliases.model_constants import JDBC_DRIVER_PARAMS_PROPERTIES
from wlsdeploy.aliases.model_constants import JDBC_RESOURCE
from wlsdeploy.aliases.model_constants import JDBC_SYSTEM_RESOURCE
from wlsdeploy.aliases.model_constants import LOG_FILTER
from wlsdeploy.aliases.model_constants import MACHINE
from wlsdeploy.aliases.model_constants import MIGRATABLE_TARGET
from wlsdeploy.aliases.model_constants import NAME
Expand All @@ -42,6 +43,9 @@
from wlsdeploy.aliases.model_constants import URL
from wlsdeploy.aliases.model_constants import USER
from wlsdeploy.aliases.model_constants import VIRTUAL_TARGET
from wlsdeploy.aliases.model_constants import WS_RELIABLE_DELIVERY_POLICY
from wlsdeploy.aliases.model_constants import XML_ENTITY_CACHE
from wlsdeploy.aliases.model_constants import XML_REGISTRY
from wlsdeploy.exception import exception_helper
from wlsdeploy.exception.expection_types import ExceptionType
from wlsdeploy.tool.create.creator import Creator
Expand Down Expand Up @@ -382,6 +386,8 @@ def __apply_base_domain_config(self, topology_folder_list):
self.security_provider_creator.create_security_configuration(security_config_location)
topology_folder_list.remove(SECURITY_CONFIGURATION)

self.__create_mbeans_used_by_topology_mbeans(location, topology_folder_list)

self.__create_machines(location)
topology_folder_list.remove(MACHINE)
topology_folder_list.remove(UNIX_MACHINE)
Expand Down Expand Up @@ -423,6 +429,21 @@ def __set_core_domain_params(self):
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
return

def __create_mbeans_used_by_topology_mbeans(self, location, topology_folder_list):
"""
Create the entities that are referenced by domain, machine, server and server template attributes.
:param location: current location
:raises: CreateException: if an error occurs
"""
self.__create_log_filters(location)
topology_folder_list.remove(LOG_FILTER)
self.__create_reliable_delivery_policy(location)
topology_folder_list.remove(WS_RELIABLE_DELIVERY_POLICY)
self.__create_xml_entity_cache(location)
topology_folder_list.remove(XML_ENTITY_CACHE)
self.__create_xml_registry(location)
topology_folder_list.remove(XML_REGISTRY)

def __create_security_folder(self, location):
"""
Create the /Security folder objects, if any.
Expand All @@ -438,6 +459,70 @@ def __create_security_folder(self, location):
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
return

def __create_log_filters(self, location):
"""
Create the /LogFilter objects if any for use in the logs of the base components like domain and server
:param location: the location to use
:raises: CreateException: if an error occurs
"""
_method_name = '__create_log_filters'

self.logger.entering(str(location), class_name=self.__class_name, method_name=_method_name)
log_filter_nodes = dictionary_utils.get_dictionary_element(self._topology, LOG_FILTER)

if len(log_filter_nodes) > 0:
self._create_named_mbeans(LOG_FILTER, log_filter_nodes, location, log_created=True)
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
return

def __create_reliable_delivery_policy(self, location):
"""
Create the /WSReliableDeliverPolicy objects if any for use by the server and server templates.
:param location: the location to use
:raises: CreateException: if an error occurs
"""
_method_name = '__create_reliable_delivery_policy'

self.logger.entering(str(location), class_name=self.__class_name, method_name=_method_name)
policy_nodes = dictionary_utils.get_dictionary_element(self._topology, WS_RELIABLE_DELIVERY_POLICY)

if len(policy_nodes) > 0:
self._create_named_mbeans(WS_RELIABLE_DELIVERY_POLICY, policy_nodes, location, log_created=True)
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
return

def __create_xml_entity_cache(self, location):
"""
Create the /XMLEntityCache objects if any for use by the server and server templates.
:param location: the location to use
:raises: CreateException: if an error occurs
"""
_method_name = '__create_xml_entity_cache'

self.logger.entering(str(location), class_name=self.__class_name, method_name=_method_name)
cache_nodes = dictionary_utils.get_dictionary_element(self._topology, XML_ENTITY_CACHE)

if len(cache_nodes) > 0:
self._create_named_mbeans(XML_ENTITY_CACHE, cache_nodes, location, log_created=True)
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
return

def __create_xml_registry(self, location):
"""
Create the /XMLRegistry objects if any for use by the server and server templates.
:param location: the location to use
:raises: CreateException: if an error occurs
"""
_method_name = '__create_xml_registry'

self.logger.entering(str(location), class_name=self.__class_name, method_name=_method_name)
registry_nodes = dictionary_utils.get_dictionary_element(self._topology, XML_REGISTRY)

if len(registry_nodes) > 0:
self._create_named_mbeans(XML_REGISTRY, registry_nodes, location, log_created=True)
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
return

def __create_machines(self, location):
"""
Create the /Machine and /UnixMachine folder objects, if any.
Expand Down
111 changes: 97 additions & 14 deletions core/src/main/python/wlsdeploy/tool/discover/discoverer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _populate_model_parameters(self, dictionary, location):
wlst_param,
wlst_value)
except AliasException, de:
_logger.warning('WLSDPLY-06106', wlst_param, wlst_path, de.getLocalizedMessage(),
_logger.info('WLSDPLY-06106', wlst_param, wlst_path, de.getLocalizedMessage(),
class_name=_class_name, method_name=_method_name)
continue

Expand Down Expand Up @@ -139,24 +139,28 @@ def _get_attributes_for_current_location_offline(self, location):

def _get_attributes_for_current_location_online(self, location):
_method_name = '_get_attributes_for_current_location_online'
attributes = dict()
lsa_attributes = dict()
path = self._alias_helper.get_wlst_attributes_path(location)
added = False
try:
attributes = wlst_helper.lsa(path)
mbean_attributes = wlst_helper.get_mbi().getAttributes()
if mbean_attributes:
alias_attributes = self._get_wlst_attributes(location)
for mbean_attribute in mbean_attributes:
name = mbean_attribute.getName()
if name not in attributes and name in alias_attributes:
attributes[name] = wlst_helper.get(name)
added = True
lsa_attributes = wlst_helper.lsa(path)
mbi_attributes = _get_mbi_attribute_list()
if mbi_attributes:
for lsa_attribute_name in lsa_attributes:
if lsa_attribute_name in lsa_attributes and lsa_attribute_name not in mbi_attributes:
_logger.finer('WLSDPLY-06142', lsa_attribute_name)
del lsa_attributes[lsa_attribute_name]
for mbi_attribute_name in mbi_attributes:
if mbi_attribute_name not in lsa_attributes and mbi_attribute_name in mbi_attributes:
# don't count on the item in the get required list in caller, just get the value
# and add it to our lsa list
_logger.finer('WLSDPLY-06141', mbi_attribute_name, class_name=_class_name,
method_name=_method_name)
lsa_attributes[mbi_attribute_name] = wlst_helper.get(mbi_attribute_name)
except PyWLSTException, pe:
name = location.get_model_folders()[-1]
_logger.fine('WLSDPLY-06109', name, str(location), pe.getLocalizedMessage(), class_name=_class_name,
method_name=_method_name)
return attributes
return lsa_attributes

def _is_defined_attribute(self, location, wlst_name):
attribute = False
Expand Down Expand Up @@ -260,6 +264,11 @@ def _find_singleton_name_in_folder(self, location):
return name

def _find_subfolders(self, location):
if self._wlst_mode == WlstModes.OFFLINE:
return self._find_subfolders_offline(location)
else:
return self._find_subfolders_online(location)
def _find_subfolders_offline(self, location):
"""
Find the subfolders of the current location.
:param location: context containing current location information
Expand All @@ -278,6 +287,20 @@ def _find_subfolders(self, location):
wlst_subfolders = new_subfolders
return wlst_subfolders

def _find_subfolders_online(self, location):
wlst_path = self._alias_helper.get_wlst_subfolders_path(location)
wlst_subfolders = []
if self.wlst_cd(wlst_path, location):
wlst_subfolders = _massage_online_folders(self._wlst_helper.lsc())
if wlst_subfolders:
new_subfolders = []
for wlst_subfolder in wlst_subfolders:
model_subfolder_name = self._get_model_name(location, wlst_subfolder)
if model_subfolder_name:
new_subfolders.append(wlst_subfolder)
wlst_subfolders = new_subfolders
return wlst_subfolders

def _discover_subfolder_singleton(self, model_subfolder_name, location):
"""
Discover the subfolder from the wlst subfolder name. populate the attributes in the folder.
Expand Down Expand Up @@ -586,7 +609,7 @@ def _get_wlst_attributes(self, location):
wlst_attribute = self._aliases.get_wlst_attribute_name(location, model_attribute)
if wlst_attribute:
wlst_attributes.append(wlst_attribute)
except AliasException, ae:
except AliasException:
continue
return wlst_attributes

Expand Down Expand Up @@ -636,6 +659,66 @@ def convert_to_absolute_path(relative_to, file_name):
return file_name


def _get_mbi_attribute_list():
attribute_list = []
for mbean_attribute_info in wlst_helper.get_mbi().getAttributes():
if _is_attribute(mbean_attribute_info):
attribute_list.append(mbean_attribute_info.getName())
return attribute_list


def _is_attribute(attributes_info):
return _is_attribute_type(attributes_info) or _is_valid_reference(attributes_info)


def _is_valid_reference(attribute_info):
# check again after all done to see whether need to use get deprecated
return _is_reference(attribute_info) and (
attribute_info.isWritable() or not _is_deprecated(attribute_info))


def _is_reference(mbean_attribute_info):
return mbean_attribute_info.getDescriptor().getFieldValue('com.bea.relationship') == 'reference'


def _is_deprecated(mbean_attribute_info):
deprecated_version = mbean_attribute_info.getDescriptor().getFieldValue('deprecated')
return deprecated_version is not None and deprecated_version != 'null' and len(deprecated_version) > 1


def _is_containment(mbean_attribute_info):
return mbean_attribute_info.getDescriptor().getFieldValue('com.bea.relationship') == 'containment'


def _is_attribute_type(attribute_info):
_method_name = '_is_attribute_type'
if not attribute_info.isWritable() and _is_deprecated(attribute_info):
_logger.finer('WLSDPLY-06143', attribute_info.getName(), wlst_helper.get_pwd(),
class_name=_class_name, method_name=_method_name)
return attribute_info.getDescriptor().getFieldValue(
'descriptorType') == 'Attribute' and attribute_info.getDescriptor().getFieldValue(
'com.bea.relationship') is None and (attribute_info.isWritable() or not _is_deprecated(attribute_info))


def _massage_online_folders(lsc_folders):
_method_name = '_massage_online_folders'
location = wlst_helper.get_pwd()
folder_list = []
mbi_folder_list = []
for mbean_attribute_info in wlst_helper.get_mbi().getAttributes():
if _is_containment(mbean_attribute_info):
mbi_folder_list.append(mbean_attribute_info.getName())
for lsc_folder in lsc_folders:
if lsc_folder in mbi_folder_list:
folder_list.append(lsc_folder)
else:
_logger.finer('WLSDPLY-06144', lsc_folder, location, class_name=_class_name, method_name=_method_name)
if len(folder_list) != len(mbi_folder_list):
_logger.fine('WLSDPLY-06145', folder_list, location, mbi_folder_list, class_name=_class_name,
method_name=_method_name)
return folder_list


def get_discover_logger_name():
"""
Return the common logger used for all discover logging.
Expand Down
Loading