예제 #1
0
 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
예제 #2
0
 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 discover(self):
     """
     Discover weblogic resources from the on-premise domain.
     :return: resources: dictionary
     """
     _method_name = 'discover'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     _logger.info('WLSDPLY-06300', class_name=_class_name, method_name=_method_name)
     GlobalResourcesDiscoverer(self._model_context, self._dictionary, self._base_location, self._wlst_mode,
                               self._aliases).discover()
     CommonResourcesDiscoverer(self._model_context, self._dictionary, self._base_location, self._wlst_mode,
                               self._aliases).discover()
     _logger.exiting(class_name=_class_name, method_name=_method_name)
     return self._dictionary