[WIP] VMware: Fix fragile sort order in vmware_vcenter_statistics (#62288)
* vmware_vcenter_statistics: Fix fragile sort order * vmware_vcenter_statistics: Python 2.6 compatibility
This commit is contained in:
parent
a8dddff5ec
commit
3e4d5aeee3
1 changed files with 14 additions and 1 deletions
|
@ -141,6 +141,10 @@ class ChangeHelper:
|
|||
self.old = old
|
||||
self.new = new
|
||||
|
||||
def __eq__(self, other):
|
||||
return ((self.key, self.new.enabled, self.new.level) ==
|
||||
(other.key, other.new.enabled, other.new.level))
|
||||
|
||||
def __gt__(self, other):
|
||||
if self.key < other.key:
|
||||
# You cannot disable daily if weekly is enabled, so later
|
||||
|
@ -153,7 +157,16 @@ class ChangeHelper:
|
|||
else:
|
||||
return self.new.level < other.old.level
|
||||
else:
|
||||
return not (self.old > self.new)
|
||||
return not (other > self)
|
||||
|
||||
def __ge__(self, other):
|
||||
return (self > other) or (self == other)
|
||||
|
||||
def __lt__(self, other):
|
||||
return not (self >= other)
|
||||
|
||||
def __le__(self, other):
|
||||
return not (self > other)
|
||||
|
||||
|
||||
class VmwareVcenterStatistics(PyVmomi):
|
||||
|
|
Loading…
Reference in a new issue