@@ -472,27 +472,28 @@ def doEnablePubkeys(reactor, opts, config, pkobjs):
472
472
if code != 0 :
473
473
raise Exception ('Cannot broadcast transaction' )
474
474
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
496
497
497
498
def main ():
498
499
o = Options ()
0 commit comments