//deployer SLmanager implementation // Copyright (C) 2024 Jean-Cloud // GNU General Public License v3 #include #include #include #include #include "Service.h" using namespace std; //constructor and destructor inlin //services vector GetServices() const; const Service * FindServiceByUsername(string aUsername) const; const Service * FindServiceByID(int aUserID) const; //list FindServicesByServer(string aServer) const; int isServiceOnServer(string serviceUsername); vector services; //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" which is the notation for loopback in IpV6 // cout << "service " << serviceUsername << " on server" << endl; // return 0; // } // cout << "service" << serviceUsername << " not on server" << endl; // return 1; // return 0; // }