Revision 765ff3ff snf-cyclades-gtools/synnefo/ganeti/eventd.py

b/snf-cyclades-gtools/synnefo/ganeti/eventd.py
76 76
    """
77 77
    status = op.status
78 78
    if status == constants.JOB_STATUS_QUEUED:
79
        return job.received_timestamp
79
        time = job.received_timestamp
80 80
    try:  # Compatibility with Ganeti version
81 81
        if status == constants.JOB_STATUS_WAITLOCK:
82
            return op.start_timestamp
82
            time = op.start_timestamp
83 83
    except AttributeError:
84 84
        if status == constants.JOB_STATUS_WAITING:
85
            return op.start_timestamp
85
            time = op.start_timestamp
86 86
    if status == constants.JOB_STATUS_CANCELING:
87
        return op.start_timestamp
87
        time = op.start_timestamp
88 88
    if status == constants.JOB_STATUS_RUNNING:
89
        return op.exec_timestamp
89
        time = op.exec_timestamp
90 90
    if status in constants.JOBS_FINALIZED:
91
        if op.end_timestamp:
92
            return op.end_timestamp
93
        else:
94
            # Error opcodes do not always have end timestamp
95
            return job.end_timestamp
91
        time = op.end_timestamp
92

  
93
    return time and time or job.end_timestamp
96 94

  
97 95
    raise InvalidBackendStatus(status, job)
98 96

  

Also available in: Unified diff