From 3a8a5dfb3e0e06b743e75cf0ced0d5eb424c0a10 Mon Sep 17 00:00:00 2001 From: Kevin Adams Date: Mon, 25 May 2026 09:16:13 -0400 Subject: [PATCH] fix: correct truenas_target IQN match in _portal_groups_for_new_target (#263) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The regex was testing whether the TrueNAS target's short name ends with the user-supplied value — the opposite of what we want. When truenas_target holds a full IQN (iqn...ctl:proxmox) the check must test whether that IQN ends with the short name stored in TrueNAS. Silently fell through to auto-discovery for every user who supplied a full IQN. Co-Authored-By: Claude Sonnet 4.6 --- perl5/PVE/Storage/Custom/TrueNAS.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl5/PVE/Storage/Custom/TrueNAS.pm b/perl5/PVE/Storage/Custom/TrueNAS.pm index 99d6288..df15f94 100644 --- a/perl5/PVE/Storage/Custom/TrueNAS.pm +++ b/perl5/PVE/Storage/Custom/TrueNAS.pm @@ -228,7 +228,7 @@ sub _portal_groups_for_new_target { # Prefer copying groups from the configured base target if (my $base = $scfg->{truenas_target}) { - my ($bt) = grep { $_->{name} eq $base || "$_->{name}" =~ /:\Q$base\E$/ } @$targets; + my ($bt) = grep { $_->{name} eq $base || $base =~ /:\Q$_->{name}\E$/ } @$targets; if ($bt) { my @gs = grep { $our_portal_ids{$_->{portal}} } @{$bt->{groups} // []}; return _clean_groups(\@gs) if @gs;