[pmg-devel] [PATCH pmg-api v2 2/3] extend `pmgdb dump`
Stoiko Ivanov
s.ivanov at proxmox.com
Mon Feb 11 15:43:07 CET 2019
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 at proxmox.com>
---
PMG/CLI/pmgdb.pm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/PMG/CLI/pmgdb.pm b/PMG/CLI/pmgdb.pm
index e3031a0..cabf619 100644
--- a/PMG/CLI/pmgdb.pm
+++ b/PMG/CLI/pmgdb.pm
@@ -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);
--
2.11.0
More information about the pmg-devel
mailing list