@@ -80,17 +80,10 @@ def __init__(self, connection):
80
80
def login (self , username , password ):
81
81
payload = {}
82
82
url = '/gaia_api/login'
83
- cp_domain = self .get_option ('domain' )
84
- cp_api_key = self .get_option ('api_key' )
85
- if cp_domain :
86
- payload ['domain' ] = cp_domain
87
- if username and password and not cp_api_key :
88
- payload ['user' ] = username
89
- payload ['password' ] = password
90
- elif cp_api_key and not username and not password :
91
- payload ['api-key' ] = cp_api_key
83
+ if username and password :
84
+ payload = {'user' : username , 'password' : password }
92
85
else :
93
- raise AnsibleConnectionFailure ('[ Username and password] or api_key are required for login' )
86
+ raise AnsibleConnectionFailure ('Username and password are required for login' )
94
87
if self .mgmt_proxy_enabled == True :
95
88
url = '/web_api/login'
96
89
response , response_data = self .send_request (url , payload )
@@ -100,9 +93,6 @@ def login(self, username, password):
100
93
except KeyError :
101
94
raise ConnectionError (
102
95
'Server returned response without token info during connection authentication: %s' % response_data )
103
- # Case of read-only
104
- if 'uid' in response_data .keys ():
105
- self .connection ._session_uid = response_data ['uid' ]
106
96
107
97
def logout (self ):
108
98
url = '/gaia_api/logout'
@@ -114,10 +104,7 @@ def get_session_uid(self):
114
104
return self .connection ._session_uid
115
105
116
106
def send_request (self , path , body_params ):
117
- cp_cloud_mgmt_id = self .get_option ('cloud_mgmt_id' )
118
- if cp_cloud_mgmt_id :
119
- path = '/' + cp_cloud_mgmt_id + path
120
- # we only replace gaia_ip/ with web_api/gaia-api/ if target is set and path contails for gaia_ip/
107
+ # we only replace gaia_ip/ with web_api/gaia-api/ if target is set and path contains for gaia_ip/
121
108
cp_api_target = self .get_option ('cptarget' )
122
109
if 'gaia_api/' in path : # Avoid login/logut requests in case of web_api
123
110
if self .mgmt_proxy_enabled == True :
0 commit comments