aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKorenLev <korenlev@gmail.com>2018-05-07 14:42:08 -0400
committerKoren Lev <korenlev@gmail.com>2018-05-07 15:42:36 +0000
commit9cae502d03b40e4e2069c8aadf8cf905e3612025 (patch)
tree5cd4a627f4d70d89668a7a1a2298dfeac173c94a
parent8f3b074fafd2271557a152f43a676abaee6a32ea (diff)
installer to make sure dir exists on host
Change-Id: I627b031d529e45808d6123b096afa476958713bb Signed-off-by: KorenLev <korenlev@gmail.com> (cherry picked from commit 9196554c5906ea3c8300702a50410fcc40de270c)
-rw-r--r--app/install/calipso-installer.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/install/calipso-installer.py b/app/install/calipso-installer.py
index ccb9cdc..687504a 100644
--- a/app/install/calipso-installer.py
+++ b/app/install/calipso-installer.py
@@ -20,6 +20,7 @@ import socket
# by default, we want to use the docker0 interface ip address for inter-contatiner communications,
# if hostname argument will not be provided as argument for the calipso-installer
import os
+import errno
dockerip = os.popen('ip addr show docker0 | grep "\<inet\>" | awk \'{ print $2 }\' | awk -F "/" \'{ print $1 }\'')
local_hostname = dockerip.read().replace("\n", "")
@@ -28,7 +29,7 @@ H_MONGO_CONFIG = "/home/calipso/calipso_mongo_access.conf"
PYTHONPATH = "/home/scan/calipso_prod/app"
C_LDAP_CONFIG = "/local_dir/ldap.conf"
H_LDAP_CONFIG = "/home/calipso/ldap.conf"
-
+H_DIR="/home/calipso/"
calipso_volume = {'/home/calipso': {'bind': '/local_dir', 'mode': 'rw'}}
RESTART_POLICY = {"Name": "always"}
@@ -432,6 +433,14 @@ while container != "all" and container not in container_names:
if container == "q":
exit()
+# create local directory on host, raise error if it doesn't exists
+try:
+ os.makedirs(H_DIR)
+ os.makedirs(H_DIR+'log')
+ os.makedirs(H_DIR+'log/calipso')
+except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
# starting the containers per arguments:
if action == "start":