Skip to content

Commit ae19f3d

Browse files
committed
chore: move foundry -> builder
1 parent 992eca4 commit ae19f3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+133
-123
lines changed

goldboot-image/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ pub struct PrimaryHeader {
231231
pub directory_size: u32,
232232
}
233233

234+
impl PrimaryHeader {
235+
pub fn name(&self) -> String {
236+
let parts: Vec<String> = self.elements.iter().map(|element| element.name()).collect();
237+
parts.join(" / ")
238+
}
239+
}
240+
234241
/// Contains metadata which may be encrypted.
235242
#[derive(BinRead, BinWrite, Debug, Eq, PartialEq, Clone)]
236243
#[brw(big)]

goldboot-registry/src/extract.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ impl FromRequest<RegistryState> for ImageHandle {
1818
Ok(value) => match value.get("image_id") {
1919
Some(image_id) => match ImageLibrary::find_by_id(image_id) {
2020
Ok(image_handle) => {
21-
if image_handle.primary_header.is_public() {
22-
Ok(ImageHandle(image_handle))
23-
} else {
24-
todo!()
25-
}
21+
// TODO access control
22+
Ok(ImageHandle(image_handle))
2623
}
2724
Err(_) => Err(StatusCode::NOT_FOUND),
2825
},

goldboot/src/foundry/fabricators/ansible.rs renamed to goldboot/src/builder/fabricators/ansible.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::foundry::Foundry;
2-
use crate::{cli::prompt::Prompt, foundry::ssh::SshConnection};
1+
use crate::builder::Foundry;
2+
use crate::{cli::prompt::Prompt, builder::ssh::SshConnection};
33
use anyhow::Result;
44
use anyhow::bail;
55
use serde::{Deserialize, Serialize};

goldboot/src/foundry/fabricators/exe.rs renamed to goldboot/src/builder/fabricators/exe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::Fabricate;
2-
use crate::foundry::Foundry;
3-
use crate::{cli::prompt::Prompt, foundry::ssh::SshConnection};
2+
use crate::builder::Foundry;
3+
use crate::{cli::prompt::Prompt, builder::ssh::SshConnection};
44
use anyhow::Result;
55
use anyhow::bail;
66
use serde::{Deserialize, Serialize};

goldboot/src/foundry/fabricators/mod.rs renamed to goldboot/src/builder/fabricators/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! image templates. Templates may also specify their own specialized
33
//! provisioners for specific tasks.
44
5-
use crate::foundry::ssh::SshConnection;
5+
use crate::builder::ssh::SshConnection;
66
use ansible::Ansible;
77
use anyhow::Result;
88
use enum_dispatch::enum_dispatch;

goldboot/src/foundry/fabricators/shell.rs renamed to goldboot/src/builder/fabricators/shell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
44
use tracing::info;
55
use validator::Validate;
66

7-
use crate::foundry::ssh::SshConnection;
7+
use crate::builder::ssh::SshConnection;
88

99
/// Runs an inline shell command.
1010
#[derive(Clone, Serialize, Deserialize, Validate, Debug)]
File renamed without changes.

goldboot/src/foundry/mod.rs renamed to goldboot/src/builder/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use self::qemu::{Accel, detect_accel};
22
use self::{fabricators::Fabricator, os::Os, sources::ImageSource};
3-
use crate::foundry::os::BuildImage;
3+
use crate::builder::os::BuildImage;
44
use crate::library::ImageLibrary;
55

66
use anyhow::Result;
@@ -52,7 +52,7 @@ impl ImageElement {
5252
/// A `Foundry` produces a goldboot image given a raw configuration. This is the
5353
/// central concept in the machinery that creates images.
5454
#[derive(Clone, Serialize, Deserialize, Validate, Default, Debug)]
55-
#[validate(schema(function = "crate::foundry::custom_foundry_validator"))]
55+
#[validate(schema(function = "crate::builder::custom_builder_validator"))]
5656
pub struct Foundry {
5757
#[validate(length(min = 1))]
5858
pub alloy: Vec<ImageElement>,
@@ -106,7 +106,7 @@ pub struct Foundry {
106106
}
107107

108108
/// Handles more sophisticated validation of a [`Foundry`].
109-
pub fn custom_foundry_validator(_f: &Foundry) -> Result<(), validator::ValidationError> {
109+
pub fn custom_builder_validator(_f: &Foundry) -> Result<(), validator::ValidationError> {
110110
// If there's more than one OS, they must all support alloy
111111
// if f.alloy.len() > 1 {
112112
// for template in &self.config.templates {
@@ -127,13 +127,13 @@ impl Foundry {
127127
// Unpack included firmware if one isn't given
128128
let ovmf_path = if let Some(path) = self.ovmf_path.clone() {
129129
PathBuf::from(path)
130-
} else if let Some(path) = crate::foundry::ovmf::find() {
130+
} else if let Some(path) = crate::builder::ovmf::find() {
131131
path
132132
} else if cfg!(feature = "include_ovmf") {
133133
let path = tmp.path().join("OVMF.fd").to_string_lossy().to_string();
134134

135135
#[cfg(feature = "include_ovmf")]
136-
crate::foundry::ovmf::write(self.arch, &path).unwrap();
136+
crate::builder::ovmf::write(self.arch, &path).unwrap();
137137
PathBuf::from(path)
138138
} else {
139139
panic!("No OVMF firmware found");

goldboot/src/foundry/options/hostname.rs renamed to goldboot/src/builder/options/hostname.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::fmt::Display;
22

3-
use crate::{cli::prompt::Prompt, foundry::Foundry};
3+
use crate::{cli::prompt::Prompt, builder::Foundry};
44
use anyhow::Result;
55
use serde::{Deserialize, Serialize};
66
use validator::Validate;
@@ -27,10 +27,10 @@ impl Default for Hostname {
2727
}
2828

2929
impl Prompt for Hostname {
30-
fn prompt(&mut self, foundry: &Foundry) -> Result<()> {
30+
fn prompt(&mut self, builder: &Foundry) -> Result<()> {
3131
self.hostname = dialoguer::Input::with_theme(&crate::cli::cmd::init::theme())
3232
.with_prompt("Enter network hostname")
33-
.default(foundry.name.clone())
33+
.default(builder.name.clone())
3434
.interact()?;
3535

3636
self.validate()?;

0 commit comments

Comments
 (0)