Update source/src/utils/execute.cpp
This commit is contained in:
@@ -204,14 +204,29 @@ namespace dropshell
|
|||||||
if (!hasFlag(mode, cMode::NoBB64))
|
if (!hasFlag(mode, cMode::NoBB64))
|
||||||
remote_bb64_path = remotepath(ssh_info.get_server_ID(), ssh_info.get_user()).agent() + "/bb64";
|
remote_bb64_path = remotepath(ssh_info.get_server_ID(), ssh_info.get_user()).agent() + "/bb64";
|
||||||
|
|
||||||
|
// Capture output to check for AGENT_MISMATCH (but not in Interactive mode)
|
||||||
|
std::string captured_output;
|
||||||
|
std::string* output_ptr = output;
|
||||||
|
if (!hasFlag(mode, cMode::Interactive) && output == nullptr)
|
||||||
|
output_ptr = &captured_output;
|
||||||
|
|
||||||
bool rval = execute_local_command(
|
bool rval = execute_local_command(
|
||||||
"", // local directory to run in
|
"", // local directory to run in
|
||||||
ssh_cmd.str() + " " + remote_command.construct_cmd(remote_bb64_path), // local command to run
|
ssh_cmd.str() + " " + remote_command.construct_cmd(remote_bb64_path), // local command to run
|
||||||
{}, // environment variables
|
{}, // environment variables
|
||||||
output, // output string
|
output_ptr, // output string
|
||||||
mode // mode
|
mode // mode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Check for agent mismatch error
|
||||||
|
if (!rval && output_ptr != nullptr && output_ptr->find("AGENT_MISMATCH:") != std::string::npos)
|
||||||
|
{
|
||||||
|
error << "Agent version mismatch detected!" << std::endl;
|
||||||
|
error << "The remote agent on " << ssh_info.get_host() << " is out of date." << std::endl;
|
||||||
|
info << "Run 'ds install " << ssh_info.get_server_ID() << "' to update the agent." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!rval && !hasFlag(mode, cMode::Silent))
|
if (!rval && !hasFlag(mode, cMode::Silent))
|
||||||
{
|
{
|
||||||
error << "Failed to execute ssh command" << std::endl;
|
error << "Failed to execute ssh command" << std::endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user