Skip to content

Commit

Permalink
backport of commit 8da4046 (#18625)
Browse files Browse the repository at this point in the history
Co-authored-by: Phil Renaud <[email protected]>
  • Loading branch information
hc-github-team-nomad-core and philrenaud authored Sep 29, 2023
1 parent 6f40897 commit bd4996c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/18621.txt
Original file line number Diff line number Diff line change
@@ -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
```
13 changes: 11 additions & 2 deletions ui/app/components/job-page/parts/title.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit bd4996c

Please sign in to comment.