Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Need to handle error when writing /etc/hosts #170

Merged
merged 4 commits into from Jan 11, 2017
Merged

Need to handle error when writing /etc/hosts #170

merged 4 commits into from Jan 11, 2017

Conversation

mattcui
Copy link
Contributor

@mattcui mattcui commented Nov 4, 2016

To address #133650831, the problem is reported from issue #168

@cfdreddbot
Copy link

Hey mattcui!

Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you and the commit authors have already signed the CLA.

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/133721557

The labels on this github issue will be updated when the story is started.

@mattcui mattcui added this to the ecpi-v3 milestone Nov 4, 2016
@mattcui mattcui added the bug label Nov 4, 2016
@mattcui mattcui self-assigned this Nov 4, 2016
@mattcui
Copy link
Contributor Author

mattcui commented Nov 4, 2016

@maximilien The code is ready for review. Thanks.

@maximilien
Copy link
Contributor

@mattcui please address each comment. I cannot review if you just ignore comments. What's the point?

Copy link
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

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

Please address each and I will review again

vm, err := creator.Create(agentID, stemcell, cloudProps, networks, env)
Expect(err).ToNot(HaveOccurred())
Expect(vm.ID()).To(Equal(1234567))
})
It("returns error when creating a new SoftLayerVM without bosh ip using non-root user", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this It description is incorrect

@@ -154,7 +154,7 @@ func UpdateEtcHostsOfBoshInit(record string) (err error) {
logger := boshlog.NewWriterLogger(boshlog.LevelError, os.Stderr, os.Stderr)
fs := boshsys.NewOsFileSystem(logger)

err = fs.WriteFile("/etc/hosts", buffer.Bytes())
err = fs.WriteFile(fileName, buffer.Bytes())
Copy link
Contributor

Choose a reason for hiding this comment

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

You might want to mv file instead of writing. So write to a temp file and mv to the /etc/hosts this is because mv operation is atomic but cp is not. This matters if there is an error during cp. For mv you will either have success or failure but not a file that is corrupted or half written.

LengthOfHostName int
TIMEOUT time.Duration
POLLING_INTERVAL time.Duration
LocalDiskFlagNotSet bool
Copy link
Contributor

Choose a reason for hiding this comment

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

I am uncomfortable why these globals exist. I can understand if they need to be set. But the LocalDNSConfigurationFile is always /etc/hosts why not make it a constant? Is there a case where it will be different?

@maximilien
Copy link
Contributor

@mattcui see my submitted reviews. Please address each so we can move further. Thanks.

@maximilien
Copy link
Contributor

@mattcui still waiting for changes on this one that addresses my comments.

Copy link
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

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

I am merging to expedite but you need to address each comment by also stating what you did.

@maximilien
Copy link
Contributor

Cannot merge. You need to rebase and resolve conflicts

Copy link
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

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

Cannot merge. You need to rebase and resolve conflicts

@maximilien
Copy link
Contributor

Still have conflicts

@mattcui
Copy link
Contributor Author

mattcui commented Dec 19, 2016

@maximilien I solved all conflicts, it's ready for review and merge now, thanks.

@maximilien maximilien merged commit 8eb993a into cloudfoundry:master Jan 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants