Big refactor
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled

This commit is contained in:
Your Name
2025-05-23 22:06:37 +12:00
parent 048345c636
commit 462d215d5c
24 changed files with 615 additions and 621 deletions

View File

@@ -1,7 +1,7 @@
#include "shared_commands.hpp"
#include "utils/assert.hpp"
#include "utils/utils.hpp"
#include "server_env_manager.hpp"
#include "servers.hpp"
#include "directories.hpp"
#include "services.hpp"
#include "servers.hpp"
@@ -21,10 +21,10 @@ namespace dropshell
if (ctx.args.size() == 0)
{ // just the command, no args yet.
// list servers
std::vector<ServerInfo> servers = get_configured_servers();
std::vector<server_config> servers = get_configured_servers();
for (const auto &server : servers)
{
rawout << server.name << std::endl;
rawout << server.get_server_name() << std::endl;
}
}
else if (ctx.args.size() == 1)
@@ -54,7 +54,7 @@ namespace dropshell
bool rsync_tree_to_remote(
const std::string &local_path,
const std::string &remote_path,
server_env_manager &server_env,
server_config &server_env,
bool silent)
{
ASSERT(!local_path.empty() && !remote_path.empty(), "Local or remote path not specified. Can't rsync.");
@@ -84,7 +84,7 @@ namespace dropshell
// ------------------------------------------------------------------------------------------------
// cRemoteTempFolder : SHARED CLASS
// ------------------------------------------------------------------------------------------------
cRemoteTempFolder::cRemoteTempFolder(const server_env_manager &server_env, std::string user) :
cRemoteTempFolder::cRemoteTempFolder(const server_config &server_env, std::string user) :
mServerEnv(server_env), mUser(user)
{
std::string p = remotepath(server_env.get_server_name(),user).temp_files() + "/" + random_alphanumeric_string(10);
@@ -113,7 +113,7 @@ namespace dropshell
{
std::map<std::string, ServiceStatus> status;
server_env_manager env(server_name);
server_config env(server_name);
if (!env.is_valid())
{
error << "Invalid server environment" << std::endl;
@@ -214,7 +214,7 @@ namespace dropshell
// ------------------------------------------------------------------------------------------------
HealthStatus is_healthy(const std::string &server, const std::string &service)
{
server_env_manager env(server);
server_config env(server);
if (!env.is_valid())
{
error << "Server service not initialized" << std::endl;
@@ -307,7 +307,7 @@ namespace dropshell
// ------------------------------------------------------------------------------------------------
// scp_file_to_remote : SHARED COMMAND
// ------------------------------------------------------------------------------------------------
bool scp_file_to_remote(const server_env_manager &server_env, const std::string &local_path, const std::string &remote_path, bool silent)
bool scp_file_to_remote(const server_config &server_env, const std::string &local_path, const std::string &remote_path, bool silent)
{
if (!server_env.is_valid())
{
@@ -322,7 +322,7 @@ namespace dropshell
// ------------------------------------------------------------------------------------------------
// scp_file_from_remote : SHARED COMMAND
// ------------------------------------------------------------------------------------------------
bool scp_file_from_remote(const server_env_manager &server_env, const std::string &remote_path, const std::string &local_path, bool silent)
bool scp_file_from_remote(const server_config &server_env, const std::string &remote_path, const std::string &local_path, bool silent)
{
if (!server_env.is_valid())
{