From 49b1475ffd03a3701c147d3722b3d540735d261e Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 15 May 2025 00:01:26 +1200 Subject: [PATCH] Remote create not working yet. --- make_createagent.sh | 6 +++++- src/commands/install.cpp | 4 +++- src/utils/createagent.cpp | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/make_createagent.sh b/make_createagent.sh index 629e7d9..a5775b6 100755 --- a/make_createagent.sh +++ b/make_createagent.sh @@ -84,7 +84,11 @@ namespace dropshell { // create the sh file on the remote server. for (const auto &file : agent_files) { // write out the file contents in the file. - remote_write_file(server_env.get_SSH_INFO(), file); + if (remote_write_file(server_env.get_SSH_INFO(), file) != 0) { + std::cerr << "Failed to write file " << file.filename << std::endl; + return 1; + } + std::cout << "Wrote file " << file.filename << " on " << server_name << std::endl; } return 0; diff --git a/src/commands/install.cpp b/src/commands/install.cpp index d042f4f..b570999 100644 --- a/src/commands/install.cpp +++ b/src/commands/install.cpp @@ -5,7 +5,7 @@ #include "templates.hpp" #include "shared_commands.hpp" #include "utils/hash.hpp" - +#include "utils/createagent.hpp" #include #include #include @@ -329,6 +329,8 @@ namespace dropshell else std::cout << "Downloaded bb64 to " << agent_path << " on remote server." << std::endl; + // now create the agent. + create_agent(server); return 0; // NOTIMPL } diff --git a/src/utils/createagent.cpp b/src/utils/createagent.cpp index 94742e3..8a09a45 100644 --- a/src/utils/createagent.cpp +++ b/src/utils/createagent.cpp @@ -48,7 +48,11 @@ namespace dropshell { // create the sh file on the remote server. for (const auto &file : agent_files) { // write out the file contents in the file. - remote_write_file(server_env.get_SSH_INFO(), file); + if (remote_write_file(server_env.get_SSH_INFO(), file) != 0) { + std::cerr << "Failed to write file " << file.filename << std::endl; + return 1; + } + std::cout << "Wrote file " << file.filename << " on " << server_name << std::endl; } return 0;