./ct_report/coverage/service_admin_extra_node.COVER.html

1 %%%-------------------------------------------------------------------
2 %%% File : service_admin_extra_node.erl
3 %%% Author : Badlop <badlop@process-one.net>, Piotr Nosek <piotr.nosek@erlang-solutions.com>
4 %%% Purpose : Contributed administrative functions and commands
5 %%% Created : 10 Aug 2008 by Badlop <badlop@process-one.net>
6 %%%
7 %%%
8 %%% ejabberd, Copyright (C) 2002-2008 ProcessOne
9 %%%
10 %%% This program is free software; you can redistribute it and/or
11 %%% modify it under the terms of the GNU General Public License as
12 %%% published by the Free Software Foundation; either version 2 of the
13 %%% License, or (at your option) any later version.
14 %%%
15 %%% This program is distributed in the hope that it will be useful,
16 %%% but WITHOUT ANY WARRANTY; without even the implied warranty of
17 %%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 %%% General Public License for more details.
19 %%%
20 %%% You should have received a copy of the GNU General Public License
21 %%% along with this program; if not, write to the Free Software
22 %%% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 %%%
24 %%%-------------------------------------------------------------------
25
26 -module(service_admin_extra_node).
27 -author('badlop@process-one.net').
28
29 -export([commands/0,
30 get_cookie/0,
31 remove_node/1]).
32
33 -ignore_xref([
34 commands/0, load_config/1, get_cookie/0, remove_node/1
35 ]).
36
37 -include("ejabberd_commands.hrl").
38
39 %%%
40 %%% Register commands
41 %%%
42
43 -spec commands() -> [ejabberd_commands:cmd(), ...].
44 commands() ->
45 152 [
46 #ejabberd_commands{name = get_cookie, tags = [erlang],
47 desc = "Get the Erlang cookie of this node",
48 module = ?MODULE, function = get_cookie,
49 args = [],
50 result = {cookie, string}},
51 #ejabberd_commands{name = remove_node, tags = [erlang],
52 desc = "Remove a MongooseIM node from Mnesia clustering config",
53 module = ?MODULE, function = remove_node,
54 args = [{node, string}],
55 result = {res, rescode}}
56 ].
57
58
59 %%%
60 %%% Node
61 %%%
62
63
64 -spec get_cookie() -> string().
65 get_cookie() ->
66
:-(
atom_to_list(erlang:get_cookie()).
67
68
69 -spec remove_node(string()) -> 'ok'.
70 remove_node(Node) ->
71
:-(
mnesia:del_table_copy(schema, list_to_atom(Node)),
72
:-(
ok.
73
Line Hits Source