Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add logs to support xud-docker-api setup-status #771

Merged
merged 6 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 2 additions & 0 deletions images/utils/launcher/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,8 @@ def expand_vars(self, value):
if isinstance(value, str):
if "$home_dir" in value:
value = value.replace("$home_dir", self.home_dir)
if "$network_dir" in value:
value = value.replace("$network_dir", self.network_dir)
if f"${self.network}_dir" in value:
value = value.replace(f"${self.network}_dir", self.network_dir)
if "$data_dir" in value:
Expand Down
13 changes: 12 additions & 1 deletion images/utils/launcher/config/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ def __str__(self):
"host": "$data_dir/lndltc",
"container": "/root/.lndltc",
},
{
"host": "$network_dir",
"container": "/root/network",
},
],
"ports": [PortPublish("127.0.0.1:28889:8080")],
"mode": "native",
Expand Down Expand Up @@ -392,7 +396,10 @@ def __str__(self):
"host": "$data_dir/lndltc",
"container": "/root/.lndltc",
},

{
"host": "$network_dir",
"container": "/root/network",
},
],
"ports": [PortPublish("127.0.0.1:18889:8080")],
"mode": "native",
Expand Down Expand Up @@ -610,6 +617,10 @@ def __str__(self):
"host": "$data_dir/lndltc",
"container": "/root/.lndltc",
},
{
"host": "$network_dir",
"container": "/root/network",
},
],
"ports": [PortPublish("127.0.0.1:8889:8080")],
"mode": "native",
Expand Down