From d8069f47f2b8928c0f730adeb413fffe43a8850a Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 17 Jan 2019 20:38:56 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jumpserver/conf.py | 7 +++---- jms | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index c0d94ee69..7a749cd77 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -193,8 +193,8 @@ class Config(dict): if self.root_path: filename = os.path.join(self.root_path, filename) try: - with open(filename) as json_file: - obj = yaml.load(json_file) + with open(filename) as f: + obj = yaml.load(f) except IOError as e: if silent and e.errno in (errno.ENOENT, errno.EISDIR): return False @@ -202,8 +202,7 @@ class Config(dict): raise if obj: return self.from_mapping(obj) - else: - return False + return True def from_mapping(self, *mapping, **kwargs): """Updates the config like :meth:`update` ignoring items with non-upper diff --git a/jms b/jms index 0c2ae8fd3..a5d105c75 100755 --- a/jms +++ b/jms @@ -18,7 +18,7 @@ try: from apps.jumpserver.conf import load_user_config CONFIG = load_user_config() except ImportError: - print("Could not find config file, `cp config_example.py config.py`") + print("Could not find config file, `cp config_example.yml config.yml`") sys.exit(1) os.environ["PYTHONIOENCODING"] = "UTF-8"