Simplify dict() construction for fstab-lines
This commit is contained in:
parent
d355a42a44
commit
d8a47bb8be
@ -233,6 +233,8 @@ class FstabGenerator(object):
|
|||||||
|
|
||||||
if not mount_point and not filesystem == "swap":
|
if not mount_point and not filesystem == "swap":
|
||||||
return None
|
return None
|
||||||
|
if not mount_point:
|
||||||
|
mount_point = "swap"
|
||||||
|
|
||||||
options = self.mount_options.get(filesystem,
|
options = self.mount_options.get(filesystem,
|
||||||
self.mount_options["default"])
|
self.mount_options["default"])
|
||||||
@ -253,41 +255,19 @@ class FstabGenerator(object):
|
|||||||
self.root_is_ssd = is_ssd
|
self.root_is_ssd = is_ssd
|
||||||
|
|
||||||
if filesystem == "btrfs" and "subvol" in partition:
|
if filesystem == "btrfs" and "subvol" in partition:
|
||||||
if has_luks:
|
options="subvol={},".format(partition["subvol"]) + options
|
||||||
return dict(
|
|
||||||
device="/dev/mapper/" + partition["luksMapperName"],
|
|
||||||
mount_point=mount_point,
|
|
||||||
fs=filesystem,
|
|
||||||
options=",".join(
|
|
||||||
["subvol={}".format(partition["subvol"]), options]
|
|
||||||
),
|
|
||||||
check=check,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
return dict(
|
|
||||||
device="UUID=" + partition["uuid"],
|
|
||||||
mount_point=mount_point,
|
|
||||||
fs=filesystem,
|
|
||||||
options=",".join(
|
|
||||||
["subvol={}".format(partition["subvol"]), options]
|
|
||||||
),
|
|
||||||
check=check,
|
|
||||||
)
|
|
||||||
|
|
||||||
if has_luks:
|
if has_luks:
|
||||||
return dict(device="/dev/mapper/" + partition["luksMapperName"],
|
device="/dev/mapper/" + partition["luksMapperName"]
|
||||||
mount_point=mount_point or "swap",
|
|
||||||
fs=filesystem,
|
|
||||||
options=options,
|
|
||||||
check=check,
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
return dict(device="UUID=" + partition["uuid"],
|
device="UUID=" + partition["uuid"]
|
||||||
mount_point=mount_point or "swap",
|
|
||||||
fs=filesystem,
|
return dict(device=device,
|
||||||
options=options,
|
mount_point=mount_point,
|
||||||
check=check,
|
fs=filesystem,
|
||||||
)
|
options=options,
|
||||||
|
check=check,
|
||||||
|
)
|
||||||
|
|
||||||
def print_fstab_line(self, dct, file=None):
|
def print_fstab_line(self, dct, file=None):
|
||||||
""" Prints line to '/etc/fstab' file. """
|
""" Prints line to '/etc/fstab' file. """
|
||||||
|
Loading…
Reference in New Issue
Block a user