Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos
Commits
74b23bb7
Commit
74b23bb7
authored
Apr 27, 2015
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kvm: prevent creating bad hard drive with gunzip option
parent
9ea9d29f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
slapos/recipe/kvm/template/kvm_run.in
slapos/recipe/kvm/template/kvm_run.in
+8
-3
No files found.
slapos/recipe/kvm/template/kvm_run.in
View file @
74b23bb7
...
@@ -133,9 +133,14 @@ if not os.path.exists(disk_path) and virtual_hard_drive_url != '':
...
@@ -133,9 +133,14 @@ if not os.path.exists(disk_path) and virtual_hard_drive_url != '':
else:
else:
print('Warning: not checksum specified.')
print('Warning: not checksum specified.')
if downloaded_disk.endswith('.gz'):
if downloaded_disk.endswith('.gz'):
with open(disk_path, 'w') as disk:
try:
with gzip.open(downloaded_disk, 'rb') as disk_gz:
with open(disk_path, 'w') as disk:
shutil.copyfileobj(disk_gz, disk)
with gzip.open(downloaded_disk, 'rb') as disk_gz:
shutil.copyfileobj(disk_gz, disk)
except Exception:
if os.path.exists(disk_path):
os.remove(disk_path)
raise
os.remove(downloaded_disk)
os.remove(downloaded_disk)
# Create disk if doesn't exist
# Create disk if doesn't exist
...
...
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