Skip to content

Commit 7c1281b

Browse files
authored
Don't fail to make unencrypted regions (#1067)
If instructed by Nexus to make an unencrypted region, the agent crashes due to an improper blank argument. Fix the agent so it can create unencrypted regions.
1 parent e95d59d commit 7c1281b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

agent/src/main.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,9 @@ fn worker_region_create(
18201820
* files (note region starts blank).
18211821
*/
18221822
info!(log, "creating region {:?} at {:?}", region, dir);
1823-
let cmd = Command::new(prog)
1823+
1824+
let mut binding = Command::new(prog);
1825+
let mut cmd = binding
18241826
.env_clear()
18251827
.arg("create")
18261828
.arg("--uuid")
@@ -1832,9 +1834,13 @@ fn worker_region_create(
18321834
.arg("--extent-size")
18331835
.arg(region.extent_size.to_string())
18341836
.arg("--extent-count")
1835-
.arg(region.extent_count.to_string())
1836-
.arg(if region.encrypted { "--encrypted" } else { "" })
1837-
.output()?;
1837+
.arg(region.extent_count.to_string());
1838+
1839+
if region.encrypted {
1840+
cmd = cmd.arg("--encrypted");
1841+
}
1842+
1843+
let cmd = cmd.output()?;
18381844

18391845
if cmd.status.success() {
18401846
info!(log, "region files created ok");

0 commit comments

Comments
 (0)