[pmg-devel] [RFC PATCH pmg-api 10/11] WIP: ModGroup: add possibility to explode to all targets

Dominik Csapak d.csapak at proxmox.com
Thu Feb 1 16:36:56 CET 2024


we will need that for the remove action + and/invert

note that this is only a wip commit, there will be a more efficient
implementation later!

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/PMG/ModGroup.pm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/PMG/ModGroup.pm b/src/PMG/ModGroup.pm
index b0fa9a6..d4e1cd5 100644
--- a/src/PMG/ModGroup.pm
+++ b/src/PMG/ModGroup.pm
@@ -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__
-- 
2.30.2





More information about the pmg-devel mailing list