Revision 9a914f7a
b/lib/backend.py | ||
---|---|---|
1801 | 1801 |
@param data: the new contents of the file |
1802 | 1802 |
@type mode: int |
1803 | 1803 |
@param mode: the mode to give the file (can be None) |
1804 |
@type uid: int
|
|
1805 |
@param uid: the owner of the file (can be -1 for default)
|
|
1806 |
@type gid: int
|
|
1807 |
@param gid: the group of the file (can be -1 for default)
|
|
1804 |
@type uid: string
|
|
1805 |
@param uid: the owner of the file |
|
1806 |
@type gid: string
|
|
1807 |
@param gid: the group of the file |
|
1808 | 1808 |
@type atime: float |
1809 | 1809 |
@param atime: the atime to set on the file (can be None) |
1810 | 1810 |
@type mtime: float |
... | ... | |
1821 | 1821 |
|
1822 | 1822 |
raw_data = _Decompress(data) |
1823 | 1823 |
|
1824 |
if not (isinstance(uid, basestring) and isinstance(gid, basestring)): |
|
1825 |
_Fail("Invalid username/groupname type") |
|
1826 |
|
|
1827 |
getents = runtime.GetEnts() |
|
1828 |
uid = getents.LookupUser(uid) |
|
1829 |
gid = getents.LookupGroup(gid) |
|
1830 |
|
|
1824 | 1831 |
utils.SafeWriteFile(file_name, None, |
1825 | 1832 |
data=raw_data, mode=mode, uid=uid, gid=gid, |
1826 | 1833 |
atime=atime, mtime=mtime) |
b/lib/rpc.py | ||
---|---|---|
45 | 45 |
from ganeti import errors |
46 | 46 |
from ganeti import netutils |
47 | 47 |
from ganeti import ssconf |
48 |
from ganeti import runtime |
|
48 | 49 |
|
49 | 50 |
# pylint has a bug here, doesn't see this import |
50 | 51 |
import ganeti.http.client # pylint: disable-msg=W0611 |
... | ... | |
1168 | 1169 |
file_contents = utils.ReadFile(file_name) |
1169 | 1170 |
data = cls._Compress(file_contents) |
1170 | 1171 |
st = os.stat(file_name) |
1171 |
params = [file_name, data, st.st_mode, st.st_uid, st.st_gid, |
|
1172 |
st.st_atime, st.st_mtime] |
|
1172 |
getents = runtime.GetEnts() |
|
1173 |
params = [file_name, data, st.st_mode, getents.LookupUid(st.st_uid), |
|
1174 |
getents.LookupGid(st.st_gid), st.st_atime, st.st_mtime] |
|
1173 | 1175 |
return cls._StaticMultiNodeCall(node_list, "upload_file", params, |
1174 | 1176 |
address_list=address_list) |
1175 | 1177 |
|
Also available in: Unified diff