Fixed bad messages syntax

I was investigating on #34 and I discover some wrong messages.
This PR fixed them but it's not fixing the root cause #34.
This commit is contained in:
Gianluca Arbezzano 2017-08-10 17:42:37 +02:00
parent 4f796064eb
commit 1c9598b048
No known key found for this signature in database
GPG Key ID: 9505D2809E1D6180

View File

@ -66,7 +66,7 @@ func (p SwarmProvider) Scale(serviceId string, target int, direction bool) error
logrus.WithFields(logrus.Fields{ logrus.WithFields(logrus.Fields{
"error": err.Error(), "error": err.Error(),
"provider": "swarm", "provider": "swarm",
}).Info("Service %s is not scaling.", serviceId) }).Infof("Service %s is not scaling.", serviceId)
return err return err
} }
@ -96,7 +96,7 @@ func (p SwarmProvider) Scale(serviceId string, target int, direction bool) error
// This function validate if a request is acceptable or not. // This function validate if a request is acceptable or not.
func (p *SwarmProvider) isAcceptable(tasks []swarm.Task, target int, direction bool) error { func (p *SwarmProvider) isAcceptable(tasks []swarm.Task, target int, direction bool) error {
if p.calculateActiveTasks(tasks) < target || p.calculateActiveTasks(tasks) < 2 && direction == false { if direction == false && (p.calculateActiveTasks(tasks) < target || p.calculateActiveTasks(tasks) < 2) {
return errors.New(fmt.Sprintf("I can not scale down because it has only %d running.", target)) return errors.New(fmt.Sprintf("I can not scale down because it has only %d running.", target))
} }
return nil return nil