fallback to get definition if submission 404s when restarting job in ui (#18621)

This commit is contained in:
Phil Renaud
2023-09-29 14:52:21 -04:00
committed by GitHub
parent badaecea66
commit 8da40465af
2 changed files with 14 additions and 2 deletions

3
.changelog/18621.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
ui: using start/stop from the job page in the UI will no longer fail when the job lacks HCL submission data
```

View File

@@ -71,8 +71,17 @@ export default class Title extends Component {
*/
@task(function* (withNotifications = false) {
const job = this.job;
const specification = yield job.fetchRawSpecification();
job.set('_newDefinition', specification.Source);
// Try to get the submission/hcl sourced specification first.
// In the event that this fails, fall back to the raw definition.
try {
const specification = yield job.fetchRawSpecification();
job.set('_newDefinition', specification.Source);
} catch {
const definition = yield job.fetchRawDefinition();
delete definition.Stop;
job.set('_newDefinition', JSON.stringify(definition));
}
try {
yield job.parse();