Skip to content

Commit

Permalink
Merge pull request #77 from Superbition/develop
Browse files Browse the repository at this point in the history
New Release Merge: v5.0.4
  • Loading branch information
danielashare authored May 30, 2021
2 parents efb2cec + 9d439f4 commit 08ceee4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 38 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [v5.0.4 (2021-05-30)](https://github.com/Superbition/Bakup-Agent/releases/tag/v5.0.4)

### Fixed
- Fixed an issue where jobs would only run when the agent was in debug mode (#76)

## [v5.0.3 (2021-05-30)](https://github.com/Superbition/Bakup-Agent/releases/tag/v5.0.3)

### Added
Expand Down
43 changes: 23 additions & 20 deletions src/Agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,30 +105,33 @@ bool Agent::getJob(Debug &debug, int retryCounter, int retryMaxCount)
this->jobs = job.getVectoredResponse();

// If debug mode is enabled
if(!jobs.empty() && debug.getDebugMode())
if(!jobs.empty())
{
// Print received jobs
debug.info("Commands received:");
for(const command_t &jobStruct: jobs)
if(debug.getDebugMode())
{
// Print the execution time of the job
debug.info("Job to execute at " + to_string(jobStruct.targetExecutionTime));

// Store the commands in a string for printing
string toPrint;
for(const string &command: jobStruct.commands)
// Print received jobs
debug.info("Commands received:");
for(const command_t &jobStruct: jobs)
{
toPrint.append(command + ", ");
// Print the execution time of the job
debug.info("Job to execute at " + to_string(jobStruct.targetExecutionTime));

// Store the commands in a string for printing
string toPrint;
for(const string &command: jobStruct.commands)
{
toPrint.append(command + ", ");
}

// Store the clean up commands in the toPrint string for printing
for(const string &command: jobStruct.cleanUpCommands)
{
toPrint.append(command + ", ");
}

// Print out command string without last comma
debug.info(toPrint.substr(0, toPrint.size()-2));
}

// Store the clean up commands in the toPrint string for printing
for(const string &command: jobStruct.cleanUpCommands)
{
toPrint.append(command + ", ");
}

// Print out command string without last comma
debug.info(toPrint.substr(0, toPrint.size()-2));
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion src/Agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Agent
const string apiVersion = "1";

// Version of the agent
const string agentVersion = "v5.0.3";
const string agentVersion = "v5.0.4";

// Program loop wait time in seconds
const int pollTime = 60;
Expand Down
17 changes: 0 additions & 17 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,6 @@ int main(int argc, char *argv[])
// Get the program loop wait time
int waitTime = agent.getWaitTime();

// If there is a command line argument
if(argc == 2)
{
// If the -d flag is passed
if(strcmp(argv[1], "-d") == 0)
{
// Set the debug class to true, to log to command line
debug.setDebugMode(true);
}
}
// If there is more than one command line argument
else if(argc > 2)
{
debug.error("Too many arguments passed");
return EXIT_FAILURE;
}

// Main program loop
while(true)
{
Expand Down

0 comments on commit 08ceee4

Please sign in to comment.