// deployer main programm // Copyright (C) 2024 Jean-Cloud // GNU General Public License v3 #include #include #include #include #include #include "Services.h" #include "Modules.h" #include "BashManager.h" using namespace std; void help(char * argv0) { //temporary cout << "usage: ./" << argv0 <<"action file \n with action=deploy or remove and file=path to a file or all. \n" << endl; } int isServiceOnServer(string serviceUsername) //this method tests if a certain service is on the current server //it looks into the /etc/hosts file thanks to a pipe to a separate bash process { string cmd ="getent hosts " +serviceUsername; string result = BashManager::executeAndReadResult(cmd); if(result.find("::1")!=string::npos){ //if result contains "::1" cout << "service on server" << endl; return 0; } cout << "service not on server" << endl; return 1; } int createUser(string serviceUsername){ //TO DO cout << "create user called" << endl; return 0; } int createEnv(string serviceUsername){ //TO DO cout << "create env called" << endl; return 0; } int runBashScripts(string serviceUsername){ //TO DO cout << "run bash scripts called" << endl; return 0; } int deployAll(){ //this method deploys all the services that are on this server cout << "deploying all" <