cylera-cli 1.3.1__tar.gz → 1.3.2__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.1
3
+ Version: 1.3.2
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,7 +361,16 @@ def switchorg(
361
361
  require_config()
362
362
  try:
363
363
  with get_client() as client:
364
- result = Organization(client).switch_organization(organization_id)
364
+ org_api = Organization(client)
365
+ # GET /organization/ doesn't return the id switching takes (a
366
+ # mapping id, not the organization's), so the switch is
367
+ # confirmed by the target's name.
368
+ target_name = next(
369
+ (o.get("name") for o in org_api.get_available_organizations()
370
+ if str(o.get("id")) == str(organization_id)),
371
+ None,
372
+ )
373
+ result = org_api.switch_organization(organization_id)
365
374
  print_json(result)
366
375
 
367
376
  current: dict[str, Any] = {}
@@ -373,9 +382,9 @@ def switchorg(
373
382
  # can't be renewed in place, so it has to be exchanged again.
374
383
  with get_client() as client:
375
384
  current = Organization(client).get_organization()
376
- if str(current.get("id", "")) == str(organization_id):
385
+ if target_name is not None and current.get("name") == target_name:
377
386
  print(
378
- f"Confirmed: now in org {current.get('name', organization_id)!r}",
387
+ f"Confirmed: now in org {target_name!r}",
379
388
  file=sys.stderr,
380
389
  )
381
390
  return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cylera-cli
3
- Version: 1.3.1
3
+ Version: 1.3.2
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.1"
3
+ version = "1.3.2"
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