mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-04 17:44:11 +02:00
update bollard
This commit is contained in:
parent
f569ca17e2
commit
df38f16f10
23 changed files with 410 additions and 502 deletions
|
|
@ -1,11 +1,11 @@
|
|||
use crate::cloud::Cloud;
|
||||
use bollard::network::CreateNetworkOptions;
|
||||
use bollard::config::NetworkCreateRequest;
|
||||
use bollard::Docker;
|
||||
use miette::{IntoDiagnostic, Result, WrapErr};
|
||||
|
||||
pub async fn clear_networks(docker: &Docker, instances: &[Cloud]) -> Result<()> {
|
||||
let networks = docker
|
||||
.list_networks::<&str>(None)
|
||||
.list_networks(None)
|
||||
.await
|
||||
.into_diagnostic()
|
||||
.wrap_err("Failed to list docker networks")?;
|
||||
|
|
@ -23,7 +23,7 @@ pub async fn clear_networks(docker: &Docker, instances: &[Cloud]) -> Result<()>
|
|||
|
||||
async fn get_network_id(docker: &Docker, name: &str) -> Result<Option<String>> {
|
||||
let networks = docker
|
||||
.list_networks::<&str>(None)
|
||||
.list_networks(None)
|
||||
.await
|
||||
.into_diagnostic()
|
||||
.wrap_err("Failed to list docker networks")?;
|
||||
|
|
@ -41,9 +41,8 @@ pub async fn ensure_network_exists(docker: &Docker, name: &str) -> Result<String
|
|||
Ok(id)
|
||||
} else {
|
||||
Ok(docker
|
||||
.create_network(CreateNetworkOptions {
|
||||
name,
|
||||
check_duplicate: true,
|
||||
.create_network(NetworkCreateRequest {
|
||||
name: name.into(),
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue