inventory_mac: skip updating MAC if firstboot file exists

If the sync-mac option is enabled and no firstboot file exists,
a dbus signal is registered to monitor changes from inventory manager,
the same as the force-sync-mac option works.

When MAC address is updated in the inventory manager, the MAC address
is synced to the Ethernet interface, and the firstboot file is created.
However, the signal monitor is still watching, and there is no code
to check the firstboot file again. This leads to the next MAC address
change being updated unexpectedly.

This commit adds more checks to the firstboot file to avoid this case.

Tested:
1. Add mapping in entity-manager to NetworkInterface inventory.
   For example,
        "xyz.openbmc_project.Inventory.Item.NetworkInterface": {
            "MACAddress": "$BOARD_INFO_AM1"
        },
2. Do factory reset the system and reboot BMC.
3. Check if the MAC address from FRU is synced for eth interface.
3. Edit MAC Address in FRU by "ipmitool fru edit" command.
   Wait some seconds and check if eth still keeps old MAC Address.

Change-Id: I429267878b7b82b8deb0a1a362689a63687acf6e
Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com>
1 file changed