Permalink
Browse files

verx: allow passing in transport type

Use short form as argument, rather than the module name.
  • Loading branch information...
1 parent 9407e2f commit e08daa4a9f0f7f20712a17714dd6f461c2d4ad07 @msantos committed Feb 3, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 bin/verx
View
9 bin/verx
@@ -360,8 +360,8 @@ connect(Opt0) ->
Opt = proplists:substitute_aliases([{"connect", "uri"}], Opt0),
URI = proplists:get_value("uri", Opt, "qemu:///system"),
- Transport = list_to_atom(proplists:get_value("transport", Opt,
- "verx_client_unix")),
+ Transport = transport(list_to_atom(proplists:get_value("transport", Opt,
+ "verx_client_unix"))),
% Unix socket
Path = proplists:get_value("path", Opt, ?LIBVIRT_SOCK_PATH),
@@ -391,6 +391,11 @@ connect(Opt0) ->
ok = verx:open(Ref, [URI, 0]),
{ok, Ref}.
+transport(tcp) -> verx_client_tcp;
+transport(tls) -> verx_client_tls;
+transport(unix) -> verx_client_unix;
+transport(N) -> N.
+
getopt(Opts0) ->
Opts = lists:flatmap(fun(X)-> string:tokens(X, "=") end, Opts0),
getopt(Opts, []).

0 comments on commit e08daa4

Please sign in to comment.