Skip to content

Commit

Permalink
Remove login path argument from clients and TatlinModule
Browse files Browse the repository at this point in the history
  • Loading branch information
kvlvs committed Nov 15, 2022
1 parent cf22809 commit fd16073
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
4 changes: 0 additions & 4 deletions plugins/doc_fragments/connection_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ class ModuleDocFragment(object):
description:
- Responsible for SSL certificates validation.
- If set to False certificates won't validated.
login_path:
type: str
default: "auth/login"
description: Tatlin REST API endpoint for authorization
timeout:
type: int
default: 60
Expand Down
2 changes: 2 additions & 0 deletions plugins/module_utils/tatlin_api/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def build_url(*parts):

# Auth service
AUTH_ENDPOINT = 'auth'
LOGIN_ENDPOINT = build_url(AUTH_ENDPOINT, 'login')
LOGOUT_ENDPOINT = build_url(AUTH_ENDPOINT, 'logout')
USERS_ENDPOINT = build_url(AUTH_ENDPOINT, 'users')
GROUPS_ENDPOINT = build_url(AUTH_ENDPOINT, 'groups')
LDAP_ENDPOINT = build_url(AUTH_ENDPOINT, 'ldap')
Expand Down
4 changes: 1 addition & 3 deletions plugins/module_utils/tatlin_api/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,12 @@ def __init__(
username=None, # type: str
password=None, # type: str
validate_certs=True, # type: bool
login_path=None, # type: str
timeout=60, # type: int
auth_method=AUTH_SESSION,
auth_method=AUTH_SESSION # type: str,
): # type: (...) -> None

self._username = username
self._password = password
self._login_path = login_path
self._auth_key = None
self._token = None
self._auth_method = auth_method
Expand Down
9 changes: 2 additions & 7 deletions plugins/module_utils/tatlin_api/tatlin_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
Optional = List = Union = Dict = None


LOGIN_PATH = 'auth/login'
LOGOUT_PATH = 'auth/logout'


class TatlinClient(RestClient):

def __init__(
Expand All @@ -57,7 +53,6 @@ def __init__(
username=None, # type: Optional[str]
password=None, # type: Optional[str]
validate_certs=True, # type: Optional[bool]
login_path=LOGIN_PATH, # type: Optional[str]
timeout=60, # type: Optional[int]
auth_method=AUTH_SESSION, # type: Optional[str]
): # type: (...) -> None
Expand All @@ -67,11 +62,11 @@ def __init__(
username=username,
password=password,
validate_certs=validate_certs,
login_path=login_path,
timeout=timeout,
auth_method=auth_method,
)

self._login_path = eps.LOGIN_ENDPOINT
self._ldap_config = None
self._system_name = None
self._system_version = None
Expand Down Expand Up @@ -508,7 +503,7 @@ def get_user_groups(self): # type: () -> List[UserGroup]

def logout(self): # type: () -> None
if self._token:
self.post(LOGOUT_PATH)
self.post(eps.LOGOUT_ENDPOINT)
self._token = None

def reboot_node(self, name): # type: (str) -> None
Expand Down
6 changes: 0 additions & 6 deletions plugins/module_utils/tatlin_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ def __init__(
"type": "bool",
"default": True,
},
"login_path": {
"required": False,
"type": "str",
"default": "auth/login",
},
"timeout": {
"required": False,
"type": "int",
Expand All @@ -78,7 +73,6 @@ def __init__(
username=connection['username'],
password=connection['password'],
validate_certs=connection['validate_certs'],
login_path=connection['login_path'],
timeout=connection['timeout'],
)

Expand Down

0 comments on commit fd16073

Please sign in to comment.