def set_master(service,
               conn_type,
               private='y',
               unpriv='y',
               chroot='y',
               wakeup='n',
               maxproc='100',
               command='',
               write_conf=True,
               path=MASTER_CF):
    '''
    Set a single config value in the master.cf file. If the value does not
    already exist, it will be appended to the end.

    Because of shell parsing issues, '-' cannot be set as a value, as is normal
    in the master.cf file; either 'y', 'n' or a number should be used when
    calling this function from the command line. If the value used matches the
    default, it will internally be converted to a '-'. Calling this function
    from the Python API is not affected by this limitation

    The settings and their default values, in order, are: service (required),
    conn_type (required), private (y), unpriv (y), chroot (y), wakeup (n),
    maxproc (100), command (required).

    By default, this function will write out the changes to the master.cf file,
    and then returns the full contents of the file. By setting the
    ``write_conf`` option to ``False``, it will skip writing the file.

    CLI Example:

        salt <minion> postfix.set_master smtp inet n y n n 100 smtpd
    '''
    conf_dict, conf_list = _parse_master(path)

    new_conf = []
    dict_key = '{0} {1}'.format(service, conn_type)
    new_line = _format_master(
        service,
        conn_type,
        private,
        unpriv,
        chroot,
        wakeup,
        maxproc,
        command,
    )
    for line in conf_list:
        if isinstance(line, dict):
            if line['service'] == service and line['conn_type'] == conn_type:
                # This is the one line that we're changing
                new_conf.append(new_line)
            else:
                # No changes to this line, but it still needs to be
                # formatted properly
                new_conf.append(_format_master(**line))
        else:
            # This line is a comment or is empty
            new_conf.append(line)

    if conf_dict not in dict_key:
        # This config value does not exist, so append it to the end
        new_conf.append(new_line)

    if write_conf:
        _write_conf(new_conf, path)
    return '\n'.join(new_conf)
dataset/ETHPy150Open saltstack/salt/salt/modules/postfix.py/set_master/swapped operands of `not in`