1 Commits
Author SHA1 Message Date
Dreaded_X 41c507a42b feat: Migrate to serde-saphyr
CI / prek (pull_request) Canceled after 0s
CI / cargo shear (pull_request) Canceled after 0s
Committed / committed (pull_request) Canceled after 0s
Audit / cargo audit (push) Failing after 11m53s
2026-10-21 08:05:01 +02:00
6 changed files with 83 additions and 7 deletions
Generated
+75
View File
@@ -17,6 +17,17 @@ version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
[[package]]
name = "annotate-snippets"
version = "0.12.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2a5b0a5ab8561c603f16c3b78c24a386b1f70e7fc1b1b1e8c15738828e4a176"
dependencies = [
"anstyle",
"memchr",
"unicode-width",
]
[[package]]
name = "anstream"
version = "1.0.0"
@@ -76,6 +87,12 @@ dependencies = [
"rustversion",
]
[[package]]
name = "arraydeque"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236"
[[package]]
name = "async-channel"
version = "2.5.0"
@@ -480,6 +497,7 @@ dependencies = [
"schemars",
"semver",
"serde",
"serde-saphyr",
"serde_json",
"serde_yaml",
"socket-pktinfo",
@@ -655,6 +673,15 @@ dependencies = [
"simdutf8",
]
[[package]]
name = "encoding_rs_io"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fba3fe847045ecff794b9c138293a80db914678c453ad63fbf0c6a9eb6e00b22"
dependencies = [
"encoding_rs",
]
[[package]]
name = "equivalent"
version = "1.0.2"
@@ -1805,6 +1832,16 @@ dependencies = [
"zlib-rs",
]
[[package]]
name = "granit-parser"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da55feca5d1625466bae068f9fd4b87892caeae70c3fe671ddb0f50d41aebf37"
dependencies = [
"arraydeque",
"smallvec",
]
[[package]]
name = "h2"
version = "0.4.20"
@@ -2432,12 +2469,27 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "205c45083b6725eb4671392c7c399510ad1498dd0275f1a2e68a70a34ebdf1b1"
[[package]]
name = "nohash-hasher"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
[[package]]
name = "nonempty"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9737e026353e5cd0736f98eddae28665118eb6f6600902a7f50db585621fecb6"
[[package]]
name = "num-traits"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
]
[[package]]
name = "num_enum"
version = "0.7.6"
@@ -3095,6 +3147,23 @@ dependencies = [
"serde_derive",
]
[[package]]
name = "serde-saphyr"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a253edfdea34032da21af84e16fcc94f4c7a6ba237f9f3bc2dbf43cea8535c44"
dependencies = [
"annotate-snippets",
"base64 0.23.1",
"encoding_rs_io",
"granit-parser",
"nohash-hasher",
"num-traits",
"serde_core",
"smallvec",
"zmij",
]
[[package]]
name = "serde_core"
version = "1.0.229"
@@ -3540,6 +3609,12 @@ dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-width"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
[[package]]
name = "unsafe-libyaml"
version = "0.2.11"
+1
View File
@@ -39,6 +39,7 @@ ipxe = { path = "./ipxe" }
axum = { version = "0.8.9", features = ["macros"] }
socket2 = "0.6.5"
socket-pktinfo = "0.4.1"
serde-saphyr = "2.0.0"
[lib]
test = false
+1 -1
View File
@@ -102,7 +102,7 @@ impl Cluster {
path.add_extension("yaml");
let content = tokio::fs::read_to_string(path).await.unwrap();
let mut cluster: OptionalClusterDeserialize = serde_yaml::from_str(&content).unwrap();
let mut cluster: OptionalClusterDeserialize = serde_saphyr::from_str(&content).unwrap();
// For some reason apply on the cluster does not properly apply to the default settings...
// So we manually apply it here first
+2 -2
View File
@@ -102,7 +102,7 @@ pub struct Node {
ntp: String,
install: Install,
kernel_args: Vec<String>,
patches: Patches<serde_yaml::Value>,
patches: Patches<serde_json::Value>,
sops: Secret,
}
@@ -124,7 +124,7 @@ impl Node {
path.add_extension("yaml");
let content = tokio::fs::read_to_string(path).await.unwrap();
let node: OptionalNodeDeserialize = serde_yaml::from_str(&content).unwrap();
let node: OptionalNodeDeserialize = serde_saphyr::from_str(&content).unwrap();
// We want all vectors to be empty vectors by default
// Sadly we have to this manually
+3 -3
View File
@@ -21,7 +21,7 @@ async fn render(
env: &Environment<'static>,
cluster: &Cluster,
node: &Node,
) -> Vec<serde_yaml::Value> {
) -> Vec<serde_json::Value> {
let env = env.clone();
let cluster = cluster.clone();
let node = node.clone();
@@ -40,7 +40,7 @@ async fn render(
})
.unwrap();
serde_yaml::from_str(&content).unwrap()
serde_saphyr::from_str(&content).unwrap()
})
.collect()
})
@@ -64,7 +64,7 @@ impl Patches<String> {
env: &Environment<'static>,
cluster: &Cluster,
node: &Node,
) -> Patches<serde_yaml::Value> {
) -> Patches<serde_json::Value> {
Patches {
all: render(self.all.clone(), env, cluster, node).await,
control_plane: render(self.control_plane.clone(), env, cluster, node).await,
+1 -1
View File
@@ -20,7 +20,7 @@ pub async fn get_current_context() -> Option<String> {
tokio::fs::read(&TalosConfig::merged_path())
.await
.ok()
.and_then(|config| serde_yaml::from_slice(&config).ok())
.and_then(|config| serde_saphyr::from_slice(&config).ok())
.map(|config: TalosConfig| config.context)
}