Changeset b175d61 in nscp


Ignore:
Timestamp:
01/20/12 07:40:51 (16 months ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
bd1e5e5
Parents:
f19371a
Message:
  • Fixed a race condition in the python unit test script
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • changelog

    r2ec2eb6 rb175d61  
    55 * Fixa dependonservice LanManWorkStation (old win) 
    66 * Fix RtlStringFromGUID problem on NT4 
     7 
     82012-01-20 MickeM 
     9 * Fixed a race condition in the python unit test script 
    710 
    8112012-01-19 MickeM 
  • scripts/python/test_nsca.py

    rf19371a rb175d61  
    3030  message = None 
    3131  perfdata = None 
     32  got_response = False 
    3233  got_simple_response = False 
    3334 
     
    4243    #self.uuid = unicodedata.normalize('NFKD', command).encode('ascii','ignore') 
    4344    self.command = command 
     45    self.uuid = None 
     46    self.source = None 
     47    self.status = None 
     48    self.message = None 
     49    self.perfdata = None 
     50    self.got_response = False 
     51    self.got_simple_response = False 
     52     
     53     
     54  def copy_changed_attributes(self, other): 
     55    if other.source: 
     56      self.source = other.source 
     57    if other.command: 
     58      self.command = other.command 
     59    if other.status: 
     60      self.status = other.status 
     61    if other.message: 
     62      self.message = other.message 
     63    if other.perfdata: 
     64      self.perfdata = other.perfdata 
     65    if other.got_simple_response: 
     66      self.got_simple_response = True 
     67   
    4468  def __str__(self): 
    4569    return 'Message: %s (%s, %s, %s)'%(self.uuid, self.source, self.command, self.status) 
     
    6589  def set_response(self, msg): 
    6690    with sync: 
    67       self._responses[msg.uuid] = msg 
     91      self._responses[msg.uuid].copy_changed_attributes(msg) 
    6892 
    6993  def del_response(self, id): 
     
    95119   
    96120  def simple_inbox_handler_wrapped(self, channel, source, command, status, message, perf): 
    97     log('Got simple message %s'%command) 
     121    log('Got simple message %s on %s'%(command, channel)) 
    98122    msg = self.get_response(command) 
    99123    msg.source = source 
     
    106130 
    107131  def inbox_handler_wrapped(self, channel, request): 
    108     log_error('DISCARDING message on %s'%(channel)) 
    109      
    110132    message = plugin_pb2.SubmitRequestMessage() 
    111133    message.ParseFromString(request) 
Note: See TracChangeset for help on using the changeset viewer.