print rook version info

This commit is contained in:
Travis Nielsen committed 2016-11-07 16:52:46 -08:00
1 parent bbedd7f79a
commit 425118d2c1
3 files changed
+23 -4

No files matched your search

+1
View File
@@ -61,6 +61,7 @@ func addCommands() {
rootCmd.AddCommand(poolCmd)
rootCmd.AddCommand(blockCmd)
rootCmd.AddCommand(statusCmd)
rootCmd.AddCommand(versionCmd)
}
func NewTableWriter(buffer io.Writer) *tabwriter.Writer {
+17
View File
@@ -0,0 +1,17 @@
package rook
import (
"fmt"
"github.com/rook/rook/pkg/version"
"github.com/spf13/cobra"
)
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of rookd",
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Printf("rook: %v\n", version.Version)
return nil
},
}
+5 -4
View File
@@ -5,18 +5,19 @@ package main
import (
"fmt"
"github.com/spf13/cobra"
etcdversion "github.com/coreos/etcd/version"
"github.com/rook/rook/pkg/cephmgr/cephd"
"github.com/rook/rook/pkg/version"
"github.com/spf13/cobra"
)
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of rookd",
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Printf("rookd: %s\n", version.Version)
fmt.Printf("cephd: %v\n", cephd.Version())
rmajor, rminor, rpatch := cephd.RadosVersion()
fmt.Printf("rados: %v.%v.%v\n", rmajor, rminor, rpatch)
fmt.Printf(" etcd: %s\n", etcdversion.Version)
return nil
},
}