Implement an option to choose a job type on relaunch (issue #14177) (#15249)

Allows changing the job type (run, check) when relaunching
a job by adding a "job_type" to the relaunch POST payload
This commit is contained in:
Sasa Jovicic
2025-03-12 18:27:05 +01:00
committed by GitHub
parent 0f0f5aa289
commit 6f7d5ca8a3
3 changed files with 43 additions and 1 deletions

View File

@@ -3352,11 +3352,17 @@ class JobRelaunchSerializer(BaseSerializer):
choices=[('all', _('No change to job limit')), ('failed', _('All failed and unreachable hosts'))],
write_only=True,
)
job_type = serializers.ChoiceField(
required=False,
allow_null=True,
choices=NEW_JOB_TYPE_CHOICES,
write_only=True,
)
credential_passwords = VerbatimField(required=True, write_only=True)
class Meta:
model = Job
fields = ('passwords_needed_to_start', 'retry_counts', 'hosts', 'credential_passwords')
fields = ('passwords_needed_to_start', 'retry_counts', 'hosts', 'job_type', 'credential_passwords')
def validate_credential_passwords(self, value):
pnts = self.instance.passwords_needed_to_start