Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-3224

Why are interface names canonified in sys.hardware_mac[] keys, sys.ip2iface[] values, and keys of sys.ipv4_1, sys.ipv4_2, and sys.ipv4_3?

    XMLWordPrintable

    Details

    • Type: Knowledge acquisition
    • Status: Open
    • Priority: (None)
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      Why are interface names canonified in sys.hardware_mac[] keys, sys.ip2iface[] values, and keys of sys.ipv4_1[], sys.ipv4_2[], and sys.ipv4_3[]?

      Can we change to use the actual interface name instead of the canonified version?

      Interfaces that contain dots are not canonified in sys.interfaces.

      bundle agent main
      {
        vars:
      
            # Generate a classic array
            # Iterate over known interfaces, define interface as key and IP as value
            "iface2ipv4[$(sys.interfaces)]"
              string => "$(sys.ipv4[$(sys.interfaces)])",
              meta => { "inventory", "attribute_name=$(sys.interfaces) IPv4" };
      
      
      }
      
      # cf-agent --no-lock --log-level info --show-evaluated-vars=\(sys\.interfaces\|sys.cf_version\)$ --file example_showing_sys_interfaces_includes_interfaces_containing_dots.cf
      Variable name                            Variable value                                               Meta tags                               
      default:sys.cf_version                   3.15.0a.90b67ded3                                            inventory,source=agent,attribute_name=CFEngine version
      default:sys.interfaces                    {"wlan0","docker0","virbr0","wlan0.1"}                      inventory,source=agent,attribute_name=Interfaces

      Canonified version of sys.interfaces in the keys of sys.ipv4

      cf-promises --show-vars=default:sys\.\(ipv4\\[\|cf_version$\)
      
      Variable name                            Variable value                                               Meta tags                               
      default:sys.cf_version                   3.15.0a.90b67ded3                                            inventory,source=agent,attribute_name=CFEngine version
      default:sys.ipv4[docker0]                172.17.0.1                                                   source=agent                            
      default:sys.ipv4[lo]                     127.0.0.1                                                    source=agent                            
      default:sys.ipv4[virbr0]                 192.168.122.1                                                source=agent                            
      default:sys.ipv4[wlan0]                  192.168.42.189                                               source=agent                            
      default:sys.ipv4[wlan0_1]                192.168.42.190                                               source=agent                            

      Canonified version of sys.interfaces are used in the keys of sys.hardware_mac

      bundle agent main
      {
        vars:
      
            # Generate a classic array
            # Iterate over known interfaces, define interface as key and IP as value
            "iface2ipv4[$(sys.interfaces)]"
              string => "$(sys.ipv4[$(sys.interfaces)])",
              meta => { "inventory", "attribute_name=$(sys.interfaces) IPv4" };
      
      
      }
      
      # cf-agent --no-lock --log-level info --show-evaluated-vars=sys\.hardware_mac --file example_showing_sys_interfaces_includes_interfaces_containing_dots.cf
      Variable name                            Variable value                                               Meta tags                               
      default:sys.hardware_mac[docker0]        02:42:eb:6b:71:cb                                            source=agent                            
      default:sys.hardware_mac[eth0]           54:ee:75:5a:45:41                                            source=agent,derived-from=ifconfig      
      default:sys.hardware_mac[veth0]          f2:8e:d0:0b:74:27                                            source=agent,derived-from=ifconfig      
      default:sys.hardware_mac[virbr0]         52:54:00:6b:62:06                                            source=agent                            
      default:sys.hardware_mac[wlan0]          5c:e0:c5:9f:f3:8f                                            source=agent                            
      default:sys.hardware_mac[wlan0_1]        e2:f3:8d:c4:5e:3a                                            source=agent                            

      Canonified version of sys.interfaces used for the values in the sys.ip2iface map

      bundle agent main
      {
        vars:
      
            # Generate a classic array
            # Iterate over known interfaces, define interface as key and IP as value
            "iface2ipv4[$(sys.interfaces)]"
              string => "$(sys.ipv4[$(sys.interfaces)])",
              meta => { "inventory", "attribute_name=$(sys.interfaces) IPv4" };
      
      
      }
      
      # cf-agent --no-lock --log-level info --show-evaluated-vars=sys\.ip2iface --file example_showing_sys_interfaces_includes_interfaces_containing_dots.cf
      Variable name                            Variable value                                               Meta tags                               
      default:sys.ip2iface[127.0.0.1]          lo                                                           source=agent                            
      default:sys.ip2iface[172.17.0.1]         docker0                                                      source=agent                            
      default:sys.ip2iface[192.168.122.1]      virbr0                                                       source=agent                            
      default:sys.ip2iface[192.168.42.189]     wlan0                                                        source=agent                            
      default:sys.ip2iface[192.168.42.190]     wlan0_1                                                      source=agent                            

      Canonified version of sys.interfaces used for the keys in the sys.ipv4_1, sys.ipv4_2, and sys.ipv4_3.

      bundle agent main
      {
        vars:
      
            # Generate a classic array
            # Iterate over known interfaces, define interface as key and IP as value
            "iface2ipv4[$(sys.interfaces)]"
              string => "$(sys.ipv4[$(sys.interfaces)])",
              meta => { "inventory", "attribute_name=$(sys.interfaces) IPv4" };
      
      
      }
      
      # cf-agent --no-lock --log-level info --show-evaluated-vars=sys\.ipv4_ --file example_showing_sys_interfaces_includes_interfaces_containing_dots.cf
      Variable name                            Variable value                                               Meta tags                               
      default:sys.ipv4_1[docker0]              172                                                          source=agent                            
      default:sys.ipv4_1[lo]                   127                                                          source=agent                            
      default:sys.ipv4_1[virbr0]               192                                                          source=agent                            
      default:sys.ipv4_1[wlan0]                192                                                          source=agent                            
      default:sys.ipv4_1[wlan0_1]              192                                                          source=agent                            
      default:sys.ipv4_2[docker0]              172.17                                                       source=agent                            
      default:sys.ipv4_2[lo]                   127.0                                                        source=agent                            
      default:sys.ipv4_2[virbr0]               192.168                                                      source=agent                            
      default:sys.ipv4_2[wlan0]                192.168                                                      source=agent                            
      default:sys.ipv4_2[wlan0_1]              192.168                                                      source=agent                            
      default:sys.ipv4_3[docker0]              172.17.0                                                     source=agent                            
      default:sys.ipv4_3[lo]                   127.0.0                                                      source=agent                            
      default:sys.ipv4_3[virbr0]               192.168.122                                                  source=agent                            
      default:sys.ipv4_3[wlan0]                192.168.42                                                   source=agent                            
      default:sys.ipv4_3[wlan0_1]              192.168.42                                                   source=agent                            
      

      * Please see Zendesk Support tab for further comments and attachments.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              a10042 Nick Anderson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Zendesk Support

                  Summary Panel