mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 19:07:36 -02:30
Fix an issue where POST to schedules would no longer work. Populate
some more summary fields
This commit is contained in:
@@ -67,6 +67,8 @@ SUMMARIZABLE_FK_FIELDS = {
|
|||||||
'permission': DEFAULT_SUMMARY_FIELDS,
|
'permission': DEFAULT_SUMMARY_FIELDS,
|
||||||
'job': DEFAULT_SUMMARY_FIELDS + ('status', 'failed',),
|
'job': DEFAULT_SUMMARY_FIELDS + ('status', 'failed',),
|
||||||
'job_template': DEFAULT_SUMMARY_FIELDS,
|
'job_template': DEFAULT_SUMMARY_FIELDS,
|
||||||
|
'schedule': DEFAULT_SUMMARY_FIELDS + ('next_run',),
|
||||||
|
'unified_job_template': DEFAULT_SUMMARY_FIELDS,
|
||||||
'last_job': DEFAULT_SUMMARY_FIELDS + ('status', 'failed', 'license_error'),
|
'last_job': DEFAULT_SUMMARY_FIELDS + ('status', 'failed', 'license_error'),
|
||||||
'last_job_host_summary': DEFAULT_SUMMARY_FIELDS + ('failed',),
|
'last_job_host_summary': DEFAULT_SUMMARY_FIELDS + ('failed',),
|
||||||
'last_update': DEFAULT_SUMMARY_FIELDS + ('status', 'failed', 'license_error'),
|
'last_update': DEFAULT_SUMMARY_FIELDS + ('status', 'failed', 'license_error'),
|
||||||
@@ -1305,7 +1307,7 @@ class ScheduleSerializer(BaseSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Schedule
|
model = Schedule
|
||||||
fields = ('*', 'enabled', 'dtstart', 'dtend', 'rrule', 'next_run')
|
fields = ('*', 'unified_job_template', 'enabled', 'dtstart', 'dtend', 'rrule', 'next_run')
|
||||||
|
|
||||||
def get_related(self, obj):
|
def get_related(self, obj):
|
||||||
res = super(ScheduleSerializer, self).get_related(obj)
|
res = super(ScheduleSerializer, self).get_related(obj)
|
||||||
@@ -1320,12 +1322,12 @@ class ScheduleSerializer(BaseSerializer):
|
|||||||
|
|
||||||
# We reject rrules if:
|
# We reject rrules if:
|
||||||
# - DTSTART is not include
|
# - DTSTART is not include
|
||||||
|
# - INTERVAL is not included
|
||||||
# - TZID is used
|
# - TZID is used
|
||||||
# - multiple BYDAY (except WEEKLY), BYMONTHDAY, BYMONTH
|
# - multiple BYDAY (except WEEKLY), BYMONTHDAY, BYMONTH
|
||||||
# - BYDAY prefixed with a number (MO is good but not 20MO)
|
# - BYDAY prefixed with a number (MO is good but not 20MO)
|
||||||
# - BYYEARDAY
|
# - BYYEARDAY
|
||||||
# - BYWEEKNO
|
# - BYWEEKNO
|
||||||
# - INTERVAL required
|
|
||||||
def validate_rrule(self, attrs, source):
|
def validate_rrule(self, attrs, source):
|
||||||
rrule_value = attrs[source]
|
rrule_value = attrs[source]
|
||||||
if not 'dtstart' in rrule_value.lower():
|
if not 'dtstart' in rrule_value.lower():
|
||||||
|
|||||||
Reference in New Issue
Block a user