Browse Source

rename dist to dist_node

pull/1132/head
Fred Hebert 9 years ago
parent
commit
410de349d1
2 changed files with 10 additions and 10 deletions
  1. +2
    -2
      src/rebar_dist_utils.erl
  2. +8
    -8
      test/rebar_dist_utils_SUITE.erl

+ 2
- 2
src/rebar_dist_utils.erl View File

@ -64,7 +64,7 @@ find_name_options(State) ->
case {proplists:get_value(name, Opts), proplists:get_value(sname, Opts)} of
{undefined, undefined} ->
%% Else try the config file
DistOpts = rebar_state:get(State, dist, []),
DistOpts = rebar_state:get(State, dist_node, []),
%% Pick the first one seen to support profile merges
find_first_name(DistOpts);
Res ->
@ -82,7 +82,7 @@ find_cookie_option(State) ->
case proplists:get_value(setcookie, Opts) of
undefined ->
%% Else try the config file
DistOpts = rebar_state:get(State, dist, []),
DistOpts = rebar_state:get(State, dist_node, []),
proplists:get_value(setcookie, DistOpts, nocookie);
Res ->
Res

+ 8
- 8
test/rebar_dist_utils_SUITE.erl View File

@ -20,12 +20,12 @@ end_per_testcase(_, _) ->
ok.
from_config(Config) ->
ShortConfig = [{dist, [{sname, 'a@localhost'}, {setcookie, abc}]}],
LongConfig = [{dist, [{name, 'a@localhost.x'}, {setcookie, abc}]}],
BothConfig = [{dist, [{sname, 'a@localhost'}, {name, 'a@localhost.x'}, {setcookie,abc}]}],
ShortConfig = [{dist_node, [{sname, 'a@localhost'}, {setcookie, abc}]}],
LongConfig = [{dist_node, [{name, 'a@localhost.x'}, {setcookie, abc}]}],
BothConfig = [{dist_node, [{sname, 'a@localhost'}, {name, 'a@localhost.x'}, {setcookie,abc}]}],
NoConfig = [],
CookieConfig = [{dist, [{setcookie, def}]}],
NoCookie = [{dist, [{sname, 'a@localhost'}]}],
CookieConfig = [{dist_node, [{setcookie, def}]}],
NoCookie = [{dist_node, [{sname, 'a@localhost'}]}],
{ok, State0} = rebar_test_utils:run_and_check(Config, ShortConfig, ["version"], return),
{undefined, 'a@localhost', [{setcookie, abc}]} = rebar_dist_utils:find_options(State0),
{ok, State1} = rebar_test_utils:run_and_check(Config, LongConfig, ["version"], return),
@ -59,7 +59,7 @@ from_cli(Config) ->
overlap(Config) ->
%% Make sure that CLI config takes over rebar config without clash for names, though
%% cookies can pass through
RebarConfig = [{dist, [{sname, 'a@localhost'}, {setcookie, abc}]}],
RebarConfig = [{dist_node, [{sname, 'a@localhost'}, {setcookie, abc}]}],
{ok, State0} = rebar_test_utils:run_and_check(Config, RebarConfig, ["version"], return),
State1 = rebar_state:command_parsed_args(State0, {[{name, 'b@localhost.x'}], []}),
{'b@localhost.x', undefined, [{setcookie, abc}]} = rebar_dist_utils:find_options(State1),
@ -67,8 +67,8 @@ overlap(Config) ->
from_config_profile(Config) ->
%% running as a profile does not create name clashes
RebarConfig = [{dist, [{sname, 'a@localhost'}, {setcookie, abc}]},
{profiles, [ {fake, [{dist, [{name, 'a@localhost.x'}]}]} ]}],
RebarConfig = [{dist_node, [{sname, 'a@localhost'}, {setcookie, abc}]},
{profiles, [ {fake, [{dist_node, [{name, 'a@localhost.x'}]}]} ]}],
{ok, State0} = rebar_test_utils:run_and_check(Config, RebarConfig, ["as","fake","version"], return),
{'a@localhost.x', undefined, [{setcookie, abc}]} = rebar_dist_utils:find_options(State0),
ok.

Loading…
Cancel
Save