summaryrefslogtreecommitdiffstats
path: root/src/lib/Server
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2004-10-21 20:39:09 +0000
committerNarayan Desai <desai@mcs.anl.gov>2004-10-21 20:39:09 +0000
commit240440b706864703b8683ced141dae0b11f7ed66 (patch)
tree1116d0d30f5ede32aa29692ef4ae1d5323ae3c48 /src/lib/Server
parentd5fcc148e4574753405f0f3b2e9c4b04a14e1ca4 (diff)
downloadbcfg2-240440b706864703b8683ced141dae0b11f7ed66.tar.gz
bcfg2-240440b706864703b8683ced141dae0b11f7ed66.tar.bz2
bcfg2-240440b706864703b8683ced141dae0b11f7ed66.zip
fix __cmp__
(Logical change 1.106) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@479 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server')
-rw-r--r--src/lib/Server/Metadata.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/Server/Metadata.py b/src/lib/Server/Metadata.py
index 21ac519a0..bc012d116 100644
--- a/src/lib/Server/Metadata.py
+++ b/src/lib/Server/Metadata.py
@@ -36,6 +36,12 @@ class Metadata(object):
return False
return True
+ def __cmp__(self, other):
+ fields = ['image', 'classes', 'bundles', 'attributes', 'hostname']
+ sum1 = [x for x in len(fields) if getattr(self, fields[x])][0]
+ sum2 = [x for x in len(fields) if getattr(other, fields[x])][0]
+ return sum1 < sum2
+
class Profile(object):
def __init__(self, xml):
object.__init__(self)