Skip to content

Commit

Permalink
Hardening the commission procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
HoKim98 committed Sep 11, 2022
1 parent 080aafe commit f631e2f
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions kiss/gateway/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use actix_web::{
App, HttpResponse, HttpServer, Responder,
};
use ipis::{
core::{anyhow::Result, chrono::Utc},
core::{
anyhow::{bail, Result},
chrono::Utc,
},
env::infer,
log::warn,
logger,
Expand Down Expand Up @@ -114,25 +117,7 @@ async fn get_commission(client: Data<Arc<Client>>, Json(spec): Json<BoxSpec>) ->
api.patch(&name, &pp, &patch).await?;
api.patch_status(&name, &pp, &patch).await?;
}
Err(_) => {
let data = BoxCrd {
metadata: ObjectMeta {
name: Some(name.clone()),
..Default::default()
},
spec,
status: Some(BoxStatus {
state: BoxState::Ready,
bind_group: None,
last_updated: Utc::now(),
}),
};
let pp = PostParams {
dry_run: false,
field_manager: Some("kiss-gateway".into()),
};
api.create(&pp, &data).await?;
}
Err(_) => bail!("no such box: {name}"),
}
Ok(())
}
Expand Down

0 comments on commit f631e2f

Please sign in to comment.