summaryrefslogtreecommitdiffstats
path: root/src/virtBootstrap/sources
Commit message (Collapse)AuthorAgeFilesLines
* docker-source: Support blobs without .tar extRadostin Stoyanov2018-04-281-2/+19
| | | | | | | | | | | | | | Since skopeo v0.1.29 [1] blobs are saved without the .tar extension. This commit changes the docker-source module to handle both cases (with or without .tar extension) [1] commit: projectatomic/skopeo@43acc74 Fix skopeo tests with changes to dir transport The dir transport has been changed to save the blobs without the .tar extension Fixes the skopeo tests failing due to this change Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
* Revert "docker-source: Support blobs without .tar ext"Radostin Stoyanov2018-04-241-5/+1
| | | | This reverts commit 6146e9ab5e36ff894b8c95d00a45db6181ad8472.
* docker-source: Support blobs without .tar extRadostin Stoyanov2018-04-101-1/+5
| | | | | | | | | | | | Since skopeo v0.1.29 blobs are saved without the .tar extension. See commit: projectatomic/skopeo@43acc74 Fix skopeo tests with changes to dir transport The dir transport has been changed to save the blobs without the .tar extension Fixes the skopeo tests failing due to this change Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
* pylint: Resolve similar linesRadostin Stoyanov2018-03-012-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch resolves the following pylint warning: R: 1, 0: Similar lines in 2 files ==virtBootstrap.sources.docker_source:306 ==virtBootstrap.sources.file_source:87 dest, self.uid_map, self.gid_map, (self.root_password is None) # Create new disk? ) else: raise Exception("Unknown format:" + self.output_format) (duplicate-code) R: 1, 0: Similar lines in 2 files ==virtBootstrap.sources.file_source:50 ==virtBootstrap.sources.virt_builder_source:58 self.output_format = kwargs.get('fmt', utils.DEFAULT_OUTPUT_FORMAT) self.uid_map = kwargs.get('uid_map', []) self.gid_map = kwargs.get('gid_map', []) self.root_password = kwargs.get('root_password', None) self.progress = kwargs['progress'].update_progress (duplicate-code) Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
* pylint: Resolve logging-not-lazyRadostin Stoyanov2018-03-012-2/+2
| | | | | | | | | Specify string format arguments as logging function parameters (logging-not-lazy) https://docs.python.org/3/library/logging.html#logging.Logger.debug Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
* pylint: Resolve - two spaces before commentRadostin Stoyanov2018-03-011-1/+1
| | | | | | E261 at least two spaces before inline comment Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
* pylint: Resolve test for membershipRadostin Stoyanov2018-03-011-1/+1
| | | | | | E713 test for membership should be 'not in' Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
* docker-source: Get list of layers without `--raw`Radostin Stoyanov2017-12-181-17/+12
| | | | | | | | | | | | When `skopeo inspect --raw docker://feodra` is used the returned manifest content contains a list with manifests for specific platforms [1] rather than a list with layers. By using `skopeo inpect docker://fedora` the correct manifest content is retrieved and a list with layers is provided. In addition, skopeo handles the difference between schemaVersion 1 and 2. [1] https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions
* docker-source: Avoid skopeo copy in cacheRadostin Stoyanov2017-12-121-3/+13
| | | | | | | The `skopeo copy` command has changed it's behaviour to keep only a files for single container image per directory. To get around this and keep cache of downloaded images is used temporary destination directory for 'skopeo copy' and image files are then moved in the cache folder.
* source-docker: Show error if skopeo not installedRadostin Stoyanov2017-11-211-0/+4
| | | | Show appropriate error message when skopeo is not installed.
* Update doc stringsRadostin Stoyanov2017-08-281-17/+17
| | | | | | These documentation can be seen using: $ pydoc virtBootstrap
* Define source code encodingRadostin Stoyanov2017-08-283-0/+3
| | | | | | | | | The default source code encoding in Python2.* is ASCII (PEP 263 [1]) and in Python3.* is UTF-8 (PEP 3120 [2]). Define the encoding on top of each file for consistency. [1] https://www.python.org/dev/peps/pep-0263/ [2] https://www.python.org/dev/peps/pep-3120/
* Add virt-builder sourceRadostin Stoyanov2017-08-282-0/+155
| | | | | | | | | | | | | | | | | | | | Add implementation for virt-builder source which aims to create container root file system from VM image build with virt-builder. Usage examples: $ virt-bootstrap virt-builder://fedora-25 /tmp/foo $ virt-bootstrap virt-builder://ubuntu-16.04 /tmp/bar --root-password secret $ virt-bootstrap virt-builder://fedora-25 /tmp/foo -f qcow2 --idmap 0:1000:10 $ sudo virt-bootstrap virt-builder://fedora-25 /tmp/foo --idmap 0:1000:10 Tests are also introduced along with the implementation. They cover creation of root file system and UID/GID mapping for 'dir' and 'qcow2' output format by mocking the build_image() method to avoid the time consuming call to virt-builder which might also require network connection with function which creates dummy disk image. Setting root password is handled by virt-builder and hence the introduced test only ensures that the password string is passed correctly.
* Set root password with guestfs-pythonRadostin Stoyanov2017-08-282-2/+18
| | | | | | | | Use the python bindings of libguestfs to create additional qcow2 image which has as backing file the last layer (layer-0.qcow2 for FileSource) and insert hashed value of given root password in the /etc/shadow file. Note: This additional qcow2 image is also used to apply UID/GID map.
* Enable UID/GID mapping for qcow2Radostin Stoyanov2017-08-282-0/+19
| | | | | | | | | | | Apply ownership mapping in qcow2 images using libguestfs python bindings. To make this solution more general we introduce function guestfs_walk() which will return the root file system tree of disk image along with UID/GID values. These changes are applied in additional qcow2 disk image using the last layer as backing file. For FileSource this is layer-1.qcow2 with backing file layer-0.qcow2.
* Create qcow2 images with guestfs-pythonRadostin Stoyanov2017-08-282-7/+17
| | | | | | | | | | | | Use the python bindings of libguestfs to create qcow2 image with backing chains to mimic the layers of container image. This commit also changes the behavior of FileSource when 'qcow2' output format is used. Now the string layer-0.qcow2 will be used as name of the output file. This change is applied in the test suite as an update to the function get_image_path().
* Get layer size if not providedRadostin Stoyanov2017-08-281-3/+2
| | | | | | | Docker registry with Manifest v1 does not require the size of layers to be included. However, when this information is not provided we can use os.path.getsize() to get and show the size of tarball. We can also use this function for FileSource to provide consistent output messages.
* DockerSource: Split checksum and layersRadostin Stoyanov2017-08-282-3/+12
| | | | | | | | | | | | The current implementation store in one list: - checksum - checksum type - file path - file size However, the information about checksum and checksum type is only used to verify the content of tarball before it is being extracted. Splitting these into separate lists would allow us to reuse the function untar_layers() with FileSource.
* Split 'sources' module into filesRadostin Stoyanov2017-08-033-0/+388
Improve readability by spliting the 'sources' module into separate files. Each file contains only one class. In addition update the mock statements in the unit tests to match these changes. Add recursive-include in MANIFEST.in to include virtBootstrap.sources module. Update the unit tests to match these changes.