|
38 | 38 | from craft_cli import ArgumentParsingError, emit
|
39 | 39 | from craft_cli.errors import CraftError
|
40 | 40 | from craft_parts import Step
|
41 |
| -from craft_store import attenuations, models |
| 41 | +from craft_store import attenuations, models, publisher |
42 | 42 | from craft_store.errors import CredentialsUnavailable
|
43 | 43 | from craft_store.models import ResponseCharmResourceBase
|
44 | 44 | from humanize import naturalsize
|
@@ -2382,18 +2382,12 @@ class CreateTrack(CharmcraftCommand):
|
2382 | 2382 | name = "create-track"
|
2383 | 2383 | help_msg = "Create one or more tracks for a charm on Charmhub"
|
2384 | 2384 | overview = textwrap.dedent(
|
2385 |
| - """ |
2386 |
| - Create one or more tracks for a charm on Charmhub. Returns |
2387 |
| - the full list of tracks for that charm. |
2388 |
| -
|
2389 |
| - For example: |
| 2385 | + """\ |
| 2386 | + Create one or more tracks for a charm on Charmhub. |
2390 | 2387 |
|
2391 |
| - $ charmcraft create-track my-charm track-1 track-2 |
2392 |
| - Name Created at Automatic phasing percentage |
2393 |
| - --------- -------------------- ------------------------------ |
2394 |
| - track-1 2024-12-10T23:48:40Z |
2395 |
| - track-2 2024-12-11T00:14:24Z |
2396 |
| - latest 2023-04-17T23:55:07Z |
| 2388 | + Returns the full list of tracks for that charm. Tracks must match an existing |
| 2389 | + guardrail for this charm. Guardrails can be requested in the charmhub requests |
| 2390 | + category at https://discourse.charmhub.io. |
2397 | 2391 | """
|
2398 | 2392 | )
|
2399 | 2393 | format_option = True
|
@@ -2421,13 +2415,13 @@ def run(self, parsed_args: argparse.Namespace) -> None:
|
2421 | 2415 | """Run the command."""
|
2422 | 2416 | emit.progress(f"Creating {len(parsed_args.track)} tracks on the store")
|
2423 | 2417 | pct = parsed_args.automatic_phasing_percentage
|
2424 |
| - tracks = [ |
| 2418 | + tracks: list[publisher.CreateTrackRequest] = [ |
2425 | 2419 | {"name": track, "automatic-phasing-percentage": pct}
|
2426 | 2420 | for track in parsed_args.track
|
2427 | 2421 | ]
|
2428 | 2422 | output_tracks = self._services.store.create_tracks(
|
2429 | 2423 | parsed_args.name,
|
2430 |
| - *tracks, # type: ignore[arg-type] # false positive in mypy |
| 2424 | + *tracks, |
2431 | 2425 | )
|
2432 | 2426 |
|
2433 | 2427 | if fmt := parsed_args.format:
|
|
0 commit comments