]> git.proxmox.com Git - pmg-api.git/commitdiff
new helper run_postmap
authorDietmar Maurer <dietmar@proxmox.com>
Sat, 25 Feb 2017 14:48:12 +0000 (15:48 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Sat, 25 Feb 2017 14:48:12 +0000 (15:48 +0100)
PMG/Utils.pm

index 73741d55beb43fc3b483e8f2b9853b356a4a9c23..332c13a8269959927ab081a022b29c26461c3ea2 100644 (file)
@@ -458,4 +458,20 @@ sub lookup_node_ip {
     return wantarray ? ($ip, $family) : $ip;
 }
 
+sub run_postmap {
+    my ($filename) = @_;
+
+    # make sure the file exists (else postmap fails)
+    IO::File->new($filename, 'a', 0644);
+
+    eval {
+       PVE::Tools::run_command(
+           ['/usr/sbin/postmap', $filename],
+           errmsg => "unable to update postfix table $filename");
+    };
+    my $err = $@;
+
+    warn $err if $err;
+}
+
 1;