Revision 9a914f7a lib/backend.py
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) |
Also available in: Unified diff