def _get_attributes_for_current_location_online(self, location): _method_name = '_get_attributes_for_current_location_online' lsa_attributes = dict() path = self._alias_helper.get_wlst_attributes_path(location) try: 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)
def _populate_model_parameters(self, dictionary, location): """ Populate the model dictionary with the attribute values discovered at the current location. Perform any special processing for a specific attribute before storing into the model dictionary. :param dictionary: where to store the discovered attributes :param location: context containing current location information :return: dictionary of model attribute name and wlst value """ _method_name = '_populate_model_parameters' wlst_path = self._alias_helper.get_wlst_attributes_path(location) _logger.finer('WLSDPLY-06100', wlst_path, class_name=_class_name, method_name=_method_name) if not self.wlst_cd(wlst_path, location): return wlst_params = self._get_attributes_for_current_location(location) _logger.finest('WLSDPLY-06102', self._wlst_helper.get_pwd(), wlst_params, class_name=_class_name, method_name=_method_name) wlst_get_params = self._get_required_attributes(location) _logger.finest('WLSDPLY-06103', str(location), wlst_get_params, class_name=_class_name, method_name=_method_name) attr_dict = OrderedDict() if wlst_params: for wlst_param in wlst_params: if wlst_param in wlst_get_params: _logger.finest('WLSDPLY-06104', wlst_param, class_name=_class_name, method_name=_method_name) try: wlst_value = wlst_helper.get(wlst_param) except PyWLSTException, pe: _logger.warning('WLSDPLY-06127', wlst_param, wlst_path, pe.getLocalizedMessage(), class_name=_class_name, method_name=_method_name) continue else: _logger.finer('WLSDPLY-06131', wlst_param, class_name=_class_name, method_name=_method_name) wlst_value = wlst_params[wlst_param] # if type(wlst_value) == str and len(wlst_value) == 0: # wlst_value = None _logger.finer('WLSDPLY-06105', wlst_param, wlst_value, wlst_path, class_name=_class_name, method_name=_method_name) try: model_param, model_value = self._aliases.get_model_attribute_name_and_value(location, wlst_param, wlst_value) except AliasException, de: _logger.warning('WLSDPLY-06106', wlst_param, wlst_path, de.getLocalizedMessage(), class_name=_class_name, method_name=_method_name) continue attr_dict[model_param] = wlst_value model_value = self._check_attribute(model_param, model_value, location) if model_value is not None: _logger.finer('WLSDPLY-06107', model_param, model_value, class_name=_class_name, method_name=_method_name) dictionary[model_param] = model_value elif model_param is None: _logger.finest('WLSDPLY-06108', model_param, class_name=_class_name, method_name=_method_name)
def _add_domain_name(location, aliases): _method_name = '_get_domain_name' try: wlst_helper.cd('/') domain_name = wlst_helper.get(model_constants.DOMAIN_NAME) except PyWLSTException, pe: de = exception_helper.create_discover_exception( 'WLSDPLY-06020', pe.getLocalizedMessage()) __logger.throwing(class_name=_class_name, method_name=_method_name, error=de) raise de
def get(self, attribute_name): """ Return the value for the attribute at the current location :param attribute_name: name of the wlst attribute :return: value set for the attribute :raises: BundleAwareException of the specified type: if an error occurs """ _method_name = 'get' try: result = wlst_helper.get(attribute_name) except PyWLSTException, pwe: ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19101', attribute_name, pwe.getLocalizedMessage(), error=pwe) self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name) raise ex
def _get_attributes_for_current_location_online(self, location): _method_name = '_get_attributes_for_current_location_online' 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 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)