Skip to content

Commit

Permalink
Add support for setting/querying a cluster-wide time zone
Browse files Browse the repository at this point in the history
  • Loading branch information
macintux committed Jul 19, 2016
1 parent 1bd052f commit b33c63a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions rebar.config
Expand Up @@ -18,5 +18,6 @@
{pbkdf2, ".*", {git, "git://github.com/basho/erlang-pbkdf2.git", {tag, "2.0.0"}}},
{eleveldb, ".*", {git, "git://github.com/basho/eleveldb.git", {tag, "ts-1.0.4"}}},
{exometer_core, ".*", {git, "git://github.com/basho/exometer_core.git", {tag, "1.0.0-basho6"}}},
{jam, ".*", {git, "git://github.com/macintux/jam.git", {branch, "master"}}},
{clique, "0.3.5", {git, "git://github.com/basho/clique.git", {tag, "0.3.5"}}}
]}.
24 changes: 23 additions & 1 deletion src/riak_core_console.erl
Expand Up @@ -31,7 +31,8 @@
print_users/1, print_user/1, print_sources/1,
print_groups/1, print_group/1, print_grants/1,
security_enable/1, security_disable/1, security_status/1, ciphers/1,
stat_show/1, stat_info/1, stat_enable/1, stat_disable/1, stat_reset/1]).
timezone/1,
stat_show/1, stat_info/1, stat_enable/1, stat_disable/1, stat_reset/1]).

%% New CLI API
-export([command/1]).
Expand Down Expand Up @@ -752,6 +753,27 @@ commit_staged([]) ->
"plan and try to commit again~n")
end.

timezone([]) ->
TZ = riak_core_metadata:get({riak_core, timezone}, string,
[{default, "not configured"}]),
io:format("~s~n", [TZ]);
timezone([TZString]) ->
TZ = jam:process(jam_iso8601:parse_tz(TZString)),
attempt_set_timezone(jam:is_valid(TZ), TZ, TZString).

attempt_set_timezone(false, _TZ, String) ->
io:format("Failed, unrecognized timezone string '~s'~n",
[String]);
attempt_set_timezone(true, TZ, _String) ->
NewString = jam_iso8601:to_string(TZ, [{z, false}]),
riak_core_metadata:put({riak_core, timezone}, string,
NewString),
riak_core_metadata:put({riak_core, timezone}, seconds,
jam:tz_offset(TZ)),
io:format("Success, timezone is now configured to '~s'~n",
[NewString]).


transfer_limit([]) ->
{Limits, Down} =
riak_core_util:rpc_every_member_ann(riak_core_handoff_manager,
Expand Down

4 comments on commit b33c63a

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from javajolt
at b33c63a

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging basho/riak_core/feature_jrd_cmd-tz = b33c63a into borshop-integration-847-feature_jrd_cmd-tz

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basho/riak_core/feature_jrd_cmd-tz = b33c63a merged ok, testing candidate = 03fb938

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.