Copilot commented on code in PR #11632:
URL: https://github.com/apache/cloudstack/pull/11632#discussion_r2347988944
##########
scripts/util/keystore-cert-import:
##########
@@ -122,7 +122,7 @@ if [ -f "$LIBVIRTD_FILE" ]; then
ln -sf /etc/pki/libvirt/private/serverkey.pem
/etc/pki/libvirt-vnc/server-key.pem
cloudstack-setup-agent -s > /dev/null
- QEMU_GROUP=$(sed -n 's/^group=//p' /etc/libvirt/qemu.conf | awk -F'"'
'{print $2}' | tail -n1)
+ QEMU_GROUP=$(sed -n 's/^group\s*=//p' /etc/libvirt/qemu.conf | awk -F'='
'{print $1}' | tr -d '"' |tr -d ' ' | tail -n1)
Review Comment:
The awk command is using the wrong field. After sed removes 'group=' from
the line, awk should print field $1 (which would be the value), but the awk
pattern '-F=' '{print $1}' will split on '=' and print the part before '='.
Since sed already removed 'group=', this will likely print an empty string or
incorrect value. The awk command should be '{print $1}' without the field
separator, or the sed pattern should be adjusted.
```suggestion
QEMU_GROUP=$(sed -n 's/^group\s*=//p' /etc/libvirt/qemu.conf | tr -d '"'
| tr -d ' ' | tail -n1)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]