Trees | Indices | Help |
|
---|
|
Utility functions for I/O.
|
|||
FileStatHelper Helper to store file handle's fstat .
|
|||
TemporaryFileManager Stores the list of files to be deleted and removes them on demand. |
|
|||
|
|||
str |
|
||
None or int |
|
||
|
|||
boolean |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
str |
|
||
list |
|
||
|
|||
str or None |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
int |
|
||
int |
|
||
int |
|
||
int |
|
||
int |
|
||
|
|||
str |
|
||
int |
|
||
|
|||
str |
|
||
bool |
|
||
bool |
|
Imports: os, re, logging, shutil, tempfile, errno, time, stat, grp, pwd, errors, constants, pathutils, filelock
|
Format an EnvironmentError exception. If the
|
Reads a file.
|
(Over)write a file atomically. The file_name and either fn (a function taking one argument, the file descriptor, and which should write the data to it) or data (the contents of the file) must be passed. The other arguments are optional and allow setting the file mode, owner and group, and the mtime/atime of the file. If the function doesn't raise an exception, it has succeeded and the target file has the new contents. If the function has raised an exception, an existing target file should be unmodified and the temporary file should be removed.
|
Returns the file 'id', i.e. the dev/inode and mtime information. Either the path to the file or the fd must be given.
|
Verifies that two file IDs are matching. Differences in the inode/device are not accepted, but and older timestamp for fi_disk is accepted.
|
Wraper over WriteFile that locks the target file. By keeping the target file locked during WriteFile, we ensure that cooperating writers will safely serialise access to the file.
|
Return the first non-empty line from a file.
|
Remove a file ignoring some errors. Remove a file, ignoring non-existing ones or directories. Other errors are passed.
|
Remove an empty directory. Remove a directory, ignoring non-existing ones. Other errors are passed. This includes the case, where the directory is not empty, so it can't be removed.
|
Renames a file. This just creates the very least directory if it does not exist and
|
Enforces that given path has given permissions.
|
Enforces that given path is a dir and has given mode, uid and gid set.
|
Super-mkdir; create a leaf directory and all intermediate ones. This is a wrapper around |
Returns the current time formatted for filenames. The format doesn't contain colons as some shells and applications treat them as separators. Uses the local timezone. |
Creates a backup of a file.
|
Returns a list of visible files in a directory.
|
Make required directories, if they don't exist.
|
Look for a filesystem object in a given path. This is an abstract method to search for filesystem object (files, dirs) under a given search path.
|
Check whether a path is absolute and also normalized This avoids things like /dir/../../other/path to be valid. |
Check whether a path is below a root dir. This works around the nasty byte-byte comparison of commonprefix. |
Safe-join a list of path components. Requirements:
|
Return the last lines from a file.
Note: this function will only read and parse the last 4KB of the file; if the lines are very long, it could be that less than the requested number of lines are returned |
Converts bytes to mebibytes.
|
Calculates the size of a directory recursively.
|
Returns the total and free space on a filesystem.
|
Read a pid from a file.
|
Tries to extract a process ID from a PID file's content.
|
Reads a locked PID file. This can be used together with utils.process.StartDaemon.
|
Compute a ganeti pid file absolute path
|
Write the current process pidfile.
|
Reads the watcher pause file.
|
Returns a random UUID.
Note: This is a Linux-specific method as it uses the /proc filesystem. |
Returns True if the user belongs to the group.
|
Returns True if the user can access (read) the file.
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Apr 4 13:43:46 2016 | http://epydoc.sourceforge.net |