diff --git a/changelogs/fragments/zfs-root-snapshot.yml b/changelogs/fragments/zfs-root-snapshot.yml new file mode 100644 index 0000000000..13b5e8ce0c --- /dev/null +++ b/changelogs/fragments/zfs-root-snapshot.yml @@ -0,0 +1,2 @@ +bugfixes: + - zfs - fixed ``invalid character '@' in pool name"`` error when working with snapshots on a root zvol (https://github.com/ansible-collections/community.general/issues/932). diff --git a/plugins/modules/storage/zfs/zfs.py b/plugins/modules/storage/zfs/zfs.py index 0536ece19d..6b2260fb14 100644 --- a/plugins/modules/storage/zfs/zfs.py +++ b/plugins/modules/storage/zfs/zfs.py @@ -90,7 +90,7 @@ class Zfs(object): self.changed = False self.zfs_cmd = module.get_bin_path('zfs', True) self.zpool_cmd = module.get_bin_path('zpool', True) - self.pool = name.split('/')[0] + self.pool = name.split('/')[0].split('@')[0] self.is_solaris = os.uname()[0] == 'SunOS' self.is_openzfs = self.check_openzfs() self.enhanced_sharing = self.check_enhanced_sharing()