Add support for cron syntax
Change-Id: Iea944653dbe5e5f0a7adfa83955b806ab504444e Implements: blueprint cron-based-continuous-audits
This commit is contained in:
parent
2e7f77ad48
commit
b2cc81c03f
@ -43,15 +43,15 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
'class': 'switchable',
|
||||
'data-slug': 'audit_type'
|
||||
}))
|
||||
interval = forms.DurationField(initial="01:00:00",
|
||||
label=_("Interval (format hh:mm:ss)"),
|
||||
help_text=_("Interval in format hh:mm:ss "
|
||||
"for CONTINUOUS audit"),
|
||||
widget=forms.TextInput(attrs={
|
||||
'class': 'switched',
|
||||
'data-switch-on': 'audit_type',
|
||||
'data-audit_type-continuous':
|
||||
_("Interval (format hh:mm:ss)")}))
|
||||
interval = forms.CharField(label=_("Interval (in seconds or cron format)"),
|
||||
help_text=_("Interval in seconds or cron"
|
||||
"format for CONTINUOUS audit"),
|
||||
widget=forms.TextInput(attrs={
|
||||
'class': 'switched',
|
||||
'data-switch-on': 'audit_type',
|
||||
'data-audit_type-continuous':
|
||||
_("Interval (in seconds or cron"
|
||||
" format)")}))
|
||||
failure_url = 'horizon:admin:audits:index'
|
||||
auto_trigger = forms.BooleanField(label=_("Auto Trigger"),
|
||||
required=False)
|
||||
@ -87,7 +87,7 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
params['audit_type'] = data['audit_type'].upper()
|
||||
params['auto_trigger'] = data['auto_trigger']
|
||||
if data['audit_type'] == 'continuous':
|
||||
params['interval'] = int(data['interval'].total_seconds())
|
||||
params['interval'] = data['interval']
|
||||
else:
|
||||
params['interval'] = None
|
||||
audit = watcher.Audit.create(request, **params)
|
||||
|
Loading…
x
Reference in New Issue
Block a user