Skip to content

Commit

Permalink
fix(proxmoxve): don't crash when there is no network interface
Browse files Browse the repository at this point in the history
  • Loading branch information
arcln committed Dec 7, 2023
1 parent 4959192 commit 069f639
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/providers/proxmoxve/cloudconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,14 @@ impl MetadataProvider for ProxmoxVECloudConfig {
.map(|entry| entry.to_interface())
.collect::<Result<Vec<_>, _>>()?;

if let Some(nameserver) = nameservers.first() {
interfaces[0].nameservers = nameserver
.address
.iter()
.map(|ip| IpAddr::from_str(ip))
.collect::<Result<Vec<IpAddr>, AddrParseError>>()?;
if let Some(iface) = interfaces.first_mut() {
if let Some(nameserver) = nameservers.first() {
iface.nameservers = nameserver
.address
.iter()
.map(|ip| IpAddr::from_str(ip))
.collect::<Result<Vec<IpAddr>, AddrParseError>>()?;
}
}

Ok(interfaces)
Expand Down

0 comments on commit 069f639

Please sign in to comment.