Skip to content

Commit d84d7dd

Browse files
committed
types: Remove fallback "any" filesystem type
Signed-off-by: Ikey Doherty <[email protected]>
1 parent dd04563 commit d84d7dd

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

crates/partitioning/src/formatter.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ impl FilesystemExt for Filesystem {
3131
types::StandardFilesystemType::Xfs => "mkfs.xfs",
3232
types::StandardFilesystemType::Swap => "mkswap",
3333
},
34-
Filesystem::Any => panic!("Cannot format with 'any' filesystem type"),
3534
}
3635
}
3736

@@ -58,7 +57,6 @@ impl FilesystemExt for Filesystem {
5857
vec![]
5958
}
6059
}
61-
Filesystem::Any => vec![],
6260
}
6361
}
6462

@@ -85,7 +83,6 @@ impl FilesystemExt for Filesystem {
8583
vec![]
8684
}
8785
}
88-
Filesystem::Any => panic!("Cannot format with 'any' filesystem type"),
8986
}
9087
}
9188

@@ -98,7 +95,6 @@ impl FilesystemExt for Filesystem {
9895
types::StandardFilesystemType::Xfs => vec!["-f".to_string()],
9996
types::StandardFilesystemType::Swap => vec!["-f".to_string()],
10097
},
101-
Filesystem::Any => vec![],
10298
}
10399
}
104100
}
@@ -118,12 +114,9 @@ impl Formatter {
118114
}
119115
}
120116

121-
/// Creates a new Formatter with force enabled
122-
pub fn force(filesystem: Filesystem) -> Self {
123-
Self {
124-
filesystem,
125-
force: true,
126-
}
117+
/// Forces the format operation
118+
pub fn force(self) -> Self {
119+
Self { force: true, ..self }
127120
}
128121

129122
/// Returns a Command configured to format the given device with the filesystem
@@ -185,11 +178,4 @@ mod tests {
185178
assert_eq!(fs.uuid_arg(), vec!["-m".to_string(), format!("uuid={}", uuid)]);
186179
assert_eq!(fs.label_arg(), vec!["-L", "data"]);
187180
}
188-
189-
#[test]
190-
#[should_panic(expected = "Cannot format with 'any' filesystem type")]
191-
fn test_any_filesystem_panic() {
192-
let fs = Filesystem::Any;
193-
fs.mkfs_command();
194-
}
195181
}

crates/provisioning/tests/use_whole_disk.kdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ strategy name="whole_disk" summary="Wipe and use an entire disk" {
4545
}
4646
type (GUID)"linux-fs"
4747
filesystem {
48-
type "any"
48+
type "xfs"
4949
label "ROOT"
5050
}
5151
}

crates/types/src/filesystem.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ pub enum Filesystem {
2222
label: Option<String>,
2323
uuid: Option<String>,
2424
},
25-
Any,
2625
}
2726

2827
#[derive(Debug, Clone, PartialEq)]
@@ -63,7 +62,7 @@ impl FromKdlProperty<'_> for StandardFilesystemType {
6362
let value = kdl_value_to_string(entry)?;
6463
let v = value.parse().map_err(|_| crate::UnsupportedValue {
6564
at: entry.span(),
66-
advice: Some("'fat32', 'ext4', 'f2fs', 'xfs' 'swap' and 'any' are supported".into()),
65+
advice: Some("'fat32', 'ext4', 'f2fs', 'xfs' 'swap' are supported".into()),
6766
})?;
6867
Ok(v)
6968
}
@@ -108,7 +107,6 @@ impl Filesystem {
108107
}
109108
Ok(Filesystem::Fat32 { label, volume_id })
110109
}
111-
"any" => Ok(Filesystem::Any),
112110
fs_type => {
113111
if volume_id.is_some() {
114112
return Err(crate::InvalidArguments {

0 commit comments

Comments
 (0)