[pmg-devel] [PATCH pmg-api 2/3] add priority and an active flag to `pmgdb dump`

Stoiko Ivanov s.ivanov at proxmox.com
Fri Feb 8 12:35:47 CET 2019


pmgdb dump provides the complete ruleset including all rules and related
objects. The information whether a rule is active or not is necessary to get an
overview about the setup for pmg-smtp-filter.

Additionally the priority was explicitly added to the output for easier matching
with the GUI.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 PMG/CLI/pmgdb.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PMG/CLI/pmgdb.pm b/PMG/CLI/pmgdb.pm
index e3031a0..72229eb 100644
--- a/PMG/CLI/pmgdb.pm
+++ b/PMG/CLI/pmgdb.pm
@@ -39,7 +39,8 @@ sub print_objects {
 sub print_rule {
     my ($ruledb, $rule) = @_;
 
-    print "Found RULE $rule->{id}: $rule->{name}\n";
+    my $active = $rule->{active} ? 'active' : 'inactive';
+    print "Found RULE $rule->{id} (priority: $rule->{priority}, $active): $rule->{name}\n";
 
     my ($from, $to, $when, $what, $action) =
 	$ruledb->load_groups($rule);
-- 
2.11.0




More information about the pmg-devel mailing list