Skip to content
Snippets Groups Projects
Verified Commit 89c166b2 authored by Nicolas KAROLAK's avatar Nicolas KAROLAK
Browse files

check presence of nscd

parent ae483270
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
'''
Script to set the domain of an existing MediaServer, Miris Manager or Monitor
'''
import apt
import os
import re
import subprocess
......@@ -162,7 +163,13 @@ class SetAppDomain():
with open('/etc/hosts', 'w') as fo:
fo.write(new_hosts)
log('The "/etc/hosts" file has been update.')
utils.run_commands(['service nscd restart'])
cache = apt.Cache()
cache.open()
try:
cache['nscd'].is_installed
utils.run_commands(['service nscd restart'])
except KeyError:
pass
else:
log('The "/etc/hosts" file is already up to date.')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment