Re: Ridding unpredictable predictable interface names
"'Nick Anderson' via help-cfengine" <[email protected]>
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
Martin Simons <[email protected]> writes: > I have two lists that I want to pair, like this: macs slist => { > '52:54:00:64:0d:0c', '52:54:00:64:0d:0d ' }; Interfaces slist => { > 'eth1', 'eth2' }; I want an array or container like this: > persistent[eth1] string => '52:54:00:64:0d:0c'; persistent[eth2] > string => '52:54:00:64:0d:0d'; I looked over the functions again and > again but I do not get it right. How do I pair those into an array? I don't think that there are any native functions that deal with mapping mac addresses to interface names, only interface names and IP addresses ([iprange()]). [sys.hardware_mac] maps mac addresses to interface names. ,---- | bundle agent __main__ | { | reports: | "$(with)" with => storejson( "sys.hardware_mac" ); | } `---- Listing 1: Example Policy ,---- | R: { | "docker0": "02:42:3f:46:7c:ce", | "enx5cff35c6864b": "5c:ff:35:c6:86:4b", | "tun0": "00:00:00:00:00:00", | "vboxnet0": "0a:00:27:00:00:00" | } `---- Are you able to use that directly? If not, you need some way to link the mac address to the name, it's not clear to me from above what that mapping data looks like. How do you know that mac `52:54:00:64:0d:0d' should be mapped to `eth2'? [iprange()] <https://docs.cfengine.com/docs/3.18/reference-functions-iprange.html> [sys.hardware_mac] <https://docs.cfengine.com/docs/3.18/reference-special-variables-sys.html#sys-hardware_mac-interface_name> -- You received this message because you are subscribed to the Google Groups "help-cfengine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/878ryynutc.fsf%40northern.tech. -- Nick Anderson | Doer of Things | (+1) 785-550-1767 | https://northern.tech -- You received this message because you are subscribed to the Google Groups "help-cfengine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/878ryynutc.fsf%40northern.tech.