コード例 #1
0
def __process_args(args):
    """
    Process the command-line arguments.
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    _method_name = '__process_args'

    cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
    argument_map = cla_util.process_args(args, trailing_arg_count=2)

    model_context = ModelContext(_program_name, argument_map)
    model_context.set_ignore_missing_archive_entries(True)
    return model_context
コード例 #2
0
def main(args):
    """
    The python entry point for updateDomain.

    :param args:
    :return:
    """
    _method_name = 'main'

    __logger.entering(args[0], class_name=_class_name, method_name=_method_name)
    for index, arg in enumerate(args):
        __logger.finer('sys.argv[{0}] = {1}', str(index), str(arg), class_name=_class_name, method_name=_method_name)

    __wlst_helper.silence()

    exit_code = CommandLineArgUtil.PROG_OK_EXIT_CODE

    try:
        model_context = __process_args(args)
    except CLAException, ex:
        exit_code = ex.getExitCode()
        if exit_code != CommandLineArgUtil.HELP_EXIT_CODE:
            __logger.severe('WLSDPLY-20008', _program_name, ex.getLocalizedMessage(), error=ex,
                            class_name=_class_name, method_name=_method_name)
        cla_helper.clean_up_temp_files()

        # create a minimal model for summary logging
        model_context = ModelContext(_program_name, dict())
        tool_exit.end(model_context, exit_code)
コード例 #3
0
ファイル: create.py プロジェクト: flaviomi87/myOra
def __process_args(args):
    """
    Process the command-line arguments and prompt the user for any missing information
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    cla_util = CommandLineArgUtil(_program_name, __required_arguments,
                                  __optional_arguments)
    required_arg_map, optional_arg_map = cla_util.process_args(args, True)
    __verify_required_args_present(required_arg_map)
    __process_java_home_arg(optional_arg_map)
    __process_domain_location_args(optional_arg_map)
    __process_model_args(optional_arg_map)

    #
    # Verify that the domain type is a known type and load its typedef.
    #
    domain_type = required_arg_map[CommandLineArgUtil.DOMAIN_TYPE_SWITCH]
    domain_typedef = DomainTypedef(_program_name, domain_type)
    optional_arg_map[CommandLineArgUtil.DOMAIN_TYPEDEF] = domain_typedef

    __process_rcu_args(optional_arg_map, domain_type, domain_typedef)
    __process_encryption_args(optional_arg_map)

    combined_arg_map = optional_arg_map.copy()
    combined_arg_map.update(required_arg_map)
    model_context = ModelContext(_program_name, combined_arg_map)
    domain_typedef.set_model_context(model_context)
    return model_context
コード例 #4
0
    def testPrintUsageRecursive(self):
        _method_name = 'testPrintUsageRecursive'

        _RECURSIVE = '-recursive'

        args = {
            '-oracle_home': os.environ['MW_HOME']
        }

        model_paths = [
            'appDeployments:/Application'
        ]

        try:
            # Loop through valid list of model sections
            for model_path in model_paths:
                # Set print usage context
                args['-print_usage'] = '%s %s' % (model_path, _RECURSIVE)
                self._logger.info('args={0}', str(args), class_name=self._class_name, method_name=_method_name)
                model_context = ModelContext(self._program_name, args)
                model_validator = Validator(model_context, wlst_mode=WlstModes.ONLINE)
                model_validator.print_usage(model_path)
                self.assertEquals(True, True)
        except ValidateException, ve:
            self.fail(ve.getLocalizedMessage())
コード例 #5
0
    def testDeleteModelAppDeployments(self):
        _method_name = 'testCompareModelFull'

        _variables_file = self._resources_dir + '/compare_model_model1.10.properties'
        _new_model_file = self._resources_dir + '/compare_model_model5.yaml'
        _old_model_file = self._resources_dir + '/compare_model_model1.yaml'
        _temp_dir = os.path.join(tempfile.gettempdir(), _method_name)

        if os.path.exists(_temp_dir):
            shutil.rmtree(_temp_dir)

        os.mkdir(_temp_dir)

        mw_home = os.environ['MW_HOME']
        args_map = {
            '-oracle_home': mw_home,
            '-variable_file': _variables_file,
            '-output_dir': _temp_dir,
            '-domain_type': 'WLS',
            '-trailing_arguments': [_new_model_file, _old_model_file]
        }

        try:
            model_context = ModelContext('CompareModelTestCase', args_map)
            obj = ModelFileDiffer(_new_model_file, _old_model_file,
                                  model_context, _temp_dir)
            return_code = obj.compare()
            self.assertEqual(return_code, 0)

            yaml_result = _temp_dir + os.sep + 'diffed_model.yaml'
            stdout_result = obj.get_compare_msgs()
            model_dictionary = FileToPython(yaml_result).parse()
            yaml_exists = os.path.exists(yaml_result)

            self.assertEqual(yaml_exists, True)
            self.assertEqual(len(stdout_result), 0)

            self.assertEqual(model_dictionary.has_key('appDeployments'), True)
            self.assertEqual(
                model_dictionary['appDeployments'].has_key('Library'), True)
            self.assertEqual(
                model_dictionary['appDeployments'].has_key('Application'),
                True)
            self.assertEqual(
                model_dictionary['appDeployments']['Application'].has_key(
                    '!myear'), True)
            self.assertEqual(
                model_dictionary['appDeployments']['Library'].has_key(
                    '!jax-rs#[email protected]'), True)
            self.assertEqual(
                model_dictionary['appDeployments']['Library'].has_key(
                    '!jsf#[email protected]'), True)

        except (CompareException, PyWLSTException), te:
            return_code = 2
            self._logger.severe('WLSDPLY-05709',
                                te.getLocalizedMessage(),
                                error=te,
                                class_name=self._program_name,
                                method_name=_method_name)
コード例 #6
0
    def testCompareModelInvalidModel(self):
        _method_name = 'testCompareModelInvalidModel'

        _variables_file = self._resources_dir + '/compare_model_model1.10.properties'
        _new_model_file = self._resources_dir + '/compare_model_model3.yaml'
        _old_model_file = self._resources_dir + '/compare_model_model1.yaml'
        _temp_dir = os.path.join(tempfile.gettempdir(), _method_name)

        if os.path.exists(_temp_dir):
            shutil.rmtree(_temp_dir)
        os.mkdir(_temp_dir)

        mw_home = os.environ['MW_HOME']
        args_map = {
            '-oracle_home': mw_home,
            '-variable_file': _variables_file,
            '-output_dir': _temp_dir,
            '-domain_type': 'WLS',
            '-trailing_arguments': [_new_model_file, _old_model_file]
        }
        try:
            model_context = ModelContext('CompareModelTestCase', args_map)
            obj = ModelFileDiffer(_new_model_file, _old_model_file,
                                  model_context, _temp_dir)
            return_code = obj.compare()
        except (CompareException, PyWLSTException), te:
            return_code = 2
コード例 #7
0
def __process_args(args):
    """
    Process the command-line arguments and prompt the user for any missing information
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    global __wlst_mode

    cla_util = CommandLineArgUtil(_program_name, __required_arguments,
                                  __optional_arguments)
    required_arg_map, optional_arg_map = cla_util.process_args(args)

    domain_type = dictionary_utils.get_element(
        optional_arg_map, CommandLineArgUtil.DOMAIN_TYPE_SWITCH)
    if domain_type is None:
        domain_type = 'WLS'
    domain_typedef = DomainTypedef(_program_name, domain_type)
    optional_arg_map[CommandLineArgUtil.DOMAIN_TYPEDEF] = domain_typedef

    __verify_required_args_present(required_arg_map)
    __wlst_mode = __process_online_args(optional_arg_map)
    __process_archive_filename_arg(required_arg_map)
    __process_variable_filename_arg(optional_arg_map)

    combined_arg_map = optional_arg_map.copy()
    combined_arg_map.update(required_arg_map)

    return ModelContext(_program_name, combined_arg_map)
コード例 #8
0
    def _is_alias_folder(self, path):
        """
        Check if the delimited path is a folder or attribute
        :param path: '|' delimited path
        :return: true if it is a folder otherwise false
        """
        debug("DEBUG: Entering is_alias_folder %s", path)
        path_tokens = path.split(PATH_TOKEN)
        model_context = ModelContext("test", {})
        aliases = Aliases(model_context=model_context,
                          wlst_mode=WlstModes.OFFLINE)
        location = LocationContext()
        last_token = path_tokens[-1]
        alias_helper = AliasHelper(aliases, __logger, ExceptionType.COMPARE)

        found = True
        name_token_next = False
        for path_token in path_tokens[1:]:
            if name_token_next:
                token_name = aliases.get_name_token(location)
                location.add_name_token(token_name, path_token)
                name_token_next = False
            else:
                location.append_location(path_token)
                if last_token == path_token:
                    break
                name_token_next = alias_helper.supports_multiple_mbean_instances(
                    location)
            attrib_names = alias_helper.get_model_attribute_names(location)
            if last_token in attrib_names:
                found = False

        debug("DEBUG: is_alias_folder %s %s", path, found)

        return found
コード例 #9
0
    def testPersistModelAfterFilter(self):
        """
        Verify filter was run and changes are persisted to model file
        """
        # Setup model context arguments
        _model_file = self._resources_dir + '/simple-model.yaml'
        _archive_file = self._resources_dir + "/SingleAppDomain.zip"
        _method_name = 'testPersistModelAfterFilter'

        mw_home = os.environ['MW_HOME']

        args_map = {
            '-oracle_home': mw_home,
            '-model_file': _model_file,
            '-archive_file': _archive_file
        }

        model_context = ModelContext('validate', args_map)

        aliases = Aliases(model_context, wlst_mode=WlstModes.OFFLINE, exception_type=ExceptionType.DEPLOY)

        # Load model and invoke filter
        model_dictionary = cla_helper.load_model('validateModel', model_context, aliases, "validate", WlstModes.OFFLINE)

        # assert the validate filter made modications and was persisted
        self.assertEquals('gumby1234', model_dictionary['domainInfo']['AdminPassword'], "Expected validate filter to have changed AdminPassword to 'gumby1234'")
コード例 #10
0
    def testPrintUsageFoldersOnly(self):
        _method_name = 'testPrintUsageFoldersOnly'

        _FOLDERS_ONLY = '-folders_only'

        args = {
            '-oracle_home': os.environ['MW_HOME']
        }

        model_paths = [
            'resources:/FileStore'
        ]

        try:
            # Loop through valid list of model sections
            for model_path in model_paths:
                # Set print usage context
                args['-print_usage'] = '%s %s' % (model_path, _FOLDERS_ONLY)
                self._logger.info('args={0}', str(args), class_name=self._class_name, method_name=_method_name)
                model_context = ModelContext(self._program_name, args)
                model_validator = Validator(model_context, wlst_mode=WlstModes.ONLINE)
                model_validator.print_usage(model_path)
                self.assertEquals(True, True)
        except ValidateException, ve:
            self.fail(ve.getLocalizedMessage())
コード例 #11
0
    def testFilterInvokedOnModelValidation(self):
        """
        Verify filter was run and changes are persisted to model file
        """

        # Setup model context arguments
        _model_file = self._resources_dir + '/simple-model.yaml'
        _archive_file = self._resources_dir + "/SingleAppDomain.zip"
        _method_name = 'testFilterInvokedOnModelValidation'

        mw_home = os.environ['MW_HOME']

        args_map = {
            '-oracle_home': mw_home,
            '-model_file': _model_file,
            '-archive_file': _archive_file
        }

        model_context = ModelContext('validate', args_map)

        try:
            # Invoke model validation
            __perform_model_file_validation(_model_file, model_context)

            # read persisted model file and convert to python dictionary
            model_dictionary = FileToPython(self._wlsdeply_store_model,
                                            True)._parse_json()
        except ValidateException, ve:
            self._logger.severe('WLSDPLY-20000',
                                self._program_name,
                                ve.getLocalizedMessage(),
                                error=ve,
                                class_name=self._class_name,
                                method_name=_method_name)
コード例 #12
0
    def setUp(self):
        model_context = ModelContext("test", {CommandLineArgUtil.USE_ENCRYPTION_SWITCH: 'true',
                                              CommandLineArgUtil.PASSPHRASE_SWITCH: self._passphrase})
        self.aliases = Aliases(model_context, wlst_mode=WlstModes.OFFLINE, wls_version=self._wls_version)
        self.online_aliases = Aliases(model_context, wlst_mode=WlstModes.ONLINE, wls_version=self._wls_version)

        self.location = LocationContext()
        self.location.append_location(JDBC_SYSTEM_RESOURCE)
        self.location.add_name_token(self.aliases.get_name_token(self.location), "Mine")
        self.location.append_location(JDBC_RESOURCE)
        self.location.append_location(JDBC_DRIVER_PARAMS)
コード例 #13
0
    def testAttributeNames(self):
        model_context = ModelContext("test", { })
        aliases = Aliases(model_context=model_context, wlst_mode=WlstModes.OFFLINE, wls_version=self.wls_version)

        location = LocationContext()
        self._check_folder('Domain', location, aliases)

        for folder_name in aliases.get_model_top_level_folder_names():
            location = LocationContext()
            location.append_location(folder_name)
            self._check_folder(folder_name, location, aliases)
コード例 #14
0
    def setUp(self):
        model_context = ModelContext("test", {})
        self.aliases = Aliases(model_context,
                               wlst_mode=WlstModes.OFFLINE,
                               wls_version=self._wls_version)
        self.online_aliases = Aliases(model_context,
                                      wlst_mode=WlstModes.ONLINE,
                                      wls_version=self._wls_version)

        self.location = aliases_test.get_jdbc_driver_params_location(
            "Mine", self.aliases)
コード例 #15
0
    def testYamlModelValidation(self):
        """
            Parse and validate a YAML model with '-' list type and attributes with negative values.
        """

        _model_file = self._resources_dir + '/simple-model.yaml'
        _archive_file = self._resources_dir + "/SingleAppDomain.zip"
        _method_name = 'testYamlModelValidation'

        mw_home = os.environ['MW_HOME']
        args_map = {
            '-oracle_home': mw_home,
            '-model_file': _model_file,
            '-archive_file': _archive_file
        }

        model_context = ModelContext('ValidationTestCase', args_map)

        try:
            model_dictionary = FileToPython(model_context.get_model_file()).parse()
            model_validator = Validator(model_context,
                                        wlst_mode=WlstModes.ONLINE)
            return_code = model_validator.validate_in_tool_mode(model_dictionary,
                                                                model_context.get_variable_file(),
                                                                model_context.get_archive_file_name())
            self._logger.info('The Validator.validate_in_tool_mode() call returned {0}',
                              Validator.ReturnCode.from_value(return_code),
                              class_name=self._class_name, method_name=_method_name)
        except TranslateException, te:
            return_code = Validator.ReturnCode.STOP
            self._logger.severe('WLSDPLY-20009',
                                self._program_name,
                                model_context.get_model_file(),
                                te.getLocalizedMessage(), error=te,
                                class_name=self._class_name, method_name=_method_name)
コード例 #16
0
    def testModelValidation(self):
        _method_name = 'testModelValidation'

        _model_file = self._resources_dir + '/variablestest.yaml'
        _variable_file = self._resources_dir + '/variablestest.properties'
        _archive_file = self._resources_dir + '/variablestest.zip'

        mw_home = os.environ['MW_HOME']
        args_map = {
            '-oracle_home': mw_home,
            '-model_file': _model_file,
            '-variable_file': _variable_file,
            '-archive_file': _archive_file
        }

        model_context = ModelContext('ValidationTestCase', args_map)

        try:
            model_dictionary = FileToPython(model_context.get_model_file()).parse()
            model_validator = Validator(model_context,
                                        wlst_mode=WlstModes.ONLINE)
            return_code = model_validator.validate_in_tool_mode(model_dictionary,
                                                                model_context.get_variable_file(),
                                                                model_context.get_archive_file_name())
            self._logger.info('The Validator.validate_in_tool_mode() call returned {0}',
                              Validator.ReturnCode.from_value(return_code),
                              class_name=self._class_name, method_name=_method_name)
        except TranslateException, te:
            return_code = Validator.ReturnCode.STOP
            self._logger.severe('WLSDPLY-20009',
                                self._program_name,
                                model_context.get_model_file(),
                                te.getLocalizedMessage(), error=te,
                                class_name=self._class_name, method_name=_method_name)
コード例 #17
0
    def setUp(self):
        arg_map = dict()
        arg_map[CLA.ORACLE_HOME_SWITCH] = '/my/path/to/oracle'
        arg_map[CLA.TARGET_MODE_SWITCH] = 'offline'

        self._model_context = ModelContext("test", arg_map)
        self._aliases = Aliases(model_context=self._model_context,
                                wlst_mode=WlstModes.OFFLINE,
                                wls_version=self._wls_version)
        self._custom_helper = CustomFolderHelper(self._aliases, self._logger,
                                                 self._model_context,
                                                 ExceptionType.DISCOVER)
        return
コード例 #18
0
def __process_args(args, logger):
    """
    Process the command-line arguments.
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    _method_name = '__process_args'

    cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
    argument_map = cla_util.process_args(args)

    __process_target_arg(argument_map, logger)

    return ModelContext(_program_name, argument_map)
コード例 #19
0
    def setUp(self):
        model_context = ModelContext("test", {})
        self.aliases = Aliases(model_context,
                               wlst_mode=WlstModes.OFFLINE,
                               wls_version=self._wls_version)
        self.online_aliases = Aliases(model_context,
                                      wlst_mode=WlstModes.ONLINE,
                                      wls_version=self._wls_version)

        self.location = LocationContext()
        self.location.append_location(JDBC_SYSTEM_RESOURCE)
        self.location.add_name_token(
            self.aliases.get_name_token(self.location), "Mine")
        self.location.append_location(JDBC_RESOURCE)
        self.location.append_location(JDBC_DRIVER_PARAMS)
コード例 #20
0
    def setUp(self):
        # construct aliases as if the -use_encryption and -passphrase switches were used
        model_context = ModelContext(
            "test", {
                CommandLineArgUtil.USE_ENCRYPTION_SWITCH: 'true',
                CommandLineArgUtil.PASSPHRASE_SWITCH: self._passphrase
            })
        self.aliases = Aliases(model_context,
                               wlst_mode=WlstModes.OFFLINE,
                               wls_version=self._wls_version)
        self.online_aliases = Aliases(model_context,
                                      wlst_mode=WlstModes.ONLINE,
                                      wls_version=self._wls_version)

        self.location = aliases_test.get_jdbc_driver_params_location(
            "Mine", self.aliases)
コード例 #21
0
def __process_args(args):
    """
    Process the command-line arguments.
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    _method_name = '__process_args'

    cla_util = CommandLineArgUtil(_program_name, __required_arguments,
                                  __optional_arguments)
    cla_util.set_allow_multiple_models(True)
    argument_map = cla_util.process_args(args)

    target_configuration_helper.process_target_arguments(argument_map)

    return ModelContext(_program_name, argument_map)
コード例 #22
0
def create_context(program_name, combined_arg_map, domain_typedef=None):
    """
    Create a model context object from the specified argument map, with the domain typedef set up correctly.
    If the domain_typedef is not specified, construct it from the argument map.
    :param program_name: the program name, used for logging
    :param combined_arg_map: all the arguments passed to the program
    :param domain_typedef: a domain typedef object to be used, or None
    :return: the new model context object
    """
    if domain_typedef is None:
        domain_typedef = create_typedef(program_name, combined_arg_map)

    combined_arg_map[CommandLineArgUtil.DOMAIN_TYPEDEF] = domain_typedef
    model_context = ModelContext(program_name, combined_arg_map)
    domain_typedef.set_model_context(model_context)
    return model_context
コード例 #23
0
    def testDelimitedAttributes(self):
        # This test ensures that delimited attributes are always comma-delimited for the model.
        # Space-delimited attributes are allowed to bypass this rule.

        model_context = ModelContext("test", {})
        aliases = Aliases(model_context=model_context,
                          wlst_mode=WlstModes.OFFLINE,
                          wls_version=self.wls_version)

        location = LocationContext()
        self._check_folder(location, aliases)

        for folder_name in aliases.get_model_top_level_folder_names():
            location = LocationContext()
            location.append_location(folder_name)
            self._check_folder(location, aliases)
コード例 #24
0
    def _get_model_help(self, path, control_option):
        try:
            old_out = sys.stdout
            sys.stdout = StringIO()

            model_context = ModelContext(self._program_name, { })
            aliases = Aliases(model_context, WlstModes.OFFLINE, self.wls_version)
            printer = ModelHelpPrinter(aliases, self._logger)
            printer.print_model_help(path, control_option)

            sys.stdout.flush()
            text = sys.stdout.getvalue()
            sys.stdout = old_out
            return text

        except CLAException, e:
            self.fail(e.getLocalizedMessage())
コード例 #25
0
def __process_args(args):
    """
    Process the command-line arguments and prompt the user for any missing information
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
    cla_util.set_allow_multiple_models(True)
    required_arg_map, optional_arg_map = cla_util.process_args(args)

    __verify_required_args_present(required_arg_map)
    __process_model_args(optional_arg_map)
    __process_print_usage_args(optional_arg_map)

    combined_arg_map = optional_arg_map.copy()
    combined_arg_map.update(required_arg_map)

    return ModelContext(_program_name, combined_arg_map)
コード例 #26
0
    def testCompareModel5(self):
        _method_name = 'testCompareModel5'

        _models_dir = self._resources_dir + '/compare'
        _new_model_file = _models_dir + '/model-4-new.yaml'
        _old_model_file = _models_dir + '/model-4-new.yaml'

        _output_dir = os.path.join(self._results_dir, 'model-5')
        if not os.path.isdir(_output_dir):
            os.mkdir(_output_dir)

        args_map = {
            '-oracle_home': '/oracle',
            '-output_dir': _output_dir,
            '-trailing_arguments': [_new_model_file, _old_model_file]
        }

        try:
            model_context = ModelContext('CompareModelTestCase', args_map)
            differ = ModelFileDiffer(_new_model_file, _old_model_file,
                                     model_context, _output_dir)
            return_code = differ.compare()
            self.assertEqual(return_code, 0)

            yaml_result = _output_dir + os.sep + 'diffed_model.yaml'
            self.assertEqual(os.path.exists(yaml_result), False,
                             "YAML result should not exist: " + yaml_result)

            json_result = _output_dir + os.sep + 'diffed_model.json'
            self.assertEqual(os.path.exists(json_result), False,
                             "JSON result should not exist: " + json_result)

            json_result = _output_dir + os.sep + 'compare_model_stdout'
            self.assertEqual(
                os.path.exists(json_result), False,
                "compare_model.stdout result should not exist: " + json_result)

        except (CompareException, PyWLSTException), te:
            return_code = 2
            self._logger.severe('WLSDPLY-05709',
                                te.getLocalizedMessage(),
                                error=te,
                                class_name=self._program_name,
                                method_name=_method_name)
コード例 #27
0
    def testCompareModelInvalidFile(self):
        _method_name = 'testCompareModelInvalidFile'

        _variables_file = self._resources_dir + '/compare_model_model1.10.properties'
        _new_model_file = self._resources_dir + '/compare_model_model4.yaml'
        _old_model_file = self._resources_dir + '/compare_model_model1.yaml'
        _temp_dir = os.path.join(tempfile.gettempdir(), _method_name)

        if os.path.exists(_temp_dir):
            shutil.rmtree(_temp_dir)
        os.mkdir(_temp_dir)

        mw_home = os.environ['MW_HOME']
        args_map = {
            '-oracle_home': mw_home,
            '-variable_file': _variables_file,
            '-output_dir': _temp_dir,
            '-domain_type': 'WLS',
            '-trailing_arguments': [_new_model_file, _old_model_file]
        }

        try:
            model_context = ModelContext('CompareModelTestCase', args_map)
            obj = ModelFileDiffer(_new_model_file, _old_model_file,
                                  model_context, _temp_dir)

            # expected parse error for model4, disable logging
            yaml_logger = PlatformLogger('wlsdeploy.yaml')
            yaml_level = yaml_logger.get_level()
            yaml_logger.set_level(Level.OFF)

            compare_logger = PlatformLogger('wlsdeploy.compare_model')
            compare_level = compare_logger.get_level()
            compare_logger.set_level(Level.OFF)

            return_code = obj.compare()

            # Restore original log levels
            yaml_logger.set_level(yaml_level)
            compare_logger.set_level(compare_level)

        except (CompareException, PyWLSTException), te:
            return_code = 2
コード例 #28
0
def __process_args(args):
    """
    Process the command-line arguments and prompt the user for any missing information
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    global __wlst_mode

    cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
    required_arg_map, optional_arg_map = cla_util.process_args(args)

    __process_model_args(optional_arg_map)
    __process_injector_file(optional_arg_map)
    __process_keywords_file(optional_arg_map)
    __process_properties_file(optional_arg_map)

    combined_arg_map = optional_arg_map.copy()
    combined_arg_map.update(required_arg_map)

    return ModelContext(_program_name, combined_arg_map)
コード例 #29
0
def __process_args(args):
    """
    Process the command-line arguments.
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    _method_name = '__process_args'

    cla_util = CommandLineArgUtil(_program_name, __required_arguments,
                                  __optional_arguments)
    required_arg_map, optional_arg_map = cla_util.process_args(
        args, trailing_arg_count=2)

    cla_helper.verify_required_args_present(_program_name,
                                            __required_arguments,
                                            required_arg_map)

    combined_arg_map = optional_arg_map.copy()
    combined_arg_map.update(required_arg_map)
    return ModelContext(_program_name, combined_arg_map)
コード例 #30
0
def __process_args(args):
    """
    Process the command-line arguments and prompt the user for any missing information
    :param args: the command-line arguments list
    :raises CLAException: if an error occurs while validating and processing the command-line arguments
    """
    global __wlst_mode

    cla_util = CommandLineArgUtil(_program_name, __required_arguments,
                                  __optional_arguments)
    required_arg_map, optional_arg_map = cla_util.process_args(args)

    __verify_required_args_present(required_arg_map)
    __wlst_mode = __process_online_args(optional_arg_map)
    __process_archive_filename_arg(required_arg_map)
    __process_variable_filename_arg(optional_arg_map)

    combined_arg_map = optional_arg_map.copy()
    combined_arg_map.update(required_arg_map)

    return ModelContext(_program_name, combined_arg_map)