Merge pull request #153 from travisn/rook-version

Print rook version info
This commit is contained in:
Travis Nielsen
2016-11-07 17:01:17 -08:00
committed by GitHub
3 changed files with 23 additions and 4 deletions
+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
},
}