Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 918140

Summary: semanage boolean -m BOOLEAN_NAME tracebacks
Product: Red Hat Enterprise Linux 7 Reporter: Milos Malik <mmalik>
Component: policycoreutilsAssignee: Daniel Walsh <dwalsh>
Status: CLOSED CURRENTRELEASE QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: mtruneck
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 11:48:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Milos Malik 2013-03-05 15:11:34 UTC
Description of problem:
I'm not sure what "semanage boolean -m xen_use_nfs" should do, but it is a valid combination, based on the output of "semanage --help":
semanage boolean -{d|m} [--on|--off|-1|-0] [-N] -F boolean | boolean_file

Version-Release number of selected component (if applicable):
policycoreutils-2.1.14-17.el7.x86_64
policycoreutils-devel-2.1.14-17.el7.x86_64
policycoreutils-sandbox-2.1.14-17.el7.x86_64
policycoreutils-python-2.1.14-17.el7.x86_64
policycoreutils-restorecond-2.1.14-17.el7.x86_64
policycoreutils-gui-2.1.14-17.el7.x86_64
policycoreutils-newrole-2.1.14-17.el7.x86_64

How reproducible:
always

Steps to Reproduce:
# semanage boolean -m xen_use_nfs
Traceback (most recent call last):
  File "/usr/sbin/semanage", line 570, in <module>
    process_args(sys.argv[1:])
  File "/usr/sbin/semanage", line 448, in process_args
    OBJECT.modify(target, value, use_file)
  File "/usr/lib64/python2.7/site-packages/seobject.py", line 2080, in modify
    self.__mod(name, value)
  File "/usr/lib64/python2.7/site-packages/seobject.py", line 2049, in __mod
    if value.upper() in self.dict:
AttributeError: 'NoneType' object has no attribute 'upper'
# echo $?
1
#

Actual results:
 * a traceback

Expected results:
 * either specified action is done or an error message "you forgot to specify ..." is displayed

Comment 1 Daniel Walsh 2013-03-05 16:20:59 UTC
Fixed in policycoreutils-2.1.14-18.el7

It should require a value.

Comment 2 Milos Malik 2013-03-22 10:57:13 UTC
Unfortunately, the fix introduced another bug. A boolean value is required on the command line even if a file is given as parameter.

# semanage boolean -l -F > booleans-values.txt
# ls -l booleans-values.txt 
-rw-r--r--. 1 root root 5412 Mar 22 11:50 booleans-values.txt
# head booleans-values.txt  
ftp_home_dir=0
smartmon_3ware=0
xdm_sysadm_login=0
xen_use_nfs=0
mozilla_read_content=0
ssh_chroot_rw_homedirs=0
mount_anyfile=1
clamscan_read_user_content=0
tftp_anon_write=0
zoneminder_anon_write=0
# semanage boolean -m -F ./booleans-values.txt
/usr/sbin/semanage: Value Required [ --on | --off ]
# echo $?
1
#

Comment 3 Daniel Walsh 2013-07-11 22:27:05 UTC
fixed in policycoreutils-2.1.14-63.el7

Comment 4 Milos Malik 2013-08-06 07:30:32 UTC
A boolean file is mentioned as a positional argument, but semanage cannot work with it:

# semanage boolean --help 2>&1 | head -n 5
usage: semanage boolean [-h] [-n] [-N] [-s STORE] [  --extract  | --deleteall  | --list -C | --modify ( ( ( --on | --off ) ( boolean ) ) ) ) ]

positional arguments:
  boolean               boolean | boolean_file
# cat ./pokus 
nis_enabled=0
# semanage boolean -m -F ./pokus 
usage: semanage [-h]
                
                {import,export,login,user,port,interface,module,node,fcontext,boolean,permissive,dontaudit}
                ...
semanage: error: unrecognized arguments: -F
# semanage boolean -m ./pokus 
state option is needed
#

Previous versions of semanage recognized -F parameter, but current version does not.

Comment 5 Daniel Walsh 2013-08-06 12:57:08 UTC
Fixed in policycoreutils-2.1.14-72.el7

Comment 8 Ludek Smid 2014-06-13 11:48:11 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.