Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
snf-image-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
itminedu
snf-image-creator
Commits
d595255c
Commit
d595255c
authored
Sep 16, 2014
by
Nikos Skalkotos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support older versions of qemu-img
Older versions of qemu-img do not accept a '--output json' option
parent
a413acff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
image_creator/util.py
image_creator/util.py
+10
-1
No files found.
image_creator/util.py
View file @
d595255c
...
...
@@ -51,7 +51,16 @@ def image_info(image):
"""Returns information about an image file"""
qemu_img
=
get_command
(
'qemu-img'
)
info
=
qemu_img
(
'info'
,
'--output'
,
'json'
,
image
)
try
:
info
=
qemu_img
(
'info'
,
'--output'
,
'json'
,
image
)
except
sh
.
ErrorReturnCode_1
:
# Old version of qemu-img that does not support --output json
info
=
qemu_img
(
'info'
,
image
)
for
line
in
str
(
info
).
splitlines
():
if
line
.
startswith
(
'file format:'
):
format
=
line
.
split
(
':'
)[
1
].
strip
()
return
{
'format'
:
format
}
raise
FatalError
(
"Unable to determine the image format"
)
return
json
.
loads
(
str
(
info
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment