This is an automated email from the ASF dual-hosted git repository.

rob pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new a3976d420c Correct __HOSTNAME__ for short hostName unknown (#6812)
a3976d420c is described below

commit a3976d420c424f70e2e343854bf85ff5418c5715
Author: Miguel <[email protected]>
AuthorDate: Fri May 6 15:34:31 2022 -0500

    Correct __HOSTNAME__ for short hostName unknown (#6812)
---
 CHANGELOG.md                   | 1 +
 lib/go-atscfg/serverunknown.go | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index eff31f54f3..a6c302f728 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -46,6 +46,7 @@ The format is based on [Keep a 
Changelog](http://keepachangelog.com/en/1.0.0/).
 - Fixed TO API `PUT /servers/:id/status` to only queue updates on the same CDN 
as the updated server
 - t3c-generate fix for combining remapconfig and cachekeyconfig parameters for 
MakeRemapDotConfig call.
 - [#6780](https://github.com/apache/trafficcontrol/issues/6780) Fixed t3c to 
use secondary parents when there are no primary parents available.
+- Correction where using the placeholder __HOSTNAME__ in "unknown" files 
(others than the defaults ones), was being replaced by the full FQDN instead of 
the shot hostname.
 
 ### Removed
 - Remove traffic\_portal dependencies to mitigate `npm audit` issues, 
specifically `grunt-concurrent`, `grunt-contrib-concat`, 
`grunt-contrib-cssmin`, `grunt-contrib-jsmin`, `grunt-contrib-uglify`, 
`grunt-contrib-htmlmin`, `grunt-newer`, and `grunt-wiredep`
diff --git a/lib/go-atscfg/serverunknown.go b/lib/go-atscfg/serverunknown.go
index 810044e9a5..595693c645 100644
--- a/lib/go-atscfg/serverunknown.go
+++ b/lib/go-atscfg/serverunknown.go
@@ -75,7 +75,7 @@ func MakeServerUnknown(
                txt += pa.Val + "\n"
        }
 
-       txt = strings.Replace(txt, `__HOSTNAME__`, 
*server.HostName+`.`+*server.DomainName, -1)
+       txt = strings.Replace(txt, `__HOSTNAME__`, *server.HostName, -1)
        txt = strings.Replace(txt, `__RETURN__`, "\n", -1)
 
        lineComment := getServerUnknownConfigCommentType(params)

Reply via email to