Skip to content

Commit

Permalink
Merge pull request #777 from guydavis/integration
Browse files Browse the repository at this point in the history
Fixes for Cactus CLI renamings.
  • Loading branch information
guydavis authored Sep 21, 2022
2 parents cab4c70 + de83a25 commit 3c94ef1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions api/commands/chia_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ def load_blockchain_show(blockchain):

def load_connections_show(blockchain):
chia_binary = globals.get_blockchain_binary(blockchain)
proc = Popen("{0} show --connections".format(chia_binary), stdout=PIPE, stderr=PIPE, shell=True)
if blockchain == 'cactus': # Cactus now supports only 'peer' command
proc = Popen("{0} peer -c full_node".format(chia_binary), stdout=PIPE, stderr=PIPE, shell=True)
else:
proc = Popen("{0} show --connections".format(chia_binary), stdout=PIPE, stderr=PIPE, shell=True)
try:
outs, errs = proc.communicate(timeout=30)
if errs:
Expand Down Expand Up @@ -205,7 +208,10 @@ def pause_wallet(blockchain):
def remove_connection(node_id, ip, blockchain):
chia_binary = globals.get_blockchain_binary(blockchain)
try:
proc = Popen("{0} show --remove-connection {1}".format(chia_binary, node_id), stdout=PIPE, stderr=PIPE, shell=True)
if blockchain == 'cactus': # Cactus now supports only 'peer' command
proc = Popen("{0} peer --remove-connection {1} full_node".format(chia_binary, node_id), stdout=PIPE, stderr=PIPE, shell=True)
else:
proc = Popen("{0} show --remove-connection {1}".format(chia_binary, node_id), stdout=PIPE, stderr=PIPE, shell=True)
try:
outs, errs = proc.communicate(timeout=30)
if errs:
Expand Down Expand Up @@ -286,7 +292,10 @@ def add_connections(connections, blockchain):
elif socket.gethostbyname(hostname) != hostname:
app.logger.debug('{} is a valid hostname'.format(hostname))
app.logger.info("Adding {0} connection to peer: {1}".format(blockchain, connection))
proc = Popen("{0} show --add-connection {1}".format(chia_binary, connection), stdout=PIPE, stderr=PIPE, shell=True)
if blockchain == 'cactus': # Cactus now supports only 'peer' command
proc = Popen("{0} peer --add-connection {1} full_node".format(chia_binary, connection), stdout=PIPE, stderr=PIPE, shell=True)
else:
proc = Popen("{0} show --add-connection {1}".format(chia_binary, connection), stdout=PIPE, stderr=PIPE, shell=True)
try:
outs, errs = proc.communicate(timeout=60)
if errs:
Expand Down

0 comments on commit 3c94ef1

Please sign in to comment.