Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

Add error handling to utility functions, remove assumptions about host #301

Merged
merged 1 commit into from
Aug 22, 2018

Conversation

donbowman
Copy link
Contributor

@donbowman donbowman commented Aug 20, 2018

Most error checking was missing from pkg/bootstrap/node.go.
Added to all utility functions.

In addition, pkg/bootstrap/node.go made assumptions about
host-path for binaries (machinectl/qemu-img/mount etc). Remove this.
If the binaries are not on the PATH, fail. This is the reason
for Unix PATH, to indicate where to find executables, hard-coding
fallbacks can create a security issue or astonishment.

The code had a hard-coded assumption that the machine had
selinux available (e.g. it assumed selinux is enforcing/not-enforcing)
where there is a 3rd-option (not available). If selinux is not
available (e.g. Ubuntu-derived hosts), then return false
from isSELinuxEnforcing().

…t path.

Most error checking was missing from pkg/bootstrap/node.go.
Added to all utility functions.

In addition, pkg/bootstrap/node.go made assumptions about
host-path for binaries (machinectl/qemu-img/mount etc). Remove this.
If the binaries are not on the PATH, fail. This is the reason
for Unix PATH, to indicate where to find executables, hard-coding
fallbacks can create a security issue or astonishment.

The code had a hard-coded assumption that the machine had
selinux available (e.g. it assumped selinux is enforcing/not-enforcing)
where there is a 3rd-option (not available). If selinux is not
available (e.g. Ubuntu-derived hosts), then return false
from isSELinuxEnforcing().
log.Println("Warning: overlayfs not found, docker would not run.")
log.Println("loading overlay module... ")
// This is an incorrect assumption. It depends on the docker
// storage driver
Copy link
Member

Choose a reason for hiding this comment

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

In this function, code looks effectively similar as before.
But I'm not sure I understand this comment.
Are you saying that we should check for docker storage driver in the future?
In that case, we should create another github issue, or add TODO to the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

issue added
#302

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for adding the issue.

Copy link
Member

@dongsupark dongsupark left a comment

Choose a reason for hiding this comment

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

Basically it looks good. Tested, and it works.

@dongsupark dongsupark merged commit 8d8657c into kinvolk:master Aug 22, 2018
@donbowman donbowman deleted the error-handling branch August 22, 2018 23:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants