]> git.proxmox.com Git - pmg-api.git/commitdiff
extend `pmgdb dump`
authorStoiko Ivanov <s.ivanov@proxmox.com>
Mon, 11 Feb 2019 14:43:07 +0000 (15:43 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 12 Feb 2019 09:30:08 +0000 (10:30 +0100)
add priority, direction and an active flag to `pmgdb dump` output.

pmgdb dump provides the complete ruleset including all rules and related
objects. The information whether a rule is active and in which direction it
works 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@proxmox.com>
PMG/CLI/pmgdb.pm

index e3031a0de14482b36c5a97b07cc8044dd6d66c1b..cabf619edc9aec7c223d8fa57e7eea29a4208c21 100644 (file)
@@ -39,7 +39,15 @@ sub print_objects {
 sub print_rule {
     my ($ruledb, $rule) = @_;
 
-    print "Found RULE $rule->{id}: $rule->{name}\n";
+    my $direction = {
+       0 => 'in',
+       1 => 'out',
+       2 => 'in+out',
+    };
+    my $active = $rule->{active} ? 'active' : 'inactive';
+    my $dir = $direction->{$rule->{direction}};
+
+    print "Found RULE $rule->{id} (prio: $rule->{priority}, $dir, $active): $rule->{name}\n";
 
     my ($from, $to, $when, $what, $action) =
        $ruledb->load_groups($rule);