Skip to content

Commit

Permalink
fix: error message for det agent [enable|disable]. (#7839)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioga authored Sep 11, 2023
1 parent 9132dcb commit 813ed36
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions harness/determined/cli/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,13 @@ def patch_agent(enabled: bool) -> Callable[[argparse.Namespace], None]:
@authentication.required
def patch(args: argparse.Namespace) -> None:
check.check_false(args.all and args.agent_id)
action = "enable" if enabled else "disable"

if not (args.all or args.agent_id):
raise errors.CliError("Must specify exactly on of --all or --agent-id")
raise errors.CliError(
"Please pass agent id or --all option. "
f"See `det agent {action} --help` for details."
)

if args.agent_id:
agent_ids = [args.agent_id]
Expand All @@ -169,7 +173,6 @@ def patch(args: argparse.Namespace) -> None:
drain_mode = None if enabled else args.drain

for agent_id in agent_ids:
action = "enable" if enabled else "disable"
path = f"api/v1/agents/{agent_id}/{action}"

payload = None
Expand Down

0 comments on commit 813ed36

Please sign in to comment.