# Buggy code
def show_low_sls(mods, saltenv="base", test=None, **kwargs):
    """
    Display the low state data from a specific sls or list of sls files on the
    master.

    .. versionadded:: 2016.3.2

    CLI Example:

    .. code-block:: bash

        salt '*' state.show_sls core,edit.vim dev
    """
    __pillar__.update(kwargs.get("pillar", {}))
    __opts__["grains"] = __grains__

    opts = copy.copy(__opts__)
    if salt.utils.test_mode(test=test, **kwargs):
        opts["test"] = True
    else:
        opts["test"] = __opts__.get("test", None)
    st_ = salt.client.ssh.state.SSHHighState(
        __opts__, __pillar__, __salt__, __context__["fileclient"]
    )
    if isinstance(mods, string_types):
        mods = mods.split(",")
    high_data, errors = st_.render_highstate({saltenv: mods})
    high_data, ext_errors = st_.state.reconcile_extend(high_data)
    errors += ext_errors
    errors += st_.state.verify_high(high_data)
    if errors:
        return errors
    high_data, req_in_errors = st_.state.requisite_in(high_data)
    errors += req_in_errors
    high_data = st_.state.apply_exclude(high_data)
    # Verify that the high data is structurally sound
    if errors:
        return errors
    ret = st_.state.compile_high_data(high_data)
    return ret


# Traceback (AttributeError)
root@1404-salt-master ~/.ssh # salt-ssh '*' state.highstate test=True
[CRITICAL] Rendering SLS base.users failed, render error: 'NoneType' object has no attribute 'building_highstate'
zabbix-server:
- Rendering SLS base.users failed, render error: 'NoneType' object has no attribute 'building_highstate'
- Traceback (most recent call last):
-   File "/usr/lib/python2.7/dist-packages/salt/state.py", line 2455, in render_state
-     sls, rendered_sls=mods
-   File "/usr/lib/python2.7/dist-packages/salt/template.py", line 84, in compile_template
-     ret = render(input_data, saltenv, sls, **render_kwargs)
-   File "/usr/lib/python2.7/dist-packages/salt/renderers/pydsl.py", line 358, in render
-     dsl_sls = pydsl.Sls(sls, saltenv, rendered_sls)
-   File "/usr/lib/python2.7/dist-packages/salt/utils/pydsl.py", line 117, in __init__
-     self.included_highstate = HighState.get_active().building_highstate
- AttributeError: 'NoneType' object has no attribute 'building_highstate'
root@1404-salt-master ~/.ssh # salt 'zabbix-server' state.highstate test=True
zabbix-server:
----------
ID: basic-packages
Function: pkg.installed
Result: None
Comment: The following packages are set to be installed/updated: sshfs, ncdu, zip.
Started: 14:47:40.732026
Duration: 971.393 ms
Changes:
----------
…

Summary
-------------
Succeeded: 38 (unchanged=38, changed=23)
Failed:     0
-------------
Total states run:     38

# Fixed code
def show_low_sls(mods, saltenv="base", test=None, **kwargs):
    """
    Display the low state data from a specific sls or list of sls files on the
    master.

    .. versionadded:: 2016.3.2

    CLI Example:

    .. code-block:: bash

        salt '*' state.show_sls core,edit.vim dev
    """
    __pillar__.update(kwargs.get("pillar", {}))
    __opts__["grains"] = __grains__

    opts = copy.copy(__opts__)
    if salt.utils.test_mode(test=test, **kwargs):
        opts["test"] = True
    else:
        opts["test"] = __opts__.get("test", None)
    st_ = salt.client.ssh.state.SSHHighState(
        __opts__, __pillar__, __salt__, __context__["fileclient"]
    )
    st_.push_active()
    if isinstance(mods, string_types):
        mods = mods.split(",")
    high_data, errors = st_.render_highstate({saltenv: mods})
    high_data, ext_errors = st_.state.reconcile_extend(high_data)
    errors += ext_errors
    errors += st_.state.verify_high(high_data)
    if errors:
        return errors
    high_data, req_in_errors = st_.state.requisite_in(high_data)
    errors += req_in_errors
    high_data = st_.state.apply_exclude(high_data)
    # Verify that the high data is structurally sound
    if errors:
        return errors
    ret = st_.state.compile_high_data(high_data)
    _cleanup_slsmod_low_data(ret)
    return ret