fix selinux permissions

This commit is contained in:
diogo.matsubara@canonical.com 2015-01-13 12:28:21 -02:00
parent b1be1ddb98
commit 86d53b16f5
2 changed files with 11 additions and 1 deletions

7
hooks/fabfile.py vendored
View File

@ -56,10 +56,15 @@ def fix_path_ownership(path, user='nova'):
sudo('chown {} {}'.format(user, path))
def fix_selinux_permission(path):
sudo('chcon -vv --user=system_u --role=object_r --type=etc_t --range=s0 '
'{}'.format(path))
def fix_ml2_plugin_config():
sudo('sed -i "s!openvswitch/ovs_neutron_plugin.ini'
'!ml2/ml2_conf.ini!g" /etc/init.d/neutron-openvswitch-agent')
def fix_local_ip(f):
sudo('sed -i "s!LOCAL_IP!%s!g" %s' % (env.host, f))
sudo('sed -i "s!LOCAL_IP!%s!g" %s' % (env.host, f))

View File

@ -22,6 +22,7 @@ from fabfile import (
enable_shell,
disable_shell,
fix_path_ownership,
fix_selinux_permission,
fix_ml2_plugin_config,
fix_local_ip
)
@ -129,10 +130,14 @@ class POWERProxy():
def fix_path_ownership(self, user, path):
execute(fix_path_ownership, user, path)
def fix_selinux_permission(self, path):
execute(fix_selinux_permission, path)
def commit(self):
for f in CONFIG_FILES:
if os.path.exists("%s%s" % (CHARM_SCRATCH_DIR, f)):
self.copy_file(f)
self.fix_selinux_permission(f)
self._fixup_local_ips()
def _fixup_local_ips(self):