From 9cae502d03b40e4e2069c8aadf8cf905e3612025 Mon Sep 17 00:00:00 2001 From: KorenLev Date: Mon, 7 May 2018 14:42:08 -0400 Subject: installer to make sure dir exists on host Change-Id: I627b031d529e45808d6123b096afa476958713bb Signed-off-by: KorenLev (cherry picked from commit 9196554c5906ea3c8300702a50410fcc40de270c) --- app/install/calipso-installer.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 "\" | 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": -- cgit 1.2.3-korg From 5c821a4d1462f3b0131f37995f40fc77a53468e6 Mon Sep 17 00:00:00 2001 From: KorenLev Date: Tue, 8 May 2018 11:33:26 -0400 Subject: per yaron's review remove redundant lines for mkdir function Change-Id: I260605fe8ac5bcfe01d5907eb4aef765e81f10a7 Signed-off-by: KorenLev (cherry picked from commit 802ba9cd2e1412ad20bd36009cb052b7e1e1b07e) --- app/install/calipso-installer.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/install/calipso-installer.py b/app/install/calipso-installer.py index 687504a..b101907 100644 --- a/app/install/calipso-installer.py +++ b/app/install/calipso-installer.py @@ -435,8 +435,6 @@ while container != "all" and container not in container_names: # 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: -- cgit 1.2.3-korg From afb1a0ab7c5a6cf777623facb4174e75f971c51f Mon Sep 17 00:00:00 2001 From: Koren Lev Date: Sun, 27 May 2018 10:25:04 +0300 Subject: tagging Change-Id: I0a0467388e52f5eb6b126fdd739600776d4a7faf Signed-off-by: Koren Lev --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 9455af2..7f9c19c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) +Copyright (c) 2018 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others Licensed under the Apache License, Version 2.0 (the "License"); -- cgit 1.2.3-korg