Skip to content

Commit 1959aef

Browse files
committed
roachprod: potential shell syntax error in fips
Previous patch #137555 introduced a check on FIPS enablement in a FIPS environment. To avoid a potential shell syntax error if this code was to be executed outside of a Ubuntu Pro FIPS environment, this patch adds quotes around the result of the `pro status` command result to avoid an `[: !=: unary operator expected` error. Epic: none Release note: None
1 parent 84697f3 commit 1959aef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/roachprod/vm/startup.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ const startupScriptFIPS = `
181181
{{ if .EnableFIPS }}
182182
sudo apt-get install -yq ubuntu-advantage-tools jq
183183
# Enable FIPS (in practice, it's often already enabled at this point).
184-
if [ $(sudo pro status --format json | jq '.services[] | select(.name == "fips") | .status') != '"enabled"' ]; then
184+
fips_status=$(sudo pro status --format json | jq '.services[] | select(.name == "fips") | .status')
185+
if [ "$fips_status" != '"enabled"' ]; then
185186
sudo ua enable fips --assume-yes
186187
fi
187188
{{ end }}`

0 commit comments

Comments
 (0)