diff --git a/base.py b/base.py index c9868df..99de9b7 100644 --- a/base.py +++ b/base.py @@ -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)