diff --git a/rust/src/api.rs b/rust/src/api.rs index 4ded5eb4..84e5d141 100644 --- a/rust/src/api.rs +++ b/rust/src/api.rs @@ -186,7 +186,13 @@ impl Server { )); } - if self.attributes.get(&attribute).as_array().unwrap().contains(&value) { + if self + .attributes + .get(&attribute) + .as_array() + .unwrap() + .contains(&value) + { return Ok(self); } @@ -220,7 +226,13 @@ impl Server { )); } - if !self.attributes.get(&attribute).as_array().unwrap().contains(&value) { + if !self + .attributes + .get(&attribute) + .as_array() + .unwrap() + .contains(&value) + { return Ok(self); } diff --git a/rust/src/config.rs b/rust/src/config.rs index f812548f..6516d487 100644 --- a/rust/src/config.rs +++ b/rust/src/config.rs @@ -7,10 +7,10 @@ use signature::Signer; use crate::API_VERSION; -pub const ENV_NAME_BASE_URL: &'static str = "SERVERADMIN_BASE_URL"; -pub const ENV_NAME_TOKEN: &'static str = "SERVERADMIN_TOKEN"; -pub const ENV_NAME_KEY_PATH: &'static str = "SERVERADMIN_KEY_PATH"; -pub const ENV_NAME_SSH_AGENT: &'static str = "SSH_AUTH_SOCK"; +pub const ENV_NAME_BASE_URL: &str = "SERVERADMIN_BASE_URL"; +pub const ENV_NAME_TOKEN: &str = "SERVERADMIN_TOKEN"; +pub const ENV_NAME_KEY_PATH: &str = "SERVERADMIN_KEY_PATH"; +pub const ENV_NAME_SSH_AGENT: &str = "SSH_AUTH_SOCK"; #[derive(Clone, Debug, Default)] pub struct Config { diff --git a/rust/src/new_object.rs b/rust/src/new_object.rs index 541e2be9..741e46b3 100644 --- a/rust/src/new_object.rs +++ b/rust/src/new_object.rs @@ -23,7 +23,10 @@ impl NewObject { }) } - pub async fn get_or_create(servertype: impl ToString, hostname: impl ToString) -> anyhow::Result { + pub async fn get_or_create( + servertype: impl ToString, + hostname: impl ToString, + ) -> anyhow::Result { let mut new_object = Self::request_new(servertype).await?; if let Ok(server) = Query::builder() @@ -32,7 +35,8 @@ impl NewObject { .build() .request() .await? - .one() { + .one() + { new_object.object_id = Some(server.object_id); new_object.attributes = server.attributes; }