def install_domain_libraries(self):
        """
        Extract the domain libraries listed in the model, if any, to the <DOMAIN_HOME>/lib directory.
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'install_domain_libraries'

        self.logger.entering(self.domain_home, class_name=self.__class_name, method_name=_method_name)
        domain_info_dict = self.model.get_model_domain_info()
        if DOMAIN_LIBRARIES not in domain_info_dict or len(domain_info_dict[DOMAIN_LIBRARIES]) == 0:
            self.logger.info('WLSDPLY-12213', class_name=self.__class_name, method_name=_method_name)
        elif DOMAIN_LIBRARIES in domain_info_dict:
            domain_libs = dictionary_utils.get_dictionary_element(domain_info_dict, DOMAIN_LIBRARIES)
            if self.archive_helper is None:
                ex = exception_helper.create_create_exception('WLSDPLY-12214', domain_libs)
                self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
                raise ex

            for domain_lib in domain_libs:
                if WLSDeployArchive.isPathIntoArchive(domain_lib):
                    self.logger.info('WLSDPLY-12215', domain_lib, self.domain_home,
                                     class_name=self.__class_name, method_name=_method_name)
                    self.archive_helper.extract_domain_library(domain_lib)
                else:
                    self.logger.info('WLSDPLY-12235', domain_lib, self.domain_home,
                                     class_name=self.__class_name, method_name=_method_name)
                    self._copy_domain_library(domain_lib)

        self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
        return
Esempio n. 2
0
    def _set_attribute(self, location, model_name, model_value, uses_path_tokens_names, masked=False):
        """
        Set the specified attribute at the specified location to the specified value.
        :param location: the location
        :param model_name: the model attribute name
        :param model_value: the model attribute value
        :param: uses_path_token_names: the list of model attribute names that use file system path tokens
        :param masked: whether or not to mask the attribute value in the log
        :raises: CreateException: if an error occurs
        """
        _method_name = '_set_attribute'

        if model_name in uses_path_tokens_names and WLSDeployArchive.isPathIntoArchive(model_value):
            if self.archive_helper is not None:
                if self.archive_helper.contains_file(model_value):
                    #
                    # We cannot extract the files until the domain directory exists
                    # so add them to the list so that they can be extracted after
                    # domain creation completes.
                    #
                    self.files_to_extract_from_archive.append(model_value)
                else:
                    path = self.alias_helper.get_model_folder_path(location)
                    archive_file_name = self.model_context.get_archive_file_name
                    ex = exception_helper.create_create_exception('WLSDPLY-12121', model_name, path,
                                                                  model_value, archive_file_name)
                    self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
                    raise ex
            else:
                path = self.alias_helper.get_model_folder_path(location)
                ex = exception_helper.create_create_exception('WLSDPLY-12122', model_name, path, model_value)
                self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
                raise ex

        wlst_name, wlst_value = self.alias_helper.get_wlst_attribute_name_and_value(location, model_name, model_value)

        if wlst_name is None:
            self.logger.info('WLSDPLY-12106', model_name, self.alias_helper.get_model_folder_path(location),
                             class_name=self.__class_name, method_name=_method_name)
        elif wlst_value is None:
            logged_value = model_value
            if masked:
                logged_value = '<masked>'
            self.logger.info('WLSDPLY-12107', model_name, logged_value,
                             self.alias_helper.get_model_folder_path(location),
                             class_name=self.__class_name, method_name=_method_name)
        else:
            logged_value = wlst_value
            if masked:
                logged_value = '<masked>'
            self.logger.finest('WLSDPLY-12115', wlst_name, logged_value,
                               class_name=self.__class_name, method_name=_method_name)
            self.wlst_helper.set(wlst_name, wlst_value, masked=masked)
        return
Esempio n. 3
0
def is_path_into_archive(path):
    """
    Is the path specified a path into the archive file?
    :param path: the path to test
    :return: True if the path is into the archive file, False otherwise
    """
    _method_name = 'is_path_into_archive'

    _logger.entering(path, class_name=_class_name, method_name=_method_name)
    result = WLSDeployArchive.isPathIntoArchive(path)
    _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
    return result
Esempio n. 4
0
    def _extract_archive_files(self, location, model_name, model_value):
        """
        Extract any archive files associated with the specified model attribute value.
        The attribute has already been determined to use path tokens.
        :param location: the location of the attribute
        :param model_name: the model attribute name
        :param model_value: the model attribute value
        :raises: CreateException: if an error occurs
        """
        _method_name = '_extract_archive_files'

        # model value should be a list, comma-delimited string, or string
        model_paths = model_value
        if isinstance(model_value, str):
            model_paths = model_value.split(',')

        for model_path in model_paths:
            model_path = model_path.strip()

            # check for path starting with "wlsdeploy/".
            # skip classpath libraries, they are extracted elsewhere.
            if WLSDeployArchive.isPathIntoArchive(
                    model_path
            ) and not WLSDeployArchive.isClasspathEntry(model_path):
                if self.archive_helper is not None:
                    if self.archive_helper.contains_file(model_path):
                        #
                        # We cannot extract the files until the domain directory exists
                        # so add them to the list so that they can be extracted after
                        # domain creation completes.
                        #
                        self.files_to_extract_from_archive.append(model_path)
                    else:
                        path = self.alias_helper.get_model_folder_path(
                            location)
                        archive_file_name = self.model_context.get_archive_file_name(
                        )
                        ex = exception_helper.create_create_exception(
                            'WLSDPLY-12121', model_name, path, model_path,
                            archive_file_name)
                        self.logger.throwing(ex,
                                             class_name=self.__class_name,
                                             method_name=_method_name)
                        raise ex
                else:
                    path = self.alias_helper.get_model_folder_path(location)
                    ex = exception_helper.create_create_exception(
                        'WLSDPLY-12122', model_name, path, model_path)
                    self.logger.throwing(ex,
                                         class_name=self.__class_name,
                                         method_name=_method_name)
                    raise ex
 def qualify_nm_properties(self, type_name, model_nodes, base_location, model_context, attribute_setter):
     """
     For the NM properties MBean, update the keystore file path to be fully qualified with the domain directory.
     :param type_name: the type name of the MBean to be checked
     :param model_nodes: the model nodes of the MBean to be checked
     :param base_location: the parent location of the MBean
     :param model_context: the model context of the tool
     :param attribute_setter: the attribute setter to be used for update
     """
     if type_name == NM_PROPERTIES:
         location = LocationContext(base_location).append_location(type_name)
         keystore_file = dictionary_utils.get_element(model_nodes, CUSTOM_IDENTITY_KEYSTORE_FILE)
         if keystore_file and WLSDeployArchive.isPathIntoArchive(keystore_file):
             value = model_context.get_domain_home() + "/" + keystore_file
             attribute_setter.set_attribute(location, CUSTOM_IDENTITY_KEYSTORE_FILE, value)
Esempio n. 6
0
    def install_domain_scripts(self):
        """
        Extract the scripts from domain bin listed in the model, if any, to the <DOMAIN_HOME>/bin directory.
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'install_domain_scripts'

        self.logger.entering(self.domain_home,
                             class_name=self.__class_name,
                             method_name=_method_name)
        domain_info_dict = self.model.get_model_domain_info()
        if DOMAIN_SCRIPTS not in domain_info_dict or len(
                domain_info_dict[DOMAIN_SCRIPTS]) == 0:
            self.logger.info('WLSDPLY-12241',
                             class_name=self.__class_name,
                             method_name=_method_name)
        elif DOMAIN_SCRIPTS in domain_info_dict:
            domain_scripts = dictionary_utils.get_dictionary_element(
                domain_info_dict, DOMAIN_SCRIPTS)
            if self.archive_helper is None:
                ex = exception_helper.create_create_exception(
                    'WLSDPLY-12250', domain_scripts)
                self.logger.throwing(ex,
                                     class_name=self.__class_name,
                                     method_name=_method_name)
                raise ex

            for domain_script in domain_scripts:
                if WLSDeployArchive.isPathIntoArchive(domain_script):
                    self.logger.info('WLSDPLY-12251',
                                     domain_script,
                                     self.domain_home,
                                     class_name=self.__class_name,
                                     method_name=_method_name)
                    self.archive_helper.extract_domain_bin_script(
                        domain_script)
                else:
                    self.logger.info('WLSDPLY-12252',
                                     domain_script,
                                     self.domain_home,
                                     class_name=self.__class_name,
                                     method_name=_method_name)
                    self._copy_domain_bin(domain_script)

        self.logger.exiting(class_name=self.__class_name,
                            method_name=_method_name)
        return