Skip to content

Commit

Permalink
Add simple escript to modify advanced.config.
Browse files Browse the repository at this point in the history
In the future we should fix the tests to actually use a non-test
backend configuration properly, but for now we can apply our
customization directly to the advanced.config file, even against
riak_ee which will ship with settings already in advanced.config.
  • Loading branch information
seancribbs committed Jul 9, 2014
1 parent 916d5a1 commit 4e8b7ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion buildbot/Makefile
Expand Up @@ -7,7 +7,7 @@ RIAK_ADMIN = ${RIAK_DIR}/bin/riak-admin
preconfigure:
echo "storage_backend = memory" >> ${RIAK_CONF}
echo "anti_entropy = passive" >> ${RIAK_CONF}
echo "[{riak_kv,[{test,true}]}]." > ${ADVANCED_CONF}
./add_to_advanced_config ${ADVANCED_CONF} '{riak_kv,[{test,true}]}.'
echo "search = on" >> ${RIAK_CONF}
echo "listener.protobuf.internal = 127.0.0.1:8087" >> ${RIAK_CONF}
echo "distributed_cookie = riak" >> ${RIAK_CONF}
Expand Down
11 changes: 11 additions & 0 deletions buildbot/add_to_advanced_config
@@ -0,0 +1,11 @@
#!/usr/bin/env escript
%% -*- erlang -*-
main([File|Additions]) ->
{ok, Settings} = file:consult(File),
Terms = [ begin
{ok, Tokens, _} = erl_scan:string(String),
{ok, Term} = erl_parse:parse_term(Tokens),
Term
end || String <- Additions ],
Merged = lists:flatten(Terms++Settings),
file:write_file(File, io_lib:format("~p.",[Merged])).

5 comments on commit 4e8b7ad

@macintux
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on my testing, this doesn't handle the case where riak_kv already exists in advanced.config.

@macintux
Copy link
Contributor

Choose a reason for hiding this comment

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

Specifically, it creates 2 distinct riak_kv sections instead of merging them.

@seancribbs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'm aware, but for the sake of the builder it doesn't matter because the node is thrown away and rebuilt on each run.

@macintux
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure my email did anything, so: does it work? Will Riak merge the configuration blocks at launch and recognize all of the riak_kv settings?

@seancribbs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Look at the build output, it works. 😄

Please sign in to comment.