From 0eab1dcc004372b453958e7ec99773c4dea6b8a5 Mon Sep 17 00:00:00 2001 From: Hobnob Date: Fri, 23 Oct 2020 19:59:19 +0100 Subject: [PATCH] Fix zfs snapshot handling on root zvols (#72254) --- changelogs/fragments/zfs-root-snapshot.yml | 2 ++ lib/ansible/modules/storage/zfs/zfs.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/zfs-root-snapshot.yml 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()