Has this behaviour changed in version 1.11.4?


in app/views/api/v2/hosts.show.json.rabl I have:


extends "api/v2/interfaces/main”


but I don’t get the subnet_name or subnet_id passed to the hook on the 
create event. I've checked main.json.rabl and it is adding the subnet_id 
and subnet_name attributes.


What I do get is:


"interfaces":[{"id":null,"name":"test52.domain.com","ip":null,"mac":"00:50:56:9a:43:f7","identifier":"","primary":true,"provision":true,"type":"interface"}]


Thanks

Francois

On Tuesday, March 22, 2016 at 9:15:28 PM UTC+13, Dominic Cleal wrote:
>
> On 21/03/16 20:57, Francois Herbert wrote: 
> > 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? 
>
> It's from the API responses defined in 
> app/views/api/v2/hosts/show.json.rabl, which uses the "base" interface 
> view rather than the "main" one which usually includes the subnet ID. 
>
> -- 
> Dominic Cleal 
> [email protected] <javascript:> 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to