def ping_master(master):
    '''
    .. versionadded:: 2016.3.0

    Sends ping request to the given master. Fires '__master_failback' event on success.
    Returns bool result.

    CLI Example:

    .. code-block:: bash

        salt '*' status.ping_master localhost
    '''
    if master is None or master == '':
        return False

    opts = copy.deepcopy(__opts__)
    opts['master'] = master
    if 'master_ip' in opts:  # avoid 'master ip changed' warning
        del opts['master_ip']
    opts.update(salt.minion.prep_ip_port(opts))
    try:
        opts.update(salt.minion.resolve_dns(opts, fallback=False))
    except Exception:
        return False

    timeout = opts.get('auth_timeout', 60)
    load = {'cmd': 'ping'}

    result = False
    channel = salt.transport.client.ReqChannel.factory(opts, crypt='clear')
    try:
        payload = channel.send(load, tries=0, timeout=timeout)
        result = True
    except Exception as e:
        pass

    if result:
        event = salt.utils.event.get_event('minion', opts=__opts__, listen=False)
        event.fire_event({'master': master}, salt.minion.master_event(type='failback'))

    return result
def ping_master ( master ) : if master is None or master == '' : return False opts = copy . deepcopy ( __opts__ ) opts [ 'master' ] = master if 'master_ip' in opts : del opts [ 'master_ip' ] opts . update ( salt . minion . prep_ip_port ( opts ) ) try : opts . update ( salt . minion . resolve_dns ( opts , fallback = False ) ) except Exception : return False timeout = opts . get ( 'auth_timeout' , 60 ) load = { 'cmd' : 'ping' } result = False channel = salt . transport . client . ReqChannel . factory ( opts , crypt = 'clear' ) try : payload = channel . send ( load , tries = 0 , timeout = timeout ) result = True except Exception as e : pass if result : event = salt . utils . event . get_event ( 'minion' , opts = __opts__ , listen = False ) event . fire_event ( { 'master' : master } , salt . minion . master_event ( type = 'failback' ) ) return result
.. versionadded:: 2016.3.0

    Sends ping request to the given master. Fires '__master_failback' event on success.
    Returns bool result.

    CLI Example:

    .. code-block:: bash

        salt '*' status.ping_master localhost