diff --git a/.changelog/19147.txt b/.changelog/19147.txt index c5566624e90a..2122c87323d5 100644 --- a/.changelog/19147.txt +++ b/.changelog/19147.txt @@ -1,3 +1,3 @@ ```release-note:bug -cli: Fixed the `nomad job restart` command to create replacements for system jobs and prevent batch and sysbatch jobs from being rescheduled +cli: Fixed the `nomad job restart` command to create replacements for batch and system jobs and to prevent sysbatch jobs from being rescheduled since they never create replacements ``` diff --git a/command/job_restart.go b/command/job_restart.go index 87e848e3d4a1..f7e1d3db5de1 100644 --- a/command/job_restart.go +++ b/command/job_restart.go @@ -187,7 +187,8 @@ Restart Options: in-place. Since the group is not modified the restart does not create a new deployment, and so values defined in 'update' blocks, such as 'max_parallel', are not taken into account. This option cannot be used with - '-task'. Only jobs of type 'service' and 'system' can be rescheduled. + '-task'. Only jobs of type 'batch', 'service', and 'system' can be + rescheduled. -task= Specify the task to restart. Can be specified multiple times. If groups are @@ -289,7 +290,7 @@ func (c *JobRestartCommand) Run(args []string) int { // Verify job type can be rescheduled. if c.reschedule { switch *job.Type { - case api.JobTypeService, api.JobTypeSystem: + case api.JobTypeBatch, api.JobTypeService, api.JobTypeSystem: default: c.Ui.Error(fmt.Sprintf("Jobs of type %q are not allowed to be rescheduled.", *job.Type)) return 1 diff --git a/website/content/docs/commands/job/restart.mdx b/website/content/docs/commands/job/restart.mdx index e91fee0161c1..6f87e40a8253 100644 --- a/website/content/docs/commands/job/restart.mdx +++ b/website/content/docs/commands/job/restart.mdx @@ -86,7 +86,8 @@ of the exact job ID. restarted in-place. Since the group is not modified the restart does not create a new deployment, and so values defined in [`update`][] blocks, such as [`max_parallel`][], are not taken into account. This option cannot be used - with `-task`. Only jobs of type `service` and `system` can be rescheduled. + with `-task`. Only jobs of type `batch`, `service`, and `system` can be + rescheduled. - `-on-error=`: Determines what action to take when an error happens during a restart batch. If `ask` the command stops and waits for user