put instance config file to config folder
This commit is contained in:
parent
62fc1aee5c
commit
8bed0a4b10
@ -8,4 +8,4 @@ cd /mop
|
|||||||
python profile_scanner.py -c $CONFIG_FOLDER -a $AUTH_FILE
|
python profile_scanner.py -c $CONFIG_FOLDER -a $AUTH_FILE
|
||||||
|
|
||||||
# run main script
|
# run main script
|
||||||
python -u test.py -s /tmp
|
python -u test.py -s /tmp -l $INSTANCE_CONFIG
|
||||||
|
|||||||
@ -15,4 +15,5 @@ services:
|
|||||||
- net_admin
|
- net_admin
|
||||||
environment:
|
environment:
|
||||||
CONFIG_FOLDER: /config
|
CONFIG_FOLDER: /config
|
||||||
|
INSTANCE_CONFIG: /config/instances.json
|
||||||
AUTH_FILE: /config/fast.txt
|
AUTH_FILE: /config/fast.txt
|
||||||
|
|||||||
7
test.py
7
test.py
@ -13,13 +13,16 @@ ap.add_argument("-i", "--interface", required=False,
|
|||||||
help="interface (default: eth0)", default="eth0")
|
help="interface (default: eth0)", default="eth0")
|
||||||
ap.add_argument("-s", "--session_folder", required=True,
|
ap.add_argument("-s", "--session_folder", required=True,
|
||||||
help="path to the session folder")
|
help="path to the session folder")
|
||||||
|
ap.add_argument("-l", "--load_instance_config", required=False,
|
||||||
|
help="instance config file (default: /config/instance.json)", default="/config/instance.json")
|
||||||
args = vars(ap.parse_args())
|
args = vars(ap.parse_args())
|
||||||
session_folder = args["session_folder"]
|
session_folder = args["session_folder"]
|
||||||
interface = args["interface"]
|
interface = args["interface"]
|
||||||
om = OManager(session_folder, interface)
|
om = OManager(session_folder, interface)
|
||||||
|
|
||||||
root = os.path.dirname(__file__)
|
root = os.path.dirname(__file__)
|
||||||
instance_config_fp = os.path.join(root, "config/instances.json")
|
instance_config_fp = args["load_instance_config"]
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
instance_config = json.load(open(instance_config_fp, "r"))
|
instance_config = json.load(open(instance_config_fp, "r"))
|
||||||
@ -128,7 +131,7 @@ class ClearCacheInstatnceHandler(tornado.web.RequestHandler):
|
|||||||
class SaveInstanceHandler(tornado.web.RequestHandler):
|
class SaveInstanceHandler(tornado.web.RequestHandler):
|
||||||
def get(self):
|
def get(self):
|
||||||
instances = om.serialize_instance_config()
|
instances = om.serialize_instance_config()
|
||||||
with open(os.path.join(root, instance_config_fp), "w") as f:
|
with open(instance_config_fp, "w") as f:
|
||||||
f.write(json.dumps(instances))
|
f.write(json.dumps(instances))
|
||||||
self.write("OK")
|
self.write("OK")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user