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

put nscd restart in try except

parent 89c166b2
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
''' '''
Script to set the domain of an existing MediaServer, Miris Manager or Monitor Script to set the domain of an existing MediaServer, Miris Manager or Monitor
''' '''
import apt
import os import os
import re import re
import subprocess import subprocess
...@@ -163,13 +162,10 @@ class SetAppDomain(): ...@@ -163,13 +162,10 @@ class SetAppDomain():
with open('/etc/hosts', 'w') as fo: with open('/etc/hosts', 'w') as fo:
fo.write(new_hosts) fo.write(new_hosts)
log('The "/etc/hosts" file has been update.') log('The "/etc/hosts" file has been update.')
cache = apt.Cache()
cache.open()
try: try:
cache['nscd'].is_installed
utils.run_commands(['service nscd restart']) utils.run_commands(['service nscd restart'])
except KeyError: except Exception as nscd_err:
pass log(nscd_err)
else: else:
log('The "/etc/hosts" file is already up to date.') 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