Skip to content

Commit

Permalink
Merge pull request #1128 from tormath1/tormath1/proxmox
Browse files Browse the repository at this point in the history
proxmoxve: do not fail if the config drive does not exist
  • Loading branch information
prestist authored Dec 3, 2024
2 parents 0b2e30b + 587cbbc commit 1b6a3b8
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Major changes:

Minor changes:

- ProxmoxVE: Fixed instance boot without config drive

Packaging changes:

## Afterburn 5.7.0
Expand Down
4 changes: 2 additions & 2 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::providers::openstack;
use crate::providers::openstack::network::OpenstackProviderNetwork;
use crate::providers::packet::PacketProvider;
use crate::providers::powervs::PowerVSProvider;
use crate::providers::proxmoxve::ProxmoxVEConfigDrive;
use crate::providers::proxmoxve;
use crate::providers::scaleway::ScalewayProvider;
use crate::providers::vmware::VmwareProvider;
use crate::providers::vultr::VultrProvider;
Expand Down Expand Up @@ -71,7 +71,7 @@ pub fn fetch_metadata(provider: &str) -> Result<Box<dyn providers::MetadataProvi
"openstack-metadata" => box_result!(OpenstackProviderNetwork::try_new()?),
"packet" => box_result!(PacketProvider::try_new()?),
"powervs" => box_result!(PowerVSProvider::try_new()?),
"proxmoxve" => box_result!(ProxmoxVEConfigDrive::try_new()?),
"proxmoxve" => proxmoxve::try_config_drive_else_leave(),
"scaleway" => box_result!(ScalewayProvider::try_new()?),
"vmware" => box_result!(VmwareProvider::try_new()?),
"vultr" => box_result!(VultrProvider::try_new()?),
Expand Down
1 change: 1 addition & 0 deletions src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub mod ibmcloud;
pub mod ibmcloud_classic;
pub mod kubevirt;
pub mod microsoft;
pub mod noop;
pub mod openstack;
pub mod packet;
pub mod powervs;
Expand Down
28 changes: 28 additions & 0 deletions src/providers/noop/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2023 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use anyhow::Result;

use crate::providers::MetadataProvider;

/// Noop provider
pub struct NoopProvider {}

impl NoopProvider {
pub fn try_new() -> Result<NoopProvider> {
Ok(Self {})
}
}

impl MetadataProvider for NoopProvider {}
15 changes: 15 additions & 0 deletions src/providers/proxmoxve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::providers;
use crate::providers::noop::NoopProvider;
use anyhow::Result;
use slog_scope::warn;

mod configdrive;
pub use configdrive::*;

Expand All @@ -20,3 +25,13 @@ pub use cloudconfig::*;

#[cfg(test)]
mod tests;

pub fn try_config_drive_else_leave() -> Result<Box<dyn providers::MetadataProvider>> {
match ProxmoxVEConfigDrive::try_new() {
Ok(config_drive) => Ok(Box::new(config_drive)),
Err(_) => {
warn!("failed to locate config-drive - aborting ProxmoxVE provider");
Ok(Box::new(NoopProvider::try_new()?))
}
}
}

0 comments on commit 1b6a3b8

Please sign in to comment.