Permalink
Browse files

don't display replica warnings for default bucket setup

Previously when there were other validation errors we performed
warnings validations event for default bucket setup call. This commit
extracts parse_bucket_params_without_warnings function that default
bucket setup parameters parsing function calls.

Change-Id: I73a52ce4a5a31f60e6c09fa2bddfc27927c003f4
Reviewed-on: http://review.northscale.com/3202
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Sean Lynch <seanl@literati.org>
  • Loading branch information...
1 parent 4bf003d commit 385e1b8943dbe8c6af4461adf30c440a49f18452 Aliaksey Kandratsenka committed with seanlynch Oct 11, 2010
Showing with 21 additions and 9 deletions.
  1. +21 −9 deps/menelaus/src/menelaus_web_buckets.erl
@@ -345,14 +345,26 @@ parse_bucket_params_for_setup_default_bucket(Params, ClusterStorageTotals) ->
0
end,
RamTotals = proplists:get_value(ram, ClusterStorageTotals),
- parse_bucket_params(true,
- "default",
- [{"authType", "sasl"}, {"saslPassword", ""} | Params],
- [],
- [{ram, [{quotaUsed, 0} | RamTotals]} | ClusterStorageTotals],
- UsageGetter).
+ RV = parse_bucket_params_without_warnings(true,
+ "default",
+ [{"authType", "sasl"}, {"saslPassword", ""} | Params],
+ [],
+ [{ram, [{quotaUsed, 0} | RamTotals]} | ClusterStorageTotals],
+ UsageGetter),
+ case RV of
+ {ok, _, _} = X -> X;
+ {errors, Errors, Summaries, _} -> {errors, Errors, Summaries}
+ end.
parse_bucket_params(IsNew, BucketName, Params, AllBuckets, ClusterStorageTotals) ->
+ RV = parse_bucket_params_without_warnings(IsNew, BucketName, Params, AllBuckets, ClusterStorageTotals),
+ case RV of
+ {ok, _, _} = X -> X;
+ {errors, Errors, Summaries, OKs} ->
+ {errors, perform_warnings_validation(OKs, Errors), Summaries}
+ end.
+
+parse_bucket_params_without_warnings(IsNew, BucketName, Params, AllBuckets, ClusterStorageTotals) ->
UsageGetter = fun (ram, Name) ->
menelaus_stats:bucket_ram_usage(Name);
(hdd, all) ->
@@ -362,9 +374,9 @@ parse_bucket_params(IsNew, BucketName, Params, AllBuckets, ClusterStorageTotals)
(hdd, Name) ->
menelaus_stats:bucket_disk_usage(Name)
end,
- parse_bucket_params(IsNew, BucketName, Params, AllBuckets, ClusterStorageTotals, UsageGetter).
+ parse_bucket_params_without_warnings(IsNew, BucketName, Params, AllBuckets, ClusterStorageTotals, UsageGetter).
-parse_bucket_params(IsNew, BucketName, Params, AllBuckets, ClusterStorageTotals, UsageGetter) ->
+parse_bucket_params_without_warnings(IsNew, BucketName, Params, AllBuckets, ClusterStorageTotals, UsageGetter) ->
{OKs, Errors} = basic_bucket_params_screening(IsNew, BucketName,
Params, AllBuckets),
CurrentBucket = proplists:get_value(currentBucket, OKs),
@@ -409,7 +421,7 @@ parse_bucket_params(IsNew, BucketName, Params, AllBuckets, ClusterStorageTotals,
TotalErrors =:= [] ->
{ok, OKs, JSONSummaries};
true ->
- {errors, perform_warnings_validation(OKs, TotalErrors), JSONSummaries}
+ {errors, TotalErrors, JSONSummaries, OKs}
end.
basic_bucket_params_screening(IsNew, BucketName, Params, AllBuckets) ->

0 comments on commit 385e1b8

Please sign in to comment.