Skip to content

Commit 841606e

Browse files
committed
fix(commandline):
- Add strict mode definition to load option - Give strict mode option a default - Sanitize campaign name
1 parent 28a24ed commit 841606e

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

alembic/seed/seed_ci_campaign.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ metadata:
1414
# information parameters for a specific manifest type here, but the campaign
1515
# comes last in the configuration lookup hierarchy!
1616
spec:
17-
# set the initial state of the campaign to "paused" so it can be step-advanced
1817
butlerSelector:
1918
instrument: lsstcam
2019
embargo: "false"

packages/cm-commandline/src/lsst/cmservice/commandline/arguments.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ def preprocess_campaign_name(ctx: TypedContext, campaign: str) -> str:
1818
"""Preprocesses a campaign NAME by translating it to a campaign ID and
1919
storing the result in the application context
2020
"""
21-
ctx.obj.campaign_name = campaign
22-
ctx.obj.campaign_id = str(uuid5(settings.default_namespace, campaign))
23-
return campaign
21+
sanitized_campaign_name = as_snake_case(campaign)
22+
ctx.obj.campaign_name = sanitized_campaign_name
23+
ctx.obj.campaign_id = str(uuid5(settings.default_namespace, sanitized_campaign_name))
24+
return sanitized_campaign_name
2425

2526

2627
campaign_name = Annotated[

packages/cm-commandline/src/lsst/cmservice/commandline/loader/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ def load_from_yaml(
1818
filename: str,
1919
campaign: arguments.campaign_name,
2020
*,
21-
strict: Annotated[bool, typer.Option("--strict", help="Load YAML in strict mode")],
21+
strict: Annotated[
22+
bool, typer.Option(help="Load YAML in strict mode (file must have only a single campaign)")
23+
] = False,
2224
) -> None:
2325
"""Load manifests from a YAML file"""
2426
try:

0 commit comments

Comments
 (0)