diff --git a/changelogs/fragments/zfs-root-snapshot.yml b/changelogs/fragments/zfs-root-snapshot.yml new file mode 100644 index 00000000000..758e820b42b --- /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). \ No newline at end of file diff --git a/lib/ansible/modules/storage/zfs/zfs.py b/lib/ansible/modules/storage/zfs/zfs.py index 690fe53e988..c210d5f4071 100644 --- a/lib/ansible/modules/storage/zfs/zfs.py +++ b/lib/ansible/modules/storage/zfs/zfs.py @@ -96,7 +96,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()