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

Warn instead of fatal if deleted host is not found in k8s. #78

Merged
merged 1 commit into from
Nov 30, 2017

Conversation

moelsayed
Copy link
Contributor

#70

hosts/hosts.go Outdated
err := k8s.CordonUncordon(kubeClient, toDeleteHost.HostnameOverride, true)
if err != nil {
if _, err := k8s.GetNode(kubeClient, toDeleteHost.HostnameOverride); err != nil {
if !apierrors.IsNotFound(err) {

Choose a reason for hiding this comment

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

Start with if apierrors.isNotFound, and if met, log a messgae Can't find k8s node by name []

hosts/hosts.go Outdated
logrus.Warnf("[hosts] Can't find node by name [%s]")
return nil
} else {
return err

Choose a reason for hiding this comment

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

I don't think there is a need for else. Just return err

hosts/hosts.go Outdated
if !apierrors.IsNotFound(err) {
return err
} else {
logrus.Warnf("[hosts] Host [%s] is not a Kubernetes node")
Copy link
Contributor

Choose a reason for hiding this comment

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

specify the host name for %s

Copy link
Contributor

@galal-hussein galal-hussein left a comment

Choose a reason for hiding this comment

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

LGTM

@alena1108 alena1108 merged commit 7699c6b into rancher:master Nov 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants