Skip to content

Commit fe25c79

Browse files
committed
Fail when pointing at a profile that doesn't exist
Instead of attempting to create it
1 parent c4cd6ae commit fe25c79

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

planemo/galaxy/profiles.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
This is a workspace with a specific default configuration and shed
44
tool setup. It is meant to be used with various serve commands.
55
"""
6-
76
import json
87
import os
98
import shutil
109

10+
import click
1111
from galaxy.util.commands import which
1212
from gxjobconfinit import (
1313
build_job_config,
@@ -131,7 +131,16 @@ def _create_profile_external(ctx, profile_directory, profile_name, kwds):
131131
def ensure_profile(ctx, profile_name, **kwds):
132132
"""Ensure a Galaxy profile exists and return profile defaults."""
133133
if not profile_exists(ctx, profile_name, **kwds):
134-
create_profile(ctx, profile_name, **kwds)
134+
available_profiles = list_profiles(ctx, **kwds)
135+
error_message = f"Profile '{profile_name}' does not exist."
136+
if available_profiles:
137+
error_message += f"\n\nAvailable profiles: {', '.join(available_profiles)}"
138+
error_message += f"\n\nTo create a new profile, use: planemo profile_create {profile_name}"
139+
else:
140+
error_message += (
141+
f"\n\nNo profiles found. To create a new profile, use: planemo profile_create {profile_name}"
142+
)
143+
raise click.UsageError(error_message)
135144

136145
return _profile_options(ctx, profile_name, **kwds)
137146

0 commit comments

Comments
 (0)