MCPcopy Create free account
hub / github.com/apache/cloudstack / __getKeys

Method __getKeys

tools/marvin/marvin/cloudstackTestClient.py:209–238  ·  view source on GitHub ↗

@Name : ___getKeys @Desc : Retrieves the API and Secret Key for the provided Userid @Input: userid: Userid to register @Output: FAILED or tuple with apikey and secretkey

(self, userid)

Source from the content-addressed store, hash-verified

207 self.__dbConnection = DbConnection(host, port, user, passwd, db)
208
209 def __getKeys(self, userid):
210 '''
211 @Name : ___getKeys
212 @Desc : Retrieves the API and Secret Key for the provided Userid
213 @Input: userid: Userid to register
214 @Output: FAILED or tuple with apikey and secretkey
215 '''
216 try:
217 register_user = registerUserKeys.registerUserKeysCmd()
218 register_user.id = userid
219 register_user_res = \
220 self.__apiClient.registerUserKeys(register_user)
221 if not register_user_res:
222 return FAILED
223
224 getuser_keys = getUserKeys.getUserKeysCmd()
225 getuser_keys.id = userid
226 getuser_keys_res = self.__apiClient.getUserKeys(getuser_keys)
227 if getuser_keys_res is None :
228 self.__logger.error("__createApiClient: API "
229 "Client Creation Failed")
230 return FAILED
231
232 api_key = getuser_keys_res.apikey
233 security_key = getuser_keys_res.secretkey
234 return (api_key, security_key)
235 except Exception as e:
236 self.__logger.exception("Exception Occurred Under __geKeys : "
237 "%s" % GetDetailExceptionInfo(e))
238 return FAILED
239
240 def createTestClient(self):
241 '''

Callers 2

__createApiClientMethod · 0.95
__createUserApiClientMethod · 0.95

Calls 3

GetDetailExceptionInfoFunction · 0.90
registerUserKeysMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected