3 # Copyright 2016 RIFT.IO Inc
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
20 IMAGE_REGEX
= r
"{prefix}/?images/(?P<image_name>[^/]+.\.qcow2)$"
23 def is_image_file(image_path
):
25 IMAGE_REGEX
.format(prefix
=".*"),
29 return match
is not None
32 def get_package_image_files(package
):
33 """ Return a image name/file map for images in the descriptor
36 package - A DescriptorPackage
39 A dictionary mapping image names to the relative path within
44 for file_name
in package
.files
:
46 IMAGE_REGEX
.format(prefix
=package
.prefix
),
52 image_name
= match
.group("image_name")
53 image_file_map
[image_name
] = file_name