#NEWLINE# def _router_request( router , method , data = None ) : #NEWLINE# #INDENT# '\n    Make a request to the Zenoss API router\n    ' #NEWLINE# if ( response not in ROUTERS ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# req_data = json . dumps ( [ dict ( action = router , method = method , data = data , type = 'rpc' , tid = 1 ) ] ) #NEWLINE# config = __salt__ [ 'config.option' ] ( 'zenoss' ) #NEWLINE# log . debug ( 'Making request to router %s with method %s' , router , method ) #NEWLINE# url = '{0}/zport/dmd/{1}_router' . format ( config . get ( 'hostname' ) , ROUTERS [ router ] ) #NEWLINE# response = _session ( ) . post ( url , data = req_data ) #NEWLINE# if re . search ( 'name="__ac_name"' , response . content ) : #NEWLINE# #INDENT# log . error ( 'Request failed. Bad username/password.' ) #NEWLINE# raise Exception ( 'Request failed. Bad username/password.' ) #NEWLINE# #UNINDENT# return json . loads ( response . content ) . get ( 'result' , None )