From 0d459e5662826f9d08dbc54a2150077db3ebaac9 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Tue, 29 Sep 2020 06:08:15 +0200 Subject: [PATCH] Fix zfs snapshot handling on root zvols (#936) (#985) * Update zfs.py Added support for snapshots when working with a root zvol that contains no / in its path. * Added Changelog Fragment (cherry picked from commit 13fb60f58f996b5af58ab56f76a1d23bdf028de4) Co-authored-by: Hobnob --- changelogs/fragments/zfs-root-snapshot.yml | 2 ++ plugins/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 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()