Skip to content

Commit

Permalink
Fail when bucket size is less than 500gb
Browse files Browse the repository at this point in the history
  • Loading branch information
uzaxirr committed Sep 23, 2024
1 parent 13f5f1a commit bb0301b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cmd/objectstore/objectstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ func init() {
ObjectStoreCmd.AddCommand(objectStoreCredentialCmd)

//Flags for create cmd
objectStoreCreateCmd.Flags().Int64VarP(&bucketSize, "size", "s", 500, "Size of the Object store")
objectStoreCreateCmd.Flags().Int64VarP(&bucketSize, "size", "s", 500, "Size of the Object store (Minimum size is 500GB)")
objectStoreCreateCmd.Flags().StringVarP(&owner, "owner-name", "n", "", "Name of Owner of the Object store. You can reference name of any civo object store credential created before")
objectStoreCreateCmd.Flags().StringVarP(&owner, "owner-access-key", "a", "", "Access Key ID of Owner of the Object store. You can reference name of any civo object store credential created before")
objectStoreCreateCmd.Flags().BoolVarP(&waitOS, "wait", "w", false, "a simple flag (e.g. --wait) that will cause the CLI to spin and wait for the Object Store to be ready")

//Flags for update cmd
objectStoreUpdateCmd.Flags().Int64VarP(&bucketSize, "size", "s", 500, "Size of the object store")
objectStoreUpdateCmd.Flags().Int64VarP(&bucketSize, "size", "s", 500, "Size of the object store (Minimum size is 500GB)")

//Credential commands
objectStoreCredentialCmd.AddCommand(objectStoreCredentialSecretCmd)
Expand Down
9 changes: 2 additions & 7 deletions cmd/objectstore/objectstore_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,8 @@ var objectStoreCreateCmd = &cobra.Command{
}

if bucketSize < 500 {
utility.YellowConfirm("The minimum size to create an object store is 500 GB. Would you like to create an %s of 500 GB? (y/n) ? ", utility.Green("object store"))
_, err := utility.UserAccepts(os.Stdin)
if err != nil {
utility.Error("Unable to parse the input: %s", err)
os.Exit(1)
}
bucketSize = 500
utility.Error("The minimum size to create an object store is 500 GB. Please provide a valid size.")
os.Exit(1)
} else if bucketSize%500 != 0 {
utility.YellowConfirm("The size to create an object store must be a multiple of 500. Would you like to create an %s of %d GB instead? (y/n) ? ", utility.Green("object store"), bucketSize+(500-bucketSize%500))
_, err := utility.UserAccepts(os.Stdin)
Expand Down

0 comments on commit bb0301b

Please sign in to comment.