[mail-server] Uses built-in subprocess.DEVNULL instead of opening dev/null

This commit is contained in:
Maxime Bombar 2018-12-30 00:27:14 +01:00
parent 0e7aba6459
commit d8499579e3

View file

@ -9,7 +9,7 @@ from jinja2 import Environment, FileSystemLoader
import requests import requests
import base64 import base64
import json import json
from subprocess import call from subprocess import call, DEVNULL
import os import os
import sys import sys
@ -61,8 +61,8 @@ def generate(api_client):
fichier.write(virtuals_rendered) fichier.write(virtuals_rendered)
fichier.close() fichier.close()
call(["/usr/bin/newaliases"], stdout=open(os.devnull, 'wb')) # Update the aliases config file call(["/usr/bin/newaliases"], stdout=DEVNULL) # Update the aliases config file
call(["/usr/sbin/postmap", path+"/generated/virtual"], stdout=open(os.devnull, 'wb')) # Update the aliases config file call(["/usr/sbin/postmap", path+"/generated/virtual"], stdout=DEVNULL) # Update the aliases config file
call(["/usr/sbin/postfix", "reload"]) # force the reloading now call(["/usr/sbin/postfix", "reload"]) # force the reloading now
for arg in sys.argv: for arg in sys.argv: