def _discover_subfolder_with_single_name(self, model_subfolder_name, location, name_token): """ Discover a subfolder that is a singleton but has an unpredictable naming strategy. Find the name for the singleton folder and then discover the folder contents. :param location: context containing current location information :param name_token: represents the single folder name token in the aliases :return: dictionary containing discovered folder attributes """ _method_name = '_discover_subfolder_with_single_name' _logger.entering(name_token, class_name=_class_name, method_name=_method_name) name = self._find_singleton_name_in_folder(location) result = OrderedDict() if name: location.add_name_token(name_token, name) result = self._discover_subfolder_singleton(model_subfolder_name, location) location.remove_name_token(name_token) _logger.exiting(class_name=_class_name, method_name=_method_name) return result
def _process_patterns_dictionary(self, attribute, attribute_dict, location, injector_values): variable_dict = OrderedDict() regexp_list = injector_values[REGEXP] for dictionary in regexp_list: pattern = None suffix = None if REGEXP_PATTERN in dictionary: pattern = dictionary[REGEXP_PATTERN] if REGEXP_SUFFIX in dictionary: suffix = dictionary[REGEXP_SUFFIX] variable_name, variable_value = self._process_pattern_dictionary( attribute, attribute_dict, location, pattern, suffix) if variable_value: variable_dict[ variable_name] = self._check_replace_variable_value( location, attribute, variable_value, injector_values) return variable_dict
def _discover_single_folder(self, location): """ Discover the attributes in the single folder at current location and allow the caller to continue the discover for any of its child folders. This is for required for certain folders that need to be handled differently. :param location: containing the current location information :return: folder result dictionary: """ _method_name = '_discover_single_folder' _logger.entering(str(location), class_name=_class_name, method_name=_method_name) result = OrderedDict() subfolder_path = self._aliases.get_wlst_attributes_path(location) if self.wlst_cd(subfolder_path, location): self._populate_model_parameters(result, location) _logger.exiting(class_name=_class_name, method_name=_method_name) return result
def _discover_subfolder(self, model_subfolder_name, location, result=None, check_order=False): """ Discover the subfolder indicated by the model subfolder name. Append the model subfolder to the current location context, and pop that location before return :param model_subfolder_name: Name of the model subfolder :param location: context containing the current subfolder information :param check_order: does the folder need to be checked for order :return: discovered dictionary """ _method_name = '_discover_subfolder' _logger.entering(model_subfolder_name, location.get_folder_path(), class_name=_class_name, method_name=_method_name) location.append_location(model_subfolder_name) deployer_utils.set_flattened_folder_token(location, self._aliases) _logger.finer('WLSDPLY-06115', model_subfolder_name, self._aliases.get_model_folder_path(location), class_name=_class_name, method_name=_method_name) # handle null model_subfolder name which should never happen in discover. throw exception about version if result is None: result = OrderedDict() name_token = self._aliases.get_name_token(location) _logger.finest('WLSDPLY-06116', model_subfolder_name, self._aliases.get_model_folder_path(location), name_token, class_name=_class_name, method_name=_method_name) if name_token is not None: if self._aliases.requires_unpredictable_single_name_handling(location): subfolder_result = self._discover_subfolder_with_single_name(model_subfolder_name, location, name_token) elif self._aliases.requires_artificial_type_subfolder_handling(location): subfolder_result = self._discover_artificial_folder( model_subfolder_name, location, name_token, check_order) else: subfolder_result = self._discover_subfolder_with_names(model_subfolder_name, location, name_token) else: subfolder_result = self._discover_subfolder_singleton(model_subfolder_name, location) # this is a really special case. Empty means not-default it is empty if self._aliases.requires_artificial_type_subfolder_handling(location): if subfolder_result is not None: add_to_model(result, model_subfolder_name, subfolder_result) else: add_to_model_if_not_empty(result, model_subfolder_name, subfolder_result) location.pop_location() _logger.exiting(class_name=_class_name, method_name=_method_name, result=result) return result
def get_resource_groups(self, base_location): """ Discover the resource groups located at the indicated base_location - global or partition. :param base_location: context containing the current location information :return: model name for dictionary:dictionary containing the discovered resource groups """ _method_name = 'get_resource_groups' _logger.entering(str(base_location), class_name=_class_name, method_name=_method_name) result = OrderedDict() model_top_folder_name = model_constants.RESOURCE_GROUP location = LocationContext(base_location) location.append_location(model_top_folder_name) resource_groups = self._find_names_in_folder(location) if resource_groups is not None: _logger.info('WLSDPLY-06703', len(resource_groups), class_name=_class_name, method_name=_method_name) name_token = self._aliases.get_name_token(location) for resource_group in resource_groups: _logger.info('WLSDPLY-06704', resource_group, self._aliases.get_model_folder_path(location), class_name=_class_name, method_name=_method_name) location.add_name_token(name_token, resource_group) result[resource_group] = self._discover_single_folder(location) CommonResourcesDiscoverer(self._model_context, result[resource_group], location, wlst_mode=self._wlst_mode, aliases=self._aliases).discover() DeploymentsDiscoverer(self._model_context, result[resource_group], location, wlst_mode=self._wlst_mode, aliases=self._aliases).discover() location.remove_name_token(name_token) _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name) return model_top_folder_name, result
def discover_domain_mbean(self, model_top_folder_name): """ Discover the domain specific MBean and its configuration attributes. :return: model name for domain MBean:dictionary containing the discovered Domain MBean attributes """ _method_name = 'discover_domain_mbean' _logger.entering(model_top_folder_name, class_name=_class_name, method_name=_method_name) result = OrderedDict() location = LocationContext(self._base_location) location.append_location(model_top_folder_name) name = self._find_singleton_name_in_folder(location) if name is not None: _logger.info('WLSDPLY-06644', model_top_folder_name, class_name=_class_name, method_name=_method_name) location.add_name_token(self._aliases.get_name_token(location), name) self._populate_model_parameters(result, location) # if any subfolders exist, discover self._discover_subfolders(result, location) _logger.exiting(class_name=_class_name, method_name=_method_name) return model_top_folder_name, result
def inject_variables(self, injector_dictionary): """ Iterate through the injector dictionary that was loaded from the file for the model injector file keyword. :param injector_dictionary: :return: variable dictionary containing the variable string and model value entries """ variable_dict = OrderedDict() if injector_dictionary: location = LocationContext() domain_token = self.__aliases.get_name_token(location) location.add_name_token(domain_token, _fake_name_marker) for injector, injector_values in injector_dictionary.iteritems(): entries_dict = self.__inject_variable(location, injector, injector_values) if len(entries_dict) > 0: variable_dict.update(entries_dict) return variable_dict
def _inject_token(self, model_section, attribute, location, injector_commands=OrderedDict()): """ Retrieve a variable name and value from the variable injector using any special language. Add the variable name and value to the variable dictionary cache. Create a property token from the variable name and inject it into the model attribute value. :param model_section: model section currently working on :param attribute: name of the attribute in the model section to tokenize :param location: current location context for the model_section """ _method_name = '_inject_token' _logger.entering(attribute, location.get_folder_path(), injector_commands, class_name=_class_name, method_name=_method_name) # if not working with injector, do nothing. If attribute is not in model_section, not working with # correct information. if self._variable_injector is not None: self._variable_injector.custom_injection(model_section, attribute, location, injector_commands) _logger.fine('WLSDPLY-06155', attribute, location.get_folder_path(), model_section[attribute], class_name=_class_name, method_name=_method_name) _logger.exiting(class_name=_class_name, method_name=_method_name)
def testKeys(self): my_ordered_dict = OrderedDict() my_ordered_dict['nba_player'] = 'Steph Curry' my_ordered_dict['nba_mvp_count'] = 1 my_ordered_dict['is_retired'] = False my_ordered_dict['nba_finals_years'] = ['2015', '2016', '2017'] expected = [ 'nba_player', 'nba_mvp_count', 'is_retired', 'nba_finals_years' ] keys = my_ordered_dict.keys() self.assertEqual( len(expected), len(keys), 'expected the ordered dict keys to be the same length as the expected keys' ) for i, key in enumerate(keys): self.assertEqual( key, expected[i], 'expected key at position %s to be %s' % (str(i), expected[i]))
def _get_domain_log(self): """ Discover the domain log attributes. :return: model name for the Log:dictionary containing the discovered Log attributes """ _method_name = '_get_domain_log' _logger.entering(class_name=_class_name, method_name=_method_name) model_top_folder_name = model_constants.LOG result = OrderedDict() location = LocationContext(self._base_location) location.append_location(model_top_folder_name) name = self._find_singleton_name_in_folder(location) if name is not None: _logger.info('WLSDPLY-06626', class_name=_class_name, method_name=_method_name) location.add_name_token(self._alias_helper.get_name_token(location), name) self._populate_model_parameters(result, location) self._discover_subfolders(result, location) return model_top_folder_name, result
def get_partitions(self): """ Discover the partitions for the domain, including partition resources and resource groups. :return: model name for the dictionary:dictionary containing the discovered partitions """ _method_name = 'get_partitions' _logger.entering(class_name=_class_name, method_name=_method_name) result = OrderedDict() model_top_folder_name = model_constants.PARTITION location = LocationContext(self._base_location) location.append_location(model_top_folder_name) partitions = self._find_names_in_folder(location) if partitions is not None: _logger.info('WLSDPLY-06705', len(partitions), class_name=_class_name, method_name=_method_name) name_token = self._alias_helper.get_name_token(location) for partition in partitions: _logger.info('WLSDPLY-06706', partition, class_name=_class_name, method_name=_method_name) location.add_name_token(name_token, partition) result[partition] = self._discover_single_folder(location) model_rg_name, rg_result = self.get_resource_groups(location) discoverer.add_to_model_if_not_empty(result[partition], model_rg_name, rg_result) wlst_subfolders = self._find_subfolders(location) if wlst_subfolders is not None: for wlst_subfolder in wlst_subfolders: model_subfolder_name = self._get_model_name( location, wlst_subfolder) if model_subfolder_name and not model_subfolder_name == model_constants.RESOURCE_GROUP: self._discover_subfolder(model_subfolder_name, location, result[partition]) location.remove_name_token(name_token) _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name) return model_top_folder_name, result
def discover_security_configuration(self): """ Discover the security configuration for the domain. :return: name for the model:dictionary containing the discovered security configuration """ _method_name = 'discover_security_configuration' _logger.entering(class_name=_class_name, method_name=_method_name) result = OrderedDict() model_top_folder_name = model_constants.SECURITY_CONFIGURATION location = LocationContext(self._base_location) location.append_location(model_top_folder_name) security_configuration = self._find_singleton_name_in_folder(location) if security_configuration is not None: _logger.info('WLSDPLY-06622', class_name=_class_name, method_name=_method_name) self._populate_model_parameters(result, location) self._discover_subfolders(result, location) _logger.exiting(class_name=_class_name, method_name=_method_name) return model_top_folder_name, result
def __init__(self, model_context, base_location, wlst_mode, aliases=None): """ :param model_context: context about the model for this instance of discover domain :param base_location: to look for common weblogic resources. By default this is the global path or '/' """ self._model_context = model_context self._base_location = base_location self._wlst_mode = wlst_mode if aliases: self._aliases = aliases else: self._aliases = Aliases(self._model_context, wlst_mode=self._wlst_mode) self._alias_helper = AliasHelper(self._aliases, _logger, ExceptionType.DISCOVER) self._att_handler_map = OrderedDict() self._wls_version = WebLogicHelper( _logger).get_actual_weblogic_version() self._wlst_helper = WlstHelper(_logger, ExceptionType.DISCOVER)
def __process_x_other_arg(self, argument): """ Process -X arguments where the argument a switch or a value with an equals delimiter and add it to the internal map. :param argument: the argument string """ _method_name = '__process_x_value_arg' match = self.__x_args_other_regex.match(argument) xarg = match.group(1) # # match.group(3) will always be None unless the argument is of the form -Xmaxjitcodesize=240m # xvalue = match.group(3) if 'other' not in self.__x_args: self.__x_args['other'] = OrderedDict() self._logger.finer('WLSDPLY-08303', argument, xarg, xvalue, class_name=self._class_name, method_name=_method_name) self.__x_args['other'][xarg] = xvalue return
def custom_injection(self, model, attribute, location, injector_values=OrderedDict()): """ Used by external processes to add to the variable cache prior to persisting to the variables file. A token or tokens are created for the attribute based on the language provided in the injector values. The resulting variable name and value value is placed into the cache, and the model has the token injected into the attribute value. :param model: to tokenize attribute values with a token and extracting the attribute value :param attribute: name of the attribute to tokenize in the model :param location: current location context for the attribute :param injector_values: list of language to apply to the attribute :return: dictionary containing variable name(s) and value(s) """ if attribute in model: variable_dictionary = self._add_variable_info( model, attribute, location, injector_values) self.add_to_cache(dictionary=variable_dictionary)
def __process_x_size_arg(self, argument): """ Process -X arguments where the argument specifies a size that has no delimiter and add it to the internal map. :param argument: the argument string """ _method_name = '__process_x_size_arg' match = self.__x_args_size_regex.match(argument) xarg = match.group(1) xvalue = match.group(3) if 'size' not in self.__x_args: self.__x_args['size'] = OrderedDict() self._logger.finer('WLSDPLY-08301', argument, xarg, xvalue, class_name=self._class_name, method_name=_method_name) self.__x_args['size'][xarg] = xvalue return
def _build_folder_map(self, folder_location, folder_token, name_attribute): """ Build a map of existing sub-element names to folders. :param folder_location: the WLST location for the folder with named sub-elements :param folder_token: the folder token used to set the mbean name :param name_attribute: the attribute for the name in each sub-element :return: a map of existing sub-element names to folder names """ original_path = self.wlst_helper.get_pwd() folder_names = deployer_utils.get_existing_object_list(folder_location, self.alias_helper) folder_map = OrderedDict() for folder_name in folder_names: folder_location.add_name_token(folder_token, folder_name) self.wlst_helper.cd(self.alias_helper.get_wlst_attributes_path(folder_location)) name = self.wlst_helper.get(name_attribute) folder_map[name] = folder_name self.wlst_helper.cd(original_path) return folder_map
def _get_admin_console(self): """ Discover the domain level admin console configuration attributes. :return: model name for JTA:dictionary containing the discovered JTA attributes """ _method_name = '_get_admin_console' _logger.entering(class_name=_class_name, method_name=_method_name) model_top_folder_name = model_constants.ADMIN_CONSOLE result = OrderedDict() location = LocationContext(self._base_location) location.append_location(model_top_folder_name) name = self._find_singleton_name_in_folder(location) if name is not None: _logger.info('WLSDPLY-06613', class_name=_class_name, method_name=_method_name) location.add_name_token( self._alias_helper.get_name_token(location), name) self._populate_model_parameters(result, location) _logger.exiting(class_name=_class_name, method_name=_method_name) return model_top_folder_name, result
def _discover_subfolder_singleton(self, model_subfolder_name, location): """ Discover the subfolder from the wlst subfolder name. populate the attributes in the folder. Return the subfolder model name and the dictionary populated from the subfolder. The location is appended and then removed from the provided location context prior to return. :param model_subfolder_name: subfolder name in wlst format :param location: containing the current location information :return: model subfolder name: subfolder result dictionary: """ _method_name = '_discover_subfolder_singleton' _logger.entering(model_subfolder_name, str(location), class_name=_class_name, method_name=_method_name) subfolder_result = OrderedDict() # For all server subfolder names there should only be one path if self._mbean_names_exist(location): subfolder_path = self._alias_helper.get_wlst_attributes_path(location) if self.wlst_cd(subfolder_path, location): self._populate_model_parameters(subfolder_result, location) self._discover_subfolders(subfolder_result, location) _logger.finest('WLSDPLY-06111', str(location), class_name=_class_name, method_name=_method_name) _logger.exiting(class_name=_class_name, method_name=_method_name) return subfolder_result
def get_coherence_resource(self, location): """ Discover the coherence resources for the domain. Collect custom configuration files and persistence directories into the archive file. :param location: context containing the current location information :return: model name for coherence resource: dictionary containing coherence resources. """ _method_name = '_get_coherence_resource' _logger.entering(str(location), class_name=_class_name, method_name=_method_name) result = OrderedDict() model_top_folder_name = model_constants.COHERENCE_RESOURCE location.append_location(model_top_folder_name) self._populate_model_parameters(result, location) self._discover_subfolders(result, location) location.pop_location() _logger.exiting(class_name=_class_name, method_name=_method_name, result=result) return model_top_folder_name, result
def __process_xx_value_arg(self, argument): """ Process -XX arguments where there a value delimited by an equal sign and add it to the internal map. :param argument: the argument string """ _method_name = '__process_xx_value_arg' match = self.__xx_args_value_regex.match(argument) xarg = match.group(1) xvalue = match.group(2) if 'value' not in self.__xx_args: self.__xx_args['value'] = OrderedDict() self._logger.finer('WLSDPLY-08305', argument, xarg, xvalue, class_name=self._class_name, method_name=_method_name) self.__xx_args['value'][xarg] = xvalue return
def _get_restful_management_services(self): """ Discover the wlst restful management services enablement for the domain. :return: model name for the mbean:dictionary containing the discovered restful management services mbean """ _method_name = '_get_restful_management_services' _logger.entering(class_name=_class_name, method_name=_method_name) model_top_folder_name = model_constants.RESTFUL_MANAGEMENT_SERVICES result = OrderedDict() location = LocationContext(self._base_location) location.append_location(model_top_folder_name) name = self._find_singleton_name_in_folder(location) if name is not None: _logger.info('WLSDPLY-06616', class_name=_class_name, method_name=_method_name) location.add_name_token( self._alias_helper.get_name_token(location), name) self._populate_model_parameters(result, location) _logger.exiting(class_name=_class_name, method_name=_method_name) return model_top_folder_name, result
def _get_jmx(self): """ Discover the JMX agents configured in the domain. :return: model name for JMX:dictionary containing the discovered JMX attributes """ _method_name = '_get_jmx' _logger.entering(class_name=_class_name, method_name=_method_name) model_top_folder_name = model_constants.JMX result = OrderedDict() location = LocationContext(self._base_location) location.append_location(model_top_folder_name) name = self._find_singleton_name_in_folder(location) if name is not None: _logger.info('WLSDPLY-06615', class_name=_class_name, method_name=_method_name) location.add_name_token( self._alias_helper.get_name_token(location), name) self._populate_model_parameters(result, location) _logger.exiting(class_name=_class_name, method_name=_method_name) return model_top_folder_name, result
def __init__(self, model_context, base_location, wlst_mode, aliases=None, variable_injector=None): """ :param model_context: context about the model for this instance of discover domain :param base_location: to look for common weblogic resources. By default this is the global path or '/' """ self._model_context = model_context self._base_location = base_location self._wlst_mode = wlst_mode if aliases: self._aliases = aliases else: self._aliases = Aliases(self._model_context, wlst_mode=self._wlst_mode, exception_type=ExceptionType.DISCOVER) self._variable_injector = variable_injector self._att_handler_map = OrderedDict() self._custom_folder = CustomFolderHelper(self._aliases, _logger, self._model_context, ExceptionType.DISCOVER, self._variable_injector) self._weblogic_helper = WebLogicHelper(_logger) self._wlst_helper = WlstHelper(ExceptionType.DISCOVER) self._mbean_utils = MBeanUtils(self._model_context, self._aliases, ExceptionType.DISCOVER) self._wls_version = self._weblogic_helper.get_actual_weblogic_version()
def _get_server_to_server_groups_map(self, admin_server_name, server_names, dynamic_cluster_names, server_groups, sg_targeting_limits): """ Get the map of server names to the list of server groups to target to that server. :param admin_server_name: the admin server name :param server_names: the list of server names :param server_groups: the complete list of server groups that will, by default, be targeted to all managed servers unless the server is listed in the targeting limits map :param sg_targeting_limits: the targeting limits map :return: the map of server names to the list of server groups to target to that server """ _method_name = '_get_server_to_server_groups_map' self.logger.entering(admin_server_name, str(server_names), str(server_groups), str(sg_targeting_limits), class_name=self.__class_name, method_name=_method_name) result = OrderedDict() revised_server_groups = self._revised_list_server_groups(server_groups, sg_targeting_limits) for server_name in server_names: server_groups_for_server = self.__get_server_groups_for_entity(server_name, sg_targeting_limits) if len(server_groups_for_server) > 0: result[server_name] = server_groups_for_server elif server_name != admin_server_name: # By default, we only target managed servers unless explicitly listed in the targeting limits result[server_name] = list(revised_server_groups) else: result[admin_server_name] = list() for cluster_name in dynamic_cluster_names: server_groups_for_cluster = \ self.__get_server_groups_for_entity(cluster_name, sg_targeting_limits) if len(server_groups_for_cluster) > 0: result[cluster_name] = server_groups_for_cluster else: result[cluster_name] = list(revised_server_groups) self.logger.finer('WLSDPLY-12239', result[cluster_name], cluster_name, class_name=self.__class_name, method_name=_method_name) if admin_server_name not in result: result[admin_server_name] = list() self.logger.exiting(class_name=self.__class_name, method_name=_method_name, result=result) return result
def __process_xx_switch_arg(self, argument): """ Process -XX arguments where there is a plus or minus sign to turn on/off the option and add it to the internal map. :param argument: the argument string """ _method_name = '__process_xx_switch_arg' match = self.__xx_args_switch_regex.match(argument) xarg = match.group(2) on_or_off = match.group(1) if on_or_off == '+': on_or_off_text = 'on' else: on_or_off_text = 'off' if 'switch' not in self.__xx_args: self.__xx_args['switch'] = OrderedDict() self._logger.finer('WLSDPLY-08304', argument, xarg, on_or_off_text, class_name=self._class_name, method_name=_method_name) self.__xx_args['switch'][xarg] = on_or_off return
def testIteritems(self): my_ordered_dict = OrderedDict() my_ordered_dict['nba_player'] = 'Steph Curry' my_ordered_dict['nba_mvp_count'] = 1 my_ordered_dict['is_retired'] = False my_ordered_dict['nba_finals_years'] = ['2015', '2016', '2017'] result = isinstance(my_ordered_dict, dict) self.assertEqual(result, True, 'expected ordered dict to be an instance of dict') # A myOrderedDict.iteritems() needs to work like # a built-in Python dict expected_keys = ['nba_player', 'nba_mvp_count', 'is_retired', 'nba_finals_years'] expected_values = ['Steph Curry', 1, False, ['2015', '2016', '2017']] index = 0 for key, value in my_ordered_dict.iteritems(): self.assertEqual(key, expected_keys[index], 'expected key at position %s to be %s' % (str(index), expected_keys[index])) self.assertEqual(value, expected_values[index]) index += 1
def get_resource_group_templates(self): """ Discover the resource group templates used by one to many partitions. Discover the resources that are contained by the resource group template. :return: model name for template:dictionary containing discovered resource group templates """ _method_name = 'get_resource_group_templates' _logger.entering(class_name=_class_name, method_name=_method_name) result = OrderedDict() model_top_folder_name = model_constants.RESOURCE_GROUP_TEMPLATE location = LocationContext(self._base_location) location.append_location(model_top_folder_name) templates = self._find_names_in_folder(location) if templates is not None: _logger.info('WLSDPLY-06701', len(templates), class_name=_class_name, method_name=_method_name) name_token = self._alias_helper.get_name_token(location) for template in templates: _logger.info('WLSDPLY-06702', template, class_name=_class_name, method_name=_method_name) location.add_name_token(name_token, template) result[template] = self._discover_single_folder(location) CommonResourcesDiscoverer(self._model_context, result[template], wlst_mode=self._wlst_mode, base_location=location).discover() DeploymentsDiscoverer(self._model_context, result[template], wlst_mode=self._wlst_mode, base_location=location).discover() location.remove_name_token(name_token) _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name) return model_top_folder_name, result
def _get_clusters_and_members_map(self): """ Get a map keyed by cluster name with values that are a list of member server names :return: the cluster name to member server names map :raises: BundleAwareException of the specified type: is an error occurs reading from the aliases or WLST """ _method_name = '_get_clusters_and_members_map' self.logger.entering(class_name=self.__class_name, method_name=_method_name) server_location = LocationContext().append_location(SERVER) server_list_path = self.alias_helper.get_wlst_list_path( server_location) server_names = self.wlst_helper.get_existing_object_list( server_list_path) server_token = self.alias_helper.get_name_token(server_location) cluster_map = OrderedDict() for server_name in server_names: server_location.add_name_token(server_token, server_name) server_attributes_path = self.alias_helper.get_wlst_attributes_path( server_location) self.wlst_helper.cd(server_attributes_path) server_attributes_map = self.wlst_helper.lsa() cluster_name = dictionary_utils.get_element( server_attributes_map, CLUSTER) if string_utils.is_empty(cluster_name): # if server is not part of a cluster, continue with the next server continue if cluster_name not in cluster_map: cluster_map[cluster_name] = list() cluster_map[cluster_name].append(server_name) self.logger.exiting(class_name=self.__class_name, method_name=_method_name, result=cluster_map) return cluster_map
def get_webapp_container(self): """ Discover the WebAppContainer global resource settings :return: model name for the folder: dictionary containing the discovered WebAppContainer """ _method_name = '_get_webapp_container' _logger.entering(class_name=_class_name, method_name=_method_name) model_top_folder_name = model_constants.WEBAPP_CONTAINER result = OrderedDict() location = LocationContext(self._base_location) location.append_location(model_top_folder_name) webapp_container = self._find_singleton_name_in_folder(location) if webapp_container is not None: _logger.info('WLSDPLY-06615', class_name=_class_name, method_name=_method_name) location.add_name_token(self._alias_helper.get_name_token(location), webapp_container) self._populate_model_parameters(result, location) self._discover_subfolders(result, location) new_name = self._add_mimemapping_file_to_archive(result) if new_name: result[model_constants.MIME_MAPPING_FILE] = new_name _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name) return model_top_folder_name, result