---
lib/backend.py | 6 ++++++
lib/rpc.py | 6 ++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/backend.py b/lib/backend.py
index 339440b..13803f7 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -1821,6 +1821,12 @@ def UploadFile(file_name, data, mode, uid, gid, atime,
mtime):
raw_data = _Decompress(data)
+ getents = runtime.GetEnts()
+ if isinstance(uid, str):
+ uid = getents.LookupUser(uid)
+ if isinstance(gid, str):
+ gid = getents.LookupGroup(gid)
+
utils.SafeWriteFile(file_name, None,
data=raw_data, mode=mode, uid=uid, gid=gid,
atime=atime, mtime=mtime)
diff --git a/lib/rpc.py b/lib/rpc.py
index 4e2693e..1414170 100644
--- a/lib/rpc.py
+++ b/lib/rpc.py
@@ -45,6 +45,7 @@ from ganeti import constants
from ganeti import errors
from ganeti import netutils
from ganeti import ssconf
+from ganeti import runtime
# pylint has a bug here, doesn't see this import
import ganeti.http.client # pylint: disable-msg=W0611
@@ -1168,8 +1169,9 @@ class RpcRunner(object):
file_contents = utils.ReadFile(file_name)
data = cls._Compress(file_contents)
st = os.stat(file_name)
- params = [file_name, data, st.st_mode, st.st_uid, st.st_gid,
- st.st_atime, st.st_mtime]
+ getents = runtime.GetEnts()
+ params = [file_name, data, st.st_mode, getents.LookupUid(st.st_uid),
+ getents.LookupGid(st.st_gid), st.st_atime, st.st_mtime]
return cls._StaticMultiNodeCall(node_list, "upload_file", params,
address_list=address_list)
--
1.7.3.1