diff --git a/cmd/rook/rook.go b/cmd/rook/rook.go index 85d572b59..5b089ba00 100644 --- a/cmd/rook/rook.go +++ b/cmd/rook/rook.go @@ -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 { diff --git a/cmd/rook/version.go b/cmd/rook/version.go new file mode 100644 index 000000000..979ee95a5 --- /dev/null +++ b/cmd/rook/version.go @@ -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 + }, +} diff --git a/cmd/rookd/version.go b/cmd/rookd/version.go index 5d47d774e..69928681b 100644 --- a/cmd/rookd/version.go +++ b/cmd/rookd/version.go @@ -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 }, }