def proxy_reconnect(proxy_name, opts=None):
    '''
    Forces proxy minion reconnection when not alive.

    proxy_name
        The virtual name of the proxy module.

    opts: None
        Opts dictionary. Not intended for CLI usage.

    CLI Example:

        salt '*' status.proxy_reconnect rest_sample
    '''

    if not opts:
        opts = __opts__

    if 'proxy' not in opts:
        return False  # fail

    proxy_keepalive_fn = proxy_name+'.alive'
    if proxy_keepalive_fn not in __proxy__:
        return False  # fail

    is_alive = __proxy__[proxy_keepalive_fn](opts)
    if not is_alive:
        minion_id = opts.get('proxyid', '') or opts.get('id', '')
        log.info('%s (%s proxy) is down. Restarting.', minion_id, proxy_name)
        __proxy__[proxy_name+'.shutdown'](opts)  # safely close connection
        __proxy__[proxy_name+'.init'](opts)  # reopen connection
        log.debug('Restarted %s (%s proxy)!', minion_id, proxy_name)

    return True
def proxy_reconnect ( proxy_name , opts = None ) : if not opts : opts = __opts__ if 'proxy' not in opts : return False proxy_keepalive_fn = proxy_name + '.alive' if proxy_keepalive_fn not in __proxy__ : return False is_alive = __proxy__ [ proxy_keepalive_fn ] ( opts ) if not is_alive : minion_id = opts . get ( 'proxyid' , '' ) or opts . get ( 'id' , '' ) log . info ( '%s (%s proxy) is down. Restarting.' , minion_id , proxy_name ) __proxy__ [ proxy_name + '.shutdown' ] ( opts ) __proxy__ [ proxy_name + '.init' ] ( opts ) log . debug ( 'Restarted %s (%s proxy)!' , minion_id , proxy_name ) return True
Forces proxy minion reconnection when not alive.

    proxy_name
        The virtual name of the proxy module.

    opts: None
        Opts dictionary. Not intended for CLI usage.

    CLI Example:

        salt '*' status.proxy_reconnect rest_sample