diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2007-01-10 01:58:55 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2007-01-10 01:58:55 +0000 |
commit | 823023867b795b7a86695542aba9224d12370305 (patch) | |
tree | 32d0153bae6b2a73e08fb5e3aa80ba7c04bc8a93 /src/lib/Client | |
parent | 76d4a6d8e82bad8f4b5e75027d19c4636cd33117 (diff) | |
download | bcfg2-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')
-rw-r--r-- | src/lib/Client/Frame.py | 10 |
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) |