diff --git a/fedn/cli/client_cmd.py b/fedn/cli/client_cmd.py index 8cc4343ec..073b6bb48 100644 --- a/fedn/cli/client_cmd.py +++ b/fedn/cli/client_cmd.py @@ -60,9 +60,9 @@ def list_clients(ctx, protocol: str, host: str, port: str, token: str = None, n_ if _token: headers["Authorization"] = _token - click.echo(f"\nListing clients: {url}\n") click.echo(f"Headers: {headers}") + try: response = requests.get(url, headers=headers) print_response(response, "clients", None) @@ -74,7 +74,7 @@ def list_clients(ctx, protocol: str, host: str, port: str, token: str = None, n_ @click.option("-H", "--host", required=False, default=CONTROLLER_DEFAULTS["host"], help="Hostname of controller (api)") @click.option("-P", "--port", required=False, default=CONTROLLER_DEFAULTS["port"], help="Port of controller (api)") @click.option("-t", "--token", required=False, help="Authentication token") -@click.option("-id", "--id", required=False, help="Client ID") +@click.option("-id", "--id", required=True, help="Client ID") @client_cmd.command("get") @click.pass_context def get_client(ctx, protocol: str, host: str, port: str, token: str = None, id: str = None): @@ -94,7 +94,6 @@ def get_client(ctx, protocol: str, host: str, port: str, token: str = None, id: if id: url = f"{url}{id}" - headers["id"] = id click.echo(f"\nRetrieving client: {url}\n") @@ -105,7 +104,6 @@ def get_client(ctx, protocol: str, host: str, port: str, token: str = None, id: except requests.exceptions.ConnectionError: click.echo(f"Error: Could not connect to {url}") -@client_cmd.command("start") @client_cmd.command("start-v1") @click.option("-d", "--discoverhost", required=False, help="Hostname for discovery services(reducer).") @click.option("-p", "--discoverport", required=False, help="Port for discovery services (reducer).") diff --git a/fedn/cli/combiner_cmd.py b/fedn/cli/combiner_cmd.py index f7e937261..c6ccbeb19 100644 --- a/fedn/cli/combiner_cmd.py +++ b/fedn/cli/combiner_cmd.py @@ -102,7 +102,7 @@ def list_combiners(ctx, protocol: str, host: str, port: str, token: str = None, @click.option("-H", "--host", required=False, default=CONTROLLER_DEFAULTS["host"], help="Hostname of controller (api)") @click.option("-P", "--port", required=False, default=CONTROLLER_DEFAULTS["port"], help="Port of controller (api)") @click.option("-t", "--token", required=False, help="Authentication token") -@click.option("-id", "--id", required=False, help="Combiner ID") +@click.option("-id", "--id", required=True, help="Combiner ID") @combiner_cmd.command("get") @click.pass_context def get_combiner(ctx, protocol: str, host: str, port: str, token: str = None, id: str = None): @@ -122,7 +122,6 @@ def get_combiner(ctx, protocol: str, host: str, port: str, token: str = None, id if id: url = f"{url}{id}" - headers["id"] = id click.echo(f"\nRetrieving combiner: {url}\n") diff --git a/fedn/cli/model_cmd.py b/fedn/cli/model_cmd.py index 810b573ab..b5f738aad 100644 --- a/fedn/cli/model_cmd.py +++ b/fedn/cli/model_cmd.py @@ -43,7 +43,6 @@ def list_models(ctx, protocol: str, host: str, port: str, token: str = None, ses if session_id: url = f"{url}?session_id={session_id}" - headers["session_id"] = session_id click.echo(f"\nListing models: {url}\n") click.echo(f"Headers: {headers}") @@ -58,7 +57,7 @@ def list_models(ctx, protocol: str, host: str, port: str, token: str = None, ses @click.option("-H", "--host", required=False, default=CONTROLLER_DEFAULTS["host"], help="Hostname of controller (api)") @click.option("-P", "--port", required=False, default=CONTROLLER_DEFAULTS["port"], help="Port of controller (api)") @click.option("-t", "--token", required=False, help="Authentication token") -@click.option("-id", "--id", required=False, help="Model ID") +@click.option("-id", "--id", required=True, help="Model ID") @model_cmd.command("get") @click.pass_context def get_model(ctx, protocol: str, host: str, port: str, token: str = None, id: str = None): @@ -80,7 +79,6 @@ def get_model(ctx, protocol: str, host: str, port: str, token: str = None, id: s if id: url = f"{url}{id}" - headers["id"] = id click.echo(f"\nRetrieving model: {url}\n") click.echo(f"Headers: {headers}") diff --git a/fedn/cli/package_cmd.py b/fedn/cli/package_cmd.py index 30998b828..f34ea4a75 100644 --- a/fedn/cli/package_cmd.py +++ b/fedn/cli/package_cmd.py @@ -80,7 +80,7 @@ def list_packages(ctx, protocol: str, host: str, port: str, token: str = None, n @click.option("-H", "--host", required=False, default=CONTROLLER_DEFAULTS["host"], help="Hostname of controller (api)") @click.option("-P", "--port", required=False, default=CONTROLLER_DEFAULTS["port"], help="Port of controller (api)") @click.option("-t", "--token", required=False, help="Authentication token") -@click.option("-id", "--id", required=False, help="Package ID") +@click.option("-id", "--id", required=True, help="Package ID") @package_cmd.command("get") @click.pass_context def get_package(ctx, protocol: str, host: str, port: str, token: str = None, id: str = None): @@ -100,7 +100,6 @@ def get_package(ctx, protocol: str, host: str, port: str, token: str = None, id: if id: url = f"{url}{id}" - headers["id"] = id click.echo(f"\nretrieving package: {url}\n") diff --git a/fedn/cli/round_cmd.py b/fedn/cli/round_cmd.py index d60ff66e4..e790a8bdb 100644 --- a/fedn/cli/round_cmd.py +++ b/fedn/cli/round_cmd.py @@ -42,7 +42,6 @@ def list_rounds(ctx, protocol: str, host: str, port: str, token: str = None, ses if session_id: url = f"{url}?round_config.session_id={session_id}" - headers["session_id"] = session_id click.echo(f"\nListing rounds: {url}\n") click.echo(f"Headers: {headers}") @@ -57,7 +56,7 @@ def list_rounds(ctx, protocol: str, host: str, port: str, token: str = None, ses @click.option("-p", "--protocol", required=False, default=CONTROLLER_DEFAULTS["protocol"], help="Communication protocol of controller (api)") @click.option("-H", "--host", required=False, default=CONTROLLER_DEFAULTS["host"], help="Hostname of controller (api)") @click.option("-P", "--port", required=False, default=CONTROLLER_DEFAULTS["port"], help="Port of controller (api)") -@click.option("-id", "--id", required=False, help="Round ID") +@click.option("-id", "--id", required=True, help="Round ID") @click.option("-t", "--token", required=False, help="Authentication token") @round_cmd.command("get") @click.pass_context @@ -79,7 +78,6 @@ def get_round(ctx, protocol: str, host: str, port: str, token: str = None, id: s if id: url = f"{url}{id}" - headers["id"] = id click.echo(f"\nRetrieving round: {url}\n") diff --git a/fedn/cli/session_cmd.py b/fedn/cli/session_cmd.py index 65f45ac16..4cafa9e6b 100644 --- a/fedn/cli/session_cmd.py +++ b/fedn/cli/session_cmd.py @@ -71,7 +71,6 @@ def get_session(ctx, protocol: str, host: str, port: str, token: str = None, id: if id: url = f"{url}{id}" - headers["id"] = id click.echo(f"\nRetrieving session: {url}\n") diff --git a/fedn/cli/status_cmd.py b/fedn/cli/status_cmd.py index 5b445f07e..d47e4ab18 100644 --- a/fedn/cli/status_cmd.py +++ b/fedn/cli/status_cmd.py @@ -40,7 +40,6 @@ def list_statuses(ctx, protocol: str, host: str, port: str, token: str = None, s if session_id: url = f"{url}?sessionId={session_id}" - headers["session_id"] = session_id click.echo(f"\nListing statuses: {url}\n") @@ -56,7 +55,7 @@ def list_statuses(ctx, protocol: str, host: str, port: str, token: str = None, s @click.option("-H", "--host", required=False, default=CONTROLLER_DEFAULTS["host"], help="Hostname of controller (api)") @click.option("-P", "--port", required=False, default=CONTROLLER_DEFAULTS["port"], help="Port of controller (api)") @click.option("-t", "--token", required=False, help="Authentication token") -@click.option("-id", "--id", required=False, help="Status ID") +@click.option("-id", "--id", required=True, help="Status ID") @status_cmd.command("get") @click.pass_context def get_status(ctx, protocol: str, host: str, port: str, token: str = None, id: str = None): @@ -76,8 +75,6 @@ def get_status(ctx, protocol: str, host: str, port: str, token: str = None, id: if id: url = f"{url}{id}" - headers["id"] = id - click.echo(f"\nRetrieving status: {url}\n") click.echo(f"Headers: {headers}") diff --git a/fedn/cli/validation_cmd.py b/fedn/cli/validation_cmd.py index 10c594398..27ff8448d 100644 --- a/fedn/cli/validation_cmd.py +++ b/fedn/cli/validation_cmd.py @@ -41,7 +41,6 @@ def list_validations(ctx, protocol: str, host: str, port: str, token: str = None if session_id: url = f"{url}?sessionId={session_id}" - headers["session_id"] = session_id click.echo(f"\nListing validations: {url}\n") click.echo(f"Headers: {headers}") @@ -56,7 +55,7 @@ def list_validations(ctx, protocol: str, host: str, port: str, token: str = None @click.option("-H", "--host", required=False, default=CONTROLLER_DEFAULTS["host"], help="Hostname of controller (api)") @click.option("-P", "--port", required=False, default=CONTROLLER_DEFAULTS["port"], help="Port of controller (api)") @click.option("-t", "--token", required=False, help="Authentication token") -@click.option("-id", "--id", required=False, help="validation ID") +@click.option("-id", "--id", required=True, help="validation ID") @validation_cmd.command("get") @click.pass_context def get_validation(ctx, protocol: str, host: str, port: str, token: str = None, id: str = None): @@ -75,7 +74,6 @@ def get_validation(ctx, protocol: str, host: str, port: str, token: str = None, if id: url = f"{url}{id}" - headers["id"] = id click.echo(f"\nRetrieving validation: {url}\n")