Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement filesystem abstraction #232

Commits on May 4, 2020

  1. Define an interface for storage access

    Implement an abstract base class (ABC) which defined an abstract interface
    for storage operations, regardless of backend.
    
    The aim is to enable securesystemslib functions to operate as normal on
    local filesystems by implementing the interface for local filesystem
    operations within securesystemslib, with users of the library able to
    provide implementations for use with their storage backend of choice when
    this is not a local filesystem, i.e. S3 buckets as used by Warehouse for
    the PEP 458 implementation.
    
    For more context see tuf issue #1009:
    theupdateframework/python-tuf#1009
    
    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed May 4, 2020
    Configuration menu
    Copy the full SHA
    0ab77c4 View commit details
    Browse the repository at this point in the history

Commits on May 5, 2020

  1. Local filesystem impl of storage interface

    Add FilesystemBackend implementing StorageBackendInterface using Python
    standard library functions to perform operations on local files and
    filesystems.
    
    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed May 5, 2020
    Configuration menu
    Copy the full SHA
    5ad9f26 View commit details
    Browse the repository at this point in the history
  2. Add abstract storage support to digest_filename()

    Add an optional 'storage_backend' argument to digest_filename() which
    expects an object implementing
    securesystemslib.storage.StorageBackendInterface and defaults to None
    
    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed May 5, 2020
    Configuration menu
    Copy the full SHA
    d409796 View commit details
    Browse the repository at this point in the history
  3. Add StorageBackendInterface support to util funcs

    modify get_file_details(), ensure_parent_dir(),  load_json_file() and
    persist_temp_file() to take an optional storage_backend argument which
    defaults to None.
    
    If no storage_backend is defined the functions will instantiate a
    FilesystemBackend and use that, otherwise the argument expects an object
    implementing securesystemslib.storage.StorageBackendInterface.
    
    persist_temp_file() now takes an additional should_close parameter, which
    defaults to True, indicating whether the persisted tempfile should be closed.
    
    This is to better support scenarios where the same temporary file might need
    to be persisted/put to storage multiple times under different names, such as
    in the case of python-tuf metadata written with consistent snapshots.
    
    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed May 5, 2020
    Configuration menu
    Copy the full SHA
    8deb29f View commit details
    Browse the repository at this point in the history
  4. Add StorageBackendInterface to interface funcs

    Add storage_backend as an optional parameter to functions in the interface
    module which read files from the disk. When no argument is provided and
    the default value of None is used, instantiate a FilesystemBackend and use
    that to access files on the local filesystem.
    
    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed May 5, 2020
    Configuration menu
    Copy the full SHA
    32f3394 View commit details
    Browse the repository at this point in the history
  5. Mark uncovered path in interface

    Improve the coverage numbers by marking an untested path as
    not having coverage.
    
    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed May 5, 2020
    Configuration menu
    Copy the full SHA
    c60ef22 View commit details
    Browse the repository at this point in the history