cylera-cli 1.3.0__tar.gz → 1.3.1__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: cylera-cli
3
- Version: 1.3.0
3
+ Version: 1.3.1
4
4
  Summary: Command-line interface for the Cylera Partner API
5
5
  Author-email: Cylera <support@cylera.com>
6
6
  License-Expression: MIT
@@ -361,29 +361,32 @@ def switchorg(
361
361
  require_config()
362
362
  try:
363
363
  with get_client() as client:
364
- org_api = Organization(client)
365
- result = org_api.switch_organization(organization_id)
366
- print_json(result)
367
-
368
- current: dict[str, Any] = {}
369
- for attempt in range(2):
370
- print("Waiting for switch to take effect...", file=sys.stderr)
371
- time.sleep(5)
372
- current = org_api.get_organization()
373
- if str(current.get("id", "")) == str(organization_id):
374
- print(
375
- f"Confirmed: now in org {current.get('name', organization_id)!r}",
376
- file=sys.stderr,
377
- )
378
- return
379
- if attempt == 0:
380
- print("Not yet active, retrying...", file=sys.stderr)
381
-
382
- print(
383
- f"Warning: switch may still be pending. "
384
- f"Current org: {current.get('name', 'unknown')!r}",
385
- file=sys.stderr,
386
- )
364
+ result = Organization(client).switch_organization(organization_id)
365
+ print_json(result)
366
+
367
+ current: dict[str, Any] = {}
368
+ for attempt in range(2):
369
+ print("Waiting for switch to take effect...", file=sys.stderr)
370
+ time.sleep(5)
371
+ # A new client each time: a token from before the switch keeps
372
+ # acting on the old organization, and one from a WorkOS sign-in
373
+ # can't be renewed in place, so it has to be exchanged again.
374
+ with get_client() as client:
375
+ current = Organization(client).get_organization()
376
+ if str(current.get("id", "")) == str(organization_id):
377
+ print(
378
+ f"Confirmed: now in org {current.get('name', organization_id)!r}",
379
+ file=sys.stderr,
380
+ )
381
+ return
382
+ if attempt == 0:
383
+ print("Not yet active, retrying...", file=sys.stderr)
384
+
385
+ print(
386
+ f"Warning: switch may still be pending. "
387
+ f"Current org: {current.get('name', 'unknown')!r}",
388
+ file=sys.stderr,
389
+ )
387
390
  except CyleraAPIError as e:
388
391
  print(f"API error: {e}", file=sys.stderr)
389
392
  raise typer.Exit(1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cylera-cli
3
- Version: 1.3.0
3
+ Version: 1.3.1
4
4
  Summary: Command-line interface for the Cylera Partner API
5
5
  Author-email: Cylera <support@cylera.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cylera-cli"
3
- version = "1.3.0"
3
+ version = "1.3.1"
4
4
  description = "Command-line interface for the Cylera Partner API"
5
5
  readme = "README.md"
6
6
  license = "MIT"
File without changes
File without changes
File without changes
File without changes