Saltstack Official Linux Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

linux_netlink.py 412B

123456789101112131415161718
  1. # -*- coding: utf-8 -*-
  2. import re
  3. def __virtual__():
  4. return 'linux_netlink'
  5. def ls(regex):
  6. """
  7. Provide a list of network interfaces.
  8. """
  9. _lo_re = re.compile(r'^lo$')
  10. _alphanum_re = re.compile(regex)
  11. def _filter(interface):
  12. return _alphanum_re.match(interface) and not _lo_re.match(interface)
  13. return filter(_filter, __salt__['grains.get']('ip_interfaces', {}).keys())