summaryrefslogtreecommitdiffstats
path: root/src/virtBootstrap/sources.py
Commit message (Collapse)AuthorAgeFilesLines
* DockerSource: Ignore short lines from skopeoRadostin Stoyanov2017-07-051-2/+2
| | | | | Avoid parsing short lines when detecting download progress from skopeo's output.
* Gather common utility functions in "utils" moduleRadostin Stoyanov2017-07-051-314/+21
| | | | | | Add new module to collect utility functions used in virt-bootstrap. Move the function definitions from "sources" and "virt_bootstrap" to the new module.
* get_image_details: Use connection optionsRadostin Stoyanov2017-07-051-4/+13
| | | | | Pass the "not_secure", "username" and "password" values to "skopeo inspect" when manifest is retrieved.
* Detect and log download progress of layersRadostin Stoyanov2017-07-051-1/+136
| | | | | | | | | | Parse skopeo's output messages to detect and log the donwload progress for each layer and update the progress of virt-bootstrap. Example: virt-bootstrap docker://ubuntu /tmp/foo --status-only Status: Downloading layer (2/5), Progress: 25.30%
* Add new module to store the progressRadostin Stoyanov2017-07-051-19/+33
| | | | | | | | | | | | | | | | | | | | This module is used to store the progress of the bootstrap process and could be used by other applications to get status of virt-bootstrap as well as percentage of completion. Convert some info messages to use this new system for a clean reporting in client applications. Example usage: import virtBootstrap def show_progress(data): print("Status: %s, Progress: %.2f" % (data['status'], data['value'])) virtBootstrap.bootstrap(uri='docker://ubuntu', dest="/tmp/test1", progress_cb=show_progress)
* checksum: Log failuresRadostin Stoyanov2017-07-051-2/+8
|
* Remove redundant checksum verificationRadostin Stoyanov2017-07-051-10/+2
| | | | | | | | The checksum verification of downloaded layers is already done in the method validate_image_layers() or "skopeo copy" [1] [2]. [1] https://github.com/containers/image/blob/master/copy/copy.go#L352 [2] https://github.com/containers/image/blob/master/copy/copy.go#L358
* DockerSource: Use downloaded layersRadostin Stoyanov2017-07-051-1/+23
| | | | | | | | Do not call "skopeo copy" if layers were downloaded and have valid hash sum. Although, "skopeo copy" already does such check for us this change allow us to control the output and avoids spawning a binary.
* DockerSource: Encapsulate skopeo copy in a methodRadostin Stoyanov2017-07-051-19/+25
|
* Compact layers' details passed to extract methodsRadostin Stoyanov2017-07-051-24/+25
| | | | | | | | | Improve maintainability by putting layers' digest, sum_type, size and file_path in a list which is then passed to extract methods. This change replaces the function get_layer_info(). Reduce the amount of duplicated code by taking out the logging calls in a method.
* Log the size of layers when extractingRadostin Stoyanov2017-07-051-2/+26
|
* DockerSource: Retrieve manifest before downloadRadostin Stoyanov2017-07-041-6/+21
| | | | | | | | | | | | | Get manifest of Docker image before the calling "skopeo copy" command. The aim of this change is to: - Make available method get_image_details() which could be used to get information about Docker image or detect whether Docker URI is valid and accessible. - Get information about the layers before the download process (skopeo copy) is called.
* DockerSource: Use getter for image directoryRadostin Stoyanov2017-07-041-15/+23
| | | | | Make the method for getting image directory reusable and use instance variable to store the path where image layers will be stored.
* Improve URI parse of DockerSourceRadostin Stoyanov2017-07-041-7/+12
| | | | | | | | | | | Decrease the number of instance attributes of class DockerSource. Since variables "image" and "registry" are only used to create valid Docker URI they could be used as local variables instead of instance attributes to improve encapsulation. Add comments to improve readability. Fix problem with invalid docker URLs
* bootstrap: Use explicit argumentsRadostin Stoyanov2017-07-041-11/+12
| | | | | | | | | | | | | Specify explicitly the arguments of bootstrap method. This change allows to easily bootstrap a container from another python application when the module virtBootstrap is imported. Example: import virtBootstrap virtBootstrap.bootstrap(uri="docker://fedora", dest="/tmp/foo")
* Set logger name/format/levelRadostin Stoyanov2017-07-011-19/+24
| | | | | | This patch aims to set logger name for the virtBootstrap module. Set logging format to: %(levelname)s: %(message)s and use an elegant way of setting log level.
* Auto-correct docker source URIRadostin Stoyanov2017-06-281-1/+3
| | | | | | | | | | | | | | | | | | | | | | Skopeo does not accept "docker:///" as valid URI format. [1] However, driver URIs within the Libvirt project and virtualization tools such as libvirt-sandbox use three slashes after URI scheme. [2] Make virt-bootstrap auto-correct the source URI for consistency with other tools. Following the syntax specifications in RFC 1808, "urlparse" recognizes a netloc only if it is properly introduced by ‘//’. [3] Otherwise the input is presumed to be a relative URL and thus to start with a path component. [4] - "self.image" is the path component - "self.registry" is the netloc component [1] https://github.com/projectatomic/skopeo/blob/master/docs/skopeo.1.md#skopeo-copy-1 [2] http://libvirt.org/uri.html [3] https://docs.python.org/2/library/urlparse.html [4] https://hg.python.org/cpython/file/2.7/Lib/urlparse.py#l187
* Resolve pylint issuesRadostin Stoyanov2017-06-281-2/+5
|
* Refactor info messagesRadostin Stoyanov2017-06-281-6/+12
| | | | | | | Update logged messages to provide information about the current state of virt-bootstrap. E.g "Downloading container image" or "Extracting layer (1/5)"
* Improve logging of virt-sandboxRadostin Stoyanov2017-06-281-4/+2
|
* Raise exception if file source is invalidRadostin Stoyanov2017-06-281-0/+4
|
* Improve logging of executed processesRadostin Stoyanov2017-06-281-5/+7
| | | | | | Improve readability of logged messages by separating the prefix from the message with new line and raise CalledProcessError if the exit code is non-zero.
* Log executed process callsRadostin Stoyanov2017-06-191-9/+26
| | | | | Log executed commands as well as their stdout/stderr for easier debugging.
* Add automated check for code styleRadostin Stoyanov2017-06-191-34/+59
| | | | | | | | To run the code style checks, run `python setup.py pylint` Only errors could be reported using the option --errors-only. Could be useful to run in interactive git rebase Fix the reported pylint errors as well
* Remove useless shebangCédric Bosdonnat2017-06-161-1/+0
|
* Fix file headers for GPLv3Cédric Bosdonnat2017-06-161-7/+5
| | | | | Using the header as mentioned in the GPLv3 text avoids rpmlint to complain about bad FSF address.
* Change shebang to use /usr/bin/envRadostin Stoyanov2017-06-161-1/+1
| | | | | | | | When python is not /usr/bin/python but something else that is still found by your system, /usr/bin/env still finds it. :x Reference: https://mail.python.org/pipermail/python-list/2012-September/631967.html
* Move source files in src/virtBootstrapRadostin Stoyanov2017-06-161-0/+276
Preparatory commit before setup.py introduction.