From 5f9f052ec18b5cbc1717912c9a3330cf925b4d62 Mon Sep 17 00:00:00 2001 From: Nicolas KAROLAK <nicolas@karolak.fr> Date: Fri, 22 Mar 2019 15:29:50 +0100 Subject: [PATCH] put nscd restart in try except --- set_app_domain.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/set_app_domain.py b/set_app_domain.py index 9c89be86..8b2c0db1 100755 --- a/set_app_domain.py +++ b/set_app_domain.py @@ -3,7 +3,6 @@ ''' Script to set the domain of an existing MediaServer, Miris Manager or Monitor ''' -import apt import os import re import subprocess @@ -163,13 +162,10 @@ class SetAppDomain(): with open('/etc/hosts', 'w') as fo: fo.write(new_hosts) log('The "/etc/hosts" file has been update.') - cache = apt.Cache() - cache.open() try: - cache['nscd'].is_installed utils.run_commands(['service nscd restart']) - except KeyError: - pass + except Exception as nscd_err: + log(nscd_err) else: log('The "/etc/hosts" file is already up to date.') -- GitLab