Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

strip \r and \n when reading the file /etc/host_hostname #338

Merged
merged 6 commits into from
Oct 13, 2017

Conversation

michaelshobbs
Copy link
Member

@michaelshobbs michaelshobbs commented Oct 13, 2017

also:

  • fixes CI working_directory so we don't have duplicate packages
  • upgrade to alpine:3.6 in order to get golang 1.8.3
  • pass in DEBUG to test container

closes #335

@michaelshobbs
Copy link
Member Author

@nvanheuverzwijn comments welcomed here

@michaelshobbs michaelshobbs merged commit d6fe180 into master Oct 13, 2017
@michaelshobbs michaelshobbs deleted the mh/fix/strip-hostname branch October 13, 2017 19:13
@nvanheuverzwijn
Copy link
Contributor

@michaelshobbs Thank you Michael, I appreciate your work greatly ! Have an excellent day.

Copy link

@markdascher markdascher left a comment

Choose a reason for hiding this comment

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

Probably not the right place to mention this, but I noticed {{.Hostname}} doesn't work anymore in recent logspout versions. I think this is why.

func getHostname() string {
content, err := ioutil.ReadFile("/etc/host_hostname")
if err == nil && len(content) > 0 {
hostname = strings.TrimRight(string(content), "\r\n")

Choose a reason for hiding this comment

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

This modifies the global hostname variable. Should we add a local declaration at the beginning of getHostname? (Or just return here instead of assigning the result?)

if err == nil && len(content) > 0 {
hostname = strings.TrimRight(string(content), "\r\n")
} else {
hostname = getopt("SYSLOG_HOSTNAME", "{{.Container.Config.Hostname}}")

Choose a reason for hiding this comment

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

Same thing here.

@@ -69,13 +80,8 @@ func NewSyslogAdapter(route *router.Route) (router.LogAdapter, error) {
format := getopt("SYSLOG_FORMAT", "rfc5424")
priority := getopt("SYSLOG_PRIORITY", "{{.Priority}}")
pid := getopt("SYSLOG_PID", "{{.Container.State.Pid}}")
hostname = getHostname()

Choose a reason for hiding this comment

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

I think this would make more sense as := too.

@josegonzalez
Copy link
Member

@markdascher please file a new issue, rather than posting on an old pull request.

@gliderlabs gliderlabs locked and limited conversation to collaborators Sep 1, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants