Refactor! Compiles...
This commit is contained in:
@ -31,8 +31,8 @@ typedef struct ServiceStatus {
|
||||
|
||||
class service_runner {
|
||||
public:
|
||||
service_runner();
|
||||
bool init(const std::string& server_name, const std::string& service_name);
|
||||
service_runner(const std::string& server_name, const std::string& service_name);
|
||||
bool isValid;
|
||||
|
||||
// run a command over ssh, using the credentials from server.env (via server_env.hpp)
|
||||
// first check that the command corresponds to a valid .sh file in the service directory
|
||||
@ -89,42 +89,17 @@ class service_runner {
|
||||
|
||||
private:
|
||||
std::string m_server_name;
|
||||
server_env m_server_env;
|
||||
ServiceInfo m_service_info;
|
||||
std::unique_ptr<server_env> m_server_env;
|
||||
bool mValid;
|
||||
|
||||
std::string mRemote_service_path;
|
||||
std::string mRemote_service_config_path;
|
||||
std::string mRemote_service_template_path;
|
||||
std::string mRemote_service_env_file;
|
||||
|
||||
public:
|
||||
std::string sr_get_server_name() const { return m_server_name; }
|
||||
std::string sr_get_service_name() const { return m_service_info.service_name; }
|
||||
std::string sr_get_service_path() const { return m_service_info.path; }
|
||||
std::string sr_get_service_template_name() const { return m_service_info.template_name; }
|
||||
std::string sr_get_local_service_template_path() const { return m_service_info.template_local_path; }
|
||||
|
||||
ServiceInfo sr_get_service_info() const { return m_service_info; }
|
||||
const server_env& sr_get_server_env() const { ASSERT(m_server_env); return *m_server_env; }
|
||||
|
||||
const std::string& sr_get_remote_service_path() const { return mRemote_service_path; }
|
||||
const std::string& sr_get_remote_service_config_path() const { return mRemote_service_config_path; }
|
||||
const std::string& sr_get_remote_service_template_path() const { return mRemote_service_template_path; }
|
||||
const std::string& sr_get_remote_service_env_file() const { return mRemote_service_env_file; }
|
||||
|
||||
// Helper methods
|
||||
public:
|
||||
static std::string construct_ssh_cmd(const server_env &env);
|
||||
|
||||
std::string construct_ssh_cmd() const;
|
||||
std::string construct_standard_command_run_cmd(const std::string& command) const;
|
||||
|
||||
bool check_remote_dir_exists(const std::string& dir_path) const;
|
||||
bool check_remote_file_exists(const std::string& file_path) const;
|
||||
bool check_remote_items_exist(const std::vector<std::string>& file_paths) const;
|
||||
bool execute_ssh_command(const std::string& command, const std::string& error_msg) const;
|
||||
bool execute_local_command(const std::string& command, const std::string& error_msg) const;
|
||||
static bool execute_local_command_and_capture_output(const std::string& command, std::string & output);
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user