Example #1
0
def validateRCUArgsAndModel(model_context, model, alias_helper):
    has_atpdbinfo = 0
    domain_info = model[model_constants.DOMAIN_INFO]
    if domain_info is not None:
        if model_constants.RCU_DB_INFO in domain_info:
            rcu_db_info = RcuDbInfo(alias_helper,
                                    domain_info[model_constants.RCU_DB_INFO])
            has_tns_admin = rcu_db_info.has_tns_admin()
            has_regular_db = rcu_db_info.is_regular_db()
            has_atpdbinfo = rcu_db_info.has_atpdbinfo()

            if model_context.get_archive_file_name() and not has_regular_db:
                System.setProperty('oracle.jdbc.fanEnabled', 'false')

                # 1. If it does not have the oracle.net.tns_admin specified, then extract to domain/atpwallet
                # 2. If it is plain old regular oracle db, do nothing
                # 3. If it deos not have tns_admin in the model, then the wallet must be in the archive
                if not has_tns_admin:
                    # extract the wallet first
                    archive_file = WLSDeployArchive(
                        model_context.get_archive_file_name())
                    atp_wallet_zipentry = None
                    if archive_file:
                        atp_wallet_zipentry = archive_file.getATPWallet()
                    if atp_wallet_zipentry and model[
                            model_constants.TOPOLOGY]['Name']:
                        extract_path = atp_helper.extract_walletzip(
                            model, model_context, archive_file,
                            atp_wallet_zipentry)
                        # update the model to add the tns_admin
                        model[model_constants.DOMAIN_INFO][
                            model_constants.RCU_DB_INFO][
                                model_constants.
                                DRIVER_PARAMS_NET_TNS_ADMIN] = extract_path
                    else:
                        __logger.severe('WLSDPLY-12411',
                                        error=None,
                                        class_name=_class_name,
                                        method_name="validateRCUArgsAndModel")
                        __clean_up_temp_files()
                        tool_exit.end(model_context,
                                      CommandLineArgUtil.PROG_ERROR_EXIT_CODE)

        else:
            if model_context.get_domain_typedef().required_rcu():
                if not model_context.get_rcu_database(
                ) or not model_context.get_rcu_prefix():
                    __logger.severe('WLSDPLY-12408',
                                    model_context.get_domain_type(),
                                    CommandLineArgUtil.RCU_DB_SWITCH,
                                    CommandLineArgUtil.RCU_PREFIX_SWITCH)
                    __clean_up_temp_files()
                    tool_exit.end(model_context,
                                  CommandLineArgUtil.PROG_ERROR_EXIT_CODE)

    return has_atpdbinfo
Example #2
0
def validate_rcu_args_and_model(model_context, model, archive_helper, aliases):
    _method_name = 'validate_rcu_args_and_model'

    has_atpdbinfo = 0
    domain_info = model[model_constants.DOMAIN_INFO]
    if domain_info is not None:
        if model_constants.RCU_DB_INFO in domain_info:
            rcu_db_info = RcuDbInfo(model_context, aliases,
                                    domain_info[model_constants.RCU_DB_INFO])
            has_tns_admin = rcu_db_info.has_tns_admin()
            has_regular_db = rcu_db_info.is_regular_db()
            has_atpdbinfo = rcu_db_info.has_atpdbinfo()

            if archive_helper and not has_regular_db:
                System.setProperty('oracle.jdbc.fanEnabled', 'false')

                # 1. If it does not have the oracle.net.tns_admin specified, then extract to domain/atpwallet
                # 2. If it is plain old regular oracle db, do nothing
                # 3. If it deos not have tns_admin in the model, then the wallet must be in the archive
                if not has_tns_admin:
                    wallet_path = archive_helper.extract_atp_wallet()
                    if wallet_path:
                        # update the model to add the tns_admin
                        model[model_constants.DOMAIN_INFO][
                            model_constants.RCU_DB_INFO][
                                model_constants.
                                DRIVER_PARAMS_NET_TNS_ADMIN] = wallet_path
                    else:
                        __logger.severe('WLSDPLY-12411',
                                        error=None,
                                        class_name=_class_name,
                                        method_name=_method_name)
                        cla_helper.clean_up_temp_files()
                        tool_exit.end(model_context,
                                      CommandLineArgUtil.PROG_ERROR_EXIT_CODE)

        else:
            if model_context.get_domain_typedef().required_rcu():
                if not model_context.get_rcu_database(
                ) or not model_context.get_rcu_prefix():
                    __logger.severe('WLSDPLY-12408',
                                    model_context.get_domain_type(),
                                    CommandLineArgUtil.RCU_DB_SWITCH,
                                    CommandLineArgUtil.RCU_PREFIX_SWITCH)
                    cla_helper.clean_up_temp_files()
                    tool_exit.end(model_context,
                                  CommandLineArgUtil.PROG_ERROR_EXIT_CODE)

    return has_atpdbinfo
Example #3
0
                archive_file_name):
            archive_file = WLSDeployArchive(archive_file_name)
            if archive_file:
                atp_wallet_zipentry = archive_file.getATPWallet()
                if atp_wallet_zipentry:
                    atp_helper.extract_walletzip(model, model_context,
                                                 archive_file,
                                                 atp_wallet_zipentry)

        creator = DomainCreator(model, model_context, aliases)
        creator.create()

        if has_atp:
            rcu_properties_map = model[model_constants.DOMAIN_INFO][
                model_constants.RCU_DB_INFO]
            rcu_db_info = RcuDbInfo(alias_helper, rcu_properties_map)
            atp_helper.fix_jps_config(rcu_db_info, model_context)

    except WLSDeployArchiveIOException, ex:
        __logger.severe('WLSDPLY-12409',
                        _program_name,
                        ex.getLocalizedMessage(),
                        error=ex,
                        class_name=_class_name,
                        method_name=_method_name)
        __clean_up_temp_files()
        tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)

    except CreateException, ex:
        __logger.severe('WLSDPLY-12409',
                        _program_name,
Example #4
0
    def update_rcu_password(self):
        """
        Update the password of each rcu schema and then update the bootstrap password
        """

        _method_name = 'update_rcu_password'

        domain_info = self.model.get_model_domain_info()
        if RCU_DB_INFO in domain_info:
            rcu_db_info = RcuDbInfo(self.model_context, self.aliases, domain_info[RCU_DB_INFO])
            rcu_schema_pass = rcu_db_info.get_rcu_schema_password()
            rcu_prefix = rcu_db_info.get_rcu_prefix()

            location = LocationContext()
            location.append_location(JDBC_SYSTEM_RESOURCE)

            folder_path = self.aliases.get_wlst_list_path(location)
            self.wlst_helper.cd(folder_path)
            ds_names = self.wlst_helper.lsc()
            domain_typedef = self.model_context.get_domain_typedef()
            rcu_schemas = domain_typedef.get_rcu_schemas()
            if len(rcu_schemas) == 0:
                return
            schemas_len = len(rcu_schemas)

            for i in range(0,schemas_len):
                rcu_schemas[i] = rcu_prefix + '_' + rcu_schemas[i]

            for ds_name in ds_names:
                location = LocationContext()
                location.append_location(JDBC_SYSTEM_RESOURCE)
                token_name = self.aliases.get_name_token(location)
                location.add_name_token(token_name, ds_name)

                location.append_location(JDBC_RESOURCE)
                location.append_location(JDBC_DRIVER_PARAMS)
                password_location = LocationContext(location)

                wlst_path = self.aliases.get_wlst_attributes_path(location)
                self.wlst_helper.cd(wlst_path)

                location.append_location(JDBC_DRIVER_PARAMS_PROPERTIES)
                token_name = self.aliases.get_name_token(location)
                if token_name is not None:
                    location.add_name_token(token_name, DRIVER_PARAMS_USER_PROPERTY)
                wlst_path = self.aliases.get_wlst_attributes_path(location)
                self.wlst_helper.cd(wlst_path)
                ds_user = self.wlst_helper.get('Value')

                if ds_user in rcu_schemas:
                    wlst_path = self.aliases.get_wlst_attributes_path(password_location)
                    self.wlst_helper.cd(wlst_path)
                    wlst_name, wlst_value = \
                        self.aliases.get_wlst_attribute_name_and_value(password_location, PASSWORD_ENCRYPTED,
                                                                            rcu_schema_pass, masked=True)
                    self.wlst_helper.set(wlst_name, wlst_value, masked=True)

                domain_home = self.model_context.get_domain_home()
                config_file = domain_home + '/config/fmwconfig/jps-config-jse.xml'
                opss_user = rcu_prefix + '_OPSS'
                if self._modifyBootStrapCredential:
                    self.wlst_helper.modify_bootstrap_credentials(jps_configfile=config_file, username=opss_user, password=rcu_schema_pass)
Example #5
0
        has_atp = validate_rcu_args_and_model(model_context, model_dictionary,
                                              archive_helper, aliases)

        # check if there is an atpwallet and extract in the domain dir
        # it is to support non JRF domain but user wants to use ATP database
        if not has_atp and archive_helper:
            archive_helper.extract_atp_wallet()

        creator = DomainCreator(model_dictionary, model_context, aliases)
        creator.create()

        if has_atp:
            rcu_properties_map = model_dictionary[model_constants.DOMAIN_INFO][
                model_constants.RCU_DB_INFO]
            rcu_db_info = RcuDbInfo(model_context, aliases, rcu_properties_map)
            atp_helper.fix_jps_config(rcu_db_info, model_context)

    except WLSDeployArchiveIOException, ex:
        __logger.severe('WLSDPLY-12409',
                        _program_name,
                        ex.getLocalizedMessage(),
                        error=ex,
                        class_name=_class_name,
                        method_name=_method_name)
        cla_helper.clean_up_temp_files()
        tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)

    except CreateException, ex:
        __logger.severe('WLSDPLY-12409',
                        _program_name,