Fix wrong flag to prevent failure when selinux perm are correct.

This review[1] has a typo.  The bash flag was incorrect.  It was meant
to be +e/-e to avoid trouble when grep failed.

[1] https://review.openstack.org/#/q/Ib5873383632a1141c8dd3859b34ca29904020790

Change-Id: I39e42ff54fd7a461f7a03cfb8be17db92a35377e
Related-Bug: #1736246
This commit is contained in:
Sofer Athlan-Guyot 2017-12-18 12:57:18 +01:00
parent 8f8fddb2a3
commit e01745d3d8
1 changed files with 2 additions and 2 deletions

View File

@ -27,9 +27,9 @@ cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
if [ -e /usr/sbin/getenforce ]; then
if [ "$(getenforce)" == "Enforcing" ]; then
set +x
set +e
selinux_wrong_permission="$(find /root/.ssh/ -exec ls -lZ {} \; | grep -v 'ssh_home_t')"
set -x
set -e
if [ -n "${selinux_wrong_permission}" ]; then
semanage fcontext -a -t ssh_home_t '/root/.ssh(/.*)?'
restorecon -R /root/.ssh/