Sha256: c08f67e51f00fec0cd0b09493568320014d484624c3dffbf85de234f0443a9f3

Contents?: true

Size: 1.17 KB

Versions: 12

Compression:

Stored size: 1.17 KB

Contents

-module(cap_external_runtime_api).
-export([handle_call/3, handle_cast/2]).



handle_call({nodes,
            _, _},
            _From, State) ->
  Nodes    = [atom_to_list(Node) || Node <- nodes()],
  Machines = [list_to_atom(Node) || Node <- Nodes, string:substr(Node, 1, 8) == "machine-"],
  {reply, [node() | Machines], State};



handle_call({selfupdate, [RawNode], _}, _From, State) ->
  try
    Node =
    case RawNode of
    RawNode when is_atom(RawNode)   -> RawNode;
    RawNode when is_list(RawNode)   -> list_to_atom(RawNode);
    RawNode when is_binary(RawNode) -> list_to_atom(binary_to_list(RawNode))
    end,
    {reply, cap_runtime:selfupdate(Node), State}
  catch
    throw:T -> {reply, {error, T}, State}
  end;



handle_call({reboot, [RawNode], _}, _From, State) ->
  try
    Node =
    case RawNode of
    RawNode when is_atom(RawNode)   -> RawNode;
    RawNode when is_list(RawNode)   -> list_to_atom(RawNode);
    RawNode when is_binary(RawNode) -> list_to_atom(binary_to_list(RawNode))
    end,
    {reply, cap_runtime:reboot(Node), State}
  catch
    throw:T -> {reply, {error, T}, State}
  end.



handle_cast({_, _, _},
            State) ->
  {noreply, State}.


Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
capricorn-2.0.11 erlang/lib/capricorn/src/cap_external_runtime_api.erl
capricorn-2.0.10 erlang/lib/capricorn/src/cap_external_runtime_api.erl
capricorn-2.0.9 erlang/lib/capricorn/src/cap_external_runtime_api.erl
capricorn-2.0.8 erlang/lib/capricorn/src/cap_external_runtime_api.erl
capricorn-2.0.7 erlang/lib/capricorn/src/cap_external_runtime_api.erl
capricorn-2.0.6 erlang/lib/capricorn/src/cap_external_runtime_api.erl
capricorn-2.0.5 erlang/lib/capricorn/src/cap_external_runtime_api.erl
capricorn-2.0.4 erlang/lib/capricorn/src/cap_external_runtime_api.erl
capricorn-2.0.3 erlang/lib/capricorn/src/cap_external_runtime_api.erl
capricorn-2.0.3.pre2 erlang/lib/capricorn/src/cap_external_runtime_api.erl
capricorn-2.0.3.pre erlang/lib/capricorn/src/cap_external_runtime_api.erl
capricorn-2.0.2 erlang/lib/capricorn/src/cap_external_runtime_api.erl