Bug 1340038

Summary: When semanage tool is not available in the system, gdeploy should throw proper error
Product: Red Hat Gluster Storage Reporter: SATHEESARAN <sasundar>
Component: gdeployAssignee: Sachidananda Urs <surs>
Status: CLOSED ERRATA QA Contact: SATHEESARAN <sasundar>
Severity: high Docs Contact:
Priority: unspecified    
Version: rhgs-3.1CC: amukherj, asriram, rcyriac, rhinduja, smohan
Target Milestone: ---Keywords: ZStream
Target Release: RHGS 3.1.3 Async   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: gdeploy-2.0.1-1 Doc Type: Bug Fix
Doc Text:
Previously, if SELinux Policy Management tool was not installed, gdeploy did not display any error. Hence, the SELinux context was not being set. With this update, gdeploy throws error if SELinux Policy Management tool is not installed on the machine.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-07 11:33:13 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:
Bug Depends On:    
Bug Blocks: 1351522    

Description SATHEESARAN 2016-05-26 10:59:40 UTC
Description of problem:
------------------------
When 'semanage' binary tool is not available in the system,and gdeploy while executing the config script which has a 'selinux' section set to 'yes', should throw proper error message.

Currently gdeploy doesn't throw any warning and silently exits, which the user will take as success. But in reality, the correct selinux labels are not set on the gluster bricks, if semanage tool is not available. 


Version-Release number of selected component (if applicable):
-------------------------------------------------------------
gdeploy-2.0-16

How reproducible:
-----------------
Always

Steps to Reproduce:
-------------------
1. Make sure to remove - 'policycoreutils-python' package which supplies 'semanage' tool. 

Note: When I installed RHEL 7.2 from iso, I never had policycoreutils-python package installed

2. Create a config file with [selinux] section set to 'yes
[hosts]
...
[pv]
...
[vg]
...
[lv1]
...
[lv2]
...
[selinux]
yes

3. Execute the script

Actual results:
---------------
gdeploy completes successfully

Expected results:
-----------------
As the config file has requirement to selinux labels to set on bricks, if 'semanage' tool is not available, then gdeploy should complain about it and should not complete silently

Comment 1 Sachidananda Urs 2016-06-23 07:37:03 UTC
Fixed in commit: https://github.com/gluster/gdeploy/commit/7082fd44acde6fe144e4c920bbf92da6abbf7810

Comment 3 SATHEESARAN 2016-10-25 09:07:14 UTC
Tested with gdeploy-2.0.1-2.el7rhgs

When 'semanage' command is not available, gdeploy throws relevant errors and doesn't fail quietly as it used to do earlier.

Errors are as follows :

"failed: [dhcp37-172.lab.eng.blr.redhat.com] (item={u'device': u'/dev/GLUSTER_vg1/GLUSTER_lv1', u'path': u'/gluster/brick1'}) => {"changed": true, "cmd": "semanage fcontext -a -t glusterd_brick_t /gluster/brick1", "delta": "0:00:00.002824", "end": "2016-10-25 20:12:25.106210", "failed": true, "item": {"device": "/dev/GLUSTER_vg1/GLUSTER_lv1", "path": "/gluster/brick1"}, "rc": 127, "start": "2016-10-25 20:12:25.103386", "stderr": "/bin/sh: semanage: command not found", "stdout": "", "stdout_lines": [], "warnings": []}"

Comment 7 errata-xmlrpc 2017-02-07 11:33:13 UTC
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://rhn.redhat.com/errata/RHSA-2017-0260.html