Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions cirro/cli/interactive/auth_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,15 @@
from typing import Tuple, Dict

from cirro.cli.interactive.utils import ask_yes_no, ask
from cirro.config import list_tenants, extract_base_url
from cirro.config import extract_base_url

logger = logging.getLogger()


def gather_auth_config() -> Tuple[str, str, Dict, bool]:
try:
tenant_options = list_tenants()
except Exception:
logger.exception('Failed to get tenant list, enter the URL manually')
tenant_options = []

base_url = ask(
'autocomplete',
'Enter the URL of the Cirro instance you\'d like to connect to (press TAB for options)',
choices=[tenant['domain'] for tenant in tenant_options],
meta_information={tenant['domain']: tenant['displayName'] for tenant in tenant_options}
'text',
'Enter the URL of the Cirro instance you\'d like to connect to:'
)
# Fix user-provided base URL, if necessary
base_url = extract_base_url(base_url)
Expand Down
10 changes: 1 addition & 9 deletions cirro/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
import os
import re
from pathlib import Path
from typing import NamedTuple, Dict, Optional, List
from typing import NamedTuple, Dict, Optional

import requests
from requests import RequestException

from cirro.models.tenant import Tenant


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


def list_tenants() -> List[Tenant]:
resp = requests.get(f'https://nexus.{Constants.default_base_url}/info')
resp.raise_for_status()
return resp.json()['tenants']


def save_user_config(user_config: UserConfig):
original_user_config = load_user_config()
ini_config = configparser.ConfigParser()
Expand Down
7 changes: 0 additions & 7 deletions cirro/models/tenant.py

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cirro"
version = "1.5.4"
version = "1.5.5"
description = "CLI tool and SDK for interacting with the Cirro platform"
authors = ["Cirro Bio <support@cirro.bio>"]
license = "MIT"
Expand Down
6 changes: 1 addition & 5 deletions tests/test_config_load.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import unittest

from cirro.config import AppConfig, list_tenants, extract_base_url
from cirro.config import AppConfig, extract_base_url

TEST_BASE_URL = "app.cirro.bio"

Expand All @@ -16,10 +16,6 @@ def test_config_load(self):
self.assertIsNotNone(config.client_id)
self.assertIsNotNone(config.auth_endpoint)

def test_list_tenants(self):
tenants = list_tenants()
self.assertGreater(len(tenants), 1)

def test_extract_base(self):
test_cases = [
f"https://{TEST_BASE_URL}",
Expand Down
Loading