Configure FLUs and chains with "rc.d" style configuration #56

Merged
slfritchie merged 43 commits from slf/flu-config-rcd-style into master 2015-12-18 06:46:05 +00:00
2 changed files with 17 additions and 9 deletions
Showing only changes of commit df8eea8c10 - Show all commits

View file

@ -295,7 +295,7 @@ get_initial_chains() ->
sanitize_chain_def_records(CDefs).
sanitize_chain_def_records(Ps) ->
{Sane, _} = lists:foldl(fun sanitize_chain_def_rec/2, {[], dict:new()}, Ps),
{Sane, _} = lists:foldl(fun sanitize_chain_def_rec/2, {[], gb_trees:empty()}, Ps),
Sane.
sanitize_chain_def_rec(Whole, {Acc, D}) ->
@ -306,7 +306,7 @@ sanitize_chain_def_rec(Whole, {Acc, D}) ->
witnesses=Witnesses} = Whole,
{true, 10} = {is_atom(Name), 10},
NameK = {name, Name},
{error, 20} = {dict:find(NameK, D), 20},
{none, 20} = {gb_trees:lookup(NameK, D), 20},
{true, 30} = {(Mode == ap_mode orelse Mode == cp_mode), 30},
IsPSrvr = fun(X) when is_record(X, p_srvr) -> true;
(_) -> false
@ -315,7 +315,7 @@ sanitize_chain_def_rec(Whole, {Acc, D}) ->
{true, 50} = {lists:all(IsPSrvr, Witnesses), 50},
%% All is sane enough.
D2 = dict:store(NameK, Name, D),
D2 = gb_trees:enter(NameK, Name, D),
{[Whole|Acc], D2}
catch X:Y ->
lager:error("~s: Bad chain_def record (~w ~w), skipping: ~P\n",
@ -892,3 +892,6 @@ is_stringy(L) ->
is_porty(Port) ->
is_integer(Port) andalso 1024 =< Port andalso Port =< 65535.
diff_env({KV_old, KV_new, _IsNew}) ->
yo.

View file

@ -196,11 +196,10 @@ ast_run_test() ->
{chain, "ca", ["f0", "f1", "f2"], []}
],
{ok, X1} = machi_lifecycle_mgr:run_ast(R1),
Y1 = {lists:sort(dict:to_list(element(1, X1))),
lists:sort(dict:to_list(element(2, X1))),
element(3, X1)},
{ok, Env1} = machi_lifecycle_mgr:run_ast(R1),
Y1 = {lists:sort(dict:to_list(element(1, Env1))),
lists:sort(dict:to_list(element(2, Env1))),
element(3, Env1)},
io:format(user, "\nY1 ~p\n", [Y1]),
Negative_after_R1 =
@ -216,7 +215,13 @@ ast_run_test() ->
[begin
io:format(user, "Neg ~p\n", [Neg]),
{error, _} = machi_lifecycle_mgr:run_ast(R1 ++ [Neg])
end || Neg <- Negative_after_R1].
end || Neg <- Negative_after_R1],
%% %% The 'run' phase doesn't blow smoke. What about 'diff'.
%% {ok, X2} = machi_lifecycle_mgr:diff_env(Env1),
%% io:format(user, "X2: ~p\n", [X2]),
ok.
-endif. % !PULSE
-endif. % TEST