Changeset 2ee4226
- Timestamp:
- Apr 26, 2010 6:10:57 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 05fceef
- Parents:
- d8442da
- Location:
- fedd/federation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/emulab_access.py
rd8442da r2ee4226 172 172 173 173 self.call_SetValue = service_caller('SetValue') 174 self.call_GetValue = service_caller('GetValue' )174 self.call_GetValue = service_caller('GetValue', log=self.log) 175 175 176 176 if not config.has_option("allocate", "uri"): … … 1307 1307 """ 1308 1308 1309 call_SetValue = service_caller('SetValue', log=self.log)1310 1309 for c in connInfo: 1311 1310 for p in [ p for p in c.get('parameter', []) \ … … 1321 1320 self.log.debug("Setting %s to %s on %s" % \ 1322 1321 (k, value, surl)) 1323 call_SetValue(surl, req, cf)1322 self.call_SetValue(surl, req, cf) 1324 1323 else: 1325 1324 self.log.error("Bad export request: %s" % p) … … 1331 1330 self.log.debug("Setting %s to %s on %s" % \ 1332 1331 (k, self.ssh_port, surl)) 1333 call_SetValue(surl, req, cf)1332 self.call_SetValue(surl, req, cf) 1334 1333 else: 1335 1334 self.log.error("Bad export request: %s" % p) … … 1356 1355 self.log.debug("Waiting for %s (%s) from %s" % \ 1357 1356 (name, key, store)) 1358 call_GetValue = service_caller('GetValue') 1359 r = call_GetValue(store, req, cf) 1357 r = self.call_GetValue(store, req, cf) 1360 1358 r = r.get('GetValueResponseBody', None) 1361 1359 if r : -
fedd/federation/remote_service.py
rd8442da r2ee4226 345 345 # basic string if it isn't one already. 346 346 r = self.strip_unicode(copy.deepcopy(req)) 347 url = str(url)348 349 transport = SSL_Transport(ctx)350 port = ServerProxy(url, transport=transport)351 # Make the call, and convert faults back to service_errors352 347 if self.request_body_name: 353 348 r = self.apply_to_tags(\ … … 356 351 r = self.apply_to_tags(r, self.encap_fedids) 357 352 353 url = str(url) 358 354 ok = False 359 355 retries = 0 … … 361 357 while not ok and retries < self.max_retries: 362 358 try: 359 transport = SSL_Transport(ctx) 360 port = ServerProxy(url, transport=transport) 363 361 remote_method = getattr(port, self.service_name, None) 364 362 resp = remote_method(r) … … 405 403 "Call to soap service without a configured request body"); 406 404 407 # If a context is given, use it. Otherwise construct one from408 # components. The construction shouldn't call out for passwords.409 if context:410 ctx = context411 else:412 try:413 ctx = fedd_ssl_context(cert_file, trusted_certs,414 password=cert_pwd)415 except SSL.SSLError:416 raise service_error(service_error.server_config,417 "Certificates misconfigured")418 loc = self.locator()419 get_port = getattr(loc, self.port_name, None)420 if not get_port:421 raise service_error(service_error.internal,422 "Cannot get port %s from locator" % self.port_name)423 port = get_port(url,424 transport=M2Crypto.httpslib.HTTPSConnection,425 transdict={ 'ssl_context' : ctx },426 tracefile=tf)427 remote_method = getattr(port, self.service_name, None)428 if not remote_method:429 raise service_error(service_error.internal,430 "Cannot get service from SOAP port")431 432 # Reconstruct the full request message433 msg = self.request_message()434 set_element = getattr(msg, "set_element_%s" % self.request_body_name,435 None)436 if not set_element:437 raise service_error(service_error.internal,438 "Cannot get element setting method for %s" % \439 self.request_body_name)440 set_element(self.pack_soap(msg, self.request_body_name, req))441 405 ok = False 442 406 retries = 0 443 407 while not ok and retries < self.max_retries: 444 408 try: 409 # Reconstruct the full request message 410 msg = self.request_message() 411 set_element = getattr(msg, "set_element_%s" % \ 412 self.request_body_name, 413 None) 414 if not set_element: 415 raise service_error(service_error.internal, 416 "Cannot get element setting method for %s" % \ 417 self.request_body_name) 418 set_element(self.pack_soap(msg, self.request_body_name, req)) 419 # If a context is given, use it. Otherwise construct one from 420 # components. The construction shouldn't call out for 421 # passwords. 422 if context: 423 if self.log: 424 self.log.debug("Context passed in to call_soap") 425 ctx = context 426 else: 427 if self.log: 428 self.log.debug( 429 "Constructing context in call_soap: %s" % \ 430 cert_file) 431 try: 432 ctx = fedd_ssl_context(cert_file, trusted_certs, 433 password=cert_pwd) 434 except SSL.SSLError, e: 435 if self.log: 436 self.log.debug("Certificate error: %s" % e) 437 raise service_error(service_error.server_config, 438 "Certificates misconfigured") 439 loc = self.locator() 440 get_port = getattr(loc, self.port_name, None) 441 if not get_port: 442 raise service_error(service_error.internal, 443 "Cannot get port %s from locator" % self.port_name) 444 port = get_port(url, 445 transport=M2Crypto.httpslib.HTTPSConnection, 446 transdict={ 'ssl_context' : ctx }, 447 tracefile=tf) 448 remote_method = getattr(port, self.service_name, None) 449 if not remote_method: 450 raise service_error(service_error.internal, 451 "Cannot get service from SOAP port") 452 445 453 fail_exc = None 454 if self.log: 455 self.log.debug("Calling %s (retry %d)" % \ 456 (self.service_name, retries)) 446 457 resp = remote_method(msg) 447 458 ok = True
Note: See TracChangeset
for help on using the changeset viewer.