Éric Lemoine | 1c39744 | 2016-11-03 10:54:14 +0100 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
2 | |||||
3 | import re | ||||
4 | |||||
5 | _alphanum_re = re.compile(r'^[a-z0-9]+$') | ||||
6 | _lo_re = re.compile(r'^lo$') | ||||
7 | |||||
8 | |||||
9 | def _filter(interface): | ||||
10 | return _alphanum_re.match(interface) and not _lo_re.match(interface) | ||||
11 | |||||
12 | |||||
13 | def ls(): | ||||
14 | """ | ||||
15 | Provide a list of network interfaces. | ||||
16 | """ | ||||
17 | return filter(_filter, __salt__['grains.get']('ip_interfaces', {}).keys()) |