File utilities.
New in version 1.8.
oslo_utils.fileutils.
delete_if_exists
(path, remove=<built-in function unlink>)¶Delete a file, but ignore file not found error.
Parameters: |
|
---|
oslo_utils.fileutils.
ensure_tree
(path, mode=511)¶Create a directory (and any ancestor directories required)
Parameters: |
|
---|
oslo_utils.fileutils.
remove_path_on_error
(*args, **kwds)¶Protect code that wants to operate on PATH atomically. Any exception will cause PATH to be removed.
Parameters: |
|
---|
oslo_utils.fileutils.
write_to_tempfile
(content, path=None, suffix='', prefix='tmp')¶Create a temporary file containing data.
Create a temporary file containing specified content, with a specified filename suffix and prefix. The tempfile will be created in a default location, or in the directory path, if it is not None. path and its parent directories will be created if they don’t exist.
Parameters: |
|
---|
For example: it can be used in database tests for creating configuration files.
New in version 1.9.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.