toolforge-components-cli 0.0.11__tar.gz → 0.0.13__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.3
2
2
  Name: toolforge-components-cli
3
- Version: 0.0.11
3
+ Version: 0.0.13
4
4
  Summary: Toolforge components client
5
5
  License: GPLv3
6
6
  Author: Slavina Stefanova
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "toolforge-components-cli"
3
- version = "0.0.11"
3
+ version = "0.0.13"
4
4
  description = "Toolforge components client"
5
5
  authors = ["Slavina Stefanova <sstefanova@wikimedia.org>"]
6
6
  license = "GPLv3"
@@ -467,7 +467,7 @@ def _format_status(status: str) -> str:
467
467
  fg_color = "yellow"
468
468
  elif status == "failed":
469
469
  fg_color = "red"
470
- elif status == "successful":
470
+ elif status in ("successful", "cancelled"):
471
471
  fg_color = "green"
472
472
 
473
473
  return click.style(status, fg=fg_color)
@@ -564,6 +564,26 @@ def deployment_delete(
564
564
  _display_deployment(response.get("data", {}), as_json, prefix="Deleted deployment:")
565
565
 
566
566
 
567
+ @deployment.command(name="cancel", help="Cancel a running deployment.")
568
+ @click.option(
569
+ "--json",
570
+ "as_json",
571
+ is_flag=True,
572
+ help="If set, will output in JSON format",
573
+ )
574
+ @click.argument("deployment_id", required=False, default="latest")
575
+ @click.pass_context
576
+ def deployment_cancel(ctx, deployment_id: str, as_json: bool) -> None:
577
+ components_client = ctx.obj["components_client"]
578
+ display_messages = not as_json
579
+
580
+ response = components_client.put(
581
+ f"/deployment/{deployment_id}/cancel", display_messages=display_messages
582
+ )
583
+
584
+ _display_deployment(deployment_data=response["data"], as_json=as_json)
585
+
586
+
567
587
  def main() -> int:
568
588
  debug = False
569
589
  try: