diff --git a/cmd/rook/block.go b/cmd/rook/block/block.go similarity index 80% rename from cmd/rook/block.go rename to cmd/rook/block/block.go index 9d57e13b8..542f18ad6 100644 --- a/cmd/rook/block.go +++ b/cmd/rook/block/block.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package block import ( "runtime" @@ -21,17 +21,17 @@ import ( "github.com/spf13/cobra" ) -var blockCmd = &cobra.Command{ +var Cmd = &cobra.Command{ Use: "block", Short: "Performs commands and operations on block devices and images in the cluster", } func init() { - blockCmd.AddCommand(blockListCmd) - blockCmd.AddCommand(blockCreateCmd) + Cmd.AddCommand(listCmd) + Cmd.AddCommand(createCmd) if runtime.GOOS == "linux" { - blockCmd.AddCommand(blockMountCmd) - blockCmd.AddCommand(blockUnmountCmd) + Cmd.AddCommand(mountCmd) + Cmd.AddCommand(unmountCmd) } } diff --git a/cmd/rook/block_test.go b/cmd/rook/block/block_test.go similarity index 90% rename from cmd/rook/block_test.go rename to cmd/rook/block/block_test.go index 107a5dce4..6232a6fed 100644 --- a/cmd/rook/block_test.go +++ b/cmd/rook/block/block_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package block import ( "runtime" @@ -23,10 +23,10 @@ import ( ) func TestBlockCommand(t *testing.T) { - assert.Equal(t, "block", blockCmd.Use) + assert.Equal(t, "block", Cmd.Use) commands := []string{} - for _, command := range blockCmd.Commands() { + for _, command := range Cmd.Commands() { commands = append(commands, command.Name()) } diff --git a/cmd/rook/block-create.go b/cmd/rook/block/create.go similarity index 72% rename from cmd/rook/block-create.go rename to cmd/rook/block/create.go index ba2599e06..b6fc67656 100644 --- a/cmd/rook/block-create.go +++ b/cmd/rook/block/create.go @@ -13,13 +13,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package block import ( "fmt" "net/http" "os" + "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/model" "github.com/rook/rook/pkg/rook/client" "github.com/rook/rook/pkg/util/flags" @@ -32,22 +33,24 @@ var ( newImageSize uint64 ) -var blockCreateCmd = &cobra.Command{ +var createCmd = &cobra.Command{ Use: "create", Short: "Creates a new block image in the cluster", } func init() { - blockCreateCmd.Flags().StringVar(&newImageName, "name", "", "Name of new block image to create (required)") - blockCreateCmd.Flags().StringVar(&newImagePoolName, "pool-name", "rbd", "Name of storage pool to create new block image in") - blockCreateCmd.Flags().Uint64Var(&newImageSize, "size", 0, "Size in bytes of the new block image to create (required)") + createCmd.Flags().StringVar(&newImageName, "name", "", "Name of new block image to create (required)") + createCmd.Flags().StringVar(&newImagePoolName, "pool-name", "rbd", "Name of storage pool to create new block image in") + createCmd.Flags().Uint64Var(&newImageSize, "size", 0, "Size in bytes of the new block image to create (required)") - blockCreateCmd.MarkFlagRequired("name") - blockCreateCmd.MarkFlagRequired("size") - blockCreateCmd.RunE = createBlockImagesEntry + createCmd.MarkFlagRequired("name") + createCmd.MarkFlagRequired("size") + createCmd.RunE = createBlockImagesEntry } func createBlockImagesEntry(cmd *cobra.Command, args []string) error { + rook.SetupLogging() + if err := flags.VerifyRequiredFlags(cmd, []string{"name"}); err != nil { return err } @@ -56,7 +59,7 @@ func createBlockImagesEntry(cmd *cobra.Command, args []string) error { return err } - c := client.NewRookNetworkRestClient(client.GetRestURL(apiServerEndpoint), http.DefaultClient) + c := client.NewRookNetworkRestClient(client.GetRestURL(rook.APIServerEndpoint), http.DefaultClient) out, err := createBlockImage(newImageName, newImagePoolName, newImageSize, c) if err != nil { fmt.Fprintln(os.Stderr, err) diff --git a/cmd/rook/block-create_test.go b/cmd/rook/block/create_test.go similarity index 99% rename from cmd/rook/block-create_test.go rename to cmd/rook/block/create_test.go index 6d5d0288c..59e403b65 100644 --- a/cmd/rook/block-create_test.go +++ b/cmd/rook/block/create_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package block import ( "fmt" diff --git a/cmd/rook/block-list.go b/cmd/rook/block/list.go similarity index 89% rename from cmd/rook/block-list.go rename to cmd/rook/block/list.go index a302ae316..f7c9e5946 100644 --- a/cmd/rook/block-list.go +++ b/cmd/rook/block/list.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package block import ( "bytes" @@ -23,6 +23,7 @@ import ( "runtime" "strings" + "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/rook/client" "github.com/rook/rook/pkg/util/display" "github.com/rook/rook/pkg/util/exec" @@ -31,21 +32,23 @@ import ( "github.com/spf13/cobra" ) -var blockListCmd = &cobra.Command{ +var listCmd = &cobra.Command{ Use: "ls", Short: "Gets a listing with details of all block images in the cluster and their locally mapped devices", } func init() { - blockListCmd.RunE = listBlocksEntry + listCmd.RunE = listBlocksEntry } func listBlocksEntry(cmd *cobra.Command, args []string) error { + rook.SetupLogging() + if err := flags.VerifyRequiredFlags(cmd, []string{}); err != nil { return err } - c := client.NewRookNetworkRestClient(client.GetRestURL(apiServerEndpoint), http.DefaultClient) + c := client.NewRookNetworkRestClient(client.GetRestURL(rook.APIServerEndpoint), http.DefaultClient) e := &exec.CommandExecutor{} out, err := listBlocks(rbdSysBusPathDefault, c, e) if err != nil { @@ -86,7 +89,7 @@ func listBlocks(rbdSysBusPath string, c client.RookRestClient, executor exec.Exe } var buffer bytes.Buffer - w := NewTableWriter(&buffer) + w := rook.NewTableWriter(&buffer) fmt.Fprintln(w, "NAME\tPOOL\tSIZE\tDEVICE\tMOUNT") diff --git a/cmd/rook/block-list_test.go b/cmd/rook/block/list_test.go similarity index 99% rename from cmd/rook/block-list_test.go rename to cmd/rook/block/list_test.go index c2e784498..b16e58cd0 100644 --- a/cmd/rook/block-list_test.go +++ b/cmd/rook/block/list_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package block import ( "fmt" diff --git a/cmd/rook/block/log.go b/cmd/rook/block/log.go new file mode 100644 index 000000000..4ddcbb0e8 --- /dev/null +++ b/cmd/rook/block/log.go @@ -0,0 +1,20 @@ +/* +Copyright 2016 The Rook Authors. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package block + +import "github.com/coreos/pkg/capnslog" + +var logger = capnslog.NewPackageLogger("github.com/rook/rook", "rookblock") diff --git a/cmd/rook/block-mount.go b/cmd/rook/block/mount.go similarity index 89% rename from cmd/rook/block-mount.go rename to cmd/rook/block/mount.go index f675e6193..2216f723f 100644 --- a/cmd/rook/block-mount.go +++ b/cmd/rook/block/mount.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package block import ( "fmt" @@ -24,6 +24,8 @@ import ( "strings" "time" + rc "github.com/rook/rook/cmd/rook/client" + "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/model" "github.com/rook/rook/pkg/rook/client" "github.com/rook/rook/pkg/util/exec" @@ -51,28 +53,30 @@ var ( mountImagePath string ) -var blockMountCmd = &cobra.Command{ +var mountCmd = &cobra.Command{ Use: "mount", Short: "Mounts a block image from the cluster as a local block device with the given file system path", } func init() { - blockMountCmd.Flags().StringVar(&mountImageName, "name", "", "Name of block image to mount (required)") - blockMountCmd.Flags().StringVar(&mountImagePoolName, "pool-name", "rbd", "Name of storage pool that contains block image to mount") - blockMountCmd.Flags().StringVar(&mountImagePath, "path", "", "File system path to mount block device on (required)") + mountCmd.Flags().StringVar(&mountImageName, "name", "", "Name of block image to mount (required)") + mountCmd.Flags().StringVar(&mountImagePoolName, "pool-name", "rbd", "Name of storage pool that contains block image to mount") + mountCmd.Flags().StringVar(&mountImagePath, "path", "", "File system path to mount block device on (required)") - blockMountCmd.MarkFlagRequired("name") - blockMountCmd.MarkFlagRequired("path") + mountCmd.MarkFlagRequired("name") + mountCmd.MarkFlagRequired("path") - blockMountCmd.RunE = mountBlockEntry + mountCmd.RunE = mountBlockEntry } func mountBlockEntry(cmd *cobra.Command, args []string) error { + rook.SetupLogging() + if err := flags.VerifyRequiredFlags(cmd, []string{"name", "path"}); err != nil { return err } - c := client.NewRookNetworkRestClient(client.GetRestURL(apiServerEndpoint), http.DefaultClient) + c := client.NewRookNetworkRestClient(client.GetRestURL(rook.APIServerEndpoint), http.DefaultClient) e := &exec.CommandExecutor{} out, err := mountBlock(mountImageName, mountImagePoolName, mountImagePath, rbdSysBusPathDefault, c, e) if err != nil { @@ -145,11 +149,11 @@ func mountBlock(name, poolName, mountPoint, rbdSysBusPath string, c client.RookR } func getRBDAddData(name, poolName string, clientAccessInfo model.ClientAccessInfo) (string, error) { - if err := verifyClientAccessInfo(clientAccessInfo); err != nil { + if err := rc.VerifyClientAccessInfo(clientAccessInfo); err != nil { return "", err } - monAddrs := processMonAddresses(clientAccessInfo) + monAddrs := rc.ProcessMonAddresses(clientAccessInfo) // mon address list (comma separated), user name, secret, pool name, image name rbdAddData := fmt.Sprintf( diff --git a/cmd/rook/block-mount_test.go b/cmd/rook/block/mount_test.go similarity index 99% rename from cmd/rook/block-mount_test.go rename to cmd/rook/block/mount_test.go index 00ac6bc57..0b0fbe328 100644 --- a/cmd/rook/block-mount_test.go +++ b/cmd/rook/block/mount_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package block import ( "fmt" diff --git a/cmd/rook/block-unmount.go b/cmd/rook/block/unmount.go similarity index 91% rename from cmd/rook/block-unmount.go rename to cmd/rook/block/unmount.go index 9a2fc599b..55b336eb1 100644 --- a/cmd/rook/block-unmount.go +++ b/cmd/rook/block/unmount.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package block import ( "fmt" @@ -21,6 +21,7 @@ import ( "path/filepath" "strings" + "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/util/exec" "github.com/rook/rook/pkg/util/flags" "github.com/rook/rook/pkg/util/sys" @@ -32,19 +33,21 @@ var ( unmountPath string ) -var blockUnmountCmd = &cobra.Command{ +var unmountCmd = &cobra.Command{ Use: "unmount", Short: "Unmounts and destroys a block device from the local machine", } func init() { - blockUnmountCmd.Flags().StringVar(&unmountDeviceName, "device", "", "Name of device to unmount (e.g., rbd0)") - blockUnmountCmd.Flags().StringVar(&unmountPath, "path", "", "File system path to unmount") + unmountCmd.Flags().StringVar(&unmountDeviceName, "device", "", "Name of device to unmount (e.g., rbd0)") + unmountCmd.Flags().StringVar(&unmountPath, "path", "", "File system path to unmount") - blockUnmountCmd.RunE = unmountBlockEntry + unmountCmd.RunE = unmountBlockEntry } func unmountBlockEntry(cmd *cobra.Command, args []string) error { + rook.SetupLogging() + if err := flags.VerifyRequiredFlags(cmd, []string{}); err != nil { return err } diff --git a/cmd/rook/block-unmount_test.go b/cmd/rook/block/unmount_test.go similarity index 99% rename from cmd/rook/block-unmount_test.go rename to cmd/rook/block/unmount_test.go index 3e355a313..cb266d3ce 100644 --- a/cmd/rook/block-unmount_test.go +++ b/cmd/rook/block/unmount_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package block import ( "fmt" diff --git a/cmd/rook/client.go b/cmd/rook/client/client.go similarity index 89% rename from cmd/rook/client.go rename to cmd/rook/client/client.go index 072ef6426..2b43d0cb8 100644 --- a/cmd/rook/client.go +++ b/cmd/rook/client/client.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package client import ( "fmt" @@ -22,7 +22,7 @@ import ( "github.com/rook/rook/pkg/model" ) -func verifyClientAccessInfo(clientAccessInfo model.ClientAccessInfo) error { +func VerifyClientAccessInfo(clientAccessInfo model.ClientAccessInfo) error { if clientAccessInfo.MonAddresses == nil || len(clientAccessInfo.MonAddresses) == 0 { return fmt.Errorf("missing mon addresses: %+v", clientAccessInfo) } @@ -34,7 +34,7 @@ func verifyClientAccessInfo(clientAccessInfo model.ClientAccessInfo) error { return nil } -func processMonAddresses(clientAccessInfo model.ClientAccessInfo) []string { +func ProcessMonAddresses(clientAccessInfo model.ClientAccessInfo) []string { monAddrs := make([]string, len(clientAccessInfo.MonAddresses)) for i, addr := range clientAccessInfo.MonAddresses { lastIndex := strings.LastIndex(addr, "/") diff --git a/cmd/rook/filesystem-create.go b/cmd/rook/filesystem/create.go similarity index 80% rename from cmd/rook/filesystem-create.go rename to cmd/rook/filesystem/create.go index 5b1f3b7db..dfa36244f 100644 --- a/cmd/rook/filesystem-create.go +++ b/cmd/rook/filesystem/create.go @@ -13,13 +13,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package filesystem import ( "fmt" "net/http" "os" + "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/model" "github.com/rook/rook/pkg/rook/client" "github.com/rook/rook/pkg/util/flags" @@ -30,24 +31,26 @@ var ( newFilesystemName string ) -var filesystemCreateCmd = &cobra.Command{ +var createCmd = &cobra.Command{ Use: "create", Short: "Creates a new shared filesystem in the cluster", } func init() { - filesystemCreateCmd.Flags().StringVarP(&newFilesystemName, "name", "n", "", "Name of new filesystem to create (required)") + createCmd.Flags().StringVarP(&newFilesystemName, "name", "n", "", "Name of new filesystem to create (required)") - filesystemCreateCmd.MarkFlagRequired("name") - filesystemCreateCmd.RunE = createFilesystemEntry + createCmd.MarkFlagRequired("name") + createCmd.RunE = createFilesystemEntry } func createFilesystemEntry(cmd *cobra.Command, args []string) error { + rook.SetupLogging() + if err := flags.VerifyRequiredFlags(cmd, []string{"name"}); err != nil { return err } - c := client.NewRookNetworkRestClient(client.GetRestURL(apiServerEndpoint), http.DefaultClient) + c := client.NewRookNetworkRestClient(client.GetRestURL(rook.APIServerEndpoint), http.DefaultClient) out, err := createFilesystem(newFilesystemName, c) if err != nil { fmt.Fprintln(os.Stderr, err) diff --git a/cmd/rook/filesystem-create_test.go b/cmd/rook/filesystem/create_test.go similarity index 98% rename from cmd/rook/filesystem-create_test.go rename to cmd/rook/filesystem/create_test.go index 9ba3cd887..957add4e7 100644 --- a/cmd/rook/filesystem-create_test.go +++ b/cmd/rook/filesystem/create_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package filesystem import ( "fmt" diff --git a/cmd/rook/filesystem-delete.go b/cmd/rook/filesystem/delete.go similarity index 80% rename from cmd/rook/filesystem-delete.go rename to cmd/rook/filesystem/delete.go index e814209fc..1103153aa 100644 --- a/cmd/rook/filesystem-delete.go +++ b/cmd/rook/filesystem/delete.go @@ -13,13 +13,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package filesystem import ( "fmt" "net/http" "os" + "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/model" "github.com/rook/rook/pkg/rook/client" "github.com/rook/rook/pkg/util/flags" @@ -30,24 +31,26 @@ var ( deleteFilesystemName string ) -var filesystemDeleteCmd = &cobra.Command{ +var deleteCmd = &cobra.Command{ Use: "delete", Short: "Deletes a shared filesystem from the cluster", } func init() { - filesystemDeleteCmd.Flags().StringVarP(&deleteFilesystemName, "name", "n", "", "Name of filesystem to delete (required)") + deleteCmd.Flags().StringVarP(&deleteFilesystemName, "name", "n", "", "Name of filesystem to delete (required)") - filesystemDeleteCmd.MarkFlagRequired("name") - filesystemDeleteCmd.RunE = deleteFilesystemEntry + deleteCmd.MarkFlagRequired("name") + deleteCmd.RunE = deleteFilesystemEntry } func deleteFilesystemEntry(cmd *cobra.Command, args []string) error { + rook.SetupLogging() + if err := flags.VerifyRequiredFlags(cmd, []string{"name"}); err != nil { return err } - c := client.NewRookNetworkRestClient(client.GetRestURL(apiServerEndpoint), http.DefaultClient) + c := client.NewRookNetworkRestClient(client.GetRestURL(rook.APIServerEndpoint), http.DefaultClient) out, err := deleteFilesystem(deleteFilesystemName, c) if err != nil { fmt.Fprintln(os.Stderr, err) diff --git a/cmd/rook/filesystem-delete_test.go b/cmd/rook/filesystem/delete_test.go similarity index 98% rename from cmd/rook/filesystem-delete_test.go rename to cmd/rook/filesystem/delete_test.go index 02be1fc38..0f74987c9 100644 --- a/cmd/rook/filesystem-delete_test.go +++ b/cmd/rook/filesystem/delete_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package filesystem import ( "fmt" diff --git a/cmd/rook/filesystem.go b/cmd/rook/filesystem/filesystem.go similarity index 73% rename from cmd/rook/filesystem.go rename to cmd/rook/filesystem/filesystem.go index 4a66d2747..d99f9f3fa 100644 --- a/cmd/rook/filesystem.go +++ b/cmd/rook/filesystem/filesystem.go @@ -13,20 +13,20 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package filesystem import "github.com/spf13/cobra" -var filesystemCmd = &cobra.Command{ +var Cmd = &cobra.Command{ Use: "filesystem", Aliases: []string{"fs"}, Short: "Performs commands and operations on shared filesystems in the cluster", } func init() { - filesystemCmd.AddCommand(filesystemListCmd) - filesystemCmd.AddCommand(filesystemCreateCmd) - filesystemCmd.AddCommand(filesystemMountCmd) - filesystemCmd.AddCommand(filesystemUnmountCmd) - filesystemCmd.AddCommand(filesystemDeleteCmd) + Cmd.AddCommand(listCmd) + Cmd.AddCommand(createCmd) + Cmd.AddCommand(mountCmd) + Cmd.AddCommand(unmountCmd) + Cmd.AddCommand(deleteCmd) } diff --git a/cmd/rook/filesystem-list.go b/cmd/rook/filesystem/list.go similarity index 85% rename from cmd/rook/filesystem-list.go rename to cmd/rook/filesystem/list.go index ffe0df5a8..967f9ed8a 100644 --- a/cmd/rook/filesystem-list.go +++ b/cmd/rook/filesystem/list.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package filesystem import ( "bytes" @@ -22,26 +22,29 @@ import ( "os" "strings" + "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/rook/client" "github.com/rook/rook/pkg/util/flags" "github.com/spf13/cobra" ) -var filesystemListCmd = &cobra.Command{ +var listCmd = &cobra.Command{ Use: "ls", Short: "Gets a listing with details of all shared file systems in the cluster", } func init() { - filesystemListCmd.RunE = listFilesystemEntry + listCmd.RunE = listFilesystemEntry } func listFilesystemEntry(cmd *cobra.Command, args []string) error { + rook.SetupLogging() + if err := flags.VerifyRequiredFlags(cmd, []string{}); err != nil { return err } - c := client.NewRookNetworkRestClient(client.GetRestURL(apiServerEndpoint), http.DefaultClient) + c := client.NewRookNetworkRestClient(client.GetRestURL(rook.APIServerEndpoint), http.DefaultClient) out, err := listFilesystems(c) if err != nil { fmt.Fprintln(os.Stderr, err) @@ -63,7 +66,7 @@ func listFilesystems(c client.RookRestClient) (string, error) { } var buffer bytes.Buffer - w := NewTableWriter(&buffer) + w := rook.NewTableWriter(&buffer) fmt.Fprintln(w, "NAME\tMETADATA POOL\tDATA POOLS") diff --git a/cmd/rook/filesystem-list_test.go b/cmd/rook/filesystem/list_test.go similarity index 98% rename from cmd/rook/filesystem-list_test.go rename to cmd/rook/filesystem/list_test.go index cf570ee80..66e38dcfd 100644 --- a/cmd/rook/filesystem-list_test.go +++ b/cmd/rook/filesystem/list_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package filesystem import ( "fmt" diff --git a/cmd/rook/filesystem-mount.go b/cmd/rook/filesystem/mount.go similarity index 74% rename from cmd/rook/filesystem-mount.go rename to cmd/rook/filesystem/mount.go index c4d98006f..e44670e0c 100644 --- a/cmd/rook/filesystem-mount.go +++ b/cmd/rook/filesystem/mount.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package filesystem import ( "fmt" @@ -21,6 +21,8 @@ import ( "os" "strings" + rc "github.com/rook/rook/cmd/rook/client" + "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/rook/client" "github.com/rook/rook/pkg/util/exec" "github.com/rook/rook/pkg/util/flags" @@ -33,26 +35,28 @@ var ( mountFilesystemPath string ) -var filesystemMountCmd = &cobra.Command{ +var mountCmd = &cobra.Command{ Use: "mount", Short: "Mounts a shared filesystem from the cluster to the given local mount point", } func init() { - filesystemMountCmd.Flags().StringVarP(&mountFilesystemName, "name", "n", "", "Name of filesystem to mount (required)") - filesystemMountCmd.Flags().StringVarP(&mountFilesystemPath, "path", "p", "", "Path to mount shared filesystem (required)") + mountCmd.Flags().StringVarP(&mountFilesystemName, "name", "n", "", "Name of filesystem to mount (required)") + mountCmd.Flags().StringVarP(&mountFilesystemPath, "path", "p", "", "Path to mount shared filesystem (required)") - filesystemMountCmd.MarkFlagRequired("name") - filesystemMountCmd.MarkFlagRequired("path") - filesystemMountCmd.RunE = mountFilesystemEntry + mountCmd.MarkFlagRequired("name") + mountCmd.MarkFlagRequired("path") + mountCmd.RunE = mountFilesystemEntry } func mountFilesystemEntry(cmd *cobra.Command, args []string) error { + rook.SetupLogging() + if err := flags.VerifyRequiredFlags(cmd, []string{"name", "path"}); err != nil { return err } - c := client.NewRookNetworkRestClient(client.GetRestURL(apiServerEndpoint), http.DefaultClient) + c := client.NewRookNetworkRestClient(client.GetRestURL(rook.APIServerEndpoint), http.DefaultClient) e := &exec.CommandExecutor{} out, err := mountFilesystem(mountFilesystemName, mountFilesystemPath, c, e) if err != nil { @@ -70,11 +74,11 @@ func mountFilesystem(name, path string, c client.RookRestClient, executor exec.E return "", err } - if err := verifyClientAccessInfo(clientAccessInfo); err != nil { + if err := rc.VerifyClientAccessInfo(clientAccessInfo); err != nil { return "", err } - monAddrs := processMonAddresses(clientAccessInfo) + monAddrs := rc.ProcessMonAddresses(clientAccessInfo) devicePath := strings.Join(monAddrs, ",") + ":/" options := fmt.Sprintf("name=%s,secret=%s", clientAccessInfo.UserName, clientAccessInfo.SecretKey) diff --git a/cmd/rook/filesystem-mount_test.go b/cmd/rook/filesystem/mount_test.go similarity index 99% rename from cmd/rook/filesystem-mount_test.go rename to cmd/rook/filesystem/mount_test.go index 7ff433516..80ca997fe 100644 --- a/cmd/rook/filesystem-mount_test.go +++ b/cmd/rook/filesystem/mount_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package filesystem import ( "fmt" diff --git a/cmd/rook/filesystem-unmount.go b/cmd/rook/filesystem/unmount.go similarity index 83% rename from cmd/rook/filesystem-unmount.go rename to cmd/rook/filesystem/unmount.go index 66a3b2342..c11e66bc2 100644 --- a/cmd/rook/filesystem-unmount.go +++ b/cmd/rook/filesystem/unmount.go @@ -13,12 +13,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package filesystem import ( "fmt" "os" + "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/util/exec" "github.com/rook/rook/pkg/util/flags" "github.com/rook/rook/pkg/util/sys" @@ -29,20 +30,22 @@ var ( unmountFilesystemPath string ) -var filesystemUnmountCmd = &cobra.Command{ +var unmountCmd = &cobra.Command{ Use: "unmount", Aliases: []string{"umount"}, Short: "Unmounts a shared filesystem from its local mount point (data is still persisted in the cluster)", } func init() { - filesystemUnmountCmd.Flags().StringVarP(&unmountFilesystemPath, "path", "p", "", "Path to unmount shared filesystem from (required)") + unmountCmd.Flags().StringVarP(&unmountFilesystemPath, "path", "p", "", "Path to unmount shared filesystem from (required)") - filesystemUnmountCmd.MarkFlagRequired("path") - filesystemUnmountCmd.RunE = unmountFilesystemEntry + unmountCmd.MarkFlagRequired("path") + unmountCmd.RunE = unmountFilesystemEntry } func unmountFilesystemEntry(cmd *cobra.Command, args []string) error { + rook.SetupLogging() + if err := flags.VerifyRequiredFlags(cmd, []string{"path"}); err != nil { return err } diff --git a/cmd/rook/filesystem-unmount_test.go b/cmd/rook/filesystem/unmount_test.go similarity index 98% rename from cmd/rook/filesystem-unmount_test.go rename to cmd/rook/filesystem/unmount_test.go index 01af749a2..0aeee1113 100644 --- a/cmd/rook/filesystem-unmount_test.go +++ b/cmd/rook/filesystem/unmount_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package filesystem import ( "fmt" diff --git a/cmd/rook/main.go b/cmd/rook/main.go new file mode 100644 index 000000000..df80243fa --- /dev/null +++ b/cmd/rook/main.go @@ -0,0 +1,46 @@ +/* +Copyright 2016 The Rook Authors. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package rookmain + +import ( + "fmt" + "os" + + "github.com/rook/rook/cmd/rook/block" + "github.com/rook/rook/cmd/rook/filesystem" + "github.com/rook/rook/cmd/rook/node" + "github.com/rook/rook/cmd/rook/pool" + "github.com/rook/rook/cmd/rook/rook" + "github.com/rook/rook/cmd/rook/status" + "github.com/rook/rook/cmd/rook/version" +) + +func Main() { + addCommands() + if err := rook.RootCmd.Execute(); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } +} + +func addCommands() { + rook.RootCmd.AddCommand(node.Cmd) + rook.RootCmd.AddCommand(pool.Cmd) + rook.RootCmd.AddCommand(block.Cmd) + rook.RootCmd.AddCommand(filesystem.Cmd) + rook.RootCmd.AddCommand(status.Cmd) + rook.RootCmd.AddCommand(version.Cmd) +} diff --git a/cmd/rook/node-list.go b/cmd/rook/node/list.go similarity index 86% rename from cmd/rook/node-list.go rename to cmd/rook/node/list.go index 33673e673..4208e5eb6 100644 --- a/cmd/rook/node-list.go +++ b/cmd/rook/node/list.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package node import ( "bytes" @@ -21,25 +21,28 @@ import ( "net/http" "os" + "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/model" "github.com/rook/rook/pkg/rook/client" "github.com/rook/rook/pkg/util/display" "github.com/spf13/cobra" ) -var nodeListCmd = &cobra.Command{ +var listCmd = &cobra.Command{ Use: "ls", Short: "Gets a listing with details of all nodes in the cluster", } func init() { - nodeListCmd.RunE = listNodesEntry + listCmd.RunE = listNodesEntry } func listNodesEntry(cmd *cobra.Command, args []string) error { + rook.SetupLogging() + // verify required flags. currently there are none - c := client.NewRookNetworkRestClient(client.GetRestURL(apiServerEndpoint), http.DefaultClient) + c := client.NewRookNetworkRestClient(client.GetRestURL(rook.APIServerEndpoint), http.DefaultClient) out, err := listNodes(c) if err != nil { fmt.Fprintln(os.Stderr, err) @@ -61,7 +64,7 @@ func listNodes(c client.RookRestClient) (string, error) { } var buffer bytes.Buffer - w := NewTableWriter(&buffer) + w := rook.NewTableWriter(&buffer) // write header columns fmt.Fprintln(w, "PUBLIC\tPRIVATE\tSTATE\tCLUSTER\tSIZE\tLOCATION\tUPDATED\t") diff --git a/cmd/rook/node-list_test.go b/cmd/rook/node/list_test.go similarity index 99% rename from cmd/rook/node-list_test.go rename to cmd/rook/node/list_test.go index e3a831443..61cb19bf6 100644 --- a/cmd/rook/node-list_test.go +++ b/cmd/rook/node/list_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package node import ( "fmt" diff --git a/cmd/rook/node.go b/cmd/rook/node/node.go similarity index 90% rename from cmd/rook/node.go rename to cmd/rook/node/node.go index 98f257cc2..1a4ff2972 100644 --- a/cmd/rook/node.go +++ b/cmd/rook/node/node.go @@ -13,15 +13,15 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package node import "github.com/spf13/cobra" -var nodeCmd = &cobra.Command{ +var Cmd = &cobra.Command{ Use: "node", Short: "Performs commands and operations on nodes in the cluster", } func init() { - nodeCmd.AddCommand(nodeListCmd) + Cmd.AddCommand(listCmd) } diff --git a/cmd/rook/pool-create.go b/cmd/rook/pool/create.go similarity index 81% rename from cmd/rook/pool-create.go rename to cmd/rook/pool/create.go index da3f5f44e..3d4de4935 100644 --- a/cmd/rook/pool-create.go +++ b/cmd/rook/pool/create.go @@ -13,13 +13,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package pool import ( "fmt" "net/http" "os" + "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/model" "github.com/rook/rook/pkg/rook/client" "github.com/rook/rook/pkg/util/flags" @@ -39,37 +40,39 @@ var ( newPoolCodingChunks uint ) -var poolCreateCmd = &cobra.Command{ +var createCmd = &cobra.Command{ Use: "create", Short: "Creates a new storage pool in the cluster", } func init() { - poolCreateCmd.Flags().StringVarP(&newPoolName, "name", "n", "", "Name of new storage pool to create (required)") + createCmd.Flags().StringVarP(&newPoolName, "name", "n", "", "Name of new storage pool to create (required)") - poolCreateCmd.Flags().StringVarP(&newPoolType, "type", "t", PoolTypeReplicated, + createCmd.Flags().StringVarP(&newPoolType, "type", "t", PoolTypeReplicated, fmt.Sprintf("Type of storage pool, '%s' or '%s' (required)", PoolTypeReplicated, PoolTypeErasureCoded)) - poolCreateCmd.Flags().UintVarP(&newPoolReplicaCount, "replica-count", "r", 0, + createCmd.Flags().UintVarP(&newPoolReplicaCount, "replica-count", "r", 0, fmt.Sprintf("Number of copies per object in a replicated storage pool, including the object itself (required for %s pool type)", PoolTypeReplicated)) - poolCreateCmd.Flags().UintVarP(&newPoolDataChunks, "ec-data-chunks", "d", 0, + createCmd.Flags().UintVarP(&newPoolDataChunks, "ec-data-chunks", "d", 0, fmt.Sprintf("Number of data chunks per object in an erasure coded storage pool (required for %s pool type)", PoolTypeErasureCoded)) - poolCreateCmd.Flags().UintVarP(&newPoolCodingChunks, "ec-coding-chunks", "c", 0, + createCmd.Flags().UintVarP(&newPoolCodingChunks, "ec-coding-chunks", "c", 0, fmt.Sprintf("Number of coding chunks per object in an erasure coded storage pool (required for %s pool type)", PoolTypeErasureCoded)) - poolCreateCmd.MarkFlagRequired("name") - poolCreateCmd.MarkFlagRequired("type") - poolCreateCmd.RunE = createPoolsEntry + createCmd.MarkFlagRequired("name") + createCmd.MarkFlagRequired("type") + createCmd.RunE = createPoolsEntry } func createPoolsEntry(cmd *cobra.Command, args []string) error { + rook.SetupLogging() + if err := flags.VerifyRequiredFlags(cmd, []string{"name", "type"}); err != nil { return err } - c := client.NewRookNetworkRestClient(client.GetRestURL(apiServerEndpoint), http.DefaultClient) + c := client.NewRookNetworkRestClient(client.GetRestURL(rook.APIServerEndpoint), http.DefaultClient) out, err := createPool(newPoolName, newPoolType, newPoolReplicaCount, newPoolDataChunks, newPoolCodingChunks, c) if err != nil { fmt.Fprintln(os.Stderr, err) diff --git a/cmd/rook/pool-create_test.go b/cmd/rook/pool/create_test.go similarity index 99% rename from cmd/rook/pool-create_test.go rename to cmd/rook/pool/create_test.go index a55729062..7ba5c2011 100644 --- a/cmd/rook/pool-create_test.go +++ b/cmd/rook/pool/create_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package pool import ( "fmt" diff --git a/cmd/rook/pool-list.go b/cmd/rook/pool/list.go similarity index 87% rename from cmd/rook/pool-list.go rename to cmd/rook/pool/list.go index a501f15cf..fbbb62ebb 100644 --- a/cmd/rook/pool-list.go +++ b/cmd/rook/pool/list.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package pool import ( "bytes" @@ -21,6 +21,7 @@ import ( "net/http" "os" + "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/model" "github.com/rook/rook/pkg/rook/client" "github.com/rook/rook/pkg/util/display" @@ -28,21 +29,23 @@ import ( "github.com/spf13/cobra" ) -var poolListCmd = &cobra.Command{ +var listCmd = &cobra.Command{ Use: "ls", Short: "Gets a listing with details of all storage pools in the cluster", } func init() { - poolListCmd.RunE = listPoolsEntry + listCmd.RunE = listPoolsEntry } func listPoolsEntry(cmd *cobra.Command, args []string) error { + rook.SetupLogging() + if err := flags.VerifyRequiredFlags(cmd, []string{}); err != nil { return err } - c := client.NewRookNetworkRestClient(client.GetRestURL(apiServerEndpoint), http.DefaultClient) + c := client.NewRookNetworkRestClient(client.GetRestURL(rook.APIServerEndpoint), http.DefaultClient) out, err := listPools(c) if err != nil { fmt.Fprintln(os.Stderr, err) @@ -64,7 +67,7 @@ func listPools(c client.RookRestClient) (string, error) { } var buffer bytes.Buffer - w := NewTableWriter(&buffer) + w := rook.NewTableWriter(&buffer) fmt.Fprintln(w, "NAME\tNUMBER\tTYPE\tSIZE\tDATA\tCODING\tALGORITHM") diff --git a/cmd/rook/pool-list_test.go b/cmd/rook/pool/list_test.go similarity index 99% rename from cmd/rook/pool-list_test.go rename to cmd/rook/pool/list_test.go index 3485b9246..d2c60e031 100644 --- a/cmd/rook/pool-list_test.go +++ b/cmd/rook/pool/list_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package pool import ( "fmt" diff --git a/cmd/rook/pool.go b/cmd/rook/pool/pool.go similarity index 86% rename from cmd/rook/pool.go rename to cmd/rook/pool/pool.go index edd2975d4..b21d5e82b 100644 --- a/cmd/rook/pool.go +++ b/cmd/rook/pool/pool.go @@ -13,16 +13,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package pool import "github.com/spf13/cobra" -var poolCmd = &cobra.Command{ +var Cmd = &cobra.Command{ Use: "pool", Short: "Performs commands and operations on storage pools in the cluster", } func init() { - poolCmd.AddCommand(poolListCmd) - poolCmd.AddCommand(poolCreateCmd) + Cmd.AddCommand(listCmd) + Cmd.AddCommand(createCmd) } diff --git a/cmd/rook/rook.go b/cmd/rook/rook/rook.go similarity index 69% rename from cmd/rook/rook.go rename to cmd/rook/rook/rook.go index 7c1a5bb96..fddb78bcf 100644 --- a/cmd/rook/rook.go +++ b/cmd/rook/rook/rook.go @@ -26,7 +26,8 @@ import ( ) var ( - apiServerEndpoint string + APIServerEndpoint string + logLevelRaw string ) const ( @@ -36,23 +37,20 @@ const ( outputPadChar = ' ' ) -var rootCmd = &cobra.Command{ +var RootCmd = &cobra.Command{ Use: "rook", Short: "A command line client for working with a rook cluster", Long: `https://github.com/rook/rook`, } -var logLevelRaw string -var logger = capnslog.NewPackageLogger("github.com/rook/rook", "rook") - func init() { - rootCmd.PersistentFlags().StringVar(&apiServerEndpoint, "api-server-endpoint", "127.0.0.1:8124", "IP endpoint of API server instance (required)") - rootCmd.PersistentFlags().StringVar(&logLevelRaw, "log-level", "WARNING", "logging level for logging/tracing output (valid values: CRITICAL,ERROR,WARNING,NOTICE,INFO,DEBUG,TRACE)") + RootCmd.PersistentFlags().StringVar(&APIServerEndpoint, "api-server-endpoint", "127.0.0.1:8124", "IP endpoint of API server instance (required)") + RootCmd.PersistentFlags().StringVar(&logLevelRaw, "log-level", "WARNING", "logging level for logging/tracing output (valid values: CRITICAL,ERROR,WARNING,NOTICE,INFO,DEBUG,TRACE)") - rootCmd.MarkFlagRequired("api-server-endpoint") + RootCmd.MarkFlagRequired("api-server-endpoint") } -func Main() { +func SetupLogging() { // parse the given log level and set it at a global level logLevel, err := capnslog.ParseLevel(logLevelRaw) if err != nil { @@ -60,21 +58,6 @@ func Main() { os.Exit(1) } capnslog.SetGlobalLogLevel(logLevel) - - addCommands() - if err := rootCmd.Execute(); err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } -} - -func addCommands() { - rootCmd.AddCommand(nodeCmd) - rootCmd.AddCommand(poolCmd) - rootCmd.AddCommand(blockCmd) - rootCmd.AddCommand(filesystemCmd) - rootCmd.AddCommand(statusCmd) - rootCmd.AddCommand(versionCmd) } func NewTableWriter(buffer io.Writer) *tabwriter.Writer { diff --git a/cmd/rook/status.go b/cmd/rook/status/status.go similarity index 91% rename from cmd/rook/status.go rename to cmd/rook/status/status.go index 0ecc17fc3..6e6fd09ae 100644 --- a/cmd/rook/status.go +++ b/cmd/rook/status/status.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package status import ( "bytes" @@ -21,24 +21,26 @@ import ( "net/http" "os" + "github.com/rook/rook/cmd/rook/rook" "github.com/rook/rook/pkg/model" "github.com/rook/rook/pkg/rook/client" "github.com/rook/rook/pkg/util/display" "github.com/spf13/cobra" ) -var statusCmd = &cobra.Command{ +var Cmd = &cobra.Command{ Use: "status", Short: "Outputs a summary of the status of the cluster", } func init() { - statusCmd.RunE = getStatusEntry + Cmd.RunE = getStatusEntry } func getStatusEntry(cmd *cobra.Command, args []string) error { + rook.SetupLogging() - c := client.NewRookNetworkRestClient(client.GetRestURL(apiServerEndpoint), http.DefaultClient) + c := client.NewRookNetworkRestClient(client.GetRestURL(rook.APIServerEndpoint), http.DefaultClient) out, err := getStatus(c) if err != nil { fmt.Fprintln(os.Stderr, err) @@ -56,7 +58,7 @@ func getStatus(c client.RookRestClient) (string, error) { } var buffer bytes.Buffer - w := NewTableWriter(&buffer) + w := rook.NewTableWriter(&buffer) // overall status buffer.WriteString(fmt.Sprintf("OVERALL STATUS: %s\n", model.HealthStatusToString(statusDetails.OverallStatus))) diff --git a/cmd/rook/status_test.go b/cmd/rook/status/status_test.go similarity index 99% rename from cmd/rook/status_test.go rename to cmd/rook/status/status_test.go index eeb0d51d8..366394d04 100644 --- a/cmd/rook/status_test.go +++ b/cmd/rook/status/status_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package rook +package status import ( "testing" diff --git a/cmd/rook/version.go b/cmd/rook/version/version.go similarity index 85% rename from cmd/rook/version.go rename to cmd/rook/version/version.go index 979ee95a5..49560fc8c 100644 --- a/cmd/rook/version.go +++ b/cmd/rook/version/version.go @@ -1,4 +1,4 @@ -package rook +package version import ( "fmt" @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" ) -var versionCmd = &cobra.Command{ +var Cmd = &cobra.Command{ Use: "version", Short: "Print the version number of rookd", RunE: func(cmd *cobra.Command, args []string) error { diff --git a/main.go b/main.go index b64d6aa72..7e28e288f 100644 --- a/main.go +++ b/main.go @@ -18,5 +18,5 @@ package main import "github.com/rook/rook/cmd/rook" func main() { - rook.Main() + rookmain.Main() }