Ejemplo n.º 1
0
    def set(self, attribute_name, attribute_value, masked=False):
        """
        Set the configuration for the indicated attribute to the provided value.

        :param attribute_name: attribute name at the current location
        :param attribute_value: to configure the attribute
        :param masked: whether the attribute value should be masked from the log file, default is False
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'set'

        try:
            wlst_helper.set(attribute_name, attribute_value)
        except PyWLSTException, pwe:
            log_value = attribute_value
            if masked:
                log_value = '<masked>'
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19102',
                                                   attribute_name,
                                                   log_value,
                                                   pwe.getLocalizedMessage(),
                                                   error=pwe)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Ejemplo n.º 2
0
    def set_if_needed(self, wlst_name, wlst_value, model_type, model_name, masked=False):
        """
        Set the WLST attribute to the specified value if the name and value are not None.
        :param wlst_name: the WLST attribute name
        :param wlst_value: the WLST attribute value
        :param model_type: the model type
        :param model_name: the model MBean name
        :param masked: whether or not to mask the value in the logs, default value is False
        :raises: CreateException: if an error occurs
        """
        _method_name = 'set_if_needed'

        if wlst_name is not None and wlst_value is not None:
            try:
                wlst_helper.set(wlst_name, wlst_value)
            except PyWLSTException, pwe:
                value = wlst_value
                if masked:
                    value = '<masked>'
                ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19121', model_type, model_name,
                                                       wlst_name, value, pwe.getLocalizedMessage(), error=pwe)
                self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
                raise ex