Since we already handly non-present domain names, invalid names can be
handled the same way, as not to completely fail the installation.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
#[derive(Clone, Deserialize)]
pub struct Dns {
+ #[serde(deserialize_with = "deserialize_invalid_value_as_none")]
pub domain: Option<Fqdn>,
/// List of stringified IP addresses.
#[serde(deserialize_with = "deserialize_cidr_list")]
pub addresses: Option<Vec<CidrAddress>>,
}
+
+fn deserialize_invalid_value_as_none<'de, D, T>(deserializer: D) -> Result<Option<T>, D::Error>
+where
+ D: Deserializer<'de>,
+ T: Deserialize<'de>,
+{
+ Ok(Deserialize::deserialize(deserializer).ok())
+}