Skip to content

Commit bc61fd4

Browse files
author
Andres D. Molins
committed
Fix: Solved definitively the wallet selection issue and also solved another issue fetching instances from scheduler.
1 parent 8920567 commit bc61fd4

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

src/aleph_client/commands/account.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,13 @@ async def configure(
495495
raise typer.Exit()
496496

497497
# Configures active private key file
498-
if (not account_type or account_type == AccountType.INTERNAL and
499-
not private_key_file and config and hasattr(config, "path") and Path(config.path).exists()):
498+
if not account_type or (
499+
account_type == AccountType.INTERNAL
500+
and not private_key_file
501+
and config
502+
and hasattr(config, "path")
503+
and Path(config.path).exists()
504+
):
500505
if not yes_no_input(
501506
f"Active private key file: [bright_cyan]{config.path}[/bright_cyan]\n[yellow]Keep current active private "
502507
"key?[/yellow]",
@@ -524,8 +529,7 @@ async def configure(
524529

525530
if not private_key_file and account_type == AccountType.EXTERNAL:
526531
if yes_no_input(
527-
"[bright_cyan]Loading External keys.[/bright_cyan] [yellow]"
528-
"Do you want to import from Ledger?[/yellow]",
532+
"[bright_cyan]Loading External keys.[/bright_cyan] [yellow]Do you want to import from Ledger?[/yellow]",
529533
default="y",
530534
):
531535
accounts = LedgerETHAccount.get_accounts()
@@ -571,7 +575,7 @@ async def configure(
571575
raise typer.Exit()
572576

573577
if not account_type:
574-
account_type = AccountType.INTERNAL.value
578+
account_type = AccountType.INTERNAL
575579

576580
try:
577581
config = MainConfiguration(path=private_key_file, chain=chain, address=address, type=account_type)

src/aleph_client/commands/instance/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from aleph.sdk.chains.ethereum import ETHAccount
1616
from aleph.sdk.client.vm_client import VmClient
1717
from aleph.sdk.client.vm_confidential_client import VmConfidentialClient
18-
from aleph.sdk.conf import load_main_configuration, settings, AccountType
18+
from aleph.sdk.conf import AccountType, load_main_configuration, settings
1919
from aleph.sdk.evm_utils import (
2020
FlowUpdate,
2121
get_chains_with_holding,
@@ -179,7 +179,7 @@ async def create(
179179
console.print("No active chain selected in configuration.")
180180

181181
# Populates account / address
182-
if config and config.type == AccountType.EXTERNAL.value:
182+
if config and config.type == AccountType.EXTERNAL:
183183
account = _load_account(None, None, chain=payment_chain)
184184
else:
185185
account = _load_account(private_key, private_key_file, chain=payment_chain)
@@ -745,7 +745,7 @@ async def delete(
745745

746746
config = load_main_configuration(settings.CONFIG_FILE)
747747
# Populates account / address
748-
if config and config.type == AccountType.EXTERNAL.value:
748+
if config and config.type == AccountType.EXTERNAL:
749749
account = _load_account(None, None, chain=chain)
750750
else:
751751
account = _load_account(private_key, private_key_file, chain=chain)
@@ -866,7 +866,7 @@ async def list_instances(
866866

867867
config = load_main_configuration(settings.CONFIG_FILE)
868868
# Populates account / address
869-
if config and config.type == AccountType.EXTERNAL.value:
869+
if config and config.type == AccountType.EXTERNAL:
870870
account = _load_account(None, None, chain=chain)
871871
else:
872872
account = _load_account(private_key, private_key_file, chain=chain)
@@ -909,7 +909,7 @@ async def reboot(
909909

910910
config = load_main_configuration(settings.CONFIG_FILE)
911911
# Populates account / address
912-
if config and config.type == AccountType.EXTERNAL.value:
912+
if config and config.type == AccountType.EXTERNAL:
913913
account = _load_account(None, None, chain=chain)
914914
else:
915915
account = _load_account(private_key, private_key_file, chain=chain)
@@ -947,7 +947,7 @@ async def allocate(
947947

948948
config = load_main_configuration(settings.CONFIG_FILE)
949949
# Populates account / address
950-
if config and config.type == AccountType.EXTERNAL.value:
950+
if config and config.type == AccountType.EXTERNAL:
951951
account = _load_account(None, None, chain=chain)
952952
else:
953953
account = _load_account(private_key, private_key_file, chain=chain)
@@ -980,7 +980,7 @@ async def logs(
980980

981981
config = load_main_configuration(settings.CONFIG_FILE)
982982
# Populates account / address
983-
if config and config.type == AccountType.EXTERNAL.value:
983+
if config and config.type == AccountType.EXTERNAL:
984984
account = _load_account(None, None, chain=chain)
985985
else:
986986
account = _load_account(private_key, private_key_file, chain=chain)
@@ -1016,7 +1016,7 @@ async def stop(
10161016

10171017
config = load_main_configuration(settings.CONFIG_FILE)
10181018
# Populates account / address
1019-
if config and config.type == AccountType.EXTERNAL.value:
1019+
if config and config.type == AccountType.EXTERNAL:
10201020
account = _load_account(None, None, chain=chain)
10211021
else:
10221022
account = _load_account(private_key, private_key_file, chain=chain)
@@ -1060,7 +1060,7 @@ async def confidential_init_session(
10601060

10611061
config = load_main_configuration(settings.CONFIG_FILE)
10621062
# Populates account / address
1063-
if config and config.type == AccountType.EXTERNAL.value:
1063+
if config and config.type == AccountType.EXTERNAL:
10641064
account = _load_account(None, None, chain=chain)
10651065
else:
10661066
account = _load_account(private_key, private_key_file, chain=chain)
@@ -1142,7 +1142,7 @@ async def confidential_start(
11421142
vm_hash = ItemHash(vm_id)
11431143
config = load_main_configuration(settings.CONFIG_FILE)
11441144
# Populates account / address
1145-
if config and config.type == AccountType.EXTERNAL.value:
1145+
if config and config.type == AccountType.EXTERNAL:
11461146
account = _load_account(None, None, chain=chain)
11471147
else:
11481148
account = _load_account(private_key, private_key_file, chain=chain)

src/aleph_client/commands/instance/display.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,10 @@ def _prepare_allocation_column(self):
343343
allocation_str = ALLOCATION_MANUAL
344344
color_allocation = "magenta3"
345345
crn_hash = safe_getattr(self.message.content.requirements, "node.node_hash") or ""
346-
elif self.allocation.allocations:
346+
elif isinstance(self.allocation, InstanceWithScheduler) and not self.allocation.allocations:
347+
self.allocation_column = cast(Text, Text.from_markup("[red]Not allocated[/red]"))
348+
return
349+
else:
347350
crn_url = self.allocation.allocations.node.url
348351
allocation_str = ALLOCATION_AUTO
349352
color_allocation = "deep_sky_blue1"

0 commit comments

Comments
 (0)