Debugging
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 2m10s

This commit is contained in:
Your Name
2025-05-25 19:17:51 +12:00
parent 1502d6e3d2
commit 8f06fc31ae
17 changed files with 220 additions and 188 deletions

View File

@@ -84,7 +84,7 @@ namespace dropshell
remote_command_script_file,
remotefile(server, user).service_env(service)}, user))
{
error << "Error: Required service directories not found on remote server" << std::endl;
error << "Required service directories not found on remote server" << std::endl;
info << "Is the service installed?" << std::endl;
return false;
}
@@ -103,7 +103,7 @@ namespace dropshell
std::string local_backups_dir = localpath::backups();
if (local_backups_dir.empty())
{
error << "Error: Local backups directory not found" << std::endl;
error << "Local backups directory not found" << std::endl;
info << "Run 'dropshell edit' to configure DropShell" << std::endl;
return false;
}

View File

@@ -94,11 +94,11 @@ int edit_config()
std::string config_file = localfile::dropshell_json();
if (!edit_file(config_file, false) || !std::filesystem::exists(config_file))
return die("Error: Failed to edit config file.");
return die("Failed to edit config file.");
gConfig().load_config();
if (!gConfig().is_config_set())
return die("Error: Failed to load and parse edited config file!");
return die("Failed to load and parse edited config file!");
gConfig().save_config(true);
@@ -112,7 +112,7 @@ int edit_config()
int edit_server(const std::string &server_name)
{
if (localpath::server(server_name).empty()) {
std::cerr << "Error: Server not found: " << server_name << std::endl;
error << "Server not found: " << server_name << std::endl;
return -1;
}

View File

@@ -334,7 +334,7 @@ complete -F _dropshell_completions ds
info << "Installing agent for user " << user.user << " on " << server.get_server_name() << std::endl;
std::string agent_path = remotepath(server.get_server_name(),user.user).agent();
ASSERT(agent_path == user.dir+"/agent", "Agent path does not match user directory for "+user.user+"@" + server.get_server_name() + " : " + agent_path + " != " + user.dir);
ASSERT(agent_path == user.dir+"/agent", "Remote agent path does not match user directory for "+user.user+"@" + server.get_server_name() + " : " + agent_path + " != " + user.dir);
ASSERT(!agent_path.empty(), "Agent path is empty for " + user.user + "@" + server.get_server_name());
// now create the agent.
@@ -348,7 +348,7 @@ complete -F _dropshell_completions ds
bool okay = execute_ssh_command(server.get_SSH_INFO(user.user), sCommand(agent_path, "agent-install.sh",{}), cMode::Defaults | cMode::NoBB64, nullptr);
if (!okay)
{
error << "ERROR: Failed to install remote agent on " << server.get_server_name() << std::endl;
error << "Failed to install remote agent on " << server.get_server_name() << std::endl;
return 1;
}

View File

@@ -147,7 +147,7 @@ void list_servers() {
void show_server_details(const std::string& server_name) {
ServerConfig env(server_name);
if (!env.is_valid()) {
error << "Error: Invalid server environment file: " << server_name << std::endl;
error << "Invalid server environment file: " << server_name << std::endl;
return;
}

View File

@@ -60,7 +60,7 @@ namespace dropshell
std::string local_backups_dir = localpath::backups();
if (local_backups_dir.empty() || !std::filesystem::exists(local_backups_dir))
{
error << "Error: Local backups directory not found: " << local_backups_dir << std::endl;
error << "Local backups directory not found: " << local_backups_dir << std::endl;
return {};
}
@@ -150,19 +150,19 @@ namespace dropshell
std::string local_backups_dir = localpath::backups();
if (local_backups_dir.empty() || !std::filesystem::exists(local_backups_dir))
{
error << "Error: Local backups directory not found: " << local_backups_dir << std::endl;
error << "Local backups directory not found: " << local_backups_dir << std::endl;
return 1;
}
std::string local_backup_file_path = (std::filesystem::path(local_backups_dir) / backup_details->get_filename()).string();
if (!std::filesystem::exists(local_backup_file_path))
{
error << "Error: Backup file not found at " << local_backup_file_path << std::endl;
error << "Backup file not found at " << local_backup_file_path << std::endl;
return 1;
}
if (backup_details->get_template_name() != service_info.template_name)
{
error << "Error: Backup template does not match service template. Can't restore." << std::endl;
error << "Backup template does not match service template. Can't restore." << std::endl;
info << "Backup template: " << backup_details->get_template_name() << std::endl;
info << "Service template: " << service_info.template_name << std::endl;
return 1;

View File

@@ -67,7 +67,7 @@ namespace dropshell
{
if (ctx.args.size() < 2)
{
std::cerr << "Error: Server name and service name are both required" << std::endl;
error << "Server name and service name are both required" << std::endl;
return 1;
}