Skip to content

Commit d71deec

Browse files
craig[bot]golgeek
andcommitted
Merge #152890
152890: roachprod: potential shell syntax error in fips r=srosenberg,herkolategan a=golgeek 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 Co-authored-by: Ludovic Leroux <[email protected]>
2 parents ef85192 + 1959aef commit d71deec

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)