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

Simplify updater logic for downloading and verifying target files #1202

Merged

Commits on Nov 9, 2020

  1. updater: remove unused _soft_check_file_length

    This internal method isn't used by any code other than tests.
    
    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed Nov 9, 2020
    Configuration menu
    Copy the full SHA
    b3ada5b View commit details
    Browse the repository at this point in the history
  2. updater: simplify Updater.download_target() call stack

    The call stack and code for download_target() is more complex than
    required:
    * download_target() : builds target destination filepath, gets length
      and hashes
    * _get_target_file() : fixes filenames if consistent snapshots enabled,
      defines verification callback
    * _get_file() : iterates mirrors, tries to download files, verifies them
    
    Remove the verification callback and collapse the call stack by a single
    level to make the code easier to follow.
    
    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed Nov 9, 2020
    Configuration menu
    Copy the full SHA
    ad1335b View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2020

  1. updater: more optimal file length checking

    Rather than read to the end of the file in order to determin its size, use
    the whence value of seek() to move the file object's position to the end
    of the file, then the tell() method of the file object to read the current
    position in bytes.
    
    Co-authored-by: Jussi Kukkonen <jkukkonen@vmware.com>
    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl and Jussi Kukkonen committed Nov 11, 2020
    Configuration menu
    Copy the full SHA
    02416e3 View commit details
    Browse the repository at this point in the history

Commits on Nov 26, 2020

  1. client: simplify loop exit logic

    Simplify the loop exit logic in _get_target_file() to simply return a
    verified file_object, once we have it, rather than breaking from the loop
    and then returning the file_object.
    
    This converts a use of a try/except/else to a try/except and is a little
    easier to read.
    
    Signed-off-by: Joshua Lock <jlock@vmware.com>
    joshuagl committed Nov 26, 2020
    Configuration menu
    Copy the full SHA
    372e218 View commit details
    Browse the repository at this point in the history