mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-25 06:42:49 +00:00
perf: 完善 yaml 加载
This commit is contained in:
@@ -40,7 +40,7 @@ def get_platform_automation_methods(path, lang=None):
|
||||
continue
|
||||
|
||||
with open(path, 'r', encoding='utf8') as f:
|
||||
manifest = yaml_load_with_i18n(f, lang)
|
||||
manifest = yaml_load_with_i18n(f, lang=lang)
|
||||
check_platform_method(manifest, path)
|
||||
manifest['dir'] = os.path.dirname(path)
|
||||
manifest['params_serializer'] = generate_serializer(manifest)
|
||||
|
@@ -12,7 +12,7 @@ def translate(key, i18n, lang):
|
||||
return lang_data.get(lang, key)
|
||||
|
||||
|
||||
def yaml_load_with_i18n(stream, lang):
|
||||
def yaml_load_with_i18n(stream, lang=None):
|
||||
ori_text = stream.read()
|
||||
stream = io.StringIO(ori_text)
|
||||
yaml_data = yaml.safe_load(stream)
|
||||
|
Reference in New Issue
Block a user