@@ -114,12 +114,13 @@ action(status, [], RpcTimeout) ->
114114 io :format (" Status of all running nodes...~n " , []),
115115 call_all_nodes (
116116 fun ({Node , Pid }) ->
117- Status = rpc :call (Node , rabbit , status , [], RpcTimeout ),
117+ RabbitRunning =
118+ case is_rabbit_running (Node , RpcTimeout ) of
119+ false -> not_running ;
120+ true -> running
121+ end ,
118122 io :format (" Node '~p ' with Pid ~p : ~p~n " ,
119- [Node , Pid , case parse_status (Status ) of
120- false -> not_running ;
121- true -> running
122- end ])
123+ [Node , Pid , RabbitRunning ])
123124 end );
124125
125126action (stop_all , [], RpcTimeout ) ->
@@ -197,7 +198,7 @@ start_node(NodeName, NodePort, RpcTimeout) ->
197198wait_for_rabbit_to_start (_ , RpcTimeout , _ ) when RpcTimeout < 0 ->
198199 false ;
199200wait_for_rabbit_to_start (Node , RpcTimeout , Port ) ->
200- case parse_status ( rpc : call ( Node , rabbit , status , []) ) of
201+ case is_rabbit_running ( Node , RpcTimeout ) of
201202 true -> true ;
202203 false -> receive
203204 {'EXIT' , Port , PosixCode } ->
@@ -211,22 +212,20 @@ wait_for_rabbit_to_start(Node, RpcTimeout, Port) ->
211212run_cmd (FullPath ) ->
212213 erlang :open_port ({spawn , FullPath }, [nouse_stdio ]).
213214
214- parse_status ({badrpc , _ }) ->
215- false ;
216-
217- parse_status (Status ) ->
218- case lists :keysearch (running_applications , 1 , Status ) of
219- {value , {running_applications , Apps }} ->
220- lists :keymember (rabbit , 1 , Apps );
221- _ ->
222- false
215+ is_rabbit_running (Node , RpcTimeout ) ->
216+ case rpc :call (Node , rabbit , status , [], RpcTimeout ) of
217+ {badrpc , _ } -> false ;
218+ Status -> case proplists :get_value (running_applications , Status ) of
219+ undefined -> false ;
220+ Apps -> lists :keymember (rabbit , 1 , Apps )
221+ end
223222 end .
224223
225224with_os (Handlers ) ->
226225 {OsFamily , _ } = os :type (),
227- case lists : keysearch (OsFamily , 1 , Handlers ) of
228- { value , { _ , Handler }} -> Handler ( );
229- false -> throw ({ unsupported_os , OsFamily } )
226+ case proplists : get_value (OsFamily , Handlers ) of
227+ undefined -> throw ({ unsupported_os , OsFamily } );
228+ Handler -> Handler ( )
230229 end .
231230
232231script_filename () ->
0 commit comments