summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-042-34/+48
| | | | | | | | | | | | | 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")
* Expose bootstrap method from virtBootstrap moduleRadostin Stoyanov2017-07-041-0/+26
| | | | | | | | | This allows other python applications to import the virtBootstrap module and call the bootstrap() method. Example: >>> import virtBootstrap >>> virtBootstrap.bootstrap()
* Improve help menuRadostin Stoyanov2017-07-011-4/+2
|
* Set logger name/format/levelRadostin Stoyanov2017-07-012-28/+60
| | | | | | 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.
* Check for write permissions on destination pathRadostin Stoyanov2017-07-011-0/+3
|
* 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-282-3/+6
|
* 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.
* setup: update project URLCédric Bosdonnat2017-06-251-1/+1
| | | | | The project is now live on github's virt-manager/virt-bootstrap, reflect this change in the setup.py
* Show error if destination path is not folderRadostin Stoyanov2017-06-191-1/+5
|
* Add "debug" and "quiet" flagsRadostin Stoyanov2017-06-191-0/+10
| | | | | | | | | | | | | | These flags aim to control the logging level [1] of virt-bootstrap. Default = INFO (Confirmation that things are working as expected) --debug = DEBUG (Detailed information, typically of interest only when diagnosing problems) --quiet = WARNING (An indication that something unexpected happened, or indicative of some problem in the near future) [1] https://docs.python.org/3/howto/logging.html
* 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-194-53/+589
| | | | | | | | 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
* Improve READMECédric Bosdonnat2017-06-161-0/+9
| | | | Add the lastest dependencies and a description of what the tool does.
* Remove useless shebangCédric Bosdonnat2017-06-161-1/+0
|
* Fix file headers for GPLv3Cédric Bosdonnat2017-06-162-14/+10
| | | | | Using the header as mentioned in the GPLv3 text avoids rpmlint to complain about bad FSF address.
* Use setuptools (setup.py) for installationRadostin Stoyanov2017-06-162-0/+57
| | | | | | | | | | | | | | | | | - Rename "virt-bootstrap.py" to "virt_bootstrap.py" to avoid installation issues. Reference: https://stackoverflow.com/a/30284007 Install: $ sudo ./setup.py install Clean: $ sudo ./setup.py clean --all Uninstall: $ sudo pip uninstall virt-bootstrap Or: $ sudo ./setup.py install --record installed_files.txt $ cat installed_files.txt | xargs sudo rm -rf
* Change shebang to use /usr/bin/envRadostin Stoyanov2017-06-162-2/+2
| | | | | | | | 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-163-0/+0
| | | | Preparatory commit before setup.py introduction.
* Add support for layer extraction in qcow2 imagesRadostin Stoyanov2017-06-162-25/+159
| | | | | | | | | Add support for extracting image layers in qcow2 format. Avoid requirement for root privileges by using libguestfs. - Use "qemu-img" to create backing chain which links the layers. - Use "virt-format" to format the qcow2 image. - Use "virt-tar-in" to extract each tar archives in the qcow2 image.
* Extract tar archives safely using virt-sandboxRadostin Stoyanov2017-06-161-9/+29
| | | | | | | | | This is used to prevent the possibility to create files outside of the destination path. For example, members that have absolute file names starting with "/" or file names with two dots "..". Use qemu://session to avoid requirement for root privileges.
* Cache downloaded container imagesRadostin Stoyanov2017-06-072-9/+34
| | | | | Store container images downloaded with skopeo to avoid re-download. Allow user to disable this option by passing "--no-cache" parameter
* Improve code fomattingRadostin Stoyanov2017-06-072-27/+39
| | | | | Follow PEP8 using pycodestyle https://pypi.python.org/pypi/pycodestyle/
* File source fixesCédric Bosdonnat2017-04-141-3/+3
|
* Remove trailing slash after docker imageRadostin Stoyanov2017-04-141-3/+4
| | | | | Skopeo does not accept any trailing slash at the end of the url. See https://github.com/projectatomic/skopeo#copying-images.
* Fix error: `subprocess.CalledProcessError: CommandRadostin Stoyanov2017-04-141-1/+1
| | | | | | | | | | | | | | | | Fix the following failing skopeo call: 'skopeo copy docker://ubuntu:latest/ dir://tmp/tmpyFFP9Wvirt-bootstrap' The function `tempfile.mkdtemp()` returns full path and do not need additional slash at the beginning. Thus the destination path is incorrect. `dir://tmp/tmpyFFP9Wvirt-bootstrap` -----^ it should be: `dir:/tmp/tmpyFFP9Wvirt-bootstrap` -----^
* Handle error case when creating destination folderRadostin Stoyanov2017-04-141-1/+2
| | | | | | `OSError: [Errno 17] File exists: ...` error occurs when trying to create the destination directory specified from the user without checking if it already exists.
* Python 3/2 compatibility: gettext.install unicode flagRadostin Stoyanov2017-04-141-1/+0
| | | | | | | | The unicode flag is passed to `gettext.install` has default value `False` in Python2. [1] In Python3 this flag does not exists. [2] [1] https://docs.python.org/2/library/gettext.html#gettext.NullTranslations.install [2] https://docs.python.org/3.5/library/gettext.html#gettext.NullTranslations.install
* Python 3/2 compatibility: use print with bracketsRadostin Stoyanov2017-04-141-2/+1
| | | | | | | | The `print` function in Python3 is used with brackets.[1] This syntax is also accepted in Python2.[2] [1] https://docs.python.org/3.5/library/functions.html#print [2] https://docs.python.org/2.7/library/functions.html#print
* Python 3/2 compatibility: exceptions handlingRadostin Stoyanov2017-04-141-2/+2
| | | | | | | | Examine an exception during exception handling in Python3 is done with 'as' instead of comma. This approach works in Python2 as well. https://wiki.python.org/moin/HandlingExceptions
* Initial commitCédric Bosdonnat2017-03-075-0/+904