idem mais compile sans erreur
This commit is contained in:
parent
eb8f202889
commit
fd3bf3f7a8
@ -6,7 +6,10 @@
|
||||
#include "BashManager.h"
|
||||
|
||||
//constructor and destructor inline
|
||||
|
||||
DockerModule::DockerModule()
|
||||
{
|
||||
name="Docker";
|
||||
}
|
||||
//public methods
|
||||
int DockerModule::prepare()
|
||||
{
|
||||
|
@ -10,12 +10,12 @@
|
||||
class DockerModule : public Module
|
||||
{
|
||||
public:
|
||||
DockerModule(){} //inline
|
||||
DockerModule();//inline
|
||||
~DockerModule(){} //inline
|
||||
int prepare ();
|
||||
int deploy (string serviceUsername);
|
||||
int remove(string serviceUsername);
|
||||
int clean ();
|
||||
string name;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,12 +1,12 @@
|
||||
ECHO = @echo
|
||||
GCC = g++
|
||||
RM = @rm -f
|
||||
CCFLAGS = -c -O3 -g -std=c++11 -pedantic -Wall
|
||||
CCFLAGS = -c -O3 -g -std=c++20 -pedantic -Wall
|
||||
SRC = $(wildcard *.cpp)
|
||||
BIN = ../bin
|
||||
EXE = deployer
|
||||
OBJECTS = $(patsubst %.cpp,$(BIN)/%.o,$(SRC))
|
||||
LIBRARIES =
|
||||
LIBRARIES = -lstdc++fs
|
||||
|
||||
$(EXE) : $(OBJECTS)
|
||||
$(ECHO) "-Linking $(EXE)-"
|
||||
|
@ -10,6 +10,11 @@
|
||||
//destructor, could not be inline because pure virtual
|
||||
Module::~Module(){}
|
||||
|
||||
ostream & operator << (ostream & out, const Module & m)
|
||||
{
|
||||
cout << "module " << m.name << endl;
|
||||
return cout;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -18,5 +18,7 @@ class Module
|
||||
virtual int deploy (string serviceUsername)=0;
|
||||
virtual int remove(string serviceUsername)=0;
|
||||
virtual int clean ()=0;
|
||||
friend ostream & operator<< (ostream & out, const Module & m);
|
||||
string name;
|
||||
};
|
||||
#endif
|
@ -1,6 +1,8 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "Module.h"
|
||||
#include "DockerModule.h"
|
||||
|
||||
using namespace std;
|
||||
DockerModule dockerModule=DockerModule();
|
||||
vector <Module> modules = {dockerModule};
|
||||
vector <Module *> modules={&dockerModule};
|
14
src/main.cpp
14
src/main.cpp
@ -9,7 +9,6 @@
|
||||
#include <filesystem>
|
||||
#include "Services.h"
|
||||
#include "Modules.h"
|
||||
#include "DockerModule.h"
|
||||
#include "BashManager.h"
|
||||
using namespace std;
|
||||
|
||||
@ -67,10 +66,10 @@ int deployService(string serviceUsername){
|
||||
//call to the deploy functionality of all modules
|
||||
//the modules themselves determine their course of action depending on the service
|
||||
if (userCreated && envCreated){
|
||||
for(Module * mod : modules){
|
||||
int modResult = (*mod).deploy(serviceUsername);
|
||||
for(Module * mod_ptr : modules){
|
||||
int modResult = (*mod_ptr).deploy(serviceUsername);
|
||||
if (modResult!=0){
|
||||
cerr << "Error in module "<< mod << " when deploying " << serviceUsername << endl;
|
||||
cerr << "Error in module " << (*mod_ptr) << " when deploying " << serviceUsername << endl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -95,12 +94,12 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
//check number of arguments
|
||||
if (argc != 3){
|
||||
cout << "Invalid number of arguments. \n" << endl;
|
||||
cerr << "Invalid number of arguments. \n" << endl;
|
||||
help(argv[0]);
|
||||
return -1;
|
||||
} else {
|
||||
//check that data is mounted on the server
|
||||
if (!filesystem::exists("/data/mounted")) {
|
||||
if (!(filesystem::exists("/data/mounted"))) {
|
||||
cerr << "Error. The data is not mounted on the server" << endl;
|
||||
return -1;
|
||||
} else {
|
||||
@ -121,7 +120,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
} else {
|
||||
cerr << "Invalid argument. \n" << endl;
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user