(
&self,
sandbox_id: &str,
sandbox_name: &str,
)
| 846 | } |
| 847 | |
| 848 | async fn delete_sandbox_inner( |
| 849 | &self, |
| 850 | sandbox_id: &str, |
| 851 | sandbox_name: &str, |
| 852 | ) -> Result<bool, Status> { |
| 853 | let pending = self.remove_pending_sandbox(sandbox_id, sandbox_name).await; |
| 854 | if let Some(record) = pending.as_ref() |
| 855 | && let Some(task) = record.task.as_ref() |
| 856 | { |
| 857 | task.abort(); |
| 858 | } |
| 859 | |
| 860 | let Some(container) = self |
| 861 | .find_managed_container_summary(sandbox_id, sandbox_name) |
| 862 | .await? |
| 863 | else { |
| 864 | if let Some(record) = pending { |
| 865 | let container_name = container_name_for_sandbox(&record.sandbox); |
| 866 | match self |
| 867 | .docker |
| 868 | .remove_container( |
| 869 | &container_name, |
| 870 | Some(RemoveContainerOptionsBuilder::default().force(true).build()), |
| 871 | ) |
| 872 | .await |
| 873 | { |
| 874 | Ok(()) => { |
| 875 | cleanup_sandbox_token_file(&record.sandbox, &self.config); |
| 876 | return Ok(true); |
| 877 | } |
| 878 | Err(err) if is_not_found_error(&err) => { |
| 879 | cleanup_sandbox_token_file(&record.sandbox, &self.config); |
| 880 | return Ok(true); |
| 881 | } |
| 882 | Err(err) => { |
| 883 | return Err(internal_status("delete docker sandbox container", err)); |
| 884 | } |
| 885 | } |
| 886 | } |
| 887 | return Ok(false); |
| 888 | }; |
| 889 | let Some(target) = summary_container_target(&container) else { |
| 890 | return Ok(pending.is_some()); |
| 891 | }; |
| 892 | |
| 893 | match self |
| 894 | .docker |
| 895 | .remove_container( |
| 896 | &target, |
| 897 | Some(RemoveContainerOptionsBuilder::default().force(true).build()), |
| 898 | ) |
| 899 | .await |
| 900 | { |
| 901 | Ok(()) => { |
| 902 | cleanup_sandbox_token_file_for_delete(sandbox_id, pending.as_ref(), &self.config); |
| 903 | Ok(true) |
| 904 | } |
| 905 | Err(err) if is_not_found_error(&err) => { |
no test coverage detected