mirror of https://github.com/jumpserver/jumpserver
fix: 自定义平台无自动化任务
parent
cc2e42c77a
commit
f20a4beef3
|
@ -94,6 +94,7 @@ class Applet(JMSBaseModel):
|
|||
@classmethod
|
||||
def load_platform_if_need(cls, d):
|
||||
from assets.serializers import PlatformSerializer
|
||||
from assets.const import CustomTypes
|
||||
|
||||
if not os.path.exists(os.path.join(d, 'platform.yml')):
|
||||
return
|
||||
|
@ -111,6 +112,9 @@ class Applet(JMSBaseModel):
|
|||
except KeyError:
|
||||
raise ValidationError({'error': _('Missing type in platform.yml')})
|
||||
|
||||
if not data.get('automation'):
|
||||
data['automation'] = CustomTypes._get_automation_constrains()['*']
|
||||
|
||||
s = PlatformSerializer(data=data)
|
||||
s.add_type_choices(tp, tp)
|
||||
s.is_valid(raise_exception=True)
|
||||
|
|
Loading…
Reference in New Issue