Commit 9c16afae authored by Diego Giovane Pasqualin's avatar Diego Giovane Pasqualin

Merge branch 'issue/138' into 'development'

SCRUM#138 - Test proxy connection between agent client and simmc web service

See merge request !99
parents 28136d26 5f85f166
Pipeline #12490 passed with stages
in 58 minutes and 34 seconds
......@@ -66,11 +66,13 @@ testDebian:
script:
- apt-get update && apt-get install -y git jq faketime expect cron
- git clone https://github.com/sstephenson/bats.git
- ./agent-1234.run --quiet
- cd bats
- ./install.sh /usr
- cd ../test
- ./create_users.sh
- last -F
- cat /opt/agentC3SL/conf/datasid-conf.json
- ./returnTest.bats
dependencies:
- compileUnix
......@@ -82,9 +84,11 @@ testUbuntu:
- regular
script:
- apt-get update && apt-get install -y bats jq faketime expect cron
- ./agent-1234.run --quiet
- cd test
- ./create_users.sh
- last -F
- cat /opt/agentC3SL/conf/datasid-conf.json
- ./returnTest.bats
dependencies:
- compileUnix
......@@ -99,9 +103,11 @@ testOpensuse:
- touch /var/log/wtmp
- chown root.tty /var/log/wtmp
- chmod 664 /var/log/wtmp
- ./agent-1234.run --quiet
- cd test
- ./create_users.sh
- last -F
- cat /opt/agentC3SL/conf/datasid-conf.json
- ./returnTest.bats
dependencies:
- compileUnix
......
......@@ -11,6 +11,7 @@ Using *Linux* as default
- c++ compiler
- cmake
- libudev
- make-self
<a name="HeaderBuildingAndCompiling"></a>
......
{
"idPoint" : "%d",
"proxyConf" : "%s",
"webService": "%s",
"version": "%s",
"project" : "%s"
"idPoint" : "%d",
"project" : "%s",
"proxyConf" : "%s",
"version" : "%s",
"webService" : "%s"
}
\ No newline at end of file
......@@ -3,4 +3,4 @@
"port" : "%d",
"usr" : "%s",
"password" : "%s"
}
}
\ No newline at end of file
......@@ -101,7 +101,7 @@ tmp=$(cat ../../../conf/proxy-conf.json)
printf "$tmp\n" $host $port $usr $passwd > proxy.json
tmp=$(cat ../../../conf/datasid-conf.json)
printf "$tmp\n" $idPoint /opt/agentC3SL/conf/proxy-conf.json $webService $version $project > datasid-conf.json
printf "$tmp\n" $idPoint $project /opt/agentC3SL/conf/proxy-conf.json $version $webService > datasid-conf.json
cd ../../..
......
#pragma once
#include <iostream>
#include <fstream>
#include <agent/connection.h>
#include <agent/parse_config_file.h>
#include <agent/parse_proxy_file.h>
#include <boost/filesystem.hpp>
......@@ -24,6 +25,7 @@
* <br><br>
*/
class Connection; // forward declarations
class Conf; // forward declarations
class Proxy; // forward declarations
......@@ -34,20 +36,23 @@ class Agent{
std::string pathDirInstall; /*!< Absolute path from local to install agent */
std::string pathLogDir; /*!< Absolute path from log directory */
std::string pathLogFile; /*!< Absolute path from log file */
std::string message; /*!< Success, warning and error messages to be setted in logfile */
std::string prefix; /*!< Absolute path from agent */
std::string installerName; /*!< Name of agent installer file */
Connection* connection;
Conf* conf;
Proxy* proxy;
public:
// We can't return fstream type
std::fstream logFile;
void setPathConfDir(std::string);
void setPathConfigFile(std::string);
void setPathLogDir(std::string);
void setPathLogFile(std::string);
void setMessage(std::string);
void setPrefix(std::string, int);
void setInstallerName(std::string);
void setConnection(Connection*);
void setConf(Conf*);
void setProxy(Proxy*);
......@@ -55,9 +60,9 @@ class Agent{
std::string getPathConfigFile() const;
std::string getPathLogDir() const;
std::string getPathLogFile() const;
std::string getMessage() const;
std::string getPrefix() const;
std::string getInstallerName() const;
Connection* getConnection() const;
Conf* getConf() const;
Proxy* getProxy() const;
......
......@@ -7,6 +7,8 @@
#include <boost/filesystem.hpp>
#include <json/json.h>
class Agent; // forward declarations
/** @file common.h
* @brief This file has a purpose to make parse from config and proxy file.
* Config file is required
......@@ -16,7 +18,7 @@
/**
* To make parsing from config and proxy file.
*/
bool common(std::fstream*, Agent*);
bool common(Agent*);
/**
* Check if a file exist.
......
......@@ -17,14 +17,20 @@
* - Using libcurl to make a get request (curl/curl.h)
*/
class Curl{
class Agent; // forward declarations
class Connection{
private:
CURL *curl; /*!< Curl object */
CURLcode response; /*!< Response from webService */
long httpCode = 0; /*!< Code return from webSerice (200, 404, 502 and so on) */
public:
bool downloadAgent (std::string, std::fstream*, Agent*);
bool downloadAgent (std::string, Agent*, int);
bool getVersionByProxy(Agent*, std::string*, std::string);
int getInstallerNameByProxy(std::string, Agent*, std::string*);
void setCurlOption(std::string, Agent*, std::string*);
int sendJsonByProxy(Agent*, std::string, int);
/** Default callback function that is necessary to make a curl request.
* @brief Obs:
......@@ -39,6 +45,11 @@ class Curl{
size_t written = fwrite((FILE*)ptr, size, nmemb, stream);
return written;
}
static size_t callback(void *contents, size_t size, size_t nmemb, void *userp) {
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
};
/*---------------------------------------------------------------------
......
......@@ -5,7 +5,7 @@
#include <cpr/cpr.h>
#include <json/json.h>
#include <agent/common.h>
#include <agent/curl.h>
#include <agent/connection.h>
#include <agent/helper.h>
#include <agent/parse_proxy_file.h>
#include <agent/rotate_log_file.h>
......@@ -21,9 +21,9 @@ const std::string url = "http://localhost:3001";
* @brief Check case if has a new agent version available
*/
int check_update(Agent*, std::fstream*);
int check_update(Agent*);
bool create_directories(std::string);
bool compare_version(Agent*, std::string, std::fstream*);
bool download(Agent*, std::fstream*, std::string);
bool compare_version(Agent*, std::string);
bool download(Agent*, std::string, int);
void execute_agent(boost::filesystem::path);
bool get_agent_installer_name(Conf*, std::string*);
bool get_agent_installer_name(Agent*, std::string*, int);
......@@ -4,6 +4,7 @@
#endif // __unix__
#include <time.h>
#include <iostream>
#include <agent/agent.h>
#include <agent/get_date.h>
#include <agent/get_disks_info.h>
#include <agent/get_distro.h>
......@@ -33,4 +34,4 @@
* - Mac address
*/
Json::Value get_inventory();
\ No newline at end of file
Json::Value get_inventory(Agent*);
\ No newline at end of file
......@@ -6,6 +6,7 @@
#include <agent/agent.h>
#include <agent/agent_uninstall.h>
#include <agent/common.h>
#include <agent/connection.h>
#include <agent/get.h>
#include <agent/parse_config_file.h>
#include <agent/parse_proxy_file.h>
......@@ -31,7 +32,7 @@ namespace fs = boost::filesystem;
std::string path_to_agent = "/opt/"; // NOLINT(runtime/string)
//std::string path_to_agent_conf = // NOLINT(runtime/string)
//"/opt/agentC3SL/conf/"; // NOLINT(runtime/string)
std::string path_to_agent_conf = "/home/lais/Imagens/agent/conf/";
std::string path_to_agent_conf = "/home/teste/Imagens/agent/conf/";
#else
// Temporary... Define agent path
std::string path_to_agent_tmp = "C:\\agentC3SL\\tmp\\";
......@@ -66,7 +67,7 @@ int main(int, char**);
*/
int parse_command_line(int, char*, int*, int*, bool*);
bool read_config_files(Agent*, std::fstream*);
bool read_config_files(Agent*);
/** Run agent */
int run_agent(const sys::error_code& /*e*/, pt::ptime, bool, Agent*);
......
......@@ -36,7 +36,7 @@ class Conf{
};
bool parse_config_file(Agent*, std::fstream*);
bool parse_config_file(Agent*);
/**
* @file parse_config_file.h
......
......@@ -34,7 +34,7 @@ class Proxy{
bool proxyFileIsSet() const;
};
bool parse_proxy_file(Agent*, std::fstream*);
bool parse_proxy_file(Agent*);
/**
* @file parse_proxy_file.h
......
......@@ -2,6 +2,8 @@
#include <iostream>
#include <cpr/cpr.h>
#include <json/json.h>
#include <agent/agent.h>
#include <agent/connection.h>
#include <agent/inventory.h>
#include <agent/user_history.h>
#include <agent/network_bandwidth.h>
......@@ -11,6 +13,6 @@
* @brief Collect data from hardware and send to c3sl web service
*/
int send_inventory(bool, std::string);
int send_net_bandwidth(bool, std::string);
int send_user_history(bool, std::string);
int send_inventory(bool, Agent *);
int send_net_bandwidth(bool, Agent*);
int send_user_history(bool, Agent*);
......@@ -45,16 +45,6 @@ void Agent::setPathLogFile(std::string file) {
this->pathLogFile = this->prefix + file;
}
/** Set the log message
* @brief We have a:
* * logfile
* .
* that are used to saved the success, error and warning messages
*/
void Agent::setMessage(std::string m) {
this->message = m;
}
/** Set the absolute path from agent */
void Agent::setPrefix(std::string p, int tot) {
int i = p.size(), count = 0;
......@@ -75,6 +65,10 @@ void Agent::setInstallerName(std::string i) {
this->installerName = i;
}
void Agent::setConnection(Connection* c) {
this->connection = c;
}
void Agent::setConf(Conf* conf) {
this->conf = conf;
}
......@@ -103,11 +97,6 @@ std::string Agent::getPathLogFile() const {
return this->pathLogFile;
}
/** Return the success, error or warning message */
std::string Agent::getMessage() const {
return this->message;
}
/** Return the absolute path from agent */
std::string Agent::getPrefix() const {
return this->prefix;
......@@ -120,6 +109,10 @@ std::string Agent::getInstallerName() const {
return this->installerName;
}
Connection* Agent::getConnection() const {
return this->connection;
}
Conf* Agent::getConf() const {
return this->conf;
}
......
......@@ -43,22 +43,22 @@ bool file_exist(const std::string& file) {
/**
* To make parsing from config and proxy file.
*/
bool common(std::fstream* logFile, Agent* agent) {
bool common(Agent* agent) {
try {
agent->prefixISet();
} catch (const char* error) {
*logFile << __DATE__ + *error << std::endl;
agent->logFile << __DATE__ + *error << std::endl;
return false;
}
/* Read config file and declare only valid variables */
if (!file_exist(agent->getPathConfigFile())) {
*logFile << __DATE__ +
agent->logFile << __DATE__ +
std::string(" - ERROR: Config file not found.") << std::endl;
return false;
} else {
if (!parse_config_file(agent, logFile)) {
*logFile << __DATE__ +
if (!parse_config_file(agent)) {
agent->logFile << __DATE__ +
std::string(" - ERROR: parse config file.") << std::endl;
return false;
}
......@@ -66,18 +66,18 @@ bool common(std::fstream* logFile, Agent* agent) {
/* Read proxy file and declare only valid variables */
if (!file_exist(agent->getConf()->getPathProxyFile())) {
*logFile << __DATE__ +
agent->logFile << __DATE__ +
std::string(" - WARNING: Proxy file not found.") << std::endl;
} else {
if (!parse_proxy_file(agent , logFile)) {
*logFile << __DATE__ +
if (!parse_proxy_file(agent)) {
agent->logFile << __DATE__ +
std::string(" - ERROR: parse proxy file.") << std::endl;
return false;
}
}
if (agent->getConf()->getWebService().size() == 0) {
*logFile << __DATE__ +
agent->logFile << __DATE__ +
std::string(" - ERROR: Web service url not configured.")
<< std::endl;
return false;
......
......@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
#include <agent/curl.h>
#include <agent/connection.h>
#include <string>
/** Contact webservice server to update the agent.
......@@ -32,13 +32,11 @@
* @param data json object to save success, error and warning messages
* @param logFile references from logfile to save success, error and warning messages
*/
bool Curl::downloadAgent(std::string url, std::fstream* logFile,
Agent* agent) {
bool Connection::downloadAgent(std::string url, Agent* agent, int option) {
curl = curl_easy_init();
if (!curl) {
agent->setMessage(__DATE__ + std::string(" - ERROR: Curl ") +
std::string(" did not initialize!"));
*logFile << agent->getMessage() << std::endl;
agent->logFile << __DATE__ + std::string(" - ERROR: Curl ") +
std::string(" did not initialize!") << std::endl;
return false;
}
......@@ -51,9 +49,8 @@ bool Curl::downloadAgent(std::string url, std::fstream* logFile,
boost::filesystem::temp_directory_path(ec) / "Agent%%%%-%%%%-%%%%"));
if (!boost::filesystem::create_directory(tmp_dir_agent, ec) || ec) {
agent->setMessage(__DATE__ + std::string(" - ERROR: Failed to create ")
+ std::string("a temporary directory."));
*logFile << agent->getMessage() << std::endl;
agent->logFile << __DATE__ + std::string(" - ERROR: Failed to create ")
+ std::string("a temporary directory.") << std::endl;
return false;
}
......@@ -73,33 +70,51 @@ bool Curl::downloadAgent(std::string url, std::fstream* logFile,
#endif
if (!fp) {
agent->setMessage(__DATE__ + std::string(" - ERROR: Failed to ") +
std::string("create file on the disk."));
*logFile << agent->getMessage() << std::endl;
agent->logFile << __DATE__ + std::string(" - ERROR: Failed to ") +
std::string("create file on the disk.") << std::endl;
return false;
}
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &Curl::callBackDownload);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
&Connection::callBackDownload);
if (option == 0) {
std::string::size_type sz; // NOLINT [runtime/int]
long port; // NOLINT [runtime/int]
try {
port = std::stol(agent->getProxy()->getPort(), &sz); // NOLINT [runtime/int]
} catch (std::invalid_argument& ex) {
port = 0;
}
curl_easy_setopt(curl, CURLOPT_PROXY,
agent->getProxy()->getHost().c_str());
curl_easy_setopt(curl, CURLOPT_PROXYPORT, port);
curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME,
agent->getProxy()->getUser().c_str());
curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD,
agent->getProxy()->getPassword().c_str());
}
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_FAILONERROR, true);
response = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
curl_easy_cleanup(curl);
if (httpCode == 302) {
agent->setMessage(__DATE__ + std::string(" - ERROR: Protocol HTTPS ") +
std::string("not supported or disabled in libcurl."));
*logFile << agent->getMessage() << std::endl;
agent->logFile << __DATE__ + std::string(" - ERROR: Protocol HTTPS ") +
std::string("not supported or disabled in libcurl.") << std::endl;
return false;
}
if (httpCode == 504) {
agent->setMessage(__DATE__ +
std::string(" - ERROR: Time out."));
*logFile << agent->getMessage() << std::endl;
agent->logFile << __DATE__ + std::string(" - ERROR: Time out.")
<< std::endl;
return false;
}
......@@ -111,21 +126,123 @@ bool Curl::downloadAgent(std::string url, std::fstream* logFile,
// remove agent tmp directory
boost::uintmax_t res = boost::filesystem::remove_all(tmp_dir_agent);
if (res < 2) {
agent->setMessage(__DATE__ + std::string(" - WARNING: Failed ") +
std::string("to remove the agent tmp directory."));
*logFile << agent->getMessage() << std::endl;
agent->logFile << __DATE__ + std::string(" - WARNING: Failed ") +
std::string("to remove the agent tmp directory.") << std::endl;
}
if (response) {
agent->setMessage(__DATE__ + std::string(" - ERROR: Failed ") +
std::string("to download the agent."));
*logFile << agent->getMessage() << std::endl;
agent->logFile << __DATE__ + std::string(" - ERROR: Failed ") +
std::string("to download the agent.") << std::endl;
return false;
}
return true;
}
void Connection::setCurlOption(std::string url, Agent* agent,
std::string* out) {
std::string::size_type sz; // NOLINT [runtime/int]
long port; // NOLINT [runtime/int]
try {
port = std::stol(agent->getProxy()->getPort(), &sz); // NOLINT [runtime/int]
} catch (std::invalid_argument& ex) {
port = 0;
}
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_PROXY, agent->getProxy()->getHost().c_str());
curl_easy_setopt(curl, CURLOPT_PROXYPORT, port);
curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME,
agent->getProxy()->getUser().c_str());
curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD,
agent->getProxy()->getPassword().c_str());
curl_easy_setopt(curl, CURLOPT_WRITEDATA, out);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &Connection::callback);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_FAILONERROR, true);
response = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
curl_easy_cleanup(curl);
}
bool Connection::getVersionByProxy(Agent* agent, std::string *version,
std::string url) {
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "charsets: utf-8");
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
this->setCurlOption(url, agent, version);
if (httpCode == 200)
return true;
else
return false;
}
int Connection::getInstallerNameByProxy(std::string url, Agent* agent,
std::string* filename) {
curl = curl_easy_init();
this->setCurlOption(url, agent, filename);
return httpCode;
}
int Connection::sendJsonByProxy(Agent* agent, std::string json, int opt) {
std::string::size_type sz; // NOLINT [runtime/int]
long port; // NOLINT [runtime/int]
try {
port = std::stol(agent->getProxy()->getPort(), &sz); // NOLINT [runtime/int]
} catch (std::invalid_argument& ex) {
port = 0;
}
std::string base_url = agent->getConf()->getWebService();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "charsets: utf-8");
// opt == 1 {send inventory}
// opt = 2 {send net bandwidth}
// otherwise, {send user history}
if (opt == 1)
base_url = base_url + std::string("/api/agent/collect/inventory");
else if (opt == 2)
base_url = base_url + std::string("/api/agent/collect/net_usage");
else
base_url = base_url + std::string("/api/agent/collect/user_history");
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, base_url.c_str());
curl_easy_setopt(curl, CURLOPT_PROXY, agent->getProxy()->getHost().c_str());
curl_easy_setopt(curl, CURLOPT_PROXYPORT, port);
curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME,
agent->getProxy()->getUser().c_str());
curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD,
agent->getProxy()->getPassword().c_str());
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json.c_str());
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_FAILONERROR, true);
response = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
curl_easy_cleanup(curl);
return httpCode;
}
/**
* @file curl.cpp
* @brief This file has implementation from Curl's method and the purpose is to make a get request to web
......
......@@ -30,56 +30,40 @@
* Case if needed, making download from agent zipfile.
*/
int check_update(Agent* agent, std::fstream* logFile) {
int check_update(Agent* agent) {
std::string version;
Json::Reader reader;
Json::Value version_json;
Json::FastWriter fastWriter;
int option = 1;
/* Contact webservice server to get client version. */
auto p = cpr::Get(cpr::Url{agent->getConf()->getWebService() +
"/api/agent/version"},
cpr::Header{{"content-type", "application/json"}});
/* Check error with connection */
if (p.status_code == 502)
*logFile << __DATE__ << "- ERROR: The proxy server received an"
<< " invalid response from server." << std::endl;
// Check error with connection
if (p.status_code != 200) {
option = 0;
// Case if not connected before, try it with proxy
std::string web_service = agent->getConf()->getWebService() +
std::string("/api/agent/version");
if (!agent->getConnection()->getVersionByProxy(agent, &version,
web_service)) {
agent->logFile << __DATE__ << " - ERROR: Couldn't get current " <<
"version from simmc web service." << std::endl;
}
} else {
version = p.text;
}
// p.text - response from api
reader.parse(p.text, version_json, false);
// p.text - response from api
reader.parse(version, version_json, false);
version = fastWriter.write(version_json["version"]);
boost::regex re("(\")|(\n)");
version = boost::regex_replace(version, re, "");
// Case if not connected before, try it with proxy
if (p.status_code != 200) {
// try send via proxy
auto p = cpr::Get(cpr::Url{agent->getConf()->getWebService() + "/api"},
cpr::Proxies{{"http", agent->getProxy()->getHost()}},
cpr::Parameters{{"agent", "version"}},
cpr::Header{{"content-type", "application/json"}});
/* Check error with connection */
if (p.status_code == 502)
*logFile << __DATE__ << " - ERROR: The proxy server received an"
<< "invalid response from server." << std::endl;
reader.parse(p.text, version_json, false);
version = fastWriter.write(version_json["version"]);
version = boost::regex_replace(version, re, "");
}
// Case if none of them get rigth, set log file
if (p.status_code != 200) {
*logFile << __DATE__ << " - ERROR: Try to connect with server"
<< std::endl;
return false;
}
if (agent->getConf()->getVersion() == "0.0.0") {
if (agent->getConf()->getVersion() == "0.0.0" && version != "") {
// open version.json file and update to current version
Json::Value config;
Json::Reader reader;
......@@ -102,21 +86,23 @@ int check_update(Agent* agent, std::fstream* logFile) {
}
/* Case version are different, then make the download */
if (compare_version(agent, version, logFile)) {
if (compare_version(agent, version)) {
/* Case not download, return false */
std::string filename;
if (get_agent_installer_name(agent->getConf(), &filename)) {
if (download(agent, logFile, filename)) {
*logFile << __DATE__ << " - SUCCESS: Update process " <<
if (get_agent_installer_name(agent, &filename, option)) {
if (download(agent, filename, option)) {
agent->logFile << __DATE__ << " - SUCCESS: Update process " <<
"terminated successfully." << std::endl;
logFile->close();
agent->logFile.close();
return true;
}
}
*logFile << __DATE__ << " - ERROR: Failed to update agent."
agent->logFile << __DATE__ << " - ERROR: Couldn't get installer " <<
"name from simmc web service." << std::endl;
agent->logFile << __DATE__ << " - ERROR: Failed to update agent."
<< std::endl;
}
logFile->close();
agent->logFile.close();
return false;
}
......@@ -126,29 +112,29 @@ int check_update(Agent* agent, std::fstream* logFile) {
* <br>
* Otherwise, return false.
*/
bool compare_version(Agent *agent, std::string version,
std::fstream* logFile) {