mirror of https://github.com/jumpserver/jumpserver
fix: 修复playbook部分不可执行问题
parent
23fce9e426
commit
44f029774d
|
@ -40,11 +40,16 @@ class Playbook(JMSOrgBaseModel):
|
|||
result = []
|
||||
for root, dirs, files in os.walk(self.work_dir):
|
||||
for f in files:
|
||||
try:
|
||||
if str(f).endswith('.yml') or str(f).endswith('.yaml'):
|
||||
lines = self.search_keywords(os.path.join(root, f))
|
||||
if len(lines) > 0:
|
||||
for line in lines:
|
||||
result.append({'file': f, 'line': line[0], 'keyword': line[1]})
|
||||
# 遇到无法读取的文件,跳过
|
||||
except UnicodeEncodeError:
|
||||
continue
|
||||
|
||||
return result
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue