Commit b171f0a4 by Bálint Máhonfai

Fix indentation errors

parent 63579fd2
...@@ -299,8 +299,7 @@ class Disk(object): ...@@ -299,8 +299,7 @@ class Disk(object):
finally: finally:
os.unlink(exported_path) os.unlink(exported_path)
def extract_iso_from_zip(self, disk_path):
def extract_iso_from_zip(self, disk_path):
with ZipFile(disk_path, 'r') as z: with ZipFile(disk_path, 'r') as z:
isos = z.namelist() isos = z.namelist()
if len(isos) != 1: if len(isos) != 1:
...@@ -318,8 +317,7 @@ def extract_iso_from_zip(self, disk_path): ...@@ -318,8 +317,7 @@ def extract_iso_from_zip(self, disk_path):
logger.info("Extracting %s failed, keeping original.", logger.info("Extracting %s failed, keeping original.",
disk_path) disk_path)
def snapshot(self):
def snapshot(self):
""" Creating qcow2 snapshot with base image. """ Creating qcow2 snapshot with base image.
""" """
# Check if snapshot type and qcow2 format matchmatch # Check if snapshot type and qcow2 format matchmatch
...@@ -345,8 +343,7 @@ def snapshot(self): ...@@ -345,8 +343,7 @@ def snapshot(self):
# Call subprocess # Call subprocess
subprocess.check_output(cmdline) subprocess.check_output(cmdline)
def merge_disk_with_base(self, task, new_disk, parent_id=None):
def merge_disk_with_base(self, task, new_disk, parent_id=None):
proc = None proc = None
try: try:
cmdline = [ cmdline = [
...@@ -398,8 +395,7 @@ def merge_disk_with_base(self, task, new_disk, parent_id=None): ...@@ -398,8 +395,7 @@ def merge_disk_with_base(self, task, new_disk, parent_id=None):
os.unlink(new_disk.get_path()) os.unlink(new_disk.get_path())
raise raise
def merge_disk_without_base(self, task, new_disk, parent_id=None,
def merge_disk_without_base(self, task, new_disk, parent_id=None,
length=1024 * 1024): length=1024 * 1024):
try: try:
fsrc = open(self.get_path(), 'rb') fsrc = open(self.get_path(), 'rb')
...@@ -436,8 +432,7 @@ def merge_disk_without_base(self, task, new_disk, parent_id=None, ...@@ -436,8 +432,7 @@ def merge_disk_without_base(self, task, new_disk, parent_id=None,
os.unlink(new_disk.get_path()) os.unlink(new_disk.get_path())
raise raise
def merge(self, task, new_disk, parent_id=None):
def merge(self, task, new_disk, parent_id=None):
""" Merging a new_disk from the actual disk and its base. """ Merging a new_disk from the actual disk and its base.
""" """
...@@ -455,14 +450,12 @@ def merge(self, task, new_disk, parent_id=None): ...@@ -455,14 +450,12 @@ def merge(self, task, new_disk, parent_id=None):
else: else:
self.merge_disk_without_base(task, new_disk, parent_id) self.merge_disk_without_base(task, new_disk, parent_id)
def delete(self):
def delete(self):
""" Delete file. """ """ Delete file. """
if os.path.isfile(self.get_path()): if os.path.isfile(self.get_path()):
os.unlink(self.get_path()) os.unlink(self.get_path())
@classmethod
@classmethod def list(cls, dir):
def list(cls, dir):
""" List all files in <dir> directory.""" """ List all files in <dir> directory."""
return [cls.get(dir, file) for file in os.listdir(dir)] return [cls.get(dir, file) for file in os.listdir(dir)]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment