Skip to content

Commit

Permalink
Merge pull request #2806 from bcressey/prairiedog-split
Browse files Browse the repository at this point in the history
prairiedog: allow '=' in bootconfig values
  • Loading branch information
bcressey authored Feb 15, 2023
2 parents 3438986 + 96bcfe4 commit 15e99bd
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion sources/api/prairiedog/src/bootconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ fn parse_boot_config_to_boot_settings(bootconfig: &str) -> Result<BootSettings>
let mut kernel_params: HashMap<BootConfigKey, Vec<BootConfigValue>> = HashMap::new();
let mut init_params: HashMap<BootConfigKey, Vec<BootConfigValue>> = HashMap::new();
for line in bootconfig.trim().lines() {
let mut kv = line.trim().split('=').map(|kv| kv.trim());
let mut kv = line.trim().splitn(2, '=').map(|kv| kv.trim());
// Ensure the key is a valid boot config key
let key: BootConfigKey = kv
.next()
Expand Down Expand Up @@ -485,6 +485,23 @@ mod boot_settings_tests {
);
}

static EQUALS_BOOTCONFIG: &str = r#"
kernel.dm-mod.create = "root,,,ro,0 0 delay PARTUUID=00000000-0000-0000-0000-000000000000/PARTNROFF=1 0 500"
"#;

#[test]
fn equals_boot_config_to_boot_settings_json() {
assert_eq!(
json!({"kernel":{"dm-mod.create":[
"root,,,ro,0 0 delay PARTUUID=00000000-0000-0000-0000-000000000000/PARTNROFF=1 0 500"]
}}),
serde_json::from_str::<Value>(
&boot_config_to_boot_settings_json(EQUALS_BOOTCONFIG).unwrap()
)
.unwrap()
);
}

static UNSUPPORTED_BOOTCONFIG: &str = r#"
do.androids.dream.of.electric.sheep = "?"
kernel.console = "ttyS1,115200n8", "tty0"
Expand Down

0 comments on commit 15e99bd

Please sign in to comment.