mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-05 04:06:33 +02:00
Drop the vagrant_virtualbox image in favour of the vagrant image
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This commit is contained in:
parent
bc6d20c5e8
commit
e040e9efec
@ -31,7 +31,6 @@ VALID_IMG_TYPES=(
|
||||
stackit
|
||||
vagrant
|
||||
vagrant_parallels
|
||||
vagrant_virtualbox
|
||||
vagrant_vmware_fusion
|
||||
virtualbox
|
||||
vmware
|
||||
@ -59,7 +58,6 @@ VALID_OEM_PACKAGES=(
|
||||
scaleway
|
||||
stackit
|
||||
vagrant
|
||||
vagrant-virtualbox
|
||||
virtualbox
|
||||
vmware
|
||||
)
|
||||
@ -146,14 +144,6 @@ IMG_vagrant_DISK_LAYOUT=vagrant
|
||||
IMG_vagrant_CONF_FORMAT=vagrant
|
||||
IMG_vagrant_OEM_PACKAGE=oem-vagrant
|
||||
|
||||
## vagrant_virtualbox
|
||||
IMG_vagrant_virtualbox_FS_HOOK=box
|
||||
IMG_vagrant_virtualbox_BUNDLE_FORMAT=box
|
||||
IMG_vagrant_virtualbox_DISK_FORMAT=vmdk_ide
|
||||
IMG_vagrant_virtualbox_DISK_LAYOUT=vagrant
|
||||
IMG_vagrant_virtualbox_CONF_FORMAT=vagrant
|
||||
IMG_vagrant_virtualbox_OEM_PACKAGE=oem-vagrant-virtualbox
|
||||
|
||||
## vagrant_vmware
|
||||
IMG_vagrant_vmware_fusion_FS_HOOK=box
|
||||
IMG_vagrant_vmware_fusion_BUNDLE_FORMAT=box
|
||||
|
||||
1
changelog/changes/2026-04-27-vagrant-virtualbox.md
Normal file
1
changelog/changes/2026-04-27-vagrant-virtualbox.md
Normal file
@ -0,0 +1 @@
|
||||
- Dropped the Vagrant VirtualBox image because the regular Vagrant image also targets VirtualBox. The only difference between them was that the former was geared for provisioning with Ignition and Afterburn rather than cloud-config and Vagrant itself. The Ignition support was broken when it was dropped by upsteam. A single image can handle Ignition, cloud-config, and Vagrant. The Afterburn support has been dropped entirely.
|
||||
@ -1,3 +1,2 @@
|
||||
DIST afterburn-5.10.0-vendor.tar.gz 21824451 BLAKE2B fe263d51ce29ac6cee2d3974153ee73acca9f40abc80747cf40ab7ee69638a66fa3861f288033a976ecacaaf047611f547364e4abb9ed6a729cd7d77b498441e SHA512 ac186e88a9ced2195f80540ad686ce34352c9d854439afabc31ec0838c12e4f8614e273370b3778137a435b7fc088a040106ea29b7ed8df3c70caeac7a0bb6ec
|
||||
DIST afterburn-5.10.0.tar.gz 133765 BLAKE2B 3297a99d744a446532f8811f4d68741fafac32d47b6e7fcc63d5f7ec8f126462f76f3dbf5674e4267ae393c245f01c8a4ff2daaafa783cef44dededfdaa1c3eb SHA512 4f1f61b385d109451908c996336a6491323ac531d730a974ec23ef30d90fba75f07f530936dcccd35239e6a394a93e633db21dafd599a374bea9f342fd221c83
|
||||
DIST hostname-0.4.2.crate 12983 BLAKE2B a72e015d1bfd99828a9b1402a745968d578343c81301549cca0d5a4a5814a51c1eb58f7ed937ed75a6a6be385c340bf662d5d51cf401aa21809d1c893ff207f2 SHA512 57d7688fd7e724fe95b2d275d7cd11056e829318ff9683b59617575d94d5951eeb328ef2426bb16f4172bea461d0248cece573f212b6d2d8d3d0252981def4a6
|
||||
|
||||
@ -3,12 +3,8 @@
|
||||
|
||||
EAPI=8
|
||||
|
||||
# This crate is required by our patch but missing from the vendor tarball.
|
||||
CRATES="hostname@0.4.2"
|
||||
|
||||
inherit cargo systemd
|
||||
|
||||
SRC_URI="${CARGO_CRATE_URIS}"
|
||||
DESCRIPTION="A tool for collecting instance metadata from various providers"
|
||||
HOMEPAGE="https://github.com/coreos/afterburn"
|
||||
|
||||
@ -16,7 +12,7 @@ if [[ ${PV} == 9999 ]]; then
|
||||
EGIT_REPO_URI="https://github.com/coreos/afterburn.git"
|
||||
inherit git-r3
|
||||
else
|
||||
SRC_URI+=" https://github.com/coreos/afterburn/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
|
||||
SRC_URI="https://github.com/coreos/afterburn/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
|
||||
https://github.com/coreos/afterburn/releases/download/v${PV}/${P}-vendor.tar.gz"
|
||||
KEYWORDS="amd64 arm64"
|
||||
ECARGO_VENDOR="${WORKDIR}/vendor"
|
||||
|
||||
@ -5,73 +5,14 @@ Subject: [PATCH 1/3] Revert "*: remove cl-legacy feature"
|
||||
|
||||
This reverts commit 3e4b623b390ab756a6be963eec7198b3e7f44e20.
|
||||
|
||||
(dpark: Re-add hostname crate and its dependencies, as they are not
|
||||
included by default in 5.5.)
|
||||
|
||||
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
|
||||
Signed-off-by: Dongsu Park <dpark@linux.microsoft.com>
|
||||
---
|
||||
Cargo.lock | 33 ++++++++++-
|
||||
Cargo.toml | 4 ++
|
||||
src/metadata.rs | 8 +++
|
||||
src/providers/mod.rs | 2 +
|
||||
src/providers/vagrant_virtualbox/mod.rs | 79 +++++++++++++++++++++++++
|
||||
src/util/cmdline.rs | 4 ++
|
||||
6 files changed, 129 insertions(+), 1 deletion(-)
|
||||
create mode 100644 src/providers/vagrant_virtualbox/mod.rs
|
||||
|
||||
diff --git a/Cargo.lock b/Cargo.lock
|
||||
index a4b7224..c2e3cc9 100644
|
||||
--- a/Cargo.lock
|
||||
+++ b/Cargo.lock
|
||||
@@ -31,6 +31,7 @@ dependencies = [
|
||||
"base64 0.22.1",
|
||||
"cfg-if",
|
||||
"clap",
|
||||
+ "hostname",
|
||||
"ipnetwork",
|
||||
"libflate",
|
||||
"libsystemd",
|
||||
@@ -812,6 +813,17 @@ dependencies = [
|
||||
"digest",
|
||||
]
|
||||
|
||||
+[[package]]
|
||||
+name = "hostname"
|
||||
+version = "0.4.2"
|
||||
+source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
+checksum = "617aaa3557aef3810a6369d0a99fac8a080891b68bd9f9812a1eeda0c0730cbd"
|
||||
+dependencies = [
|
||||
+ "cfg-if",
|
||||
+ "libc",
|
||||
+ "windows-link 0.2.0",
|
||||
+]
|
||||
+
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "1.3.1"
|
||||
@@ -2478,6 +2490,16 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65"
|
||||
|
||||
+[[package]]
|
||||
+name = "windows"
|
||||
+version = "0.62.0"
|
||||
+source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
+checksum = "9579d0e6970fd5250aa29aba5994052385ff55cf7b28a059e484bb79ea842e42"
|
||||
+dependencies = [
|
||||
+ "windows-core",
|
||||
+ "windows-targets 0.52.6",
|
||||
+]
|
||||
+
|
||||
[[package]]
|
||||
name = "windows-registry"
|
||||
version = "0.5.3"
|
||||
diff --git a/Cargo.toml b/Cargo.toml
|
||||
index 0929be8..7cd4b91 100644
|
||||
--- a/Cargo.toml
|
||||
+++ b/Cargo.toml
|
||||
@@ -33,11 +33,15 @@ path = "src/main.rs"
|
||||
@@ -33,6 +33,9 @@ path = "src/main.rs"
|
||||
# We assume we're being delivered via e.g. RPM which supports split debuginfo
|
||||
debug = true
|
||||
|
||||
@ -81,25 +22,10 @@ index 0929be8..7cd4b91 100644
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
base64 = "0.22"
|
||||
cfg-if = "1.0"
|
||||
clap = { version = "4", "default-features" = false, "features" = ["std", "cargo", "derive", "error-context", "help", "suggestions", "usage", "wrap_help"] }
|
||||
+hostname = "0.4.0"
|
||||
ipnetwork = ">= 0.17, < 0.22"
|
||||
libflate = "2.1"
|
||||
libsystemd = ">= 0.2.1, < 0.8.0"
|
||||
diff --git a/src/metadata.rs b/src/metadata.rs
|
||||
index 94f9238..2ad1c8e 100644
|
||||
--- a/src/metadata.rs
|
||||
+++ b/src/metadata.rs
|
||||
@@ -35,6 +35,8 @@ use crate::providers::packet::PacketProvider;
|
||||
use crate::providers::powervs::PowerVSProvider;
|
||||
use crate::providers::proxmoxve;
|
||||
use crate::providers::scaleway::ScalewayProvider;
|
||||
+#[cfg(feature = "cl-legacy")]
|
||||
+use crate::providers::vagrant_virtualbox::VagrantVirtualboxProvider;
|
||||
use crate::providers::upcloud::UpCloudProvider;
|
||||
use crate::providers::vmware::VmwareProvider;
|
||||
use crate::providers::vultr::VultrProvider;
|
||||
@@ -60,6 +62,10 @@ pub fn fetch_metadata(provider: &str) -> Result<Box<dyn providers::MetadataProvi
|
||||
"cloudstack-configdrive" => box_result!(ConfigDrive::try_new()?),
|
||||
"digitalocean" => box_result!(DigitalOceanProvider::try_new()?),
|
||||
@ -111,114 +37,6 @@ index 94f9238..2ad1c8e 100644
|
||||
"gcp" => box_result!(GcpProvider::try_new()?),
|
||||
"hetzner" => box_result!(HetznerProvider::try_new()?),
|
||||
// IBM Cloud - VPC Generation 2.
|
||||
@@ -73,6 +79,8 @@ pub fn fetch_metadata(provider: &str) -> Result<Box<dyn providers::MetadataProvi
|
||||
"powervs" => box_result!(PowerVSProvider::try_new()?),
|
||||
"proxmoxve" => proxmoxve::try_config_drive_else_leave(),
|
||||
"scaleway" => box_result!(ScalewayProvider::try_new()?),
|
||||
+ #[cfg(feature = "cl-legacy")]
|
||||
+ "vagrant-virtualbox" => box_result!(VagrantVirtualboxProvider::new()),
|
||||
"upcloud" => box_result!(UpCloudProvider::try_new()?),
|
||||
"vmware" => box_result!(VmwareProvider::try_new()?),
|
||||
"vultr" => box_result!(VultrProvider::try_new()?),
|
||||
diff --git a/src/providers/mod.rs b/src/providers/mod.rs
|
||||
index e17d551..6fe44b6 100644
|
||||
--- a/src/providers/mod.rs
|
||||
+++ b/src/providers/mod.rs
|
||||
@@ -40,6 +40,8 @@ pub mod packet;
|
||||
pub mod powervs;
|
||||
pub mod proxmoxve;
|
||||
pub mod scaleway;
|
||||
+#[cfg(feature = "cl-legacy")]
|
||||
+pub mod vagrant_virtualbox;
|
||||
pub mod upcloud;
|
||||
pub mod vmware;
|
||||
pub mod vultr;
|
||||
|
||||
diff --git a/src/providers/vagrant_virtualbox/mod.rs b/src/providers/vagrant_virtualbox/mod.rs
|
||||
new file mode 100644
|
||||
index 0000000..d7a9e0e
|
||||
--- /dev/null
|
||||
+++ b/src/providers/vagrant_virtualbox/mod.rs
|
||||
@@ -0,0 +1,79 @@
|
||||
+// Copyright 2017 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.
|
||||
+
|
||||
+//! vagrant/virtualbox metadata fetcher
|
||||
+
|
||||
+use std::collections::HashMap;
|
||||
+use std::net::IpAddr;
|
||||
+use std::thread;
|
||||
+use std::time::Duration;
|
||||
+
|
||||
+use anyhow::{anyhow,Context,Result};
|
||||
+use slog_scope::info;
|
||||
+
|
||||
+use crate::providers::MetadataProvider;
|
||||
+
|
||||
+#[derive(Clone, Copy, Debug)]
|
||||
+pub struct VagrantVirtualboxProvider;
|
||||
+
|
||||
+impl VagrantVirtualboxProvider {
|
||||
+ pub fn new() -> Self {
|
||||
+ Self
|
||||
+ }
|
||||
+
|
||||
+ fn get_ip() -> Result<String> {
|
||||
+ let max_attempts = 30;
|
||||
+ for _ in 0..max_attempts {
|
||||
+ if let Some(iface) = Self::find_eth1() {
|
||||
+ for a in iface.ips {
|
||||
+ if let IpAddr::V4(a) = a.ip() {
|
||||
+ return Ok(format!("{}", a));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ info!("eth1 not found or is lacking an ipv4 address; waiting 2 seconds");
|
||||
+ thread::sleep(Duration::from_secs(2));
|
||||
+ }
|
||||
+ Err(anyhow!("eth1 was not found!"))
|
||||
+ }
|
||||
+
|
||||
+ fn find_eth1() -> Option<pnet_datalink::NetworkInterface> {
|
||||
+ pnet_datalink::interfaces()
|
||||
+ .into_iter()
|
||||
+ .find(|i| i.name == "eth1")
|
||||
+ }
|
||||
+
|
||||
+ /// Get the hostname from local system settings.
|
||||
+ fn system_hostname() -> Result<String> {
|
||||
+ let hostname = hostname::get()
|
||||
+ .context("unable to get hostname")?
|
||||
+ .to_string_lossy()
|
||||
+ .into_owned();
|
||||
+ Ok(hostname)
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+impl MetadataProvider for VagrantVirtualboxProvider {
|
||||
+ fn attributes(&self) -> Result<HashMap<String, String>> {
|
||||
+ let hostname = Self::system_hostname()?;
|
||||
+ let ip = Self::get_ip()?;
|
||||
+
|
||||
+ let attributes = maplit::hashmap! {
|
||||
+ "VAGRANT_VIRTUALBOX_HOSTNAME".to_string() => hostname,
|
||||
+ "VAGRANT_VIRTUALBOX_PRIVATE_IPV4".to_string() => ip,
|
||||
+ };
|
||||
+
|
||||
+ Ok(attributes)
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/util/cmdline.rs b/src/util/cmdline.rs
|
||||
index d07cfeb..2e96ce4 100644
|
||||
--- a/src/util/cmdline.rs
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
# -*- mode: ruby -*-
|
||||
# # vi: set ft=ruby :
|
||||
|
||||
if Vagrant::VERSION < "1.6.0"
|
||||
raise "Need at least vagrant version 1.6.0, please update"
|
||||
end
|
||||
|
||||
require_relative 'change_host_name.rb'
|
||||
require_relative 'configure_networks.rb'
|
||||
require_relative 'base_mac.rb'
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
# always use Vagrants insecure key
|
||||
config.ssh.insert_key = false
|
||||
|
||||
# SSH in as the default 'core' user, it has the vagrant ssh key.
|
||||
config.ssh.username = "core"
|
||||
|
||||
# Disable the base shared folder, guest additions are unavailable.
|
||||
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
|
||||
config.vm.provider :virtualbox do |vb|
|
||||
# Guest Additions are unavailable.
|
||||
vb.check_guest_additions = false
|
||||
vb.functional_vboxsf = false
|
||||
|
||||
# Fix docker not being able to resolve private registry in VirtualBox
|
||||
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
||||
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
|
||||
end
|
||||
end
|
||||
@ -1,4 +0,0 @@
|
||||
# This file must be rewritten with a real value for VirtualBox
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.base_mac = "080027000000"
|
||||
end
|
||||
@ -1,18 +0,0 @@
|
||||
# -*- mode: ruby -*-
|
||||
# # vi: set ft=ruby :
|
||||
|
||||
# NOTE: This monkey-patching is done to disable to old cloud config based
|
||||
# change_host_name built into the upstream vagrant project
|
||||
|
||||
require Vagrant.source_root.join("plugins/guests/coreos/cap/change_host_name.rb")
|
||||
|
||||
module VagrantPlugins
|
||||
module GuestCoreOS
|
||||
module Cap
|
||||
class ChangeHostName
|
||||
def self.change_host_name(machine, name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,18 +0,0 @@
|
||||
# -*- mode: ruby -*-
|
||||
# # vi: set ft=ruby :
|
||||
|
||||
# NOTE: This monkey-patching is done to disable to old cloud config based
|
||||
# configure_networks built into the upstream vagrant project
|
||||
|
||||
require Vagrant.source_root.join("plugins/guests/coreos/cap/configure_networks.rb")
|
||||
|
||||
module VagrantPlugins
|
||||
module GuestCoreOS
|
||||
module Cap
|
||||
class ConfigureNetworks
|
||||
def self.configure_networks(machine, networks)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,3 +0,0 @@
|
||||
# Flatcar GRUB settings
|
||||
|
||||
set oem_id="vagrant-virtualbox"
|
||||
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
</pkgmetadata>
|
||||
@ -1,22 +0,0 @@
|
||||
# Copyright 2017 The CoreOS Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
DESCRIPTION="OEM suite for vagrant images (virtualbox)"
|
||||
HOMEPAGE=""
|
||||
SRC_URI=""
|
||||
|
||||
LICENSE="Apache-2.0"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64"
|
||||
IUSE=""
|
||||
|
||||
# no source directory
|
||||
S="${WORKDIR}"
|
||||
|
||||
src_install() {
|
||||
insinto "/oem"
|
||||
doins -r "${FILESDIR}/box"
|
||||
doins "${FILESDIR}/grub.cfg"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user