toolforge-components-cli 0.0.18__tar.gz → 0.0.20__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toolforge-components-cli
3
- Version: 0.0.18
3
+ Version: 0.0.20
4
4
  Summary: Toolforge components client
5
5
  License: GPLv3
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "toolforge-components-cli"
3
- version = "0.0.18"
3
+ version = "0.0.20"
4
4
  description = "Toolforge components client"
5
5
  authors = ["Slavina Stefanova <sstefanova@wikimedia.org>"]
6
6
  license = "GPLv3"
@@ -188,13 +188,15 @@ def config_create(ctx, config: TextIO | None, as_json: bool) -> None:
188
188
  components_client = ctx.obj["components_client"]
189
189
  display_messages = not as_json
190
190
 
191
- if config is None:
192
- if _should_prompt():
193
- click.echo(MISSING_CONFIG_MSG, err=True)
194
- sys.exit(1)
195
- config_data = yaml.safe_load(sys.stdin)
196
- else:
197
- config_data = yaml.safe_load(config)
191
+ if config is None and _should_prompt():
192
+ click.echo(MISSING_CONFIG_MSG, err=True)
193
+ sys.exit(1)
194
+
195
+ config_source = config if config is not None else sys.stdin
196
+ try:
197
+ config_data = yaml.safe_load(config_source)
198
+ except yaml.YAMLError as e:
199
+ raise ToolforgeUserError(f"Invalid YAML configuration: {e}") from e
198
200
 
199
201
  response = components_client.post(
200
202
  "/config", json=config_data, display_messages=display_messages
@@ -519,6 +521,19 @@ def deployment_list(ctx, as_json: bool) -> None:
519
521
  return
520
522
 
521
523
  deployments = response.get("data", {}).get("deployments", [])
524
+ if not deployments:
525
+ click.echo(
526
+ click.style(
527
+ (
528
+ "No deployments found, you can create one using `toolforge components deployment create`,"
529
+ + "run `toolforge components deployment create --help` for more details"
530
+ ),
531
+ fg="yellow",
532
+ ),
533
+ err=True,
534
+ )
535
+ return
536
+
522
537
  formatted_deployments = [
523
538
  [
524
539
  deployment["deploy_id"],