Skip to content

Commit 5740e3e

Browse files
committed
Fix volume removal
1 parent c34c630 commit 5740e3e

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/lib.rs

+19-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,25 @@ impl Resource {
193193
Err(e) => self.status = RemovalStatus::Error(RemovalError::Docker(e)),
194194
};
195195
}
196-
ResourceType::Volume => todo!(),
196+
ResourceType::Volume => {
197+
match docker.remove_volume(&self.id, None).await {
198+
Ok(_) => {
199+
self.status = RemovalStatus::Success;
200+
}
201+
Err(DockerResponseServerError {
202+
status_code: 404, ..
203+
}) => {
204+
// Mark as successful if already removed (404)
205+
self.status = RemovalStatus::Success;
206+
}
207+
Err(DockerResponseServerError {
208+
status_code: 409, ..
209+
}) => {
210+
self.status = RemovalStatus::InProgress;
211+
}
212+
Err(e) => self.status = RemovalStatus::Error(RemovalError::Docker(e)),
213+
}
214+
}
197215
}
198216
}
199217
}

0 commit comments

Comments
 (0)