mirror of
https://github.com/valitydev/riak_test.git
synced 2024-11-07 08:58:52 +00:00
Add functions to directly manipulate advanced.config.
Even if most of the system is running under cuttlefish, replication may not be, and may require configuration placed directly in the advanced.config file. Add a method to the rtssh harness to provide direct manipulation of that file.
This commit is contained in:
parent
3330116b61
commit
8e6b043d84
10
src/rt.erl
10
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) ->
|
||||
|
@ -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],
|
||||
|
Loading…
Reference in New Issue
Block a user