linter corrections on various sources.

*) Remove punctuation/newline at error strings.
*) Document exported functions and variables.

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal committed 2019-02-20 19:29:54 +05:30
1 parent 36112b2a86
commit 5a899a7c7d
13 files changed
+29 -29

No files matched your search

+1 -1
View File
@@ -53,7 +53,7 @@ func startOperator(cmd *cobra.Command, args []string) error {
kubeClient, _, rookClient, err := rook.GetClientset()
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to get k8s clients. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to get k8s clients. %+v\n", err))
}
logger.Infof("starting cassandra operator")
+1 -1
View File
@@ -62,7 +62,7 @@ func startAgent(cmd *cobra.Command, args []string) error {
agent := agent.New(context)
err = agent.Run()
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to run rook ceph agent. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to run rook ceph agent. %+v\n", err))
}
return nil
+1 -1
View File
@@ -28,7 +28,7 @@ import (
"github.com/rook/rook/pkg/util/flags"
)
//Cmd is the main command for operator and daemons.
// Cmd is the main command for operator and daemons.
var Cmd = &cobra.Command{
Use: "ceph",
Short: "Main command for Ceph operator and daemons.",
+1 -1
View File
@@ -89,7 +89,7 @@ func initConfig(cmd *cobra.Command, args []string) error {
err = cephconfig.WriteKeyring(keyringPath, configKeyring, keyringEval)
if err != nil {
return fmt.Errorf("failed to create keyring: %+v", err)
return fmt.Errorf("failed to create keyring: %+v\n", err)
}
if err != nil {
rook.TerminateFatal(err)
+1 -1
View File
@@ -115,7 +115,7 @@ func compareMonSecret(secret, configDir string) error {
return nil
}
if cachedKeyring.Value() != secret {
return fmt.Errorf("keyring does not match the existing keyring in %s. You may need to delete the contents of dataDirHostPath on the host from a previous deployment", cachedKeyringFile)
return fmt.Errorf("The keyring does not match the existing keyring in %s. You may need to delete the contents of dataDirHostPath on the host from a previous deployment.", cachedKeyringFile)
}
logger.Infof("cached mon secret matches the expected keyring")
return nil
+4 -4
View File
@@ -55,7 +55,7 @@ func startOperator(cmd *cobra.Command, args []string) error {
clientset, apiExtClientset, rookClientset, err := rook.GetClientset()
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to get k8s client. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to get k8s client. %+v\n", err))
}
logger.Infof("starting operator")
@@ -73,18 +73,18 @@ func startOperator(cmd *cobra.Command, args []string) error {
// Using the current image version to deploy other rook pods
pod, err := k8sutil.GetRunningPod(clientset)
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to get pod. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to get pod. %+v\n", err))
}
rookImage, err := k8sutil.GetContainerImage(pod, containerName)
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to get container image. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to get container image. %+v\n", err))
}
op := operator.New(context, volumeAttachment, rookImage, pod.Spec.ServiceAccountName)
err = op.Run()
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to run operator. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to run operator. %+v\n", err))
}
return nil
+5 -5
View File
@@ -206,7 +206,7 @@ func writeOSDConfig(cmd *cobra.Command, args []string) error {
clientset, _, _, err := rook.GetClientset()
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to init k8s client %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to init k8s client. %+v\n", err))
}
context := createContext()
@@ -214,13 +214,13 @@ func writeOSDConfig(cmd *cobra.Command, args []string) error {
commonOSDInit(osdConfigCmd)
locArgs, err := client.FormatLocation(cfg.location, cfg.nodeName)
if err != nil {
rook.TerminateFatal(fmt.Errorf("invalid location %s %+v", cfg.location, err))
rook.TerminateFatal(fmt.Errorf("invalid location %s. %+v\n", cfg.location, err))
}
crushLocation := strings.Join(locArgs, " ")
kv := k8sutil.NewConfigMapKVStore(clusterInfo.Name, clientset, metav1.OwnerReference{})
if err := osddaemon.WriteConfigFile(context, &clusterInfo, kv, osdID, osdIsDevice, cfg.storeConfig, cfg.nodeName, crushLocation); err != nil {
rook.TerminateFatal(fmt.Errorf("failed to write osd config file %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to write osd config file. %+v", err))
}
return nil
@@ -247,7 +247,7 @@ func prepareOSD(cmd *cobra.Command, args []string) error {
var dataDevices []osddaemon.DesiredDevice
if osdDataDeviceFilter != "" {
if cfg.devices != "" {
return fmt.Errorf("only one of --data-devices and --data-device-filter can be specified")
return fmt.Errorf("Only one of --data-devices and --data-device-filter can be specified.")
}
dataDevices = []osddaemon.DesiredDevice{
@@ -263,7 +263,7 @@ func prepareOSD(cmd *cobra.Command, args []string) error {
clientset, _, rookClientset, err := rook.GetClientset()
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to init k8s client. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to init k8s client. %+v\n", err))
}
context := createContext()
+3 -3
View File
@@ -63,18 +63,18 @@ func startOperator(cmd *cobra.Command, args []string) error {
// Using the current image version to deploy other rook pods
pod, err := k8sutil.GetRunningPod(clientset)
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to get pod. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to get pod. %+v\n", err))
}
rookImage, err := k8sutil.GetContainerImage(pod, containerName)
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to get container image. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to get container image. %+v\n", err))
}
op := operator.New(context, rookImage)
err = op.Run()
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to run operator. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to run operator. %+v\n", err))
}
return nil
+3 -3
View File
@@ -62,18 +62,18 @@ func startOperator(cmd *cobra.Command, args []string) error {
// Using the current image version to deploy other rook pods
pod, err := k8sutil.GetRunningPod(clientset)
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to get pod. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to get pod. %+v\n", err))
}
rookImage, err := k8sutil.GetContainerImage(pod, containerName)
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to get container image. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to get container image. %+v\n", err))
}
op := edgefsoperator.New(context, rookImage, pod.Spec.ServiceAccountName)
err = op.Run()
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to run operator. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to run operator. %+v\n", err))
}
return nil
+3 -3
View File
@@ -66,18 +66,18 @@ func startOperator(cmd *cobra.Command, args []string) error {
// Using the current image version to deploy other rook pods
pod, err := k8sutil.GetRunningPod(clientset)
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to get pod. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to get pod. %+v\n", err))
}
rookImage, err := k8sutil.GetContainerImage(pod, containerName)
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to get container image. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to get container image. %+v\n", err))
}
op := minio.New(context, rookImage)
err = op.Run()
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to run operator. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to run operator. %+v\n", err))
}
return nil
+4 -4
View File
@@ -49,7 +49,7 @@ func startOperator(cmd *cobra.Command, args []string) error {
clientset, apiExtClientset, rookClientset, err := rook.GetClientset()
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to get k8s clients. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to get k8s clients. %+v\n", err))
}
logger.Infof("starting NFS operator")
@@ -63,18 +63,18 @@ func startOperator(cmd *cobra.Command, args []string) error {
// Using the current image version to deploy other rook pods
pod, err := k8sutil.GetRunningPod(clientset)
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to get pod. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to get pod. %+v\n", err))
}
rookImage, err := k8sutil.GetContainerImage(pod, containerName)
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to get container image. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to get container image. %+v\n", err))
}
op := operator.New(context, rookImage)
err = op.Run()
if err != nil {
rook.TerminateFatal(fmt.Errorf("failed to run operator. %+v", err))
rook.TerminateFatal(fmt.Errorf("failed to run operator. %+v\n", err))
}
return nil
+1 -1
View File
@@ -106,7 +106,7 @@ func GetClientset() (kubernetes.Interface, apiextensionsclient.Interface, rookcl
return clientset, apiExtClientset, rookClientset, nil
}
// TerminateFatal terminate the terminationlog file.
// TerminateFatal terminates the process with an exit code of 1 and writes the given reason to stderr and // the termination log file.
func TerminateFatal(reason error) {
fmt.Fprintln(os.Stderr, reason)
+1 -1
View File
@@ -23,7 +23,7 @@ import (
"github.com/spf13/cobra"
)
// Versioncmd is the command for printing version of rook.
// VersionCmd is the command for printing version of rook.
var VersionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of rook",