Edward Haas has uploaded a new change for review. Change subject: net: set netconf/* owner to 'vdsm' ......................................................................
net: set netconf/* owner to 'vdsm' On ovirt-node netconf/* has umask of 660 with root as owner. Accessing the folders and files by vdsm is denied. Resolved by changing the owner of the files and folders to 'vdsm' Change-Id: I65725c698bdd3cd3a51a3327b33ce9b16292820a Bug-Url: https://bugzilla.redhat.com/1294075 Signed-off-by: Edward Haas <edwa...@redhat.com> Reviewed-on: https://gerrit.ovirt.org/50984 Continuous-Integration: Jenkins CI Reviewed-by: Dan Kenigsberg <dan...@redhat.com> Reviewed-on: https://gerrit.ovirt.org/51053 (cherry picked from commit a47bbd992245a9e1bedcf69afedfe60aa0e36881) --- M lib/vdsm/netconfpersistence.py M tests/netconfpersistenceTests.py 2 files changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/60/51060/1 diff --git a/lib/vdsm/netconfpersistence.py b/lib/vdsm/netconfpersistence.py index cbb159e..1be6f32 100644 --- a/lib/vdsm/netconfpersistence.py +++ b/lib/vdsm/netconfpersistence.py @@ -24,6 +24,7 @@ import logging import netaddr import os +import pwd import string from .config import config @@ -156,6 +157,11 @@ with open(path, 'w') as configurationFile: json.dump(config, configurationFile) + # Set owner to vdsm (required by ovirt-node) + vdsm_uid = pwd.getpwnam(constants.VDSM_USER).pw_uid + os.chown(dirPath, vdsm_uid, 0) + os.chown(path, vdsm_uid, 0) + @staticmethod def _removeConfig(path): utils.rmFile(path) diff --git a/tests/netconfpersistenceTests.py b/tests/netconfpersistenceTests.py index f997800..aad5be8 100644 --- a/tests/netconfpersistenceTests.py +++ b/tests/netconfpersistenceTests.py @@ -19,7 +19,9 @@ # import json +from monkeypatch import MonkeyPatch import os +import pwd from shutil import rmtree import tempfile @@ -69,6 +71,7 @@ persistence.removeBonding(BONDING) self.assertTrue(persistence.bonds.get(BONDING) is None) + @MonkeyPatch(pwd, 'getpwnam', lambda name: pwd.getpwuid(os.geteuid())) def testSaveAndDelete(self): persistence = Config(self.tempdir) persistence.setNetwork(NETWORK, NETWORK_ATTRIBUTES) -- To view, visit https://gerrit.ovirt.org/51060 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I65725c698bdd3cd3a51a3327b33ce9b16292820a Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: ovirt-3.5 Gerrit-Owner: Edward Haas <edwa...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches