diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index 3efaaf833..7b5eeab88 100644 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -70,8 +70,11 @@ sub build_line { } } - if ($domain && !$longname) { - $longname="$node.$domain"; + if ($node =~ m/\.$domain$/i) { + $longname = $node; + $node =~ s/\.$domain$//; + } elsif ($domain && !$longname) { + $longname="$node.$domain"; } $othernames=join(' ', @o_names);