From 7418daf3408d70760c22b0a9319d8c6f3c71c5c5 Mon Sep 17 00:00:00 2001 From: Phil Renaud Date: Fri, 29 Sep 2023 18:52:21 +0000 Subject: [PATCH] backport of commit 8da40465af3133df150cf0e0d10c7e1b36fd2151 --- .changelog/18621.txt | 3 +++ ui/app/components/job-page/parts/title.js | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changelog/18621.txt diff --git a/.changelog/18621.txt b/.changelog/18621.txt new file mode 100644 index 00000000000..bf075ceac24 --- /dev/null +++ b/.changelog/18621.txt @@ -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 +``` diff --git a/ui/app/components/job-page/parts/title.js b/ui/app/components/job-page/parts/title.js index b4bb411fc04..d9b68fe6dff 100644 --- a/ui/app/components/job-page/parts/title.js +++ b/ui/app/components/job-page/parts/title.js @@ -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();