mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-24 03:45:38 +08:00
better API start/stop handling
This commit is contained in:
@@ -492,13 +492,19 @@ def blockstack_client_initialize_wallet( password, payment_privkey, owner_privke
|
||||
|
||||
print '\n{}\n'.format(json.dumps(wallet, indent=4, sort_keys=True))
|
||||
|
||||
print "\n(re)starting RPC daemon\n"
|
||||
print "\nstopping API daemon\n"
|
||||
|
||||
res = blockstack_client.rpc.local_api_stop(config_dir=config_dir)
|
||||
if not res:
|
||||
if exception:
|
||||
raise Exception("Failed to stop API daemon")
|
||||
|
||||
print "\nstarting API daemon\n"
|
||||
|
||||
blockstack_client.rpc.local_api_stop(config_dir=config_dir)
|
||||
res = blockstack_client.rpc.local_api_start(api_pass=conf['api_password'], port=int(conf['api_endpoint_port']), config_dir=os.path.dirname(config_path), password="0123456789abcdef")
|
||||
if not res:
|
||||
if exception:
|
||||
raise Exception("Failed to restart RPC daemon")
|
||||
raise Exception("Failed to start API daemon")
|
||||
|
||||
return res
|
||||
|
||||
@@ -539,11 +545,15 @@ def blockstack_client_set_wallet( password, payment_privkey, owner_privkey, data
|
||||
log.error("Failed to initialize wallet: %s" % wallet['error'])
|
||||
raise Exception("Failed to initialize wallet")
|
||||
|
||||
print "\n(re)starting RPC daemon\n"
|
||||
blockstack_client.rpc.local_api_stop(config_dir=config_dir)
|
||||
print "\nStopping API daemon\n"
|
||||
res = blockstack_client.rpc.local_api_stop(config_dir=config_dir)
|
||||
if not res:
|
||||
raise Exception("Failed to stop API daemon")
|
||||
|
||||
print "\nStarting API daemon\n"
|
||||
res = blockstack_client.rpc.local_api_start(api_pass=conf['api_password'], port=int(conf['api_endpoint_port']), config_dir=os.path.dirname(config_path), password="0123456789abcdef")
|
||||
if not res:
|
||||
raise Exception("Failed to restart RPC daemon")
|
||||
raise Exception("Failed to restart API daemon")
|
||||
|
||||
return wallet
|
||||
|
||||
|
||||
Reference in New Issue
Block a user