-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Gitee Indexea management page.
Signed-off-by: EdmondFrank <[email protected]>
- Loading branch information
1 parent
809a1b3
commit c789b2e
Showing
13 changed files
with
493 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/compass_admin/agents/base_agent.ex → lib/compass_admin/agents/deploy_agent.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
defmodule CompassAdmin.Agents.ExecAgent do | ||
use GenServer | ||
|
||
@exec_timeout 60_000 | ||
|
||
def start_link(args) do | ||
GenServer.start_link(__MODULE__, args, name: __MODULE__) | ||
end | ||
|
||
def init(args) do | ||
{:ok, args} | ||
end | ||
|
||
def shell_exec(cmd) do | ||
GenServer.call(__MODULE__, {:shell_exec, cmd}, @exec_timeout) | ||
end | ||
|
||
def handle_call({:shell_exec, cmd}, _from, state) do | ||
try do | ||
result = | ||
Exile.stream!(["bash", "-l", "-c", cmd]) | ||
|> Enum.into("") | ||
|
||
{:reply, {:ok, result}, state} | ||
rescue | ||
e in Exile.Stream.AbnormalExit -> {:reply, {:error, e.exit_status, e.message}, state} | ||
_ -> {:reply, {:error, -1, "Unknown error"}, state} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,4 +54,6 @@ defmodule CompassAdmin.User do | |
def backend_dev_role, do: 7 | ||
|
||
def super_role, do: 10 | ||
|
||
def admin_role, do: 65535 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.