diff --git a/src/DockerModule.cpp b/src/DockerModule.cpp index c69133b..e99ca92 100644 --- a/src/DockerModule.cpp +++ b/src/DockerModule.cpp @@ -20,7 +20,6 @@ int DockerModule::deploy (string serviceUsername) { cout << "docker module deploy" << endl; /* - //test if there is a docker compose //pulling images int pulling =BashManager::execute("docker-compose pull")==0; diff --git a/src/deployer b/src/deployer deleted file mode 100755 index 2941b78..0000000 Binary files a/src/deployer and /dev/null differ diff --git a/src/main.cpp b/src/main.cpp index 786d816..04bb835 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,7 +21,7 @@ void help(char * argv0) 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" @@ -30,6 +30,7 @@ int isServiceOnServer(string serviceUsername) } cout << "service not on server" << endl; return 1; + return 0; } int createUser(string serviceUsername){ diff --git a/testenv/Dockerfile b/testenv/Dockerfile new file mode 100644 index 0000000..b98344f --- /dev/null +++ b/testenv/Dockerfile @@ -0,0 +1,4 @@ +FROM ubuntu:latest +WORKDIR /usr/src/deployer_test +CMD ["bash"] + diff --git a/testenv/docker-compose.yaml b/testenv/docker-compose.yaml new file mode 100644 index 0000000..317baa7 --- /dev/null +++ b/testenv/docker-compose.yaml @@ -0,0 +1,10 @@ +services: + deployer_test: + image: "ubuntu:latest" + build: . + container_name: deployer_test_container + volumes: + - .:/usr/src/deployer_test + - ./test_hosts:/etc/hosts + stdin_open: true + tty: true diff --git a/testenv/test_hosts b/testenv/test_hosts new file mode 100644 index 0000000..8356928 --- /dev/null +++ b/testenv/test_hosts @@ -0,0 +1,7 @@ +127.0.0.1 localhost +127.0.1.1 example.net example + +# The following lines are desirable for IPv6 capable hosts +::1 localhost ip6-localhost ip6-loopback +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters