This commit is contained in:
HAL
2026-05-20 10:01:52 +02:00
parent 16854f9a93
commit 1980971ec9
+4 -3
View File
@@ -24,7 +24,7 @@
import sys
import json
import os
from os.path import expanduser, basename, exists, isdir
from os.path import expanduser, basename, exists, isdir, isfile
import subprocess
import time
import re
@@ -71,7 +71,7 @@ def get_config():
parser.optionxform = str
cfgfiles = '/sq_sw/linse/servicemanager.cfg', expanduser('~/servicemanager.cfg')
for cfgfile in cfgfiles:
if isdir(cfgfile):
if isfile(cfgfile):
parser.read(cfgfile)
return parser
raise FileNotFoundError(f'can not find cfg file in {cfgfiles}')
@@ -145,7 +145,8 @@ class ServiceManager:
section = dict(parser[ins])
if ins == this_ins:
self.main_ins = this_ins
self.is_remote = socket.gethostname().split('.')[0] != section.get('host')
hostname = socket.gethostname().split('.')[0]
self.is_remote = hostname != section.get('host', hostname)
command = section.get('%s_command' % self.group)
self.revcmd[command] = self.group
nr = section.get(self.group)