From e74b1ac6411db83e854d8008ef438ab1a3f48dda Mon Sep 17 00:00:00 2001 From: Steve Milner Date: Fri, 9 Nov 2018 10:18:56 -0500 Subject: [PATCH 1/3] mcd: Clean up logging Signed-off-by: Steve Milner --- pkg/daemon/daemon.go | 4 +--- pkg/daemon/update.go | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index 8733a8056b..c52eb568d0 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -153,7 +153,7 @@ func NewClusterDrivenDaemon( func (dn *Daemon) Run(stop <-chan struct{}) error { // Catch quickly if we've been asked to run once. if dn.onceFrom != "" { - glog.V(2).Info("Running once per request") + glog.V(2).Info("Daemon running once per request") return dn.runOnce() } @@ -236,7 +236,6 @@ func (dn *Daemon) runOnce() error { glog.V(2).Infof("Unable to prep update: %s", err) return err } else if needUpdate == false { - glog.V(2).Infof("No update needed") return nil } // At this point we have verified we need to update @@ -287,7 +286,6 @@ func (dn *Daemon) handleNodeUpdate(old, cur interface{}) { // Note that if executeUpdateFromCluster errors it will mark the node // degraded and reboot. if err = dn.executeUpdateFromCluster(); err != nil { - glog.V(2).Infof("Unable to execute update: %s", err) return } } diff --git a/pkg/daemon/update.go b/pkg/daemon/update.go index 0fc89e1fc4..410eb5791d 100644 --- a/pkg/daemon/update.go +++ b/pkg/daemon/update.go @@ -87,7 +87,7 @@ func (dn *Daemon) reconcilable(oldConfig, newConfig *mcfgv1.MachineConfig) (bool // We skip out of reconcilable if there is no Kind and we are in runOnce mode. The // reason is that there is a good chance a previous state is not available to match against. if oldConfig.Kind == "" && dn.onceFrom != "" { - glog.Infof("Missing kind in old config. Assuming reconcilable with new.") + glog.Infof("Missing kind in old config. Assuming no prior state.") return true, nil } oldIgn := oldConfig.Spec.Config From 267f972886eba273fd59be711cc8da4249a6eb90 Mon Sep 17 00:00:00 2001 From: Steve Milner Date: Fri, 9 Nov 2018 10:23:25 -0500 Subject: [PATCH 2/3] daemon/node: gofmt updates - allow_noent -> allowNoent - drop unneeded else statement Signed-off-by: Steve Milner --- pkg/daemon/node.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/daemon/node.go b/pkg/daemon/node.go index a343dcd6bb..9c527656ea 100644 --- a/pkg/daemon/node.go +++ b/pkg/daemon/node.go @@ -61,7 +61,7 @@ func getNodeAnnotation(client corev1.NodeInterface, node string, k string) (stri } // getNodeAnnotationExt is like getNodeAnnotation, but allows one to customize ENOENT handling -func getNodeAnnotationExt(client corev1.NodeInterface, node string, k string, allow_noent bool) (string, error) { +func getNodeAnnotationExt(client corev1.NodeInterface, node string, k string, allowNoent bool) (string, error) { n, err := client.Get(node, metav1.GetOptions{}) if err != nil { return "", err @@ -69,11 +69,10 @@ func getNodeAnnotationExt(client corev1.NodeInterface, node string, k string, al v, ok := n.Annotations[k] if !ok { - if !allow_noent { + if !allowNoent { return "", fmt.Errorf("%s annotation not found in %s", k, node) - } else { - return "", nil } + return "", nil } return v, nil From e405de872bce6eaa13efc7c6e46c5a1cee026309 Mon Sep 17 00:00:00 2001 From: Steve Milner Date: Fri, 9 Nov 2018 10:26:46 -0500 Subject: [PATCH 3/3] daemon/update: Document constants Signed-off-by: Steve Milner --- pkg/daemon/update.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/daemon/update.go b/pkg/daemon/update.go index 410eb5791d..260032df10 100644 --- a/pkg/daemon/update.go +++ b/pkg/daemon/update.go @@ -20,8 +20,10 @@ import ( ) const ( + // DefaultDirectoryPermissions houses the default mode to use when no directory permissions are provided DefaultDirectoryPermissions os.FileMode = 0755 - DefaultFilePermissions os.FileMode = 0644 + // DefaultFilePermissions houses the default mode to use when no file permissions are provided + DefaultFilePermissions os.FileMode = 0644 ) // update the node to the provided node configuration.