WIP: AST change {chain,...} thingie
This commit is contained in:
parent
c37f23d97a
commit
6a5c590ad1
2 changed files with 14 additions and 18 deletions
|
@ -574,6 +574,8 @@ process_pending_chain2(File, CD, RemovedFLUs, ChainConfigAction, S) ->
|
||||||
Dst2 = MyPreserveDir ++ "/" ++ FLU_str ++ ".data",
|
Dst2 = MyPreserveDir ++ "/" ++ FLU_str ++ ".data",
|
||||||
lager:info("Stopped FLU ~w: rename ~s ~s\n",
|
lager:info("Stopped FLU ~w: rename ~s ~s\n",
|
||||||
[FLU, Src2, Dst2]),
|
[FLU, Src2, Dst2]),
|
||||||
|
%% TODO: If EXDEV, then we should rename to
|
||||||
|
%% another dir on same device, but ... where?
|
||||||
_ = file:rename(Src2, Dst2),
|
_ = file:rename(Src2, Dst2),
|
||||||
ok
|
ok
|
||||||
end || FLU <- LocalRemovedFLUs]
|
end || FLU <- LocalRemovedFLUs]
|
||||||
|
@ -639,19 +641,15 @@ check_an_ast_tuple({host, Name, AdminI, ClientI, Props}) ->
|
||||||
check_an_ast_tuple({flu, Name, HostName, Port, Props}) ->
|
check_an_ast_tuple({flu, Name, HostName, Port, Props}) ->
|
||||||
is_stringy(Name) andalso is_stringy(HostName) andalso
|
is_stringy(Name) andalso is_stringy(HostName) andalso
|
||||||
is_porty(Port) andalso is_proplisty(Props);
|
is_porty(Port) andalso is_proplisty(Props);
|
||||||
check_an_ast_tuple({chain, Name, AddList, RemoveList, Props}) ->
|
check_an_ast_tuple({chain, Name, FullList, Props}) ->
|
||||||
is_stringy(Name) andalso
|
is_stringy(Name) andalso
|
||||||
lists:all(fun is_stringy/1, AddList) andalso
|
lists:all(fun is_stringy/1, FullList) andalso
|
||||||
lists:all(fun is_stringy/1, RemoveList) andalso
|
|
||||||
is_proplisty(Props);
|
is_proplisty(Props);
|
||||||
check_an_ast_tuple({chain, Name, CMode, AddList, Add_Witnesses,
|
check_an_ast_tuple({chain, Name, CMode, FullList, Witnesses, Props}) ->
|
||||||
RemoveList, Remove_Witnesses, Props}) ->
|
|
||||||
is_stringy(Name) andalso
|
is_stringy(Name) andalso
|
||||||
(CMode == ap_mode orelse CMode == cp_mode) andalso
|
(CMode == ap_mode orelse CMode == cp_mode) andalso
|
||||||
lists:all(fun is_stringy/1, AddList) andalso
|
lists:all(fun is_stringy/1, FullList) andalso
|
||||||
lists:all(fun is_stringy/1, Add_Witnesses) andalso
|
lists:all(fun is_stringy/1, Witnesses) andalso
|
||||||
lists:all(fun is_stringy/1, RemoveList) andalso
|
|
||||||
lists:all(fun is_stringy/1, Remove_Witnesses) andalso
|
|
||||||
is_proplisty(Props);
|
is_proplisty(Props);
|
||||||
check_an_ast_tuple(switch_old_and_new) ->
|
check_an_ast_tuple(switch_old_and_new) ->
|
||||||
true;
|
true;
|
||||||
|
@ -675,12 +673,10 @@ normalize_an_ast_tuple({host, Name, AdminI, ClientI, Props}) ->
|
||||||
{host, Name, AdminI, ClientI, n(Props2)};
|
{host, Name, AdminI, ClientI, n(Props2)};
|
||||||
normalize_an_ast_tuple({flu, Name, HostName, Port, Props}) ->
|
normalize_an_ast_tuple({flu, Name, HostName, Port, Props}) ->
|
||||||
{flu, Name, HostName, Port, n(Props)};
|
{flu, Name, HostName, Port, n(Props)};
|
||||||
normalize_an_ast_tuple({chain, Name, AddList, RemoveList, Props}) ->
|
normalize_an_ast_tuple({chain, Name, FullList, Props}) ->
|
||||||
{chain, Name, ap_mode, n(AddList), [], n(RemoveList), [], n(Props)};
|
{chain, Name, ap_mode, n(FullList), [], n(Props)};
|
||||||
normalize_an_ast_tuple({chain, Name, CMode, AddList, Add_Witnesses,
|
normalize_an_ast_tuple({chain, Name, CMode, FullList, Witnesses, Props}) ->
|
||||||
RemoveList, Remove_Witnesses, Props}) ->
|
{chain, Name, CMode, n(FullList), n(Witnesses), n(Props)};
|
||||||
{chain, Name, CMode, n(AddList), n(Add_Witnesses),
|
|
||||||
n(RemoveList), n(Remove_Witnesses), n(Props)};
|
|
||||||
normalize_an_ast_tuple(A=switch_old_and_new) ->
|
normalize_an_ast_tuple(A=switch_old_and_new) ->
|
||||||
A.
|
A.
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ ast_tuple_syntax_test() ->
|
||||||
{admin_interface, "5.6.7.8"}]},
|
{admin_interface, "5.6.7.8"}]},
|
||||||
{flu, "fx", "foohost", 4000, []},
|
{flu, "fx", "foohost", 4000, []},
|
||||||
switch_old_and_new,
|
switch_old_and_new,
|
||||||
{chain, "cy", ["fx", "fy"], ["fz"], [{foo,"yay"},{bar,baz}]} ],
|
{chain, "cy", ["fx", "fy"], [{foo,"yay"},{bar,baz}]} ],
|
||||||
|
|
||||||
{_Good,[]=_Bad} = T(Canon1),
|
{_Good,[]=_Bad} = T(Canon1),
|
||||||
Canon1_norm = machi_lifecycle_mgr:normalize_ast_tuple_syntax(Canon1),
|
Canon1_norm = machi_lifecycle_mgr:normalize_ast_tuple_syntax(Canon1),
|
||||||
|
@ -180,9 +180,9 @@ ast_tuple_syntax_test() ->
|
||||||
{flu, "fx", "foohost", 4000, gack},
|
{flu, "fx", "foohost", 4000, gack},
|
||||||
{flu, "fx", "foohost", 4000, [22]} ]),
|
{flu, "fx", "foohost", 4000, [22]} ]),
|
||||||
{[],[_,_,_]} =
|
{[],[_,_,_]} =
|
||||||
T([ {chain, 'cy', ["fx", "fy"], ["fz"], [foo,{bar,baz}]},
|
T([ {chain, 'cy', ["fx", "fy"], [foo,{bar,baz}]},
|
||||||
yoloyolo,
|
yoloyolo,
|
||||||
{chain, "cy", ["fx", 27], ["fz"], oops,arity,way,way,way,too,big,x}
|
{chain, "cy", ["fx", 27], oops,arity,way,way,way,too,big,x}
|
||||||
]).
|
]).
|
||||||
|
|
||||||
ast_run_test() ->
|
ast_run_test() ->
|
||||||
|
|
Loading…
Reference in a new issue