]> git.proxmox.com Git - pmg-api.git/commitdiff
ModGroup: add possibility to explode to all targets
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 21 Feb 2024 12:24:34 +0000 (13:24 +0100)
committerStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 21 Feb 2024 18:30:13 +0000 (19:30 +0100)
we will need that for the remove action + and/invert
It's probably not the most efficient way to to that, but it's easy to
understand.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PMG/ModGroup.pm

index b0fa9a6cd3549e098949158e2a2de2435f10645a..d4e1cd5c7a7e6941c1c14139af69769d5ace2203 100644 (file)
@@ -81,6 +81,23 @@ sub subgroups {
     return $res;
 }
 
+# explode the groups, so we have one for each target we need
+# only to be used by the rRemove action when there was a spaminfo
+sub explode {
+    my ($self, $targets) = @_;
+
+    my $groups = $self->{groups};
+    my $ea = $self->{ea};
+    my $res;
+
+    # TODO: implment it more direclty with less overhead!
+    for my $target ($targets->@*) {
+       $self->subgroups([$target]);
+    }
+
+    return $self->subgroups($targets);
+}
+
 1;
 
 __END__