Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 6b4f9a5

Browse files
committed
update api
1 parent 481dfb3 commit 6b4f9a5

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

engine/cli/commands/engine_update_cmd.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "utils/cli_selection_utils.h"
55
#include "utils/curl_utils.h"
66
#include "utils/download_progress.h"
7+
#include "utils/json_helper.h"
78
#include "utils/logging_utils.h"
89
#include "utils/system_info_utils.h"
910
#include "utils/url_parser.h"
@@ -26,7 +27,6 @@ bool EngineUpdateCmd::Exec(const std::string& host, int port,
2627
auto dp_res = std::async(std::launch::deferred, [&dp, &engine] {
2728
return dp.Handle(DownloadType::Engine);
2829
});
29-
CLI_LOG("Validating download items, please wait..")
3030

3131
auto update_url = url_parser::Url{
3232
.protocol = "http",
@@ -35,7 +35,13 @@ bool EngineUpdateCmd::Exec(const std::string& host, int port,
3535
};
3636
auto update_result = curl_utils::SimplePostJson(update_url.ToFullPath());
3737
if (update_result.has_error()) {
38-
CTL_ERR(update_result.error());
38+
try {
39+
Json::Value json = json_helper::ParseJsonString(update_result.error());
40+
std::cout << json["message"].asString() << std::endl;
41+
} catch (const std::exception& e) {
42+
CTL_ERR(update_result.error());
43+
}
44+
3945
return false;
4046
}
4147

engine/controllers/engines.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ class Engines : public drogon::HttpController<Engines, false> {
2424
METHOD_ADD(Engines::UnloadEngine, "/{1}/load", Options, Delete);
2525
METHOD_ADD(Engines::UpdateEngine, "/{1}/update", Post);
2626
METHOD_ADD(Engines::ListEngine, "", Get);
27+
2728
METHOD_ADD(Engines::GetEngineVersions, "/{1}/versions", Get);
2829
METHOD_ADD(Engines::GetEngineVariants, "/{1}/versions/{2}", Get);
30+
METHOD_ADD(Engines::GetLatestEngineVersion, "/{1}/latest", Get);
2931

3032
ADD_METHOD_TO(Engines::GetInstalledEngineVariants, "/v1/engines/{1}", Get);
3133
ADD_METHOD_TO(Engines::InstallEngine,

0 commit comments

Comments
 (0)