fixed type bug in get_snapshots
This commit is contained in:
@@ -108,7 +108,7 @@ class Dataset:
|
|||||||
self.written = int(properties["written"]["value"])
|
self.written = int(properties["written"]["value"])
|
||||||
self.xattr = properties["xattr"]["value"]
|
self.xattr = properties["xattr"]["value"]
|
||||||
|
|
||||||
def get_snapshots(self) -> list[Snapshot] | None:
|
def get_snapshots(self) -> list[Snapshot]:
|
||||||
"""Get all snapshots from zfs and process then is test dicts of sets."""
|
"""Get all snapshots from zfs and process then is test dicts of sets."""
|
||||||
snapshots_data = _zfs_list(f"zfs list -t snapshot -pHj {self.name} -o all")
|
snapshots_data = _zfs_list(f"zfs list -t snapshot -pHj {self.name} -o all")
|
||||||
|
|
||||||
@@ -125,10 +125,10 @@ class Dataset:
|
|||||||
if return_code == 0:
|
if return_code == 0:
|
||||||
return "snapshot created"
|
return "snapshot created"
|
||||||
|
|
||||||
if snapshots := self.get_snapshots():
|
snapshots = self.get_snapshots()
|
||||||
snapshot_names = {snapshot.name for snapshot in snapshots}
|
snapshot_names = {snapshot.name for snapshot in snapshots}
|
||||||
if snapshot_name in snapshot_names:
|
if snapshot_name in snapshot_names:
|
||||||
return f"Snapshot {snapshot_name} already exists for {self.name}"
|
return f"Snapshot {snapshot_name} already exists for {self.name}"
|
||||||
|
|
||||||
return f"Failed to create snapshot {snapshot_name} for {self.name}"
|
return f"Failed to create snapshot {snapshot_name} for {self.name}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user