Changeset a65a65a for fedd


Ignore:
Timestamp:
May 27, 2010 7:45:50 AM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
f771e2f
Parents:
5e1fb7b
Message:

get rid of attrs as well (untested)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/protogeni_access.py

    r5e1fb7b ra65a65a  
    9191        self.staging_host = config.get("access", "staging_host") \
    9292                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")
    9396   
     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
    94108        self.federation_software = software_list(self.federation_software)
    95109        self.portal_software = software_list(self.portal_software)
     110        self.local_seer_software = software_list(self.local_seer_software)
    96111
    97112        self.renewal_interval = config.get("access", "renewal") or (3 * 60 )
     
    102117        self.cm_url = config.get("access", "cm_url")
    103118
    104         self.attrs = { }
    105119        self.access = { }
    106120        self.restricted = [ ]
     
    201215        key_name = "(<ANY>|<NONE>|"+fedid_expr + "|"+ name_expr + ")"
    202216
    203         attr_re = re.compile('attribute:\s*([\._\-a-z0-9]+)\s+value:\s*(.*)',
    204                 re.IGNORECASE)
    205217        access_str = '\('+key_name+'\s*,\s*'+key_name+'\s*,\s*'+ \
    206218                key_name+'\s*\)\s*->\s*\(('+name_expr +')\s*,\s*('\
     
    226238            line = line.strip();
    227239            if len(line) == 0 or line.startswith('#'):
    228                 continue
    229 
    230             # Extended (attribute: x value: y) attribute line
    231             m = attr_re.match(line)
    232             if m != None:
    233                 attr, val = m.group(1,2)
    234                 self.attrs[attr] = val
    235240                continue
    236241
     
    547552                ]
    548553            }
    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})
    553566
    554567        if services:
     
    803816
    804817            cfn = "%s/%s.gw.conf" % (tmpdir, myname.lower())
    805             tunnelconfig = self.attrs.has_key('TunnelCfg')
     818            tunnelconfig = self.tunnel_config
    806819            try:
    807820                f = open(cfn, "w")
     
    868881
    869882        starts = { }
    870 
    871         # The startcmds for master and slave testbeds
    872         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 
    879883        # Weed out the things we aren't going to instantiate: Segments, portal
    880884        # substrates, and portal interfaces.  (The copy in the for loop allows
     
    892896                s.location = re.sub("^.*/", softdir, s.location)
    893897            if isinstance(e, topdl.Computer):
    894                 if e.get_attribute('portal') and gate_cmd:
     898                if e.get_attribute('portal') and self.portal_startcommand:
    895899                    # Portals never have a user-specified start command
    896                     starts[e.name[0]] = gate_cmd
    897                 elif node_cmd:
     900                    starts[e.name] = self.portal_startcommand
     901                elif self.node_startcommand:
    898902                    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'))
    901906                        e.remove_attribute('startup')
    902907                    else:
    903                         starts[e.name[0]] = node_cmd
     908                        starts[e.name] = self.node_startcommand
    904909
    905910                # Remove portal interfaces
     
    914919
    915920        # 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))
    921924
    922925        # Convert to rspec and return it
Note: See TracChangeset for help on using the changeset viewer.