Douglas Schilling Landgraf has uploaded a new change for review. Change subject: persist: fix owner/group copy to /config ......................................................................
persist: fix owner/group copy to /config In commit 9a1986a8 the ovirt_store_config has been ported to new ovirt/node package. This new persist function uses shutil.copy2() to copy the new persisted file to /config but on POSIX platforms[1], this means that file owner and group are lost as well as ACLs affecting the permissions of the persisted file during the mount bind. This patch make sure the owner/group is correct when ovirt-node store a peristed file for later use with correct attributes. [1] https://docs.python.org/2/library/shutil.html Change-Id: I4ec3dc1773a0e84eb82c2682f9e145c15216dd91 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1204535 Signed-off-by: Douglas Schilling Landgraf <[email protected]> --- M src/ovirt/node/utils/fs/__init__.py 1 file changed, 5 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/68/39068/1 diff --git a/src/ovirt/node/utils/fs/__init__.py b/src/ovirt/node/utils/fs/__init__.py index b46572f..550fde5 100644 --- a/src/ovirt/node/utils/fs/__init__.py +++ b/src/ovirt/node/utils/fs/__init__.py @@ -27,6 +27,7 @@ import shutil import errno import os +import stat import StringIO import re import hashlib @@ -484,7 +485,11 @@ self._logger.error('Failed to clean up persisted file ' '"%s": %s', abspath, ose.message) self._prepare_dir(abspath, persisted_path) + abspath_stat = os.stat(abspath) + owner = abspath_stat[stat.ST_UID] + group = abspath_stat[stat.ST_GID] shutil.copy2(abspath, persisted_path) + os.chown(persisted_path, owner, group) mount.mount(persisted_path, abspath, flags=mount.MS_BIND) self._logger.info('File "%s" successfully persisted', abspath) self._add_path_entry(abspath) -- To view, visit https://gerrit.ovirt.org/39068 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4ec3dc1773a0e84eb82c2682f9e145c15216dd91 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-node Gerrit-Branch: master Gerrit-Owner: Douglas Schilling Landgraf <[email protected]> _______________________________________________ node-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/node-patches
