Determines the current hostname by probing  ``uname -n``.
    Falls back to ``hostname`` in case of problems.

    |appteardown| if both failed (usually they don't but consider
    this if you are debugging weird problems..)

    :returns:
        The hostname as string. Domain parts will be split off

def get_hostname():
    '''
    Determines the current hostname by probing  ``uname -n``.
    Falls back to ``hostname`` in case of problems.

    |appteardown| if both failed (usually they don't but consider
    this if you are debugging weird problems..)

    :returns:
        The hostname as string. Domain parts will be split off
    '''

    h = shell_run('uname -n', critical=False, verbose=False)
    if not h:
        h = shell_run('hostname', critical=False, verbose=False)
    if not h:
        shell_notify('could not retrieve hostname', state=True)
    return str(h.get('out')).split('.')[0]