Check that JobPlanResponse Diff Type is None before checking for changes on getExitCode (#14492)

This commit is contained in:
Gabriel Villalonga Simon 2022-10-06 21:23:22 +01:00 committed by GitHub
parent 40416be7b1
commit b974c32ba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

3
.changelog/14492.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
cli: Fixed a bug where plans for periodic jobs would return exit code 1 when the job was already register
```

View File

@ -391,6 +391,10 @@ type namespaceIdPair struct {
// * 0: No allocations created or destroyed.
// * 1: Allocations created or destroyed.
func getExitCode(resp *api.JobPlanResponse) int {
if resp.Diff.Type == "None" {
return 0
}
// Check for changes
for _, d := range resp.Annotations.DesiredTGUpdates {
if d.Stop+d.Place+d.Migrate+d.DestructiveUpdate+d.Canary > 0 {