update All hosts
This commit is contained in:
@@ -622,16 +622,25 @@ class HttpHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
|||||||
log(uname, ll)
|
log(uname, ll)
|
||||||
|
|
||||||
elif qr.path == "/u": # update
|
elif qr.path == "/u": # update
|
||||||
uname=qa.get('h',[None])[0]
|
uname=urllib.unquote(qa.get('h',[None])[0])
|
||||||
ucode=qa.get('c', [None])[0]
|
ucode=qa.get('c', [None])[0]
|
||||||
if not ucode or not uname:
|
if not ucode or not uname:
|
||||||
code, res=self.builderror(400, 'Argument error', "need h= and c= arguments")
|
code, res=self.builderror(400, 'Argument error', "need h= and c= arguments")
|
||||||
elif not Host.hosts.has_key(uname):
|
elif uname != 'All' and not Host.hosts.has_key(uname):
|
||||||
code, res=self.builderror(400, 'Data error', "h=%s not found" % uname)
|
code, res=self.builderror(400, 'Data error', "h=%s not found" % uname)
|
||||||
else:
|
else:
|
||||||
err = updatecode(ucode, urllib.unquote(uname))
|
|
||||||
res=self.buildhead()
|
res=self.buildhead()
|
||||||
res.append("3 Done: %s" % err if err else "OK")
|
if uname != 'All':
|
||||||
|
names = [uname]
|
||||||
|
else:
|
||||||
|
names = []
|
||||||
|
for n in Host.hosts:
|
||||||
|
if Host.hosts[n].cver >= 2: # earliest version that supports update
|
||||||
|
names.append(n)
|
||||||
|
for n in names:
|
||||||
|
err = updatecode(ucode, n)
|
||||||
|
res.append("update started for %s: %s<br>" % (n, err if err else "OK"))
|
||||||
|
res.append("Done")
|
||||||
|
|
||||||
elif qr.path == "/api/0/hosts": # api access to host table
|
elif qr.path == "/api/0/hosts": # api access to host table
|
||||||
headerdict = {"Content-Type": "application/json; charset=utf-8" }
|
headerdict = {"Content-Type": "application/json; charset=utf-8" }
|
||||||
|
|||||||
Reference in New Issue
Block a user