Skip to content

Commit

Permalink
feat: add logs to support xud-docker-api setup-status
Browse files Browse the repository at this point in the history
  • Loading branch information
reliveyy committed Nov 10, 2020
1 parent cd56d13 commit 7e878bc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion images/utils/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8-alpine3.12
FROM python:3.9-alpine3.12
RUN pip install toml docker demjson
ADD . /usr/local/src/utils
WORKDIR /usr/local/src/utils
Expand Down
4 changes: 4 additions & 0 deletions images/utils/launcher/auto_unlock.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import logging
from .node import XudApiError

logger = logging.getLogger(__name__)


class Action:
def __init__(self, node_manager):
Expand Down Expand Up @@ -33,4 +36,5 @@ def execute(self):
xud = self.node_manager.get_node("xud")
if not self.xud_is_locked(xud):
return
logger.info("Unlock wallets")
self.xucli_unlock_wrapper(xud)
11 changes: 11 additions & 0 deletions images/utils/launcher/check_wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ def _print_lnd_cfheaders(self, erase_last_line=True):
lndltc = self.lnd_cfheaders["litecoin"]
services["lndltc"] = "Syncing " + self._get_percentage(lndltc.current, lndltc.total)

self.logger.info("[LightSync] %s", " | ".join(["%s: %s" % (key, value) for key, value in services.items()]))

table = ServiceTable(services)
table_str = str(table)
if erase_last_line:
Expand Down Expand Up @@ -305,6 +307,7 @@ def ensure_layer2_ready(self) -> None:
print()

def xucli_create_wrapper(self, xud):
self.logger.info("Create wallets")
counter = 0
ok = False
while counter < 3:
Expand All @@ -323,6 +326,8 @@ def xucli_create_wrapper(self, xud):
raise Exception("Failed to create wallets")

def xucli_restore_wrapper(self, xud):
self.logger.info("Restore wallets")

counter = 0
ok = False
while counter < 3:
Expand Down Expand Up @@ -377,6 +382,8 @@ def setup_backup_dir(self):
if self.config.backup_dir:
return

self.logger.info("Setup backup location")

backup_dir = None

while True:
Expand Down Expand Up @@ -468,8 +475,12 @@ def setup_restore_dir(self) -> None:

def execute(self):
xud = self.node_manager.get_node("xud")

self.logger.info("Waiting for XUD dependencies to be ready")
self.ensure_layer2_ready()

if self.node_manager.newly_installed:
self.logger.info("Setup wallets")
while True:
print("Do you want to create a new xud environment or restore an existing one?")
print("1) Create New")
Expand Down

0 comments on commit 7e878bc

Please sign in to comment.