Changeset b6a6206


Ignore:
Timestamp:
Oct 6, 2011 3:58:02 PM (13 years ago)
Author:
Ted Faber <faber@…>
Branches:
compt_changes, info-ops, master
Children:
3df9b33
Parents:
2933343 (diff), f3898f7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of git://fedd.deterlab.net/fedd

Location:
fedd
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • fedd/access_to_abac.py

    r2933343 rb6a6206  
    8282    '''
    8383    right_side_str = '\s*,\s*\(\s*%s\s*,\s*%s\s*,\s*%s\s*\)' % \
    84             (id_same_str, id_same_str,id_same_str)
     84            (proj_same_str, id_same_str,id_same_str)
    8585
    8686    m = re.match(right_side_str, l)
     
    319319fedid_str = 'fedid:([0-9a-fA-F]{40})'
    320320id_str = '[a-zA-Z][\w_-]*'
     321proj_str = '[a-zA-Z][\w_/-]*'
    321322path_str = '[a-zA-Z_/\.-]+'
    322323id_any_str = '(%s|<any>)' % id_str
     324proj_any_str = '(%s|<any>)' % proj_str
    323325id_same_str = '(%s|<same>)' % id_str
     326proj_same_str = '(%s|<same>)' % proj_str
    324327left_side_str = '\(\s*%s\s*,\s*%s\s*,\s*%s\s*\)' % \
    325         (fedid_str, id_any_str, id_any_str)
     328        (fedid_str, proj_any_str, id_any_str)
    326329right_side_str = '(%s)(\s*,\s*\(.*\))?' % (id_str)
    327330line_re = re.compile('%s\s*->\s*%s' % (left_side_str, right_side_str))
  • fedd/exp_access_db.py

    r2933343 rb6a6206  
    5252q_start = """
    5353SELECT
    54     g.uid, g.pid,
     54    g.uid,
     55    CASE g.gid
     56        WHEN g.pid THEN g.pid
     57        ELSE CONCAT(g.pid, '/', g.gid)
     58    END,
    5559    CONCAT('-----BEGIN CERTIFICATE-----\\n',
    5660        s.cert,
     
    5963FROM group_membership g INNER JOIN user_sslcerts s
    6064    ON g.uid = s.uid
    61 WHERE revoked is NULL AND g.pid = g.gid
     65WHERE revoked is NULL
    6266"""
    6367q_end ="""
  • fedd/fedd_to_abac.py

    r2933343 rb6a6206  
    6565    comment_re = re.compile('^\s*#|^$')
    6666    fedid_str = 'fedid:([0-9a-fA-F]{40})'
    67     id_str = '[a-zA-Z][\w_-]*'
     67    id_str = '[a-zA-Z][\w/_-]*'
    6868    single_re = re.compile('\s*%s\s*->\s*(%s)' % (fedid_str, id_str))
    6969    double_re = re.compile('\s*%s\s*->\s*\((%s)\s*,\s*(%s)\)' % \
     
    109109                    (creds_dir or 'new_cert_dir', id.name, i)
    110110
    111             cid = Creddy.ID(cert)
    112             cid.load_privkey(key)
    113             cattr = Creddy.Attribute(cid, r, 3600 * 24 * 365 * 10)
    114             cattr.principal(k)
    115111
    116112            if debug:
     
    118114                        (cert, key, r, k, cf)
    119115            else:
     116                cid = Creddy.ID(cert)
     117                cid.load_privkey(key)
     118                cattr = Creddy.Attribute(cid, r, 3600 * 24 * 365 * 10)
     119                cattr.principal(k)
    120120                cattr.bake()
    121121                cattr.write_name(cf)
  • fedd/federation/emulab_access.py

    r2933343 rb6a6206  
    934934        vchars_re = '[^' + string.ascii_letters + string.digits  + '-]'
    935935
     936        self.state_lock.acquire()
     937        if aid in self.allocation:
     938            proj = self.allocation[aid].get('project', None)
     939            if not proj:
     940                proj = self.allocation[aid].get('sproject', None)
     941        self.state_lock.release()
     942
     943        if not proj:
     944            raise service_error(service_error.internal,
     945                    "Can't find project for %s" %aid)
     946
    936947        for a in attrs:
    937948            if a['attribute'] in configs:
     
    951962                ename = a['value']
    952963
    953         # Names longer than the emulab max are discarder
    954         if ename and len(ename) <= self.max_name_len:
     964        # Names longer than the emulab max are discarded
     965        # Projects with a group require nonce experiment names as well
     966        if ename and len(ename) <= self.max_name_len and '/' not in proj:
    955967            # Clean up the experiment name so that emulab will accept it.
    956968            ename = re.sub(vchars_re, '-', ename)
     
    973985        self.state_lock.acquire()
    974986        if aid in self.allocation:
    975             proj = self.allocation[aid].get('project', None)
    976             if not proj:
    977                 proj = self.allocation[aid].get('sproject', None)
    978987            user = self.allocation[aid].get('user', None)
    979988            self.allocation[aid]['experiment'] = ename
     
    9921001            self.write_state()
    9931002        self.state_lock.release()
    994 
    995         if not proj:
    996             raise service_error(service_error.internal,
    997                     "Can't find project for %s" %aid)
    9981003
    9991004        if not user:
     
    10921097                            certfile, tmpdir)
    10931098
     1099            if '/' in proj: proj, gid = proj.split('/')
     1100            else: gid = None
     1101
     1102
    10941103            # Set up userconf and seer if needed
    10951104            self.configure_userconf(services, tmpdir)
     
    11091118                    debug=self.create_debug, log=alloc_log, boss=self.boss,
    11101119                    cert=self.xmlrpc_cert)
    1111             rv = starter(self, ename, proj, user, expfile, tmpdir)
     1120            rv = starter(self, ename, proj, user, expfile, tmpdir, gid=gid)
    11121121        except service_error, e:
    11131122            err = e
     
    11611170            raise service_error(service_error.internal,
    11621171                    "Can't find project for %s" % aid)
     1172        else:
     1173            if '/' in proj: proj, gid = proj.split('/')
     1174            else: gid = None
    11631175
    11641176        if not user:
     
    11701182        stopper = self.stop_segment(keyfile=self.ssh_privkey_file,
    11711183                debug=self.create_debug, boss=self.boss, cert=self.xmlrpc_cert)
    1172         stopper(self, user, proj, ename)
     1184        stopper(self, user, proj, ename, gid)
    11731185        return { 'allocID': req['allocID'], 'proof': proof.to_dict() }
  • fedd/federation/emulab_segment.py

    r2933343 rb6a6206  
    9393        return state
    9494
    95     def make_null_experiment(self, pid, eid, tmpdir):
     95    def make_null_experiment(self, pid, eid, tmpdir, gid=None):
    9696        """
    9797        Create a null copy of the experiment so that we capture any logs there
     
    115115                    'wait': True
    116116                    }
     117            if gid is not None:
     118                params['group'] = gid
    117119            if self.log:
    118120                self.log.info("[make_null_experiment]: Creating experiment")
  • fedd/federation/local_emulab_segment.py

    r2933343 rb6a6206  
    5858        return True
    5959
    60     def __call__(self, parent, eid, pid, user, tclfile, tmpdir, timeout=0):
     60    def __call__(self, parent, eid, pid, user, tclfile, tmpdir, timeout=0,
     61            gid=None):
    6162        """
    6263        Start a sub-experiment on a federant.
     
    7071
    7172        if state == 'none':
    72             if not self.make_null_experiment(pid, eid, tmpdir):
     73            if not self.make_null_experiment(pid, eid, tmpdir, gid):
    7374                return False
    7475
     
    102103        emulab_segment.__init__(self, boss=boss, cert=cert)
    103104
    104     def __call__(self, parent, user, pid, eid):
     105    def __call__(self, parent, user, pid, eid, gid=None):
    105106        """
    106107        Stop a sub experiment by calling swapexp on the federant
    107108        """
     109
    108110        self.log.info("[stop_segment]: Stopping %s" % eid)
    109111        rv = False
  • fedd/federation/proxy_emulab_segment.py

    r2933343 rb6a6206  
    158158
    159159
    160     def make_null_experiment(self, user, host, pid, eid, tmpdir):
     160    def make_null_experiment(self, user, host, pid, eid, tmpdir, gid=None):
    161161        """
    162162        Create a null copy of the experiment so that we capture any logs there
     
    164164        startexp
    165165        """
     166
     167        if gid is not None: gparam = '-g %s' % gid
     168        else: gparam = ''
     169
    166170        try:
    167171            f = open("%s/null.tcl" % tmpdir, "w")
     
    179183            if not self.ssh_cmd(user, host,
    180184                    ("/usr/testbed/bin/startexp -i -f -w -p %s " +
    181                     "-e %s null.tcl") % (pid, eid), "startexp",
     185                    "-e %s %s null.tcl") % (pid, eid, gparam), "startexp",
    182186                    timeout=60 * 10):
    183187                return False
     
    276280
    277281
    278     def __call__(self, parent, eid, pid, user, tclfile, tmpdir, timeout=0):
     282    def __call__(self, parent, eid, pid, user, tclfile, tmpdir, timeout=0,
     283            gid=None):
    279284        """
    280285        Start a sub-experiment on a federant.
     
    294299            # Put a dummy in place to capture logs, and establish an experiment
    295300            # directory.
    296             if not self.make_null_experiment(user, host, pid, eid, tmpdir):
     301            if not self.make_null_experiment(user, host, pid, eid, tmpdir, gid):
    297302                return False
    298303
     
    325330        proxy_segment.__init__(self, log=log, keyfile=keyfile, debug=debug)
    326331
    327     def __call__(self, parent, user, pid, eid):
     332    def __call__(self, parent, user, pid, eid, gid=None):
    328333        """
    329334        Stop a sub experiment by calling swapexp on the federant
Note: See TracChangeset for help on using the changeset viewer.