Merge pull request #12174 from rabbitmq/mergify/bp/v4.0.x/pr-12172
Minor fix: GET/HEAD method on non existing shovel crash (backport #12172)
This commit is contained in:
		
						commit
						e5aaeef7b3
					
				| 
						 | 
					@ -45,17 +45,22 @@ resource_exists(ReqData, Context) ->
 | 
				
			||||||
                    case name(ReqData) of
 | 
					                    case name(ReqData) of
 | 
				
			||||||
                        none -> true;
 | 
					                        none -> true;
 | 
				
			||||||
                        Name ->
 | 
					                        Name ->
 | 
				
			||||||
                            %% Deleting or restarting a shovel
 | 
					 | 
				
			||||||
                            case get_shovel_node(VHost, Name, ReqData, Context) of
 | 
					                            case get_shovel_node(VHost, Name, ReqData, Context) of
 | 
				
			||||||
                                undefined ->
 | 
					                                undefined ->
 | 
				
			||||||
                                    rabbit_log:error("Shovel with the name '~ts' was not found on virtual host '~ts'. "
 | 
					                                    rabbit_log:error("Shovel with the name '~ts' was not found on virtual host '~ts'. "
 | 
				
			||||||
                                                     "It may be failing to connect and report its status.",
 | 
					                                                     "It may be failing to connect and report its status.",
 | 
				
			||||||
                                        [Name, VHost]),
 | 
					                                        [Name, VHost]),
 | 
				
			||||||
                                    case is_restart(ReqData) of
 | 
					                                    case cowboy_req:method(ReqData) of
 | 
				
			||||||
                                        true -> false;
 | 
					                                        <<"DELETE">> ->
 | 
				
			||||||
                                        %% this is a deletion attempt, it can continue and idempotently try to
 | 
					                                            %% Deleting or restarting a shovel
 | 
				
			||||||
                                        %% delete the shovel
 | 
					                                            case is_restart(ReqData) of
 | 
				
			||||||
                                        false -> true
 | 
					                                                true -> false;
 | 
				
			||||||
 | 
					                                                %% this is a deletion attempt, it can continue and idempotently try to
 | 
				
			||||||
 | 
					                                                %% delete the shovel
 | 
				
			||||||
 | 
					                                                false -> true
 | 
				
			||||||
 | 
					                                            end;
 | 
				
			||||||
 | 
					                                        _ ->
 | 
				
			||||||
 | 
					                                            false
 | 
				
			||||||
                                    end;
 | 
					                                    end;
 | 
				
			||||||
                                _ ->
 | 
					                                _ ->
 | 
				
			||||||
                                    true
 | 
					                                    true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue