Interfaces are sorted in get_facts

This commit is contained in:
David Barroso committed 2015-05-23 09:36:30 +02:00
1 parent 0dd1c3c1d2
commit a3b1634f2d
1 file changed
+8
+8
View File
@@ -1,3 +1,11 @@
import re
def sorted_nicely( l ):
""" Sort the given iterable in the way that humans expect."""
convert = lambda text: int(text) if text.isdigit() else text
alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
return sorted(l, key = alphanum_key)
def colon_separated_string_to_dict(string, separator=':'):
'''
Converts a string in the format: