Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1372716 - firewall-cmd --query-* cmds should return valid exit code
firewall-cmd --query-* cmds should return valid exit code
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: firewalld (Show other bugs)
7.3
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Phil Sutter
Tomas Dolezal
: Documentation
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-09-02 09:06 EDT by Tomas Dolezal
Modified: 2018-04-10 06:31 EDT (History)
5 users (show)

See Also:
Fixed In Version: firewalld-0.4.4.4-11.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-04-10 06:30:16 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0702 None None None 2018-04-10 06:31 EDT

  None (edit)
Description Tomas Dolezal 2016-09-02 09:06:30 EDT
Description of problem:
when the result of a query is negative, exitcode 1 is used. this code is undefined as per man:firewall-cmd(1). While the code is correctly zero/non-zero, 1 is usually result of Traceback, not a valid operation in firewalld.

Version-Release number of selected component (if applicable):
firewalld-0.4.3.2-6.el7.noarch

How reproducible:
always

Steps to Reproduce:
firewall-cmd --query-service ssh ; echo ec=$?
firewall-cmd --query-service dns ; echo ec=$?
firewall-cmd --query-panic ; echo ec=$?

Actual results:
yes
ec=0
no
ec=1
no
ec=1

Expected results:
yes
ec=0
no
ec=12 <--- CHANGED to NOT_ENABLED
no
ec=12 <--- CHANGED to NOT_ENABLED

Additional info:
Comment 2 Thomas Woerner 2016-09-02 09:59:36 EDT
All query methods either return 0 or 1 for a long time already. I do not know if it will be simply possible to change the values without breaking scripts using the current exit codes.
Comment 3 Eric Garver 2017-06-23 13:22:53 EDT
Tomas,

The man page sections for --query-* commands indicates that it may return 1. The 'EXIT CODES' section could be updated to indicate that for --query-* 1 means negative status, otherwise it's due to a traceback.

I agree with Thomas in comment 2 that changing the return code would be problematic. Best we can do is improve the man page. Do you agree?
Comment 4 Tomas Dolezal 2017-06-26 08:15:20 EDT
Hello Eric,
(In reply to Eric Garver from comment #3)
> I agree with Thomas in comment 2 that changing the return code would be
> problematic. Best we can do is improve the man page. Do you agree?
Yes, I agree. the possible change should be done in both downstream and upstream.
Comment 9 errata-xmlrpc 2018-04-10 06:30:16 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0702

Note You need to log in before you can comment on or make changes to this bug.