worker: fix crash if no autoscale instance is defined

The worker assumes that when running on AWS an autoscale is defined.
If not defined, the worker crashes
This commit is contained in:
Ygal Blum 2022-08-03 11:17:19 +03:00 committed by Ondřej Budai
parent d176df2ca5
commit 07c1f3b2f8

View file

@ -128,6 +128,10 @@ func setProtection(protected bool) {
}
return
}
if len(asInstanceOutput.AutoScalingInstances) == 0 {
logrus.Info("No Autoscaling instace is defined")
return
}
// make the request to protect (or unprotect) the instance
input := &autoscaling.SetInstanceProtectionInput{