Revision 7ca9e930 logic/dispatcher_callbacks.py

b/logic/dispatcher_callbacks.py
10 10

  
11 11
def update_db(message):
12 12
    """Process the status of a VM based on a ganeti status message"""
13
    _logger.debug("Processing msg: %s" % message.body)
13
    _logger.debug("Processing msg: %s", message.body)
14 14
    try:
15 15
        msg = json.loads(message.body)
16 16

  
17 17
        if msg["type"] != "ganeti-op-status":
18
            _logger.error("Message is of uknown type %s." % (msg["type"],))
18
            _logger.error("Message is of uknown type %s.", msg["type"])
19 19
            return
20 20

  
21 21
        vmid = utils.id_from_instance_name(msg["instance"])
22 22
        vm = VirtualMachine.objects.get(id=vmid)
23 23

  
24 24
        backend.process_backend_msg(vm, msg["jobId"], msg["operation"], msg["status"], msg["logmsg"])
25
        _logger.debug("Done processing msg for vm %s." % (msg["instance"]))
25
        _logger.debug("Done processing msg for vm %s.", msg["instance"])
26 26
        message.channel.basic_ack(message.delivery_tag)
27 27
    except KeyError:
28
        _logger.error("Malformed incoming JSON, missing attributes: " + message.body)
28
        _logger.error("Malformed incoming JSON, missing attributes: %s", message.body)
29 29
    except VirtualMachine.InvalidBackendIdError:
30
        _logger.debug("Ignoring msg for unknown instance %s." % (msg["instance"],))
30
        _logger.debug("Ignoring msg for unknown instance %s.", msg["instance"])
31 31
    except VirtualMachine.DoesNotExist:
32
        _logger.error("VM for instance %s with id %d not found in DB." % (msg["instance"], vmid))
32
        _logger.error("VM for instance %s with id %d not found in DB.", msg["instance"], vmid)
33 33
    except Exception as e:
34 34
        _logger.error("Unexpected error:\n" + "".join(traceback.format_exception(*sys.exc_info())))
35 35

  
36

  
37
def update_net(message):
38
    """Process a network status update notification from Ganeti"""
39
    _logger.debug("MINE msg: %s", message.body)
40
    message.channel.basic_ack(message.delivery_tag)
41

  
42

  
36 43
def send_email(message):
37 44
    _logger.debug("Request to send email message")
38 45
    message.channel.basic_ack(message.delivery_tag)
......
46 53
def dummy_proc(message):
47 54
    try:
48 55
        msg = json.loads(message.body)
49
        _logger.debug("Msg (exchange:%s) " % (msg, ))
56
        _logger.debug("Msg (exchange:%s) ", msg)
50 57
        message.channel.basic_ack(message.delivery_tag)
51 58
    except Exception as e:
52 59
        _logger.error("Could not receive message %s" % e.message)

Also available in: Unified diff