daemon/core/session.py
def runhook(self, state, hooks=None):
        ''' Run hook scripts upon changing states.
        If hooks is not specified, run all hooks in the given state.
        '''
        if state not in self._hooks:
            return
        if hooks is None:
            hooks = self._hooks[state]
        for (filename, data) in hooks:
            try:
                f = open(os.path.join(self.sessiondir, filename), "w")
                f.write(data)
                f.close()
            except Exception, e:
                self.warn("Error writing hook '%s': %s" % (filename, e))
            self.info("Running hook %s for state %s" % (filename, state))
            try:
                check_call(["/bin/sh", filename], cwd=self.sessiondir,
                           env=self.getenviron())
            except Exception, e:
                self.warn("Error running hook '%s' for state %s: %s" %
                          (filename, state, e))
 Run hook scripts upon changing states.
        If hooks is not specified, run all hooks in the given state.
        
Run hook scripts upon changing states.
If hooks is not specified, run all hooks in the given state.
Run hook scripts upon changing states . If hooks is not specified run all hooks in the given state .
def runhook(self, state, hooks=None):
        if state not in self._hooks:
            return
        if hooks is None:
            hooks = self._hooks[state]
        for (filename, data) in hooks:
            try:
                f = open(os.path.join(self.sessiondir, filename), "w")
                f.write(data)
                f.close()
            except Exception, e:
                self.warn("Error writing hook '%s': %s" % (filename, e))
            self.info("Running hook %s for state %s" % (filename, state))
            try:
                check_call(["/bin/sh", filename], cwd=self.sessiondir,
                           env=self.getenviron())
            except Exception, e:
                self.warn("Error running hook '%s' for state %s: %s" %
                          (filename, state, e))
def runhook ( self , state , hooks = None ) : if state not in self . _hooks : return if hooks is None : hooks = self . _hooks [ state ] for ( filename , data ) in hooks : try : f = open ( os . path . join ( self . sessiondir , filename ) , "w" ) f . write ( data ) f . close ( ) except Exception , e : self . warn ( "Error writing hook '%s': %s" % ( filename , e ) ) self . info ( "Running hook %s for state %s" % ( filename , state ) ) try : check_call ( [ "/bin/sh" , filename ] , cwd = self . sessiondir , env = self . getenviron ( ) ) except Exception , e : self . warn ( "Error running hook '%s' for state %s: %s" % ( filename , state , e ) )
Run hook scripts upon changing states.
Run hook scripts upon changing states .
''' Run hook scripts upon changing states.
        If hooks is not specified, run all hooks in the given state.
        '''
self
state
hooks