diff --git a/Cargo.lock b/Cargo.lock index c9d65edc..a89429bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -84,6 +84,17 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" +[[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" @@ -170,6 +181,12 @@ dependencies = [ "password-hash", ] +[[package]] +name = "arraydeque" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" + [[package]] name = "assert-json-diff" version = "2.0.2" @@ -428,8 +445,8 @@ dependencies = [ "secrecy", "security-framework", "serde", + "serde-saphyr", "serde_json", - "serde_yaml", "serial_test", "sha1", "sha2 0.11.1", @@ -774,6 +791,12 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + [[package]] name = "cpubits" version = "0.1.1" @@ -1302,6 +1325,29 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" +[[package]] +name = "encoding_rs" +version = "0.8.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89253175e704ab869b04f9db224d38630e0211a53841a79181deae0889e169f5" +dependencies = [ + "cfg-if", + "core_detect", + "multiversion_no_op", + "rustversion", + "scopeguard", + "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 = "endian-type" version = "0.2.0" @@ -1638,6 +1684,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "granit-parser" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f05586d4d4df3d47123207826c40b252728b438a1a07bad3c01ee6bea401df" +dependencies = [ + "arraydeque", + "smallvec", +] + [[package]] name = "group" version = "0.14.0" @@ -2597,6 +2653,12 @@ dependencies = [ "uuid", ] +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + [[package]] name = "ndk-context" version = "0.1.1" @@ -2655,6 +2717,12 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43794a0ace135be66a25d3ae77d41b91615fb68ae937f904090203e81f755b65" +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + [[package]] name = "nom" version = "7.1.3" @@ -4159,6 +4227,23 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-saphyr" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d43fb82d550b07e6f929a58d7d0935182602f48ddead875f5ee313c41c8f07fe" +dependencies = [ + "annotate-snippets", + "base64 0.23.1", + "encoding_rs_io", + "granit-parser", + "nohash-hasher", + "num-traits", + "serde_core", + "smallvec", + "zmij", +] + [[package]] name = "serde_bytes" version = "0.11.19" @@ -4214,19 +4299,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" -dependencies = [ - "indexmap", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - [[package]] name = "serdect" version = "0.4.3" @@ -5194,12 +5266,6 @@ dependencies = [ "ctutils", ] -[[package]] -name = "unsafe-libyaml" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" - [[package]] name = "untrusted" version = "0.9.0" diff --git a/Cargo.toml b/Cargo.toml index 294d3b13..d748aebd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ thiserror = "2.0.21" tracing = "0.1.44" tracing-subscriber = { version = "0.3.23", features = ["env-filter"] } serde = { version = "1.0.229", features = ["derive"] } -serde_yaml = "0.9" +serde-saphyr = "2.1.1" futures = "0.3.34" async-trait = "0.1.92" indicatif = "0.18.6" diff --git a/src/config/loader.rs b/src/config/loader.rs index 2781d853..4b76661a 100644 --- a/src/config/loader.rs +++ b/src/config/loader.rs @@ -41,7 +41,7 @@ impl Config { .with_context(|| format!("Failed to read configuration file at {}. Please check file permissions and ensure the file is accessible.", expanded_path.display()))?; let config: Config = - serde_yaml::from_str(&content).with_context(|| format!("Failed to parse YAML configuration file at {}. Please check the YAML syntax is valid.\nCommon issues:\n - Incorrect indentation (use spaces, not tabs)\n - Missing colons after keys\n - Unquoted special characters", expanded_path.display()))?; + serde_saphyr::from_str(&content).with_context(|| format!("Failed to parse YAML configuration file at {}. Please check the YAML syntax is valid.\nCommon issues:\n - Incorrect indentation (use spaces, not tabs)\n - Missing colons after keys\n - Unquoted special characters", expanded_path.display()))?; Ok(config) } @@ -194,7 +194,7 @@ impl Config { } let yaml = - serde_yaml::to_string(self).context("Failed to serialize configuration to YAML")?; + serde_saphyr::to_string(self).context("Failed to serialize configuration to YAML")?; fs::write(&expanded_path, yaml) .await diff --git a/src/config/tests.rs b/src/config/tests.rs index d7006d2c..2053d938 100644 --- a/src/config/tests.rs +++ b/src/config/tests.rs @@ -102,7 +102,7 @@ clusters: user: staging_user "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); assert_eq!(config.defaults.user, Some("admin".to_string())); assert_eq!(config.clusters.len(), 2); @@ -160,7 +160,7 @@ clusters: - host2 "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Test cluster with override - merged config let with_override = config.get_interactive_config(Some("with_override")); @@ -240,7 +240,7 @@ clusters: user: detailed-user "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); let nodes = config.resolve_nodes("ipv6").unwrap(); assert_eq!( @@ -271,7 +271,7 @@ clusters: - host: prod2.internal "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Both nodes should inherit global jump_host assert_eq!( @@ -308,7 +308,7 @@ clusters: - host: staging1.internal "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // production cluster nodes should use cluster jump_host assert_eq!( @@ -354,7 +354,7 @@ clusters: jump_host: prod-bastion.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // prod1 should use node-level jump_host assert_eq!( @@ -395,7 +395,7 @@ clusters: jump_host: "" "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // prod1 should use cluster jump_host assert_eq!( @@ -425,7 +425,7 @@ clusters: - host: prod1.internal "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // No jump_host configured anywhere assert_eq!(config.get_jump_host("production", 0), None); @@ -445,7 +445,7 @@ clusters: - host: prod1.internal "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Nonexistent cluster should return global default from get_cluster_jump_host assert_eq!( @@ -473,7 +473,7 @@ clusters: jump_host: prod-bastion.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Simple node (string) should inherit cluster jump_host // Simple nodes cannot have node-level jump_host override @@ -503,7 +503,7 @@ clusters: jump_host: ${TEST_BASTION_HOST}:${TEST_BASTION_PORT} "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Node-level with $VAR syntax assert_eq!( @@ -537,7 +537,7 @@ clusters: jump_host: prod-bastion.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Node at index 0 exists - should use cluster jump_host assert_eq!( @@ -575,7 +575,7 @@ clusters: jump_host: prod-bastion.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Simple node at index 0 - inherits cluster jump_host assert_eq!( @@ -617,7 +617,7 @@ clusters: jump_host: cluster-bastion:4444 "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Node with port in jump_host assert_eq!( @@ -653,7 +653,7 @@ clusters: jump_host: bastion1,bastion2 "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Node with multi-hop jump_host assert_eq!( diff --git a/src/server/auth/password.rs b/src/server/auth/password.rs index 525b810c..ef66f2ac 100644 --- a/src/server/auth/password.rs +++ b/src/server/auth/password.rs @@ -161,7 +161,7 @@ impl PasswordVerifier { match tokio::fs::read_to_string(path).await { Ok(content) => { let file_users: UsersFile = - serde_yaml::from_str(&content).with_context(|| { + serde_saphyr::from_str(&content).with_context(|| { format!("Failed to parse users file: {}", path.display()) })?; diff --git a/src/server/config/loader.rs b/src/server/config/loader.rs index a1b5349d..827c33c5 100644 --- a/src/server/config/loader.rs +++ b/src/server/config/loader.rs @@ -145,7 +145,7 @@ pub fn generate_config_template() -> String { yaml.push_str("# 4. Default values\n\n"); // Serialize config with defaults - yaml.push_str(&serde_yaml::to_string(&config).unwrap_or_default()); + yaml.push_str(&serde_saphyr::to_string(&config).unwrap_or_default()); yaml } @@ -159,7 +159,7 @@ fn load_config_file(path: &Path) -> Result { let content = std::fs::read_to_string(path).context(format!("Failed to read {}", path.display()))?; - serde_yaml::from_str(&content).context(format!("Failed to parse {}", path.display())) + serde_saphyr::from_str(&content).context(format!("Failed to parse {}", path.display())) } /// Check configuration file permissions on Unix systems. @@ -453,7 +453,7 @@ mod tests { assert!(template.contains("shell:")); // Template should be valid YAML - let parsed: Result = serde_yaml::from_str(&template); + let parsed: Result = serde_saphyr::from_str(&template); assert!(parsed.is_ok()); } diff --git a/src/server/config/types.rs b/src/server/config/types.rs index ab92d567..1d069f24 100644 --- a/src/server/config/types.rs +++ b/src/server/config/types.rs @@ -779,40 +779,40 @@ server: port: 2222 compression: true "#; - let config: ServerFileConfig = serde_yaml::from_str(yaml).unwrap(); + let config: ServerFileConfig = serde_saphyr::from_str(yaml).unwrap(); assert!(config.server.compression); let yaml = r#" server: port: 2222 "#; - let config: ServerFileConfig = serde_yaml::from_str(yaml).unwrap(); + let config: ServerFileConfig = serde_saphyr::from_str(yaml).unwrap(); assert!(!config.server.compression); } #[test] fn test_auth_method_serialization() { let yaml = "publickey"; - let method: AuthMethod = serde_yaml::from_str(yaml).unwrap(); + let method: AuthMethod = serde_saphyr::from_str(yaml).unwrap(); assert_eq!(method, AuthMethod::PublicKey); let yaml = "password"; - let method: AuthMethod = serde_yaml::from_str(yaml).unwrap(); + let method: AuthMethod = serde_saphyr::from_str(yaml).unwrap(); assert_eq!(method, AuthMethod::Password); } #[test] fn test_filter_action_serialization() { let yaml = "allow"; - let action: FilterAction = serde_yaml::from_str(yaml).unwrap(); + let action: FilterAction = serde_saphyr::from_str(yaml).unwrap(); matches!(action, FilterAction::Allow); let yaml = "deny"; - let action: FilterAction = serde_yaml::from_str(yaml).unwrap(); + let action: FilterAction = serde_saphyr::from_str(yaml).unwrap(); matches!(action, FilterAction::Deny); let yaml = "log"; - let action: FilterAction = serde_yaml::from_str(yaml).unwrap(); + let action: FilterAction = serde_saphyr::from_str(yaml).unwrap(); matches!(action, FilterAction::Log); } @@ -824,7 +824,7 @@ server: host_keys: - /etc/bssh/host_key "#; - let config: ServerFileConfig = serde_yaml::from_str(yaml).unwrap(); + let config: ServerFileConfig = serde_saphyr::from_str(yaml).unwrap(); assert_eq!(config.server.port, 2222); assert_eq!(config.server.host_keys.len(), 1); } @@ -866,7 +866,7 @@ security: allowed_ips: - "192.168.1.0/24" "#; - let config: ServerFileConfig = serde_yaml::from_str(yaml).unwrap(); + let config: ServerFileConfig = serde_saphyr::from_str(yaml).unwrap(); assert_eq!(config.server.bind_address, "127.0.0.1"); assert_eq!(config.server.port, 2223); assert_eq!(config.server.host_keys.len(), 2); diff --git a/src/server/exec.rs b/src/server/exec.rs index 4236e3ea..37268094 100644 --- a/src/server/exec.rs +++ b/src/server/exec.rs @@ -749,12 +749,12 @@ mod tests { .with_env("LANG", "C.UTF-8"); // Test serialization - let yaml = serde_yaml::to_string(&config).unwrap(); + let yaml = serde_saphyr::to_string(&config).unwrap(); assert!(yaml.contains("/bin/bash")); assert!(yaml.contains("1800")); // Test deserialization - let deserialized: ExecConfig = serde_yaml::from_str(&yaml).unwrap(); + let deserialized: ExecConfig = serde_saphyr::from_str(&yaml).unwrap(); assert_eq!(deserialized.default_shell, PathBuf::from("/bin/bash")); assert_eq!(deserialized.timeout_secs, 1800); assert_eq!(deserialized.env.get("LANG"), Some(&"C.UTF-8".to_string())); diff --git a/src/ssh/tokio_client/proxy_command.rs b/src/ssh/tokio_client/proxy_command.rs index 92f5a998..2851f4d8 100644 --- a/src/ssh/tokio_client/proxy_command.rs +++ b/src/ssh/tokio_client/proxy_command.rs @@ -550,7 +550,7 @@ mod tests { } else { yaml.replace(" user: alice\n", "") }; - let inventory: crate::config::Config = serde_yaml::from_str(&yaml).unwrap(); + let inventory: crate::config::Config = serde_saphyr::from_str(&yaml).unwrap(); let nodes = inventory.resolve_nodes("test").unwrap(); let node = &nodes[0]; let proxy = ProxyCommandConfig::new("cat %h %r", "inventory-alias"); @@ -576,7 +576,7 @@ mod tests { "clusters:\n test:\n nodes:\n - host: target\n user: '${{{PAYLOAD_ENV}}}'\n" ) }; - let inventory: crate::config::Config = serde_yaml::from_str(&yaml).unwrap(); + let inventory: crate::config::Config = serde_saphyr::from_str(&yaml).unwrap(); let nodes = inventory.resolve_nodes("test").unwrap(); let node = &nodes[0]; assert_eq!( diff --git a/tests/error_handling_integration.rs b/tests/error_handling_integration.rs index c46e96c5..235d7ea0 100644 --- a/tests/error_handling_integration.rs +++ b/tests/error_handling_integration.rs @@ -50,7 +50,7 @@ clusters: "#; // This should not panic even with non-existent environment variables - let config: Result = serde_yaml::from_str(yaml); + let config: Result = serde_saphyr::from_str(yaml); assert!( config.is_ok(), "Config parsing should handle missing environment variables gracefully" diff --git a/tests/jump_host_config_test.rs b/tests/jump_host_config_test.rs index 19189728..d1fd5657 100644 --- a/tests/jump_host_config_test.rs +++ b/tests/jump_host_config_test.rs @@ -47,7 +47,7 @@ clusters: - host: b1.internal "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // All clusters should inherit global jump_host assert_eq!( @@ -78,7 +78,7 @@ clusters: - host: node2.internal "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Cluster with override should use cluster jump_host assert_eq!( @@ -111,7 +111,7 @@ clusters: jump_host: cluster-bastion.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Node 0 has override assert_eq!( @@ -153,7 +153,7 @@ clusters: jump_host: cluster-bastion.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Cluster with empty jump_host should have no jump_host assert_eq!(config.get_cluster_jump_host(Some("direct_access")), None); @@ -188,7 +188,7 @@ clusters: jump_host: $BSSH_TEST_BASTION:$BSSH_TEST_PORT "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Global default with env var assert_eq!( @@ -222,7 +222,7 @@ clusters: - host: node1.internal "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Should preserve full user@host:port format assert_eq!( @@ -244,7 +244,7 @@ clusters: - host: node1.internal "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Should preserve multi-hop chain assert_eq!( @@ -270,7 +270,7 @@ clusters: ssh_key: ~/.ssh/prod_key "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Should work without jump_host configured assert_eq!(config.get_cluster_jump_host(Some("production")), None); @@ -302,7 +302,7 @@ clusters: jump_host: cluster-level.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Node 0: node-level takes priority assert_eq!( @@ -338,7 +338,7 @@ clusters: jump_host: cluster-bastion.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Both simple nodes should inherit cluster jump_host assert_eq!( @@ -364,7 +364,7 @@ clusters: jump_host: bastion.example.com "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let cluster = config.get_cluster("test").expect("Cluster not found"); match &cluster.defaults.jump_host { @@ -390,7 +390,7 @@ clusters: ssh_key: ~/.ssh/bastion_key "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let cluster = config.get_cluster("test").expect("Cluster not found"); match &cluster.defaults.jump_host { @@ -421,7 +421,7 @@ clusters: host: bastion.example.com "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let cluster = config.get_cluster("test").expect("Cluster not found"); match &cluster.defaults.jump_host { @@ -454,7 +454,7 @@ clusters: ssh_key: ~/.ssh/jump_key "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let (conn_str, ssh_key) = config .get_cluster_jump_host_with_key(Some("test")) .expect("Jump host not found"); @@ -475,7 +475,7 @@ clusters: jump_host: bastion.example.com "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let (conn_str, ssh_key) = config .get_cluster_jump_host_with_key(Some("test")) .expect("Jump host not found"); @@ -498,7 +498,7 @@ clusters: jump_host: default-bastion.example.com "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let (conn_str, ssh_key) = config .get_jump_host_with_key("test", 0) .expect("Jump host not found"); @@ -525,7 +525,7 @@ clusters: ssh_key: ${TEST_JUMP_KEY} "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let (conn_str, ssh_key) = config .get_cluster_jump_host_with_key(Some("test")) .expect("Jump host not found"); @@ -554,7 +554,7 @@ clusters: ssh_key: ~/.ssh/bastion2_key "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); // Test legacy format let (conn_str1, ssh_key1) = config @@ -650,7 +650,7 @@ clusters: ssh_config_host: bastion "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let cluster = config.get_cluster("test").expect("Cluster not found"); match &cluster.defaults.jump_host { @@ -672,7 +672,7 @@ clusters: jump_host: "@bastion" "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let cluster = config.get_cluster("test").expect("Cluster not found"); match &cluster.defaults.jump_host { @@ -868,7 +868,7 @@ clusters: jump_host: "@bastion" "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let ssh_config_content = r#" Host bastion @@ -907,7 +907,7 @@ clusters: ssh_config_host: gateway "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let ssh_config_content = r#" Host gateway @@ -939,7 +939,7 @@ clusters: jump_host: "@default-bastion" "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let ssh_config_content = r#" Host default-bastion @@ -985,7 +985,7 @@ clusters: jump_host: direct-bastion.example.com "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let ssh_config_content = r#" Host global-bastion @@ -1018,7 +1018,7 @@ clusters: jump_host: "@nonexistent-bastion" "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let ssh_config_content = r#" Host some-other-host @@ -1064,7 +1064,7 @@ clusters: ssh_config_host: gateway "#; - let config: Config = serde_yaml::from_str(yaml).expect("Failed to parse config"); + let config: Config = serde_saphyr::from_str(yaml).expect("Failed to parse config"); let ssh_config_content = r#" Host bastion diff --git a/tests/ssh_keepalive_test.rs b/tests/ssh_keepalive_test.rs index a3bfc521..9f56553d 100644 --- a/tests/ssh_keepalive_test.rs +++ b/tests/ssh_keepalive_test.rs @@ -513,7 +513,7 @@ clusters: - host: dev1.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Production cluster has override (flattened into cluster level) let interval = config.get_server_alive_interval(Some("production")); @@ -560,7 +560,7 @@ clusters: - host: dev1.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Production cluster has override (flattened into cluster level) let count = config.get_server_alive_count_max(Some("production")); @@ -594,7 +594,7 @@ clusters: - host: node1.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); let interval = config.get_server_alive_interval(Some("minimal")); assert_eq!(interval, None, "Should return None when not configured"); diff --git a/tests/timeout_test.rs b/tests/timeout_test.rs index 45155a34..eac5f631 100644 --- a/tests/timeout_test.rs +++ b/tests/timeout_test.rs @@ -17,7 +17,7 @@ clusters: - host2.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Test default timeout assert_eq!(config.defaults.timeout, Some(120)); @@ -44,7 +44,7 @@ clusters: - host1.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Test no timeout configured anywhere assert_eq!(config.defaults.timeout, None); @@ -63,7 +63,7 @@ clusters: - host1.example.com "#; - let config: Config = serde_yaml::from_str(yaml).unwrap(); + let config: Config = serde_saphyr::from_str(yaml).unwrap(); // Test timeout 0 (unlimited) assert_eq!(config.defaults.timeout, Some(0));