blob: b1a3c178a9f68dc745cf7d53b9bb47728d8a564c [file] [log] [blame]
Jaymes Mosher603e62a2017-06-28 15:53:19 -06001# -*- coding: utf-8 -*-
2
3import re
4
5
6def 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())