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._alias_helper.get_name_token(location) for resource_group in resource_groups: _logger.info('WLSDPLY-06704', resource_group, self._alias_helper.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], base_location, wlst_mode=self._wlst_mode, aliases=self._aliases).discover() DeploymentsDiscoverer(self._model_context, result[resource_group], base_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(model_context, aliases, injector, helper): """ Populate the model from the domain. :param model_context: the model context :param aliases: aliases instance for discover :param injector: variable injector instance :param helper: wlst_helper instance :return: the fully-populated model :raises DiscoverException: if an error occurred while discover the domain """ _method_name = '__discover' model = Model() base_location = LocationContext() __connect_to_domain(model_context, helper) try: _add_domain_name(base_location, aliases, helper) DomainInfoDiscoverer(model_context, model.get_model_domain_info(), base_location, wlst_mode=__wlst_mode, aliases=aliases, variable_injector=injector).discover() TopologyDiscoverer(model_context, model.get_model_topology(), base_location, wlst_mode=__wlst_mode, aliases=aliases, variable_injector=injector).discover() ResourcesDiscoverer(model_context, model.get_model_resources(), base_location, wlst_mode=__wlst_mode, aliases=aliases, variable_injector=injector).discover() DeploymentsDiscoverer(model_context, model.get_model_app_deployments(), base_location, wlst_mode=__wlst_mode, aliases=aliases, variable_injector=injector).discover() __discover_multi_tenant(model, model_context, base_location, aliases, injector) except AliasException, ae: wls_version = WebLogicHelper(__logger).get_actual_weblogic_version() wlst_mode = WlstModes.from_value(__wlst_mode) ex = exception_helper.create_discover_exception('WLSDPLY-06000', model_context.get_domain_name(), model_context.get_domain_home(), wls_version, wlst_mode, ae.getLocalizedMessage(), error=ae) __logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex
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