blob: 52d8a1ddb3095849b90c92e19df89ead69b03b5b [file] [log] [blame]
Jaymes Mosher603e62a2017-06-28 15:53:19 -06001# -*- coding: utf-8 -*-
2
3import re
4
5
Jaymes Mosher279cb882017-06-29 11:03:57 -06006def ls(regex):
Jaymes Mosher603e62a2017-06-28 15:53:19 -06007 """
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())