The cinder.openstack.common.fileutils Module

delete_if_exists(path)

Delete a file, but ignore file not found error.

Parameters:path – File to delete
ensure_tree(path)

Create a directory (and any ancestor directories required)

Parameters:path – Directory to create
file_open(*args, **kwargs)

Open file

see built-in file() documentation for more details

Note: The reason this is kept in a separate module is to easily be able to provide a stub module that doesn’t alter system state at all (for unit tests)

read_cached_file(filename, force_reload=False)

Read from a file if it has been modified.

Parameters:force_reload – Whether to reload the file.
Returns:A tuple with a boolean specifying if the data is fresh or not.
remove_path_on_error(*args, **kwds)

Protect code that wants to operate on PATH atomically. Any exception will cause PATH to be removed.

Parameters:path – File to work with

Previous topic

The cinder.openstack.common.excutils Module

Next topic

The cinder.openstack.common.gettextutils Module

This Page