Incorrect YAML generated for host behind NAT

Problem:
I added an host (behind nat) to Foreman. I attached hostgroups to it. But the generated YAML file for the host does not contain classes/hostgroups (see below). Somehow I see name: localhost.localdomain in the output and that makes me wonders if this is being caused by a missing PTR record?

Expected outcome:
Show the proper host group and classes

Foreman and Proxy versions:
1.23
Foreman and Proxy plugin versions:

Other relevant data:
Hosts/client which are not behind NAT do work as expected.

parameters:
  foreman_subnets: []
  foreman_interfaces:
  - ip: 10.40.2.128
    ip6: 
    mac: 00:50:56:85:95:7a
    name: localhost.localdomain
    attrs:
      bindings:
      - address: 10.40.2.128
        netmask: 255.255.0.0
        network: 10.40.0.0
      bindings6:
      - address: fe80::f99:841d:ba21:246b
        netmask: 'ffff:ffff:ffff:ffff::'
        network: 'fe80::'
      mtu: 1500
      netmask: 255.255.0.0
      netmask6: 'ffff:ffff:ffff:ffff::'
      network: 10.40.0.0
      network6: 'fe80::'
    virtual: false
    link: true
    identifier: ens192
    managed: true
    primary: true
    provision: true
    subnet: 
    subnet6: 
    tag: 
    attached_to: 
    type: Interface
  domainname: localdomain
  root_pw: "$5$hOH51toHXY5GeBlf$a36RK5StsZ/XKfmYvnphk0qL7PK7"
  foreman_config_groups: []
  puppetmaster: i-foreman.example.com
  puppet_ca: i-foreman.example.com
  foreman_env: production
classes: {}
environment: production

Is this template preview or you really try to download the content using curl or wget? If the latter, show me the command you do to get the data. Hint: It must contain security token, otherwise Foreman is unable to find which host you actually want the data to be generated for since IP address is not available anymore (NAT).

Hi,

Thanks for taking the time to help. I somehow fixed the problem myselves and hope other people might find this useful.

To answer your question I was referring to the yaml created in the host view and not the api.

Somehow the machine was registered as localhost.localdomain (I guess because of incorrect hostfile) in foreman. Although I created the host later in foreman with the correct name.
The created YML file for the correct host was actually the YML file of the localhost host.

I removed the localhost.localdomain host in foreman and suddenly it was creating the correct YML file.