summaryrefslogtreecommitdiffstats
path: root/src/lib/Client/Frame.py
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-01-10 01:58:55 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-01-10 01:58:55 +0000
commit823023867b795b7a86695542aba9224d12370305 (patch)
tree32d0153bae6b2a73e08fb5e3aa80ba7c04bc8a93 /src/lib/Client/Frame.py
parent76d4a6d8e82bad8f4b5e75027d19c4636cd33117 (diff)
downloadbcfg2-823023867b795b7a86695542aba9224d12370305.tar.gz
bcfg2-823023867b795b7a86695542aba9224d12370305.tar.bz2
bcfg2-823023867b795b7a86695542aba9224d12370305.zip
Alphabetize config entries for the interactive prompt (Resolves Ticket #356)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2638 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client/Frame.py')
-rw-r--r--src/lib/Client/Frame.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/Client/Frame.py b/src/lib/Client/Frame.py
index d6424b603..63770760c 100644
--- a/src/lib/Client/Frame.py
+++ b/src/lib/Client/Frame.py
@@ -4,10 +4,18 @@ __revision__ = '$Revision$'
import logging, time
import Bcfg2.Client.Tools
+def cmpent(ent1, ent2):
+ '''Sort entries'''
+ if ent1.tag != ent2.tag:
+ return cmp(ent1.tag, ent2.tag)
+ else:
+ return cmd(ent1.get('name'), ent2.get('name'))
+
def promptFilter(prompt, entries):
'''Filter a supplied list based on user input'''
ret = []
- for entry in [entry for entry in entries]:
+ entries.sort(cmpent)
+ for entry in entries[:]:
try:
if raw_input(prompt % (entry.tag, entry.get('name'))) in ['y', 'Y']:
ret.append(entry)