Jaymes Mosher | 603e62a | 2017-06-28 15:53:19 -0600 | [diff] [blame^] | 1 | # -*- coding: utf-8 -*- |
2 | |||||
3 | import re | ||||
4 | |||||
5 | |||||
6 | def ls(regex=r'^[a-z0-9]+$'): | ||||
7 | """ | ||||
8 | Provide a list of network interfaces. | ||||
9 | """ | ||||
10 | _lo_re = re.compile(r'^lo$') | ||||
11 | _alphanum_re = re.compile(regex) | ||||
12 | |||||
13 | def _filter(interface): | ||||
14 | return _alphanum_re.match(interface) and not _lo_re.match(interface) | ||||
15 | |||||
16 | return filter(_filter, __salt__['grains.get']('ip_interfaces', {}).keys()) |