Changeset ef36c1e for fedd/fedd_proj.py
- Timestamp:
- Aug 1, 2008 11:41:39 AM (16 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- 808889e
- Parents:
- 7da9da6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_proj.py
r7da9da6 ref36c1e 33 33 bool_attrs = ("dynamic_projects", "project_priority") 34 34 emulab_attrs = ("boss", "ops", "domain", "fileserver", "eventserver") 35 id_attrs = ("testbed", "cert_file", "trusted_certs", "proxy", 36 "proxy_trusted_certs", "cert_pwd") 35 id_attrs = ("testbed", "cert_file", "cert_pwd", "trusted_certs", "proxy", 36 "proxy_cert_file", "proxy_cert_pwd", "proxy_trusted_certs", 37 "dynamic_projects_url", "dynamic_projects_cert_file", 38 "dynamic_projects_cert_pwd", "dynamic_projects_trusted_certs") 37 39 38 40 # Used by the SOAP caller … … 92 94 if config != None: 93 95 self.read_config(config) 94 self.allocate_project = \ 95 fedd_allocate_project_local(self.dynamic_projects) 96 97 # Certs are promoted from the generic to the specific, so without a 98 # specific proxy certificate, the main certificates are used for proxy 99 # interactions. If no dynamic project certificates, then proxy certs 100 # are used, and if none of those the main certs. 101 102 # init proxy certs 103 if self.proxy_cert_file == None: 104 self.proxy_cert_file = self.cert_file 105 self.proxy_cert_pwd = self.cert_pwd 106 107 if self.proxy_trusted_certs == None: 108 self.proxy_trusted_certs = self.trusted_certs 109 110 # init dynamic project certs 111 if self.dynamic_projects_cert_file == None: 112 self.dynamic_projects_cert_file = self.proxy_cert_file 113 self.dynamic_projects_cert_pwd = self.proxy_cert_pwd 114 115 if self.dynamic_projects_trusted_certs == None: 116 self.dynamic_projects_trusted_certs = self.proxy_trusted_certs 117 118 proj_certs = (self.dynamic_projects_cert_file, 119 self.dynamic_projects_trusted_certs, 120 self.dynamic_projects_cert_pwd) 121 122 if self.dynamic_projects_url == None: 123 self.allocate_project = \ 124 fedd_allocate_project_local(self.dynamic_projects, 125 self.dynamic_projects_url, proj_certs) 126 fedd_proj.soap_methods['AllocateProject'] = 'soap_AllocateProject' 127 else: 128 self.allocate_project = \ 129 fedd_allocate_project_remote(self.dynamic_projects, 130 self.dynamic_projects_url, proj_certs) 96 131 97 132 def dump_state(self): … … 138 173 def proxy_xmlrpc_request(self, dt, req): 139 174 """Send an XMLRPC proxy request. Called if the SOAP RPC fails""" 140 tc = self.proxy_trusted_certs or self.trusted_certs141 175 142 176 # No retry loop here. Proxy servers must correctly authenticate 143 177 # themselves without help 144 178 try: 145 ctx = fedd_ssl_context(self.cert_file, tc, password=self.cert_pwd) 179 ctx = fedd_ssl_context(self.proxy_cert_file, 180 self.proxy_trusted_certs, password=self.proxy_cert_pwd) 146 181 except SSL.SSLError: 147 182 raise service_error(service_error.server_config, … … 186 221 also rethrows any faults. 187 222 """ 188 tc = self.proxy_trusted_certs or self.trusted_certs189 190 223 # No retry loop here. Proxy servers must correctly authenticate 191 224 # themselves without help 192 225 try: 193 ctx = fedd_ssl_context(self.cert_file, tc, password=self.cert_pwd) 226 ctx = fedd_ssl_context(self.proxy_cert_file, 227 self.proxy_trusted_certs, password=self.proxy_cert_pwd) 194 228 except SSL.SSLError: 195 229 raise service_error(service_error.server_config, … … 401 435 # Compose the dynamic project request 402 436 # (only dynamic, dynamic currently allowed) 403 preq = { 'project' : {\ 437 preq = { 'AllocateProjectRequestBody': \ 438 { 'project' : {\ 404 439 'user': [ \ 405 { 'access': { 'sshPubkey': s }} \440 { 'access': [ { 'sshPubkey': s } ] } \ 406 441 for s in ssh ] \ 442 }\ 407 443 }\ 408 444 } 409 445 if restricted != None and len(restricted) > 0: 410 preq['resources'] = [ {'node': { 'hardware' : [ h ]\ 411 } } for h in restricted ] 446 preq['AllocateProjectRequestBody']['resources'] = \ 447 [ {'node': { 'hardware' : [ h ] } } \ 448 for h in restricted ] 412 449 413 414 #self.dynamic_project(found, ssh)415 450 ap = self.allocate_project.dynamic_project(preq) 416 # XXX: fill in response values into the real response417 451 else: pass # SSH key additions 418 452 else: … … 449 483 service_error.proxy, 450 484 "Undefined fault from proxy??"); 485 486 487 def soap_AllocateProject(self, ps, fid): 488 req = ps.Parse(AllocateProjectRequestMessage.typecode) 489 490 msg = self.allocate_project.dynamic_project(unpack_soap(req), fedid) 491 492 resp = AllocateProjectResponseMessage() 493 resp.set_element_AllocateProjectResponseBody( 494 pack_soap(resp, "AllocateProjectResponseBody", msg)) 495 496 return resp 451 497 452 498 def soap_RequestAccess(self, ps, fid):
Note: See TracChangeset
for help on using the changeset viewer.