Commit 7b124d35 authored by Matheus Horstmann's avatar Matheus Horstmann 🐴 Committed by Lucas Fernandes de Oliveira
Browse files

Issue #21: Update idPoint to string


Signed-off-by: Matheus Horstmann's avatarMatheus Horstmann <mch15@inf.ufpr.br>
parent 7ad87297
{ {
"idPoint" : "%d", "idPoint" : "%s",
"project" : "%s", "project" : "%s",
"proxyConf" : "%s", "proxyConf" : "%s",
"version" : "%s", "version" : "%s",
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <agent/parse.h> #include <agent/parse.h>
#include <json/json.h> #include <json/json.h>
/** /**
* @file parse_config_file.h * @file parse_config_file.h
* @brief This file has a Conf class - The main purpose is get config file content and make parse to set in a conf object * @brief This file has a Conf class - The main purpose is get config file content and make parse to set in a conf object
*/ */
...@@ -15,20 +15,20 @@ class Agent; ...@@ -15,20 +15,20 @@ class Agent;
class Conf{ class Conf{
private: private:
int idPoint; std::string idPoint;
std::string pathProxyFile; /*!< Absolute path from proxy file. */ std::string pathProxyFile; /*!< Absolute path from proxy file. */
std::string webService; /*!< url from web service. */ std::string webService; /*!< url from web service. */
std::string version; /*!< Current agent version */ std::string version; /*!< Current agent version */
std::string project; std::string project;
public: public:
void setIdPoint(int); void setIdPoint(std::string);
void setPathProxyFile(std::string); void setPathProxyFile(std::string);
void setWebService(std::string); void setWebService(std::string);
void setVersion(std::string); void setVersion(std::string);
void setProject(std::string); void setProject(std::string);
int getIdPoint() const; std::string getIdPoint() const;
std::string getPathProxyFile() const; std::string getPathProxyFile() const;
std::string getWebService() const; std::string getWebService() const;
std::string getVersion() const; std::string getVersion() const;
...@@ -38,7 +38,7 @@ class Conf{ ...@@ -38,7 +38,7 @@ class Conf{
bool parse_config_file(Agent*); bool parse_config_file(Agent*);
/** /**
* @file parse_config_file.h * @file parse_config_file.h
* @brief This file has a Conf class - The main purpose is get config file content and make parse to set in a conf object * @brief This file has a Conf class - The main purpose is get config file content and make parse to set in a conf object
*/ */
......
...@@ -140,7 +140,7 @@ bool get_agent_installer_name(Agent* agent, std::string* filename, bool opt) { ...@@ -140,7 +140,7 @@ bool get_agent_installer_name(Agent* agent, std::string* filename, bool opt) {
std::string ws = agent->getConf()->getWebService() std::string ws = agent->getConf()->getWebService()
+ std::string("/api/agent/install/") + std::string("/api/agent/install/")
+ std::string(os) + std::string("/") + std::string(os) + std::string("/")
+ std::to_string(agent->getConf()->getIdPoint()); + agent->getConf()->getIdPoint();
if (opt) if (opt)
status_code = agent->getConnection()->getInstallerName(ws, agent, filename, opt); // NOLINT [whitespace/line_length] status_code = agent->getConnection()->getInstallerName(ws, agent, filename, opt); // NOLINT [whitespace/line_length]
...@@ -208,7 +208,7 @@ void execute_agent(Agent* agent, boost::filesystem::path tmp) { ...@@ -208,7 +208,7 @@ void execute_agent(Agent* agent, boost::filesystem::path tmp) {
} }
/** /**
* @file get.cpp * @file get.cpp
* @brief Check case if has a new agent version available * @brief Check case if has a new agent version available
*/ */
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
/** Set id Point */ /** Set id Point */
void Conf::setIdPoint(int i) { void Conf::setIdPoint(std::string i) {
this->idPoint = i; this->idPoint = i;
} }
...@@ -43,7 +43,7 @@ void Conf::setWebService(std::string web) { ...@@ -43,7 +43,7 @@ void Conf::setWebService(std::string web) {
this->webService = web; this->webService = web;
} }
/** Get the agent version from config file, at conf directory, /** Get the agent version from config file, at conf directory,
* and setted the version attribute. */ * and setted the version attribute. */
void Conf::setVersion(std::string v) { void Conf::setVersion(std::string v) {
this->version = v; this->version = v;
...@@ -55,7 +55,7 @@ void Conf::setProject(std::string p) { ...@@ -55,7 +55,7 @@ void Conf::setProject(std::string p) {
} }
/** Return id Point */ /** Return id Point */
int Conf::getIdPoint() const { std::string Conf::getIdPoint() const {
return this->idPoint; return this->idPoint;
} }
...@@ -79,8 +79,8 @@ std::string Conf::getProject() const { ...@@ -79,8 +79,8 @@ std::string Conf::getProject() const {
return this->project; return this->project;
} }
/** /**
* After parse the config file, get the values from map variable and set at conf object * After parse the config file, get the values from map variable and set at conf object
*/ */
bool set_conf_object(Agent* agent, std::map<std::string, bool set_conf_object(Agent* agent, std::map<std::string,
std::string>* content) { std::string>* content) {
...@@ -91,15 +91,15 @@ bool set_conf_object(Agent* agent, std::map<std::string, ...@@ -91,15 +91,15 @@ bool set_conf_object(Agent* agent, std::map<std::string,
content->count("PROJECT") == 0 ) content->count("PROJECT") == 0 )
return false; return false;
/* /*
* agent.getPrefix() contains the absolute path from agent * agent.getPrefix() contains the absolute path from agent
*/ */
std::string pathProxyFile = agent->getPrefix() + std::string("/") + std::string pathProxyFile = agent->getPrefix() + std::string("/") +
(*content)["PROXYCONF"]; (*content)["PROXYCONF"];
std::string webService = (*content)["WEBSERVICE"]; std::string webService = (*content)["WEBSERVICE"];
std::string version = (*content)["VERSION"]; std::string version = (*content)["VERSION"];
std::string project = (*content)["PROJECT"]; std::string project = (*content)["PROJECT"];
int idPoint = atoi((*content)["IDPOINT"].c_str()); std::string idPoint = (*content)["IDPOINT"].c_str();
agent->getConf()->setPathProxyFile(pathProxyFile); agent->getConf()->setPathProxyFile(pathProxyFile);
agent->getConf()->setWebService(webService); agent->getConf()->setWebService(webService);
...@@ -125,7 +125,7 @@ bool parse_config_file(Agent* agent) { ...@@ -125,7 +125,7 @@ bool parse_config_file(Agent* agent) {
return true; return true;
} }
/** /**
* @file parse_config_file.cpp * @file parse_config_file.cpp
* @brief This file contain the implementation from Conf's method - The main purpose is get config file content and * @brief This file contain the implementation from Conf's method - The main purpose is get config file content and
* make parse to set in a conf object * make parse to set in a conf object
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment