Skip to content

Commit c1b1b65

Browse files
committed
fix(ag-pserver): don't provision if none needIngress
1 parent 63434fa commit c1b1b65

File tree

1 file changed

+22
-21
lines changed
  • provisioning-server/src/ag_pserver

1 file changed

+22
-21
lines changed

provisioning-server/src/ag_pserver/main.py

+22-21
Original file line numberDiff line numberDiff line change
@@ -472,27 +472,28 @@ def doEnablePubkeys(reactor, opts, config, pkobjs):
472472
if code != 0:
473473
raise Exception('Cannot broadcast transaction')
474474

475-
controller_url = opts["controller"]
476-
print('contacting ' + controller_url)
477-
478-
mobj = {
479-
"type": "pleaseProvisionMany",
480-
"applies": [[pkobj['nickname'], pkobj['pubkey']] for pkobj in needIngress]
481-
}
482-
m = json.dumps(mobj)
483-
484-
# this HTTP request goes to the controller machine, where it should
485-
# be routed to vat-provisioning.js and the pleaseProvision() method.
486-
resp = yield treq.post(controller_url, m.encode('utf-8'), reactor=reactor,
487-
headers={
488-
b'Content-Type': [b'application/json'],
489-
b'Origin': [b'http://127.0.0.1'],
490-
})
491-
if resp.code < 200 or resp.code >= 300:
492-
raise Exception('invalid response code ' + str(resp.code))
493-
rawResp = yield treq.json_content(resp)
494-
if not rawResp['ok']:
495-
raise rawResp
475+
if len(needIngress) > 0:
476+
controller_url = opts["controller"]
477+
print('contacting ' + controller_url)
478+
479+
mobj = {
480+
"type": "pleaseProvisionMany",
481+
"applies": [[pkobj['nickname'], pkobj['pubkey']] for pkobj in needIngress]
482+
}
483+
m = json.dumps(mobj)
484+
485+
# this HTTP request goes to the controller machine, where it should
486+
# be routed to vat-provisioning.js and the pleaseProvision() method.
487+
resp = yield treq.post(controller_url, m.encode('utf-8'), reactor=reactor,
488+
headers={
489+
b'Content-Type': [b'application/json'],
490+
b'Origin': [b'http://127.0.0.1'],
491+
})
492+
if resp.code < 200 or resp.code >= 300:
493+
raise Exception('invalid response code ' + str(resp.code))
494+
rawResp = yield treq.json_content(resp)
495+
if not rawResp.get('ok', False):
496+
raise rawResp
496497

497498
def main():
498499
o = Options()

0 commit comments

Comments
 (0)