mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-12-24 12:43:48 +01:00
Add raw handling to process actor
This commit is contained in:
parent
b8092e9090
commit
5fdfae295a
17
Cargo.lock
generated
17
Cargo.lock
generated
@ -425,6 +425,12 @@ version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
|
||||
|
||||
[[package]]
|
||||
name = "bitfield"
|
||||
version = "0.13.2"
|
||||
@ -999,6 +1005,7 @@ dependencies = [
|
||||
"async-process",
|
||||
"async-trait",
|
||||
"backtrace",
|
||||
"base64 0.21.0",
|
||||
"capnp",
|
||||
"capnp-rpc",
|
||||
"chrono",
|
||||
@ -1467,7 +1474,7 @@ version = "7.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ea9fe3952d32674a14e0975009a3547af9ea364995b5ec1add2e23c2ae523ab"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"base64 0.13.0",
|
||||
"byteorder",
|
||||
"crossbeam-channel",
|
||||
"flate2",
|
||||
@ -2541,7 +2548,7 @@ version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"base64 0.13.0",
|
||||
"blake2b_simd",
|
||||
"constant_time_eq",
|
||||
"crossbeam-utils",
|
||||
@ -2583,7 +2590,7 @@ version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"base64 0.13.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2592,7 +2599,7 @@ version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"base64 0.13.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3135,7 +3142,7 @@ dependencies = [
|
||||
"async-stream",
|
||||
"async-trait",
|
||||
"axum",
|
||||
"base64",
|
||||
"base64 0.13.0",
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
|
@ -43,6 +43,7 @@ backtrace = "0.3.65"
|
||||
miette = { version = "4.7.1", features = ["fancy"] }
|
||||
thiserror = "1.0.31"
|
||||
toml = "0.5.8"
|
||||
base64 = "0.21"
|
||||
|
||||
# Well-known paths/dirs for e.g. cache
|
||||
dirs = "4.0.0"
|
||||
|
@ -1,6 +1,7 @@
|
||||
use futures_util::future::BoxFuture;
|
||||
use std::collections::HashMap;
|
||||
use std::process::{Command, Stdio};
|
||||
use base64::Engine;
|
||||
|
||||
use crate::actors::Actor;
|
||||
use crate::db::ArchivedValue;
|
||||
@ -39,25 +40,30 @@ impl Actor for Process {
|
||||
.args(self.args.iter())
|
||||
.arg(&self.name);
|
||||
|
||||
match &state.as_ref().inner.state {
|
||||
ArchivedStatus::Free => {
|
||||
command.arg("free");
|
||||
}
|
||||
ArchivedStatus::InUse(by) => {
|
||||
command.arg("inuse").arg(by.id.as_str());
|
||||
}
|
||||
ArchivedStatus::ToCheck(by) => {
|
||||
command.arg("tocheck").arg(by.id.as_str());
|
||||
}
|
||||
ArchivedStatus::Blocked(by) => {
|
||||
command.arg("blocked").arg(by.id.as_str());
|
||||
}
|
||||
ArchivedStatus::Disabled => {
|
||||
command.arg("disabled");
|
||||
}
|
||||
ArchivedStatus::Reserved(by) => {
|
||||
command.arg("reserved").arg(by.id.as_str());
|
||||
if state.as_ref().raw.is_empty() {
|
||||
match &state.as_ref().inner.state {
|
||||
ArchivedStatus::Free => {
|
||||
command.arg("free");
|
||||
}
|
||||
ArchivedStatus::InUse(by) => {
|
||||
command.arg("inuse").arg(by.id.as_str());
|
||||
}
|
||||
ArchivedStatus::ToCheck(by) => {
|
||||
command.arg("tocheck").arg(by.id.as_str());
|
||||
}
|
||||
ArchivedStatus::Blocked(by) => {
|
||||
command.arg("blocked").arg(by.id.as_str());
|
||||
}
|
||||
ArchivedStatus::Disabled => {
|
||||
command.arg("disabled");
|
||||
}
|
||||
ArchivedStatus::Reserved(by) => {
|
||||
command.arg("reserved").arg(by.id.as_str());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let b64 = base64::prelude::BASE64_STANDARD_NO_PAD.encode(&state.as_ref().raw);
|
||||
command.arg("raw").arg(b64);
|
||||
}
|
||||
|
||||
let name = self.name.clone();
|
||||
|
Loading…
Reference in New Issue
Block a user