Load a ruleset from the specific file, overwriting the currently loaded ruleset.

    file:
        Full path to the file containing the ruleset.

    noop:
        Don't actually load the rules, just parse them.

    CLI example:

    .. code-block:: bash

        salt '*' pf.load /etc/pf.conf.d/lockdown.conf

def load(file='/etc/pf.conf', noop=False):
    '''
    Load a ruleset from the specific file, overwriting the currently loaded ruleset.

    file:
        Full path to the file containing the ruleset.

    noop:
        Don't actually load the rules, just parse them.

    CLI example:

    .. code-block:: bash

        salt '*' pf.load /etc/pf.conf.d/lockdown.conf
    '''
    # We cannot precisely determine if loading the ruleset implied
    # any changes so assume it always does.
    ret = {'changes': True}
    cmd = ['pfctl', '-f', file]

    if noop:
        ret['changes'] = False
        cmd.append('-n')

    result = __salt__['cmd.run_all'](cmd,
                                     output_loglevel='trace',
                                     python_shell=False)

    if result['retcode'] != 0:
        raise CommandExecutionError(
            'Problem loading the ruleset from {0}'.format(file),
            info={'errors': [result['stderr']], 'changes': False}
        )

    return ret