# Buggy code
def peer(name):
    """
    Add another node into the peer list.

    name
        The remote host to probe.

    CLI Example:

    .. code-block:: bash

        salt 'one.gluster.*' glusterfs.peer two

    GLUSTER direct CLI example (to show what salt is sending to gluster):

        $ gluster peer probe ftp2

    GLUSTER CLI 3.4.4 return example (so we know what we are parsing):
        #if the "peer" is the local host:
        peer probe: success: on localhost not needed

        #if the peer was just added:
        peer probe: success

        #if the peer was already part of the cluster:
        peer probe: success: host ftp2 port 24007 already in peer list



    """
    if suc.check_name(name, "a-zA-Z0-9._-"):
        raise SaltInvocationError('Invalid characters in peer name "{0}"'.format(name))

    cmd = "peer probe {0}".format(name)

    op_result = {
        "exitval": _gluster_xml(cmd).find("opRet").text,
        "output": _gluster_xml(cmd).find("output").text,
    }
    return op_result


# Traceback (TypeError)
2016-02-05 10:07:01,763 [salt.state       ][INFO    ][25335] Running state [10.129.2.33] at time 10:07:01.762913
2016-02-05 10:07:01,763 [salt.state       ][INFO    ][25335] Executing state glusterfs.peered for 10.129.2.33 <-- This is the primary glusterfs host
2016-02-05 10:07:01,764 [salt.loaded.int.module.cmdmod][INFO    ][25335] Executing command 'gluster --xml --mode=script' in directory '/root'
2016-02-05 10:07:01,871 [salt.loaded.int.module.cmdmod][INFO    ][25335] Executing command 'gluster --xml --mode=script' in directory '/root'
2016-02-05 10:07:01,964 [salt.loaded.int.module.cmdmod][INFO    ][25335] Executing command 'gluster --xml --mode=script' in directory '/root'
2016-02-05 10:07:02,057 [salt.state       ][ERROR   ][25335] An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1624, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1491, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/states/glusterfs.py", line 83, in peered
elif 'on localhost not needed' in ret['comment']:
TypeError: argument of type 'bool' is not iterable

# Fixed code
def peer(name):
    """
    Add another node into the peer list.

    name
        The remote host to probe.

    CLI Example:

    .. code-block:: bash

        salt 'one.gluster.*' glusterfs.peer two

    GLUSTER direct CLI example (to show what salt is sending to gluster):

        $ gluster peer probe ftp2

    GLUSTER CLI 3.4.4 return example (so we know what we are parsing):
        #if the "peer" is the local host:
        peer probe: success: on localhost not needed

        #if the peer was just added:
        peer probe: success

        #if the peer was already part of the cluster:
        peer probe: success: host ftp2 port 24007 already in peer list



    """
    if suc.check_name(name, "a-zA-Z0-9._-"):
        raise SaltInvocationError('Invalid characters in peer name "{0}"'.format(name))

    cmd = "peer probe {0}".format(name)

    op_result = {
        "exitval": _gluster_xml(cmd).find("opErrno").text,
        "output": _gluster_xml(cmd).find("output").text,
    }
    return op_result