Trees | Indices | Help |
|
---|
|
Utility functions for I/O.
|
|||
str |
|
||
None or int |
|
||
|
|||
boolean |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
str |
|
||
list |
|
||
|
|||
str or None |
|
||
|
|||
|
|||
|
|||
int |
|
||
int |
|
||
int |
|
||
int |
|
||
|
|||
|
|||
|
|||
str |
|
||
int |
|
||
|
|||
str |
|
|
|||
_RANDOM_UUID_FILE = "/proc/sys/kernel/random/uuid" Path generating random UUID |
Imports: os, logging, shutil, tempfile, errno, time, errors, constants, filelock
|
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.
|
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. |
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.
|
Reads a locked PID file. This can be used together with utils.process.StartDaemon.
|
Adds an SSH public key to an authorized_keys file.
|
Removes an SSH public key from an authorized_keys file.
|
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. |
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Jul 24 16:51:20 2012 | http://epydoc.sourceforge.net |