|
1 | | -#!/usr/bin/env python3 |
2 | 1 | import importlib.metadata as metadata |
3 | 2 | import logging |
4 | 3 | import time |
5 | 4 | from pathlib import Path |
6 | | -from typing import Optional, Callable, List |
| 5 | +from typing import Optional, List |
7 | 6 |
|
8 | 7 | import click |
9 | 8 | from daemons.interfaces import exit |
@@ -50,15 +49,6 @@ def run(self): |
50 | 49 | time.sleep(0.1) |
51 | 50 |
|
52 | 51 |
|
53 | | -def _is_positive_answer(answer: str): |
54 | | - """ |
55 | | - Used to check if an answer is positive from a user. |
56 | | - """ |
57 | | - if answer.lower() in ["yes", "y"]: |
58 | | - return True |
59 | | - return False |
60 | | - |
61 | | - |
62 | 52 | @click.group(context_settings=CONTEXT_SETTINGS) |
63 | 53 | def cli(): |
64 | 54 | """Command line interface for interacting with SimulaQron.""" |
@@ -119,6 +109,9 @@ def start(name: str, nrnodes: int, nodes: str, network_config_file: Path): |
119 | 109 | logging.warning("The pidfile for this network is located at %s", pidfile) |
120 | 110 | return |
121 | 111 | nodes = nodes.split(",") |
| 112 | + if len(nodes) <=0: |
| 113 | + print(f"WARNING - The list of nodes to start is empty. If you specified the --nrnodes option " |
| 114 | + f"this can be normal. Please check your invocation line if needed.") |
122 | 115 | if nrnodes > 0 and len(nodes) < nrnodes: |
123 | 116 | nodes += [f"Node{i}" for i in range(nrnodes - len(nodes))] |
124 | 117 | d = SimulaQronDaemon(pidfile=pidfile, name=name, nodes=nodes) |
@@ -174,7 +167,7 @@ def reset(force: bool): |
174 | 167 | "(yes/no)") |
175 | 168 | else: |
176 | 169 | answer = "yes" |
177 | | - if _is_positive_answer(answer): |
| 170 | + if answer.lower() in ["yes", "y"]: |
178 | 171 | for entry in PID_FOLDER.iterdir(): |
179 | 172 | if entry.suffix == ".pid": |
180 | 173 | d = RunningSimulaQronDaemon(pidfile=entry) |
|
0 commit comments