Skip to content

Commit e5c6531

Browse files
authored
Remove tenant options prompt on initial configuration (#155)
* remove tenant options autocomplete * lint * input -> text
1 parent f216e1c commit e5c6531

File tree

5 files changed

+6
-33
lines changed

5 files changed

+6
-33
lines changed

cirro/cli/interactive/auth_args.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,15 @@
22
from typing import Tuple, Dict
33

44
from cirro.cli.interactive.utils import ask_yes_no, ask
5-
from cirro.config import list_tenants, extract_base_url
5+
from cirro.config import extract_base_url
66

77
logger = logging.getLogger()
88

99

1010
def gather_auth_config() -> Tuple[str, str, Dict, bool]:
11-
try:
12-
tenant_options = list_tenants()
13-
except Exception:
14-
logger.exception('Failed to get tenant list, enter the URL manually')
15-
tenant_options = []
16-
1711
base_url = ask(
18-
'autocomplete',
19-
'Enter the URL of the Cirro instance you\'d like to connect to (press TAB for options)',
20-
choices=[tenant['domain'] for tenant in tenant_options],
21-
meta_information={tenant['domain']: tenant['displayName'] for tenant in tenant_options}
12+
'text',
13+
'Enter the URL of the Cirro instance you\'d like to connect to:'
2214
)
2315
# Fix user-provided base URL, if necessary
2416
base_url = extract_base_url(base_url)

cirro/config.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
import os
33
import re
44
from pathlib import Path
5-
from typing import NamedTuple, Dict, Optional, List
5+
from typing import NamedTuple, Dict, Optional
66

77
import requests
88
from requests import RequestException
99

10-
from cirro.models.tenant import Tenant
11-
1210

1311
class Constants:
1412
home = os.environ.get('CIRRO_HOME', '~/.cirro')
@@ -33,12 +31,6 @@ def extract_base_url(base_url: str):
3331
return base_url
3432

3533

36-
def list_tenants() -> List[Tenant]:
37-
resp = requests.get(f'https://nexus.{Constants.default_base_url}/info')
38-
resp.raise_for_status()
39-
return resp.json()['tenants']
40-
41-
4234
def save_user_config(user_config: UserConfig):
4335
original_user_config = load_user_config()
4436
ini_config = configparser.ConfigParser()

cirro/models/tenant.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "cirro"
3-
version = "1.5.4"
3+
version = "1.5.5"
44
description = "CLI tool and SDK for interacting with the Cirro platform"
55
authors = ["Cirro Bio <support@cirro.bio>"]
66
license = "MIT"

tests/test_config_load.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import unittest
33

4-
from cirro.config import AppConfig, list_tenants, extract_base_url
4+
from cirro.config import AppConfig, extract_base_url
55

66
TEST_BASE_URL = "app.cirro.bio"
77

@@ -16,10 +16,6 @@ def test_config_load(self):
1616
self.assertIsNotNone(config.client_id)
1717
self.assertIsNotNone(config.auth_endpoint)
1818

19-
def test_list_tenants(self):
20-
tenants = list_tenants()
21-
self.assertGreater(len(tenants), 1)
22-
2319
def test_extract_base(self):
2420
test_cases = [
2521
f"https://{TEST_BASE_URL}",

0 commit comments

Comments
 (0)