I'm using foreman hooks to update an external IPAM system. The interface
hash that is sent does not include the subnet name or id that the interface
has been designated in foreman.
There is subnet information sent through in the host hash but only one
subnet per host is sent - not useful is there are multiple network
interfaces on different subnets.
I've tired making an API call in the create hook but the data isn't
committed to the database at this stage so can't retrieve the subnet
information for each network interface.
This is what currently gets sent through with the create hook for the
interface hash:
interfaces":[{"id":null,"name":"interface1name","ip":null,"mac":"00:11:22:33:44:55","identifier":"","primary":true,"provision":true,"type":"interface"},{"id":null,"name":"interface2name","ip":null,"mac":"00:11:22:33:44:56","identifier":"","primary":false,"provision":false,"type":"interface"}]
The ideal data that I need would look like:
interfaces":[{"id":null,"name":"interface1name","ip":null,"mac":"00:11:22:33:44:55","identifier":"","primary":true,"provision":true,"type":"interface","subnet_id":2,"subnet_name":"Frontend","sp_subnet_id":null},{"id":null,"name":"interface2name","ip":null,"mac":"00:11:22:33:44:56","identifier":"","primary":false,"provision":false,"type":"interface","subnet_id":3,"subnet_name":"Backend","sp_subnet_id":null}]
Has anyone got any idea what code I need to modify (or if it's possible) to
add the subnet name and subnet id through with the create hook event data
in the interfaces hash?