Graduating fileutils

blueprint: https://blueprints.launchpad.net/oslo-incubator/+spec/graduate-oslo-io

summary: move the fileutils code (and associated tests) into oslo.utils

Library Name

oslo.utils and oslo.policy

Contents

  • openstack/common/fileutils.py

  • tests/unit/test_fileutils.py

Early Adopters

  • keystone

Public API

fileutils.py has only 7 functions and 1 global. Their usage, and graduation plan will be broken down below.

  1. ensure_tree()

  • used by nova/cinder/ironic

  • to be added to oslo.utils

  1. delete_if_exists()

  • used extensively in nova and cinder and a bit in neutron

  • to be added to oslo.utils

  1. remove_path_on_error()

  • used by nova/cinder/ironic

  • to be added to oslo.utils

  1. write_to_tempfile()

  • used sparingly in keystone and ceilometer (tests only)

  • consider deprecation

  1. file_open

  • used extensively in cinder

  • can be replaced with just an open() call

  • consider deprecation

  1. read_cached_file()

  • used only by nova’s policy engine, and by oslo.policy

  • can push both of these into oslo.policy and when/if nova switches to oslo.policy, they will no longer require these functions.

  1. delete_cached_file()

  • same as above.

  1. DEFAULT_MODE

  • not being referred to, can be marked as private.

Implementation

Assignee(s)

Primary assignee:

Steve Martinelli (stevemar)

Primary Maintainer

Primary Maintainer:

Steve Martinelli (stevemar)

Security Contact

Security Contact:

Doug Hellmann (doug-hellmann)

Milestones

Liberty-1

Work Items

Adoption Notes

Projects currently importing:

from openstack.common import fileutils

would have to switch to importing:

from oslo_utils import fileutils

if using:

fileutils.file_open()

switch to:

open()

if using:

fileutils.read_cached_file()

switch to:

oslo_policy

Dependencies

None

References

Note

This work is licensed under a Creative Commons Attribution 3.0 Unported License. http://creativecommons.org/licenses/by/3.0/legalcode