pull/2/head
Rui Carmo 2016-04-02 17:49:19 +01:00
rodzic ae3f7608d4
commit c08600ed0d
1 zmienionych plików z 4 dodań i 7 usunięć

11
piku.py
Wyświetl plik

@ -503,16 +503,13 @@ def deploy_app(app, settings):
try:
k, v = map(lambda x: x.strip(), s.split(":", 1))
c = int(v) # check for integer value
if c < 0:
echo("Error: cannot scale type '%s' below 0" % k, fg='red')
return
if k not in worker_count:
echo("Error: worker type '%s' not present in '%s'" % (k, app), fg='red')
return
elif k in ['web','wsgi'] and 0 <= c < 1:
echo("Error: cannot scale type '%s' above 1" % k, fg='red')
return
if c < 0 and int(worker_count[k] - c) >= 0:
v = worker_count[k] = worker_count[k] - c
else:
worker_count[k] = v
worker_count[k] = v
echo("Scaling %s to %s for '%s'" % (k, v, app), fg='white')
except:
echo("Error: malformed setting '%s'" % s, fg='red')