diff --git a/src/rt.erl b/src/rt.erl index c24b7a3b..9f4879d8 100644 --- a/src/rt.erl +++ b/src/rt.erl @@ -94,6 +94,7 @@ set_backend/1, set_backend/2, set_conf/2, + set_advanced_conf/2, setup_harness/2, setup_log_capture/1, slow_upgrade/3, @@ -193,6 +194,15 @@ set_conf(Node, NameValuePairs) -> ?HARNESS:set_conf(Node, NameValuePairs), start(Node). +-spec set_advanced_conf(atom(), [{string(), string()}]) -> ok. +set_advanced_conf(all, NameValuePairs) -> + ?HARNESS:set_advanced_conf(all, NameValuePairs); +set_advanced_conf(Node, NameValuePairs) -> + stop(Node), + ?assertEqual(ok, rt:wait_until_unpingable(Node)), + ?HARNESS:set_advanced_conf(Node, NameValuePairs), + start(Node). + %% @doc Rewrite the given node's app.config file, overriding the varialbes %% in the existing app.config with those in `Config'. update_app_config(all, Config) -> diff --git a/src/rtssh.erl b/src/rtssh.erl index 2fa39c2e..fe8f5a7e 100644 --- a/src/rtssh.erl +++ b/src/rtssh.erl @@ -444,9 +444,27 @@ set_conf(Node, NameValuePairs) when is_atom(Node) -> append_to_conf_file(Node, get_riak_conf(Node), NameValuePairs), ok. +set_advanced_conf(all, NameValuePairs) -> + lager:debug("rtssh:set_advanced_conf(all, ~p)", [NameValuePairs]), + Hosts = rt_config:get(rtssh_hosts), + All = [{Host, DevPath} || Host <- Hosts, + DevPath <- devpaths()], + rt:pmap(fun({Host, DevPath}) -> + AllFiles = all_the_files(Host, DevPath, "etc/advanced.config"), + [update_app_config_file(Host, File, NameValuePairs, undefined) || File <- AllFiles], + ok + end, All), + ok; +set_advanced_conf(Node, NameValuePairs) when is_atom(Node) -> + append_to_conf_file(Node, get_advanced_riak_conf(Node), NameValuePairs), + ok. + get_riak_conf(Node) -> node_path(Node) ++ "/etc/riak.conf". +get_advanced_riak_conf(Node) -> + node_path(Node) ++ "/etc/advanced.config". + append_to_conf_file(Node, File, NameValuePairs) -> Current = remote_read_file(Node, File), Settings = [[$\n, to_list(Name), $=, to_list(Val), $\n] || {Name, Val} <- NameValuePairs],