Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

stage1: Add hostname to /etc/hosts #3522

Merged
merged 1 commit into from
Jan 10, 2017
Merged

Conversation

squeed
Copy link
Contributor

@squeed squeed commented Jan 9, 2017

This fixes a regression where the pod's hostname was missing from /etc/hosts

Fixes #3422

}
hostnamePath := filepath.Join(common.Stage1RootfsPath(p.Root), "etc/hostname")
if err := ioutil.WriteFile(hostnamePath, []byte(p.Hostname), 0644); err != nil {
log.FatalE("error writing "+hostnamePath, err)
Copy link
Member

Choose a reason for hiding this comment

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

Here and below, please don't FatalE. Log the error and return 254 instead, so defers can run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, though I was just matching style. This whole file needs to be fixed; I can take care of that in another PR.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I'm also guilty of introducing some of those FatalE, but I think we can gradually phase them out.

@squeed
Copy link
Contributor Author

squeed commented Jan 10, 2017

@lucab thanks, updated! Also, added a test file I forgot to commit earlier.

This fixes a regression where the pod's hostname was missing from
/etc/hosts

Fixes rkt#3422
@lucab lucab changed the title stage1: Add hostname in to /etc/hosts stage1: Add hostname to /etc/hosts Jan 10, 2017
Copy link
Member

@lucab lucab left a comment

Choose a reason for hiding this comment

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

LGTM

@lucab lucab added this to the v1.23.0 milestone Jan 10, 2017
@lucab lucab merged commit a706b1a into rkt:master Jan 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rkt pod hostname missing from /etc/hosts
2 participants