Exemple #1
0
 def _updateProc(self,grpName,procName):
   lp = process.getLPConfig(grpName,procName)
   if lp:
     updateInfo = lp.fileUpdateInfo()
     if len(updateInfo) > 0:
       downloadFiles(self.config,updateInfo[1][1],grpName,procName,updateInfo[0][1],self)
   else:
     print 'can not found LPConfig with '+json
Exemple #2
0
 def _processJson(self,json):
   action = json.get('action')
   if action=='clientOp':
     value = json['value']
     if value=='Restart':
       reactor.stop()
     elif value=='Update':
       downloadFiles(self.config,selfFileSet)
     elif value=='Reload':
       process.initYaml()
       process.startAll('reload')
       self._initSend()
     else:
       print 'unknown clientOp value:'+value
   elif action=='procOp':
     psGroup = json['grp']
     psName = json['name']
     op = json['op']
     if op=='Restart':
       process.restartProc(psGroup,psName,memo='manual')
     elif op=='Update':
       self._updateProc(psGroup,psName)
     elif op=='Console':
       self.sendLogTxt(json['uuid'],*(process.getPsLog(psGroup,psName,json.get('startPos'),json.get('endPos'))))
     elif op=='Log':
       self.sendLogTxt(json['uuid'],*(process.getPsLog(psGroup,psName,json.get('startPos'),json.get('endPos'),logType='log')))
     elif op=='StartHistory':
       self.sendLogTxt(json['uuid'],*(process.getPsLog(psGroup,psName,json.get('startPos'),json.get('endPos'),logType='start')))
     elif op=='UpdateHistory':
       self.sendLogTxt(json['uuid'],*(process.getPsLog(psGroup,psName,json.get('startPos'),json.get('endPos'),logType='update')))
     else:
       print 'unknown procOp value:'+op
   elif action=='groupOp':
     psGroup = json['grp']
     op = json['op']
     if op=='Restart':
       pg = procGroupDict.get(psGroup)
       if pg:
         for name,proc in pg.iterStatus():
           pg.restartProc(name,memo='group')
       else:
         print 'restart group,can not found process group:'+psGroup
     elif op=='Update':
       pg = procGroupDict.get(psGroup)
       if pg:
         for name,proc in pg.iterStatus():
           self._updateProc(psGroup,name)
       else:
         print 'update group,can not found process group:'+psGroup
   else:
     print 'unknown json %s'%json