File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -291,19 +291,18 @@ def scale_containers(self, **kwargs):
291291 all_containers = self .container_set .all ().order_by ('-created' )
292292 container_num = 1 if not all_containers else all_containers [0 ].num + 1
293293 # iterate and scale by container type (web, worker, etc)
294- change = False
294+ changed = False
295295 for container_type in requested_containers .keys ():
296296 containers = list (self .container_set .filter (type = container_type ).order_by ('created' ))
297297 requested = requested_containers .pop (container_type )
298298 diff = requested - len (containers )
299- change = 0
300299 if diff == 0 :
301- return change
300+ continue
301+ changed = True
302302 while diff < 0 :
303303 c = containers .pop (0 )
304304 c .delete ()
305305 diff = requested - len (containers )
306- change -= 1
307306 while diff > 0 :
308307 node = Formation .objects .next_container_node (self , container_type )
309308 c = Container .objects .create (owner = self .owner ,
@@ -314,10 +313,9 @@ def scale_containers(self, **kwargs):
314313 containers .append (c )
315314 container_num += 1
316315 diff = requested - len (containers )
317- change += 1
318316 # once nodes are in place, recalculate the formation and update the data bag
319317 databag = self .calculate ()
320- if change is True :
318+ if changed is True :
321319 self .converge (databag )
322320 return databag
323321
You can’t perform that action at this time.
0 commit comments