Added an optional timeout_seconds parameter to stopContainer
Some checks failed
Build & Upload tux-dock / build (push) Has been cancelled
Some checks failed
Build & Upload tux-dock / build (push) Has been cancelled
This commit is contained in:
parent
15f74616d5
commit
442ad330ae
4 changed files with 37 additions and 10 deletions
|
|
@ -157,8 +157,12 @@ bool DockerManager::deleteImage(const std::string& id, std::string& message) con
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DockerManager::stopContainer(const std::string& id, std::string& message) const {
|
||||
const auto stop_request = [this, &id] { return engine_.request("POST", "/containers/" + id + "/stop"); };
|
||||
bool DockerManager::stopContainer(const std::string& id,
|
||||
std::string& message,
|
||||
int timeout_seconds) const {
|
||||
const auto stop_request = [this, &id, timeout_seconds] {
|
||||
return engine_.request("POST", "/containers/" + id + "/stop?t=" + std::to_string(timeout_seconds));
|
||||
};
|
||||
const auto acceptable = [](const EngineResponse& response) {
|
||||
return response.status_code == 204 || response.status_code == 304 || response.status_code == 404 || response.ok();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue