Changeset a65a65a
- Timestamp:
- May 27, 2010 7:45:50 AM (14 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- f771e2f
- Parents:
- 5e1fb7b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/protogeni_access.py
r5e1fb7b ra65a65a 91 91 self.staging_host = config.get("access", "staging_host") \ 92 92 or "ops.emulab.net" 93 self.local_seer_software = config.get("access", "local_seer_software") 94 self.local_seer_image = config.get("access", "local_seer_image") 95 self.local_seer_start = config.get("access", "local_seer_start") 93 96 97 self.dragon_endpoint = config.get("access", "dragon") 98 self.dragon_vlans = config.get("access", "dragon_vlans") 99 self.deter_internal = config.get("access", "deter_internal") 100 101 self.tunnel_config = config.getboolean("access", "tunnel_config") 102 self.portal_command = config.get("access", "portal_command") 103 self.portal_image = config.get("access", "portal_image") 104 self.portal_type = config.get("access", "portal_type") or "pc" 105 self.portal_startcommand = config.get("access", "portal_startcommand") 106 self.node_startcommand = config.get("access", "node_startcommand") 107 94 108 self.federation_software = software_list(self.federation_software) 95 109 self.portal_software = software_list(self.portal_software) 110 self.local_seer_software = software_list(self.local_seer_software) 96 111 97 112 self.renewal_interval = config.get("access", "renewal") or (3 * 60 ) … … 102 117 self.cm_url = config.get("access", "cm_url") 103 118 104 self.attrs = { }105 119 self.access = { } 106 120 self.restricted = [ ] … … 201 215 key_name = "(<ANY>|<NONE>|"+fedid_expr + "|"+ name_expr + ")" 202 216 203 attr_re = re.compile('attribute:\s*([\._\-a-z0-9]+)\s+value:\s*(.*)',204 re.IGNORECASE)205 217 access_str = '\('+key_name+'\s*,\s*'+key_name+'\s*,\s*'+ \ 206 218 key_name+'\s*\)\s*->\s*\(('+name_expr +')\s*,\s*('\ … … 226 238 line = line.strip(); 227 239 if len(line) == 0 or line.startswith('#'): 228 continue229 230 # Extended (attribute: x value: y) attribute line231 m = attr_re.match(line)232 if m != None:233 attr, val = m.group(1,2)234 self.attrs[attr] = val235 240 continue 236 241 … … 547 552 ] 548 553 } 549 if len(self.attrs) > 0: 550 msg['fedAttr'].extend( 551 [ { 'attribute': x, 'value' : y } \ 552 for x,y in self.attrs.iteritems()]) 554 if self.dragon_endpoint: 555 msg['fedAttr'].append({'attribute': 'dragon', 556 'value': self.dragon_endpoint}) 557 if self.deter_internal: 558 print 'adding internal' 559 msg['fedAttr'].append({'attribute': 'deter_internal', 560 'value': self.deter_internal}) 561 else: print "internal: %s" % self.deter_internal 562 #XXX: ?? 563 if self.dragon_vlans: 564 msg['fedAttr'].append({'attribute': 'vlans', 565 'value': self.dragon_vlans}) 553 566 554 567 if services: … … 803 816 804 817 cfn = "%s/%s.gw.conf" % (tmpdir, myname.lower()) 805 tunnelconfig = self. attrs.has_key('TunnelCfg')818 tunnelconfig = self.tunnel_config 806 819 try: 807 820 f = open(cfn, "w") … … 868 881 869 882 starts = { } 870 871 # The startcmds for master and slave testbeds872 if master:873 gate_cmd = self.attrs.get('MasterConnectorStartCmd', '/bin/true')874 node_cmd = self.attrs.get('MasterNodeStartCmd', 'bin/true')875 else:876 gate_cmd = self.attrs.get('SlaveConnectorStartCmd', '/bin/true')877 node_cmd = self.attrs.get('SlaveNodeStartCmd', 'bin/true')878 879 883 # Weed out the things we aren't going to instantiate: Segments, portal 880 884 # substrates, and portal interfaces. (The copy in the for loop allows … … 892 896 s.location = re.sub("^.*/", softdir, s.location) 893 897 if isinstance(e, topdl.Computer): 894 if e.get_attribute('portal') and gate_cmd:898 if e.get_attribute('portal') and self.portal_startcommand: 895 899 # Portals never have a user-specified start command 896 starts[e.name [0]] = gate_cmd897 elif node_cmd:900 starts[e.name] = self.portal_startcommand 901 elif self.node_startcommand: 898 902 if e.get_attribute('startup'): 899 starts[e.name[0]] = "%s \\$USER '%s'" % \ 900 (node_cmd, e.get_attribute('startup')) 903 starts[e.name] = "%s \\$USER '%s'" % \ 904 (self.node_startcommand, 905 e.get_attribute('startup')) 901 906 e.remove_attribute('startup') 902 907 else: 903 starts[e.name [0]] = node_cmd908 starts[e.name] = self.node_startcommand 904 909 905 910 # Remove portal interfaces … … 914 919 915 920 # NB: these are extra commands issued for the node, not the startcmds 916 if master: cmd = self.attrs.get('MasterConnectorCmd', '') 917 else: cmd = self.attrs.get('SlaveConnectorCmd', '') 918 919 if cmd: 920 filters.append(topdl.generate_portal_command_filter(cmd)) 921 if self.portal_command: 922 filters.append(topdl.generate_portal_command_filter( 923 self.portal_command)) 921 924 922 925 # Convert to rspec and return it
Note: See TracChangeset
for help on using the changeset viewer.