forked from rook/rook
Merge pull request #153 from travisn/rook-version
Print rook version info
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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,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
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user