Changeset 107

Show
Ignore:
Timestamp:
11/22/07 13:03:16 (1 year ago)
Author:
edsuom
Message:

Nodes can now be directed to allow certain classes (and their modules) regardless of existing PB security settings

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • projects/AsynCluster/trunk/asyncluster/master/control.py

    r94 r107  
    2424 
    2525from twisted.python.failure import Failure 
     26from twisted.python.reflect import namedObject 
    2627from twisted.internet import defer, reactor, task 
    2728from twisted.spread import pb 
     
    300301        return d 
    301302 
     303    def remote_allowClasses(self, *args): 
     304        """ 
     305        Instructs my broker to allow the classes specified by the argument(s), 
     306        and instructs the jobber to have all current and future nodes do the 
     307        same with their brokers. 
     308         
     309        The classes are specified by their string representations:: 
     310         
     311            <package(s).module.class> 
     312         
     313        """ 
     314        for stringRep in args: 
     315            # Load the class for the string representation 
     316            cls = namedObject(stringRep) 
     317            # Allow instances of the class, including its type and module 
     318            pb.globalSecurity.allowInstancesOf(cls) 
     319        return self.ctl.jobber.allowClasses(*args) 
     320 
    302321    def remote_newJob(self, jobCode, niceness=0): 
    303322        """ 
     
    316335        """ 
    317336        return self.ctl.jobber.update(jobID, callName, *args, **kw) 
    318      
     337 
    319338    def remote_runJob(self, jobID, callName, *args, **kw): 
    320339        """ 
  • projects/AsynCluster/trunk/asyncluster/master/jobs.py

    r104 r107  
    120120        raise Exception("No job registered!") 
    121121 
     122    def allowClasses(self, *args): 
     123        """ 
     124        Instructs the controller to allow the classes specified by the 
     125        argument(s) and arrange and update to have its nodes do the same. 
     126 
     127        The classes are specified by their string representations:: 
     128         
     129            <package(s).module.class> 
     130         
     131        """ 
     132        return self.root.callRemote('allowClasses', *args) 
     133 
    122134    def run(self, cmd, *args, **kw): 
    123135        """