blob: 52eccc03b0cb50454a31373b4a5e59af1e7da4dc [file] [log] [blame]
Jaymes Mosher603e62a2017-06-28 15:53:19 -06001# -*- coding: utf-8 -*-
2
3import re
4
azvyagintsev42b64a12018-08-17 11:47:45 +03005def __virtual__():
6 return 'linux_netlink'
Jaymes Mosher603e62a2017-06-28 15:53:19 -06007
Jaymes Mosher279cb882017-06-29 11:03:57 -06008def ls(regex):
Jaymes Mosher603e62a2017-06-28 15:53:19 -06009 """
10 Provide a list of network interfaces.
11 """
12 _lo_re = re.compile(r'^lo$')
13 _alphanum_re = re.compile(regex)
14
15 def _filter(interface):
16 return _alphanum_re.match(interface) and not _lo_re.match(interface)
17
18 return filter(_filter, __salt__['grains.get']('ip_interfaces', {}).keys())