@@ -35,23 +35,6 @@ def __init__(self, tenant_name: str = None, token: str = None, silent: bool = Fa
3535 def set_output_format (self , output_format : str ):
3636 self .output_format = self .config .get_output_format (output_format )
3737
38- # it is preferable to do this in the sdk as a static method
39- # as this will eliminate the duplicate code
40- def parse_tenant (self ):
41- domain = self .tenant_name .replace ('https://' , '' ).replace ('http://' , '' ) # remove scheme
42- domain = domain .split ('/' )[0 ] # remove any paths as they will not be needed
43- try :
44- domain_without_port = domain .split (':' )[0 ]
45- socket .gethostbyname_ex (domain_without_port ) # if success then a full domain was provided
46- return domain
47- except socket .gaierror : # assume just the tenant name was provided (originally the only supported method)
48- domain = f'{ self .tenant_name } .britive-app.com'
49- try :
50- socket .gethostbyname_ex (domain ) # validate the hostname is real
51- return domain
52- except socket .gaierror :
53- raise Exception (f'Invalid tenant provided: { self .tenant_name } ' )
54-
5538 def set_credential_manager (self ):
5639 if self .credential_manager :
5740 return
@@ -113,7 +96,7 @@ def logout(self):
11396 if self .token :
11497 raise click .ClickException ('Logout not available when using an API token.' )
11598 self .login ()
116- self .b .delete (f'https://{ self .parse_tenant ()} /api/auth' )
99+ self .b .delete (f'https://{ Britive .parse_tenant (self . tenant_name )} /api/auth' )
117100 self ._cleanup_credentials ()
118101
119102 # will take a list of dicts and print to the screen based on the format specified in the config file
0 commit comments