This commit is contained in:
anlicheng 2025-05-07 17:40:41 +08:00
parent 22b4e9e9de
commit 9d4556a97e

View File

@ -105,16 +105,8 @@ handle_cast(deploy, State = #state{task_id = TaskId, root_dir = RootDir, service
%% 0: , 1: %% 0: , 1:
status = 0 status = 0
}), }),
efka_agent:feedback_phase(TaskId, efka_util:timestamp(), <<"deploy success">>),
%% {stop, normal, State};
case boot_service(ServiceId) of
{ok, Pid} when is_pid(Pid) ->
efka_agent:feedback_phase(TaskId, efka_util:timestamp(), <<"boot success">>),
{stop, normal, State};
{error, Reason} ->
efka_agent:feedback_phase(TaskId, efka_util:timestamp(), <<"boot failed">>),
{stop, {error, Reason}, State}
end;
{error, Reason} -> {error, Reason} ->
efka_agent:feedback_phase(TaskId, efka_util:timestamp(), <<"tar decompression error">>), efka_agent:feedback_phase(TaskId, efka_util:timestamp(), <<"tar decompression error">>),
{stop, {error, Reason}, State} {stop, {error, Reason}, State}
@ -238,16 +230,6 @@ check_download_url(Url) when is_list(Url) ->
{error, Reason} {error, Reason}
end. end.
-spec boot_service(ServiceId :: binary()) -> {ok, Pid :: pid()} | {error, Reason :: any()}.
boot_service(ServiceId) ->
%%
case efka_micro_service:get_pid(ServiceId) of
undefined ->
efka_micro_service_sup:start_service(ServiceId);
Pid ->
{ok, Pid}
end.
%% %%
-spec tar_extract(TarFile :: string(), TargetDir :: string()) -> ok | {error, Reason :: term()}. -spec tar_extract(TarFile :: string(), TargetDir :: string()) -> ok | {error, Reason :: term()}.
tar_extract(TarFile, TargetDir) when is_list(TarFile), is_list(TargetDir) -> tar_extract(TarFile, TargetDir) when is_list(TarFile), is_list(TargetDir) ->