Skip to content

Commit

Permalink
deploy: Don't overwrite kargs by default
Browse files Browse the repository at this point in the history
This is the same bug as
ostreedev@3089166
but for the not-booted case.

Basically in the C API bridged to Rust we can't distinguish between
"NULL array" and "zero length array".  But the _with_options path
supports distinguishing them, and we want the "no kargs provided"
case to not override anything.

Closes: ostreedev#502
  • Loading branch information
cgwalters committed Jul 19, 2023
1 parent c2a292c commit 77f04e7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/src/container/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ pub async fn deploy(
let target_imgref = options.target_imgref.unwrap_or(imgref);
origin.set_string("origin", ORIGIN_CONTAINER, &target_imgref.to_string());

let opts = ostree::SysrootDeployTreeOpts {
override_kernel_argv: options.kargs,
..Default::default()
};

if sysroot.booted_deployment().is_some() {
let opts = ostree::SysrootDeployTreeOpts {
override_kernel_argv: options.kargs,
..Default::default()
};
sysroot.stage_tree_with_options(
Some(stateroot),
commit,
Expand All @@ -95,12 +96,12 @@ pub async fn deploy(
cancellable,
)?;
} else {
let deployment = &sysroot.deploy_tree(
let deployment = &sysroot.deploy_tree_with_options(
Some(stateroot),
commit,
Some(&origin),
merge_deployment.as_ref(),
options.kargs.unwrap_or_default(),
Some(&opts),
cancellable,
)?;
let flags = ostree::SysrootSimpleWriteDeploymentFlags::NONE;
Expand Down

0 comments on commit 77f04e7

Please sign in to comment.