Foreman selecting wrong domain for host

Hi,

We are using Foreman 1.8.2.

We have a problem in our environment. When we add hosts, Foreman sometimes
associates that host with the wrong domain.

Given the following domains (in order specified):

If we add host "host-01.foo.bar.com", Foreman will select the correct
domain.

However, if we add "host-02.baz.bar.com", Foreman will assign the domain:
"bar.com"

I haven't been able to trace the source of this, except that I know it has
something to do with the primary interface.

When I view the bad record, the primary interface's DNS name entry is
"host-02.baz".

It's as though it's just using the first match, not the best match.

Also, if you edit one of these bad records, the result is the record name
being set to the truncated FQDN – whatever was in the DNS name field (ie.
"host-02.baz").

Can anybody help?

Thanks,

··· -- Brian

Hello Brian,

This looks like you found a bug in the way domains are matched.
The source of the bug is here [1], where the domain is assigned by the
first matching domain rather then by the most specific domain.
Please open an issue in our bug tracking system [2] so that we can work
towards mitigating this problem.

Thanks!
Tomer

[1]


[2] Foreman

··· On Wed, Oct 7, 2015 at 9:14 AM, Brian Warsing wrote:

Hi,

We are using Foreman 1.8.2.

We have a problem in our environment. When we add hosts, Foreman sometimes
associates that host with the wrong domain.

Given the following domains (in order specified):

If we add host “host-01.foo.bar.com”, Foreman will select the correct
domain.

However, if we add “host-02.baz.bar.com”, Foreman will assign the domain:
bar.com

I haven’t been able to trace the source of this, except that I know it has
something to do with the primary interface.

When I view the bad record, the primary interface’s DNS name entry is
"host-02.baz".

It’s as though it’s just using the first match, not the best match.

Also, if you edit one of these bad records, the result is the record name
being set to the truncated FQDN – whatever was in the DNS name field (ie.
“host-02.baz”).

Can anybody help?

Thanks,


Brian


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 foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.


Have a nice day,
Tomer Brisker
Red Hat Engineering

Tomer,

Thanks so much for your reply. This is indeed the source of the issue and as Dominic suggests, it is also related to #6687.

I will have some comments on your pending PR shortly.

Again, my thanks for your help.

··· > On Oct 7, 2015, at 12:58 AM, Tomer Brisker wrote: > > Hello Brian, > > This looks like you found a bug in the way domains are matched. > The source of the bug is here [1], where the domain is assigned by the first matching domain rather then by the most specific domain. > Please open an issue in our bug tracking system [2] so that we can work towards mitigating this problem. > > Thanks! > Tomer > > [1] https://github.com/theforeman/foreman/blob/develop/app/models/nic/interface.rb#L101 > [2] http://projects.theforeman.org/projects/foreman/issues/new > > On Wed, Oct 7, 2015 at 9:14 AM, Brian Warsing <dayglojesus@gmail.com > wrote: > Hi, > > We are using Foreman 1.8.2. > > We have a problem in our environment. When we add hosts, Foreman sometimes associates that host with the wrong domain. > > Given the following domains (in order specified): > > - id=3, name=foo.bar.com > - id=2, name=bar.com > - id=1, name=baz.bar.ccom > > If we add host "host-01.foo.bar.com ", Foreman will select the correct domain. > > However, if we add "host-02.baz.bar.com ", Foreman will assign the domain: "bar.com " > > I haven't been able to trace the source of this, except that I know it has something to do with the primary interface. > > When I view the bad record, the primary interface's DNS name entry is "host-02.baz". > > It's as though it's just using the first match, not the *best* match. > > Also, if you edit one of these bad records, the result is the record name being set to the truncated FQDN -- whatever was in the DNS name field (ie. "host-02.baz"). > > Can anybody help? > > Thanks, > > -- > Brian > > -- > 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 foreman-users+unsubscribe@googlegroups.com . > To post to this group, send email to foreman-users@googlegroups.com . > Visit this group at http://groups.google.com/group/foreman-users . > For more options, visit https://groups.google.com/d/optout . > > > > -- > Have a nice day, > Tomer Brisker > Red Hat Engineering > > -- > You received this message because you are subscribed to a topic in the Google Groups "Foreman users" group. > To unsubscribe from this topic, visit https://groups.google.com/d/topic/foreman-users/laa0UwXQo60/unsubscribe . > To unsubscribe from this group and all its topics, send an email to foreman-users+unsubscribe@googlegroups.com . > To post to this group, send email to foreman-users@googlegroups.com . > Visit this group at http://groups.google.com/group/foreman-users . > For more options, visit https://groups.google.com/d/optout .


B.

Looks like the report at Bug #6687: Subdomains in Foreman doesn't work - Foreman,
which describes the domain changing on host edit away from the most
specific subdomain (and also some mismatching of subdomains).

··· On 07/10/15 08:58, Tomer Brisker wrote: > Hello Brian, > > This looks like you found a bug in the way domains are matched. > The source of the bug is here [1], where the domain is assigned by the > first matching domain rather then by the most specific domain. > Please open an issue in our bug tracking system [2] so that we can work > towards mitigating this problem.


Dominic Cleal
dominic@cleal.org