Пример #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
Пример #2
0
    def get_wlst_flattened_mbean_type(self, location):
        """
        Get the WLST MBean name for the flattened folder.
        :param location: the location
        :return: the WLST MBean name, or None if there isn't a flattened folder
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'get_wlst_flattened_mbean_type'

        try:
            result = self.__aliases.get_wlst_flattened_mbean_type(location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19013',
                                                   str(location),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #3
0
    def _get_mbean_interface(self):
        _method_name = '__get_mbean_interface'
        if self.__mbean_interface is None:
            _logger.entering(class_name=self.__class__.__name__, method_name=_method_name)
            interfaces = [interface for interface in self._get_mbean_interfaces()
                          if re.search(self.__interface_matcher, str(interface)) is not None]
            if len(interfaces) == 0:
                ex = exception_helper.create_exception(self._get_exception_type(), 'WLSDPLY-01777',
                                                       self._get_mbean_instance())
                _logger.throwing(ex, class_name=self.__class__.__name__, method_name=_method_name)
                raise ex
            else:
                if len(interfaces) > 1:
                    _logger.fine('WLSDPLY-01770', interfaces, self._get_mbean_instance(),
                                 class_name=self.__class__.__name__, method_name=_method_name)
                interface = interfaces[0]
                self.__mbean_name = interface.getSimpleName()
                self.__mbean_interface = str(interface)
            _logger.exiting(class_name=self.__class__.__name__, method_name=_method_name, result=self.__mbean_interface)

        return self.__mbean_interface
Пример #4
0
    def cd(self, wlst_path):
        """
        Change WLST directories to the specified path
        :param wlst_path: the WLST path
        :return: the return value from the cd()
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'cd'

        try:
            result = wlst_helper.cd(wlst_path)
        except PyWLSTException, pwe:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19100',
                                                   wlst_path,
                                                   pwe.getLocalizedMessage(),
                                                   error=pwe)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
    def __get_parent_location(self, location, folder_name):
        """
        Searches the specified location for the specified folder name, and returns the corresponding location.
        :param location: the location to be examined
        :param folder_name: the folder name to find
        :return: the parent location
        :raises BundleAwareException of the specified type: if the folder is not found in the location folders list
        """
        method_name = '__get_parent_location'

        try:
            location = LocationContext(location)
            resource_index = location.get_model_folders().index(folder_name)
            while len(location.get_model_folders()) > resource_index + 1:
                location.pop_location()
        except:
            # index throws a ValueError if the item is not in the list...
            ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19205', folder_name, str(location))
            self.__logger.throwing(class_name=self._class_name, method_name=method_name, error=ex)
            raise ex
        return location
Пример #6
0
    def get_name_token(self, location):
        """
        Get the name token, if any, for the specified location.
        :param location: the location
        :return: the name token or None, if no additional name token is required
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'get_name_token'

        try:
            token_name = self.__aliases.get_name_token(location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19001',
                                                   str(location),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #7
0
    def is_custom_folder_allowed(self, location):
        """
        Returns true if the specified location allows custom, user-defined folder types.
        :param location: the location to be checked
        :return: True, if the location allows custom folder types, False otherwise
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'is_custom_folder_allowed'

        try:
            result = self.__aliases.is_custom_folder_allowed(location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19035',
                                                   str(location),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #8
0
    def is_security_provider_type(self, location):
        """
        Returns true if the specified location is a security provider type.
        :param location: the location to be checked
        :return: True, if the location is a security provider type, False otherwise
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'is_security_provider_type'

        try:
            result = self.__aliases.is_security_provider_type(location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19036',
                                                   str(location),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #9
0
    def is_artificial_type_folder(self, location):
        """
        Is the location folder specified an artificial type folder?
        :param location: the location
        :return: True, if the location is an artificial type folder, False otherwise
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'is_artificial_type_folder'

        try:
            result = self.__aliases.is_artificial_type_folder(location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19026',
                                                   str(location),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #10
0
    def supports_single_mbean_instance(self, location):
        """
        Does the location folder specified support only a single MBean instance of the parent node type?
        :param location: the location
        :return: True, if the location support only a single MBean instance of the parent node type, False otherwise
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'supports_single_mbean_instance'

        try:
            result = self.__aliases.supports_single_mbean_instance(location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19025',
                                                   str(location),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #11
0
    def get_active_activation_tasks(self, config_manager):
        """
        Return list of active activation tasks.
        :param config_manager: configuration manager
        :return: list of active activation tasks
        :raises: BundleAwareException: if an error occurs
        """
        _method_name = 'get_active_activation_tasks'

        try:
            active_tasks = wlst_helper.get_active_activation_tasks(
                config_manager)
        except PyWLSTException, pwe:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19124',
                                                   pwe.getLocalizedMessage(),
                                                   error=pwe)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #12
0
    def get_wlst_mbean_type(self, location):
        """
        Get the MBean type to use to create it for the specified location.
        :param location: the location
        :return: the MBean type
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'get_wlst_mbean_type'

        try:
            wlst_mbean_type = self.__aliases.get_wlst_mbean_type(location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19010',
                                                   str(location),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #13
0
    def is_flattened_folder(self, location):
        """
        Does the location contain a flattened folder?
        :param location: the location
        :return: True if the location has a flattened folder, False otherwise
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'is_flattened_folder'

        try:
            result = self.__aliases.is_flattened_folder(location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19011',
                                                   str(location),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #14
0
    def lsc(self, path=None, log_throwing=True):
        """
        Get the list of child folders from WLST.
        :param path: the WLST path, by default it uses the current location
        :param log_throwing: whether to log throwing if the path does not exist, the default is True
        :return: the list of folder names
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'lsc'

        try:
            result = wlst_helper.lsc(path=path, log_throwing=log_throwing)
        except PyWLSTException, pwe:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19105',
                                                   pwe.getLocalizedMessage(),
                                                   error=pwe)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #15
0
    def get_wlst_list_path(self, location):
        """
        Get the WLST list path from the aliases for the specified location.
        :param location: the location
        :return: the WLST path where the instances of the MBeans can be found
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'get_wlst_list_path'

        try:
            wlst_path = self.__aliases.get_wlst_list_path(location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19005',
                                                   str(location),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #16
0
    def get_model_folder_path(self, location):
        """
        Get the model folder path for the specified location.
        :param location: the location
        :return: the model folder path (e.g., /topology/Server/AdminServer/SSL)
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'get_model_folder_path'

        try:
            path = self.__aliases.get_model_folder_path(location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19002',
                                                   str(location),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #17
0
 def get_model_merge_required_attribute_names(self, location):
     """
     Get the names of attributes at the specified location that require merge with existing WLST values.
     :param location: the location
     :return: a list of attribute names
     :raises: BundleAwareException of the specified type: if an error occurs
     """
     _method_name = 'get_model_merge_required_attribute_names'
     try:
         result = self.__aliases.get_model_merge_required_attribute_names(
             location)
     except AliasException, ae:
         ex = exception_helper.create_exception(self.__exception_type,
                                                'WLSDPLY-19027',
                                                location.get_folder_path(),
                                                ae.getLocalizedMessage(),
                                                error=ae)
         self.__logger.throwing(ex,
                                class_name=self.__class_name,
                                method_name=_method_name)
         raise ex
Пример #18
0
    def get_mbean_for_wlst_path(self, wlst_path):
        """
        Get the MBean for the specified location.
        :param wlst_path: the WLST path
        :return: the MBean or None
        :raises: CreateException: if an error occurs
        """
        _method_name = 'get_mbean_for_wlst_path'

        try:
            wlst_value = wlst_helper.get_mbean_for_wlst_path(wlst_path)
        except PyWLSTException, pwe:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19122',
                                                   wlst_path,
                                                   pwe.getLocalizedMessage(),
                                                   error=pwe)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #19
0
    def requires_artificial_type_subfolder_handling(self, location):
        """
        Does the location folder specified require artificial subfolder type handling?
        :param location: the location
        :return: True, if the location requires artificial subfolder type handling, False otherwise
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'requires_artificial_type_subfolder_handling'

        try:
            result = self.__aliases.requires_artificial_type_subfolder_handling(
                location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19024',
                                                   str(location),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #20
0
    def contains_model(self):
        """
        Does the archive file contain a model file?
        :return: True, if a model file was found, False otherwise
        :raises: BundleAwareException of the appropriate type: if an error occurs
        """
        _method_name = 'contains_model'

        self.__logger.entering(class_name=self.__class_name,
                               method_name=_method_name)
        try:
            result = self.__archive_file.containsModel()
        except WLSDeployArchiveIOException, e:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   "WLSDPLY-19301",
                                                   self.__archive_file_name,
                                                   e.getLocalizedMessage(),
                                                   error=e)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #21
0
    def get_archive_entries(self):
        """
        Get the entries in the archive.
        :return: a list of archive entries
        :raises: BundleAwareException of the appropriate type: if an error occurs
        """
        _method_name = 'get_archive_entries'

        self.__logger.entering(class_name=self.__class_name,
                               method_name=_method_name)
        try:
            entries = self.__archive_file.getArchiveEntries()
        except WLSDeployArchiveIOException, e:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19308',
                                                   self.__archive_file_name,
                                                   e.getLocalizedMessage(),
                                                   error=e)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #22
0
    def get_model_subfolder_names(self, location):
        """
        Get the model subfolder names for the specified location.
        :param location: the location
        :return: the list of model subfolder names, or an empty list if none exist
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'get_model_subfolder_names'

        try:
            model_subfolder_names = self.__aliases.get_model_subfolder_names(
                location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19000',
                                                   str(location),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #23
0
    def get_model_password_type_attribute_names(self, location):
        """
        Get the attributes in the current location whose types are passwords.
        :param location: the location
        :return: list of the attribute names
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'get_model_password_type_attribute_names'

        try:
            password_attribute_names = self.__aliases.get_model_password_type_attribute_names(
                location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19016',
                                                   location.get_folder_path(),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #24
0
    def get_model_mbean_set_method_attribute_names_and_types(self, location):
        """
        Get the list of model attribute names and types where the set method requires an MBean.
        :param location: the location
        :return: a dictionary keyed by model attribute names with the set_method and set_mbean_type fields set
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'get_model_mbean_set_method_attribute_names_and_types'

        try:
            mbean_attribute_names = self.__aliases.get_model_mbean_set_method_attribute_names_and_types(
                location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19017',
                                                   location.get_folder_path(),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #25
0
    def set_with_cmo(self, attribute_name, attribute_value, masked=False):
        """
        Set the specified attribute using the corresponding cmo set method (e.g., cmo.setListenPort()).
        :param attribute_name: the WLST attribute name
        :param attribute_value: the WLST value
        :param masked: whether or not to mask the attribute_value from the log files.
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'set_with_cmo'

        try:
            wlst_helper.set_with_cmo(attribute_name, attribute_value, masked=masked)
        except PyWLSTException, pwe:
            path = self.get_pwd()
            log_value = attribute_value
            if masked:
                log_value = '<masked>'

            ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19136', attribute_name, path,
                                                   log_value, pwe.getLocalizedMessage(), error=pwe)
            self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
            raise ex
Пример #26
0
    def get_model_attribute_names_and_types(self, location):
        """
        Get the model attribute names and their types.
        :param location: the location
        :return: dictionary of model attribute names and their types
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'get_model_attribute_names_and_types'

        try:
            result = self.__aliases.get_model_attribute_names_and_types(
                location)
        except AliasException, ae:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19019',
                                                   location.get_folder_path(),
                                                   ae.getLocalizedMessage(),
                                                   error=ae)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #27
0
    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
Пример #28
0
    def delete(self, wlst_name, wlst_type):
        """
        Delete an MBean of the specified name and type at the current location.
        :param wlst_name: the MBean name
        :param wlst_type: the MBean type
        :raises: PyWLSTException: if a WLST error occurs
        """
        _method_name = 'delete'

        try:
            wlst_helper.delete(wlst_name, wlst_type)
        except PyWLSTException, pwe:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19135',
                                                   wlst_type,
                                                   wlst_name,
                                                   pwe.getLocalizedMessage(),
                                                   error=pwe)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
Пример #29
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
Пример #30
0
    def apply_jrf_control_updates(self, jrf_targets, model_context):
        """
        For those installs that require populating the JRF server group information to the managed servers. Control
        the session updates within the global context. Save the updates in the current context.
        :param jrf_targets: The list of entities to which to target the JRF applications and services
        :param model_context: The context containing the tool session information needed for the applyJRF
        :raises: Exception specific to tool type
        """
        _method_name = 'apply_jrf_control_updates'


        try:
            wlst_extended.apply_jrf_global_updates(model_context.is_wlst_online(),
                                                   jrf_targets,
                                                   admin_user=model_context.get_admin_user(),
                                                   admin_pass=model_context.get_admin_password(),
                                                   admin_url=model_context.get_admin_url(),
                                                   domain_home=model_context.get_domain_home())
        except PyWLSTException, pwe:
            ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19146',
                                                   pwe.getLocalizedMessage(), error=pwe)
            self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
            raise ex