Copilot commented on code in PR #13737:
URL: https://github.com/apache/cloudstack/pull/13737#discussion_r3681962379


##########
systemvm/debian/root/health_checks/iptables_check.py:
##########
@@ -41,13 +41,14 @@ def main():
 
         fetchIpTableEntriesCmd = "iptables-save | grep " + destIp
         pout = Popen(fetchIpTableEntriesCmd, shell=True, stdout=PIPE)
-        if pout.wait() != 0:
+        stdout, _ = pout.communicate()
+        if pout.returncode != 0:
             failedCheck = True

Review Comment:
   `grep` returns exit code 1 when it finds no matches, which is a 
valid/expected outcome when rules are missing. Treating any non-zero return 
code as an execution failure makes the error message misleading and skips the 
per-entry missing-rule reporting. Also, `grep` defaults to regex matching; 
using `-F` avoids surprises with dots in IP addresses.



-- 
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]

Reply via email to