feat: Migrate to serde-saphyr
This commit is contained in:
Generated
+75
@@ -17,6 +17,17 @@ version = "0.2.21"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
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]]
|
[[package]]
|
||||||
name = "anstream"
|
name = "anstream"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@@ -76,6 +87,12 @@ dependencies = [
|
|||||||
"rustversion",
|
"rustversion",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "arraydeque"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-channel"
|
name = "async-channel"
|
||||||
version = "2.5.0"
|
version = "2.5.0"
|
||||||
@@ -480,6 +497,7 @@ dependencies = [
|
|||||||
"schemars",
|
"schemars",
|
||||||
"semver",
|
"semver",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde-saphyr",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
"socket-pktinfo",
|
"socket-pktinfo",
|
||||||
@@ -655,6 +673,15 @@ dependencies = [
|
|||||||
"simdutf8",
|
"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]]
|
[[package]]
|
||||||
name = "equivalent"
|
name = "equivalent"
|
||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
@@ -1805,6 +1832,16 @@ dependencies = [
|
|||||||
"zlib-rs",
|
"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]]
|
[[package]]
|
||||||
name = "h2"
|
name = "h2"
|
||||||
version = "0.4.20"
|
version = "0.4.20"
|
||||||
@@ -2432,12 +2469,27 @@ version = "0.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "205c45083b6725eb4671392c7c399510ad1498dd0275f1a2e68a70a34ebdf1b1"
|
checksum = "205c45083b6725eb4671392c7c399510ad1498dd0275f1a2e68a70a34ebdf1b1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nohash-hasher"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nonempty"
|
name = "nonempty"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9737e026353e5cd0736f98eddae28665118eb6f6600902a7f50db585621fecb6"
|
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]]
|
[[package]]
|
||||||
name = "num_enum"
|
name = "num_enum"
|
||||||
version = "0.7.6"
|
version = "0.7.6"
|
||||||
@@ -3095,6 +3147,23 @@ dependencies = [
|
|||||||
"serde_derive",
|
"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]]
|
[[package]]
|
||||||
name = "serde_core"
|
name = "serde_core"
|
||||||
version = "1.0.229"
|
version = "1.0.229"
|
||||||
@@ -3540,6 +3609,12 @@ dependencies = [
|
|||||||
"tinyvec",
|
"tinyvec",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-width"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unsafe-libyaml"
|
name = "unsafe-libyaml"
|
||||||
version = "0.2.11"
|
version = "0.2.11"
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ ipxe = { path = "./ipxe" }
|
|||||||
axum = { version = "0.8.9", features = ["macros"] }
|
axum = { version = "0.8.9", features = ["macros"] }
|
||||||
socket2 = "0.6.5"
|
socket2 = "0.6.5"
|
||||||
socket-pktinfo = "0.4.1"
|
socket-pktinfo = "0.4.1"
|
||||||
|
serde-saphyr = "2.0.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
test = false
|
test = false
|
||||||
|
|||||||
+1
-1
@@ -102,7 +102,7 @@ impl Cluster {
|
|||||||
path.add_extension("yaml");
|
path.add_extension("yaml");
|
||||||
let content = tokio::fs::read_to_string(path).await.unwrap();
|
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...
|
// For some reason apply on the cluster does not properly apply to the default settings...
|
||||||
// So we manually apply it here first
|
// So we manually apply it here first
|
||||||
|
|||||||
+2
-2
@@ -102,7 +102,7 @@ pub struct Node {
|
|||||||
ntp: String,
|
ntp: String,
|
||||||
install: Install,
|
install: Install,
|
||||||
kernel_args: Vec<String>,
|
kernel_args: Vec<String>,
|
||||||
patches: Patches<serde_yaml::Value>,
|
patches: Patches<serde_json::Value>,
|
||||||
sops: Secret,
|
sops: Secret,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ impl Node {
|
|||||||
path.add_extension("yaml");
|
path.add_extension("yaml");
|
||||||
let content = tokio::fs::read_to_string(path).await.unwrap();
|
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
|
// We want all vectors to be empty vectors by default
|
||||||
// Sadly we have to this manually
|
// Sadly we have to this manually
|
||||||
|
|||||||
+3
-3
@@ -21,7 +21,7 @@ async fn render(
|
|||||||
env: &Environment<'static>,
|
env: &Environment<'static>,
|
||||||
cluster: &Cluster,
|
cluster: &Cluster,
|
||||||
node: &Node,
|
node: &Node,
|
||||||
) -> Vec<serde_yaml::Value> {
|
) -> Vec<serde_json::Value> {
|
||||||
let env = env.clone();
|
let env = env.clone();
|
||||||
let cluster = cluster.clone();
|
let cluster = cluster.clone();
|
||||||
let node = node.clone();
|
let node = node.clone();
|
||||||
@@ -40,7 +40,7 @@ async fn render(
|
|||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
serde_yaml::from_str(&content).unwrap()
|
serde_saphyr::from_str(&content).unwrap()
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
})
|
})
|
||||||
@@ -64,7 +64,7 @@ impl Patches<String> {
|
|||||||
env: &Environment<'static>,
|
env: &Environment<'static>,
|
||||||
cluster: &Cluster,
|
cluster: &Cluster,
|
||||||
node: &Node,
|
node: &Node,
|
||||||
) -> Patches<serde_yaml::Value> {
|
) -> Patches<serde_json::Value> {
|
||||||
Patches {
|
Patches {
|
||||||
all: render(self.all.clone(), env, cluster, node).await,
|
all: render(self.all.clone(), env, cluster, node).await,
|
||||||
control_plane: render(self.control_plane.clone(), env, cluster, node).await,
|
control_plane: render(self.control_plane.clone(), env, cluster, node).await,
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ pub async fn get_current_context() -> Option<String> {
|
|||||||
tokio::fs::read(&TalosConfig::merged_path())
|
tokio::fs::read(&TalosConfig::merged_path())
|
||||||
.await
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|config| serde_yaml::from_slice(&config).ok())
|
.and_then(|config| serde_saphyr::from_slice(&config).ok())
|
||||||
.map(|config: TalosConfig| config.context)
|
.map(|config: TalosConfig| config.context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user