Skip to content

Commit

Permalink
Remove unused tmpdir parameter in resize2fs().
Browse files Browse the repository at this point in the history
Remove unused tmpdir parameter in objects calling resize2fs().
Remove whitespace in default argument assignment.
  • Loading branch information
FGrose authored and bcl committed Dec 6, 2016
1 parent 2baf727 commit b8ab884
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
3 changes: 1 addition & 2 deletions imgcreate/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,7 @@ def _mount_instroot(self, base_on = None):
self._instroot,
self._fstype,
self.__blocksize,
self.fslabel,
self.tmpdir)
self.fslabel)

try:
self.__instloop.mount()
Expand Down
18 changes: 8 additions & 10 deletions imgcreate/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def mksquashfs(in_img, out_img, compress_type):
raise SquashfsError("'%s' exited with error (%d)" %
(" ".join(args), ret))

def resize2fs(fs, size = None, minimal = False, tmpdir = "/tmp"):
def resize2fs(fs, size=None, minimal=False):
if minimal and size is not None:
raise ResizeError("Can't specify both minimal and a size for resize!")
if not minimal and size is None:
Expand Down Expand Up @@ -217,7 +217,7 @@ class SparseExtLoopbackMount(SparseLoopbackMount):
def __init__(self, lofile, mountdir, size, fstype, blocksize, fslabel):
self.diskmount = ExtDiskMount(SparseLoopbackDisk(lofile,size),
mountdir, fstype, blocksize, fslabel,
rmmountdir = True, tmpdir = "/tmp")
rmmountdir=True)


def __format_filesystem(self):
Expand Down Expand Up @@ -449,11 +449,10 @@ def mount(self):
class ExtDiskMount(DiskMount):
"""A DiskMount object that is able to format/resize ext[23] filesystems."""
def __init__(self, disk, mountdir, fstype, blocksize, fslabel,
rmmountdir=True, tmpdir="/tmp"):
rmmountdir=True):
DiskMount.__init__(self, disk, mountdir, fstype, rmmountdir)
self.blocksize = blocksize
self.fslabel = "_" + fslabel
self.tmpdir = tmpdir

def __format_filesystem(self):
logging.info("Formating %s filesystem on %s" % (self.fstype, self.disk.device))
Expand Down Expand Up @@ -486,7 +485,7 @@ def __resize_filesystem(self, size = None):
if size > current_size:
self.disk.expand(size)

resize2fs(self.disk.lofile, size, tmpdir = self.tmpdir)
resize2fs(self.disk.lofile, size)
return size

def __create(self):
Expand Down Expand Up @@ -528,7 +527,7 @@ def parse_field(output, field):
return int(parse_field(out, "Block count")) * self.blocksize

def __resize_to_minimal(self):
resize2fs(self.disk.lofile, minimal = True, tmpdir = self.tmpdir)
resize2fs(self.disk.lofile, minimal=True)
return self.__get_size_from_filesystem()

def resparse(self, size = None):
Expand Down Expand Up @@ -618,8 +617,7 @@ def get_cow_used(self):
except ValueError:
raise SnapshotError("Failed to parse dmsetup status: " + out)

def create_image_minimizer(path, image, compress_type, target_size = None,
tmpdir = "/tmp"):
def create_image_minimizer(path, image, compress_type, target_size=None):
"""
Builds a copy-on-write image which can be used to
create a device-mapper snapshot of an image where
Expand Down Expand Up @@ -647,9 +645,9 @@ def create_image_minimizer(path, image, compress_type, target_size = None,
snapshot.create()

if target_size is not None:
resize2fs(snapshot.path, target_size, tmpdir = tmpdir)
resize2fs(snapshot.path, target_size)
else:
resize2fs(snapshot.path, minimal = True, tmpdir = tmpdir)
resize2fs(snapshot.path, minimal=True)

cow_used = snapshot.get_cow_used()
finally:
Expand Down
3 changes: 1 addition & 2 deletions imgcreate/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,7 @@ def _stage_final_image(self):

if not self.skip_minimize:
create_image_minimizer(self.__isodir + "/LiveOS/osmin.img",
self._image, self.compress_type,
tmpdir = self.tmpdir)
self._image, self.compress_type)

if self.skip_compression:
shutil.move(self._image, self.__isodir + "/LiveOS/ext3fs.img")
Expand Down

0 comments on commit b8ab884

Please sign in to comment.