def _create_config_model(name, *,
                         config=None,
                         username=DEF_USERNAME,
                         audit_name=DEF_AUDIT_NAME,
                         path=None,
                         parameters=None,
                         parameter_values=None,
                         working_dir=None,
                         script_path='echo 123',
                         skip_invalid_parameters=False):
    result_config = {}

    if script_path is not None:
        result_config['script_path'] = script_path

    if config:
        result_config.update(config)

    result_config['name'] = name

    if parameters is not None:
        result_config['parameters'] = parameters

    if path is None:
        path = name

    if working_dir is not None:
        result_config['working_directory'] = working_dir

    model = ConfigModel(result_config, path, username, audit_name)
    if parameter_values is not None:
        model.set_all_param_values(parameter_values, skip_invalid_parameters=skip_invalid_parameters)

    return model
Example #2
0
def _create_config_model(name, *,
                         config=None,
                         username=DEF_USERNAME,
                         audit_name=DEF_AUDIT_NAME,
                         path=None,
                         parameters=None,
                         parameter_values=None,
                         working_dir=None):
    result_config = {}

    if config:
        result_config.update(config)

    result_config['name'] = name

    if parameters is not None:
        result_config['parameters'] = parameters

    if path is None:
        path = name

    if working_dir is not None:
        result_config['working_directory'] = working_dir

    return ConfigModel(result_config, path, username, audit_name, parameter_values=parameter_values)
Example #3
0
def create_config_model(name,
                        *,
                        config=None,
                        username='******',
                        audit_name='127.0.0.1',
                        path=None,
                        parameters=None,
                        parameter_values=None,
                        script_command='ls',
                        output_files=None):
    result_config = {}

    if config:
        result_config.update(config)

    result_config['name'] = name

    if parameters is not None:
        result_config['parameters'] = parameters

    if path is None:
        path = name

    if output_files is not None:
        result_config['output_files'] = output_files

    result_config['script_path'] = script_command

    return ConfigModel(result_config,
                       path,
                       username,
                       audit_name,
                       parameter_values=parameter_values)
def _create_script_config(parameter_configs):
    config = ConfigModel(
        {
            'name': 'script_x',
            'script_path': 'ls',
            'parameters': parameter_configs
        }, 'script_x.json', 'user1', 'localhost')
    return config
Example #5
0
def create_config_model(name,
                        *,
                        config=None,
                        username='******',
                        audit_name='127.0.0.1',
                        path=None,
                        parameters=None,
                        parameter_values=None,
                        script_command='ls',
                        output_files=None,
                        requires_terminal=None,
                        schedulable=True):
    result_config = {}

    if config:
        result_config.update(config)

    result_config['name'] = name

    if parameters is not None:
        result_config['parameters'] = parameters

    if path is None:
        path = name

    if output_files is not None:
        result_config['output_files'] = output_files

    if requires_terminal is not None:
        result_config['requires_terminal'] = requires_terminal

    if schedulable is not None:
        result_config['scheduling'] = {'enabled': schedulable}

    result_config['script_path'] = script_command

    model = ConfigModel(result_config, path, username, audit_name)
    if parameter_values is not None:
        model.set_all_param_values(model)

    return model