def write_version(name):
    '''
    Removes the previous configuration file, then creates a new one and writes
    the name line. This function is intended to be used from states.

    If :mod:`syslog_ng.set_config_file
    <salt.modules.syslog_ng.set_config_file>`, is called before, this function
    will use the set config file.

    CLI Example:

    .. code-block:: bash

        salt '*' syslog_ng.write_version name="3.6"

    '''
    line = '@version: {0}'.format(name)
    try:
        if os.path.exists(__SYSLOG_NG_CONFIG_FILE):
            log.debug(
                'Removing previous configuration file: {0}'.format(
                    __SYSLOG_NG_CONFIG_FILE
                )
            )
            os.remove(__SYSLOG_NG_CONFIG_FILE)
            log.debug('Configuration file successfully removed')

        header = _format_generated_config_header()
        _write_config(config=header, newlines=1)
        _write_config(config=line, newlines=2)

        return _format_state_result(name, result=True)
    except __HOLE__ as err:
        log.error(
            'Failed to remove previous configuration file \'{0}\': {1}'
            .format(__SYSLOG_NG_CONFIG_FILE, str(err))
        )
        return _format_state_result(name, result=False)
dataset/ETHPy150Open saltstack/salt/salt/modules/syslog_ng.py/write_version