Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,8 @@ private String getHostNameFromFQDN(String fqdn, Boolean useLongNames) {
hostName = fqdn;
} else if (useLongNames) {
hostName = fqdn;
Pattern domainPattern = Pattern
.compile(".*(\\.(.*)\\.(co(m|.[a-z]{2})|biz|edu|info|net|org|cn|de|eu|nl))$");
Comment on lines -714 to -715

@lithorus lithorus Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is related to avahi host.local hostnames, but only hostnames like host.domain.local

Pattern domainPattern = Pattern.compile(
".*(\\.(.*)\\.(co(m|.[a-z]{2})|biz|edu|info|net|org|cn|de|eu|nl|local))$");
Matcher domainMatcher = domainPattern.matcher(fqdn);
if (domainMatcher.matches()) {
hostName = fqdn.replace(domainMatcher.group(1), "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public DispatchHost createHost(RenderHost rhost) {
@Transactional(propagation = Propagation.REQUIRED)
public DispatchHost createHost(RenderHost rhost, AllocationEntity alloc) {

hostDao.insertRenderHost(rhost, alloc, false);
hostDao.insertRenderHost(rhost, alloc, true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Hardcoding useLongNames=true changes hostname derivation for all hosts, not just .local.

Per getHostNameFromFQDN in HostDaoJdbc.java, useLongNames=false unconditionally strips everything after the first ., whereas useLongNames=true only strips the domain suffix if it matches a hardcoded TLD pattern (com|biz|edu|info|net|org|cn|de|eu|nl|local). Any FQDN with a domain suffix outside this list (e.g. internal domains like .corp, .lan, .internal, or other ccTLDs) will now be stored with the full FQDN as the host name instead of the short hostname, since the regex won't match and the fallback keeps hostName = fqdn unchanged.

This affects every deployment on upgrade, not only Bonjour/Avahi .local setups as intended by the PR objective, and could disrupt downstream hostname-based lookups/dispatching (findDispatchHost, tagging, RQD name matching) for installations using unlisted internal domains.

Consider making this configurable (e.g., via a property) rather than hardcoding true, or extending the pattern/logic to explicitly special-case .local while preserving prior stripping behavior for other domains.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cuebot/src/main/java/com/imageworks/spcue/service/HostManagerService.java` at
line 166, The hardcoded true passed to hostDao.insertRenderHost in
HostManagerService changes hostname derivation for all FQDNs, not just .local.
Update the HostManagerService flow to avoid forcing useLongNames globally;
instead make this behavior configurable or limit it to the Bonjour/Avahi .local
case, and keep the existing short-name behavior for other domains. Verify the
change against HostDaoJdbc.getHostNameFromFQDN and the host insert path so
findDispatchHost and related hostname-based lookups continue to work for
internal domains.

DispatchHost host = hostDao.findDispatchHost(rhost.getName());

hostDao.tagHost(host, alloc.tag, HostTagType.ALLOC);
Expand Down
Loading