Skip to content

Commit

Permalink
MB-15252 Collect the result of resolving cluster nodes.
Browse files Browse the repository at this point in the history
Change-Id: Iaa449228520c8e0fa41b04c39caf911ca7c9c756
Reviewed-on: http://review.couchbase.org/52632
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Artem Stemkovski <artem@couchbase.com>
  • Loading branch information
aartamonau authored and vzasade committed Jun 29, 2015
1 parent 1347e18 commit 8e317aa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
17 changes: 16 additions & 1 deletion cbcollect_info
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,21 @@ def make_product_task(guts, initargs_path, options):
if options.single_node_diag:
diag_url += "&oneNode=1"


from distutils.spawn import find_executable

lookup_cmd = None
for cmd in ["dig", "nslookup", "host"]:
if find_executable(cmd) is not None:
lookup_cmd = cmd
break

lookup_tasks = []
if lookup_cmd is not None:
lookup_tasks = [UnixTask("DNS lookup information for %s" % node,
"%(lookup_cmd)s '%(node)s'" % locals())
for node in correct_split(read_guts(guts, "nodes"), ",")]

_tasks = [
UnixTask("Directory structure",
["ls", "-lRai", root]),
Expand Down Expand Up @@ -535,7 +550,7 @@ def make_product_task(guts, initargs_path, options):
log_file="stats.log")]
]

_tasks = flatten(_tasks)
_tasks = lookup_tasks + flatten(_tasks)

return _tasks

Expand Down
9 changes: 8 additions & 1 deletion scripts/dump-guts
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ main_with_everything(StaticTerms, NSConfig, CouchInisPList, Node) ->
""),
NSLog = (catch read_ns_log(NSLogPath)),

Nodes = [node_host(N) || N <- search_config(NSConfig, nodes_wanted, [])],

Pairs = [{ns_config, iolist_to_binary(io_lib:format("~p", [sanitize_config(NSConfig)]))},
{static_config, iolist_to_binary(io_lib:format("~p", [StaticTerms]))},
{couch_inis, confget(#config.couch_inis)},
Expand All @@ -627,7 +629,8 @@ main_with_everything(StaticTerms, NSConfig, CouchInisPList, Node) ->
{memcached_admin, MCDAdmin},
{memcached_pass, MCDPass},
{memcached_logs_path, MCDLogs},
{memcached_breakpad_minidump_dir, PerNodeMDD}],
{memcached_breakpad_minidump_dir, PerNodeMDD},
{nodes, string:join(Nodes, ",")}],

output([E || {K, V} <- Pairs,
E <- [K, V]]),
Expand All @@ -644,6 +647,10 @@ read_ns_log(Path) ->
B1 = zlib:uncompress(B),
binary_to_term(B1).

node_host(Node) ->
[_, Host | _] = string:tokens(atom_to_list(Node), "@"),
Host.

binarify_output_item(Binary) when is_binary(Binary) -> Binary;
binarify_output_item(Atom) when is_atom(Atom) -> atom_to_binary(Atom, latin1);
binarify_output_item(Int) when is_integer(Int) -> integer_to_list(Int);
Expand Down

0 comments on commit 8e317aa

Please sign in to comment.