From 09745ab8e15d333e6504e10b52828d5702d422f5 Mon Sep 17 00:00:00 2001 From: Firmlyzhu Date: Wed, 14 Jun 2017 15:45:51 +0800 Subject: [PATCH] Add APPROVAL_RBT to docklet.conf and user can turn on or off the robot by the field. --- README.md | 9 +++++++-- conf/docklet.conf.template | 9 +++++++-- src/env.py | 2 ++ user/user.py | 6 +++++- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e237583..6385d40 100644 --- a/README.md +++ b/README.md @@ -87,11 +87,16 @@ Pay attention to the following settings: or not. Both master and worker must be set by same value. - PUBLIC_IP : publick ip of this machine. If DISTRIBUTED_GATEWAY is True, users' gateways can be setup on this machine. Users can visit this - machine by the public ip. default: IP of NETWORK_DEVICE. + machine by the public ip. default: IP of NETWORK_DEVICE. - USER_IP : the ip of user server. default : localhost - MASTER_IPS : tell the web server the ips of all the cluster master. - OPEN_REGISTRY : whether allow user to register a new account. - +- AUTH_KEY: the key to request users server from master, or to request + master from users server. Please set the same value on each machine. + Please don't use the default value. +- APPROVAL_RBT: whether to start the approval robot that will approve + beans applications from users automatically. + ## Start ## ### distributed file system ### diff --git a/conf/docklet.conf.template b/conf/docklet.conf.template index 30b22d3..76b86d9 100644 --- a/conf/docklet.conf.template +++ b/conf/docklet.conf.template @@ -171,8 +171,13 @@ # AUTH_KEY: the key to request users server from master, # or to request master from users server. Please set the # same value on each machine. Please don't use the default value. -# AUTH_KEY="docklet" +# AUTH_KEY=docklet # OPEN_REGISTRY: whether allow user to register new account or not. # default:False -# OPEN_REGISTRY:False +# OPEN_REGISTRY=False + +# APPROVAL_RBT: whether to start the approval robot that will approve +# beans applications from users automatically. +# ON or OFF, default: ON. +# APPROVAL_RBT=ON diff --git a/src/env.py b/src/env.py index 3de988e..63ddeab 100755 --- a/src/env.py +++ b/src/env.py @@ -73,5 +73,7 @@ def getenv(key): return os.environ.get("AUTH_KEY","docklet") elif key =="OPEN_REGISTRY": return os.environ.get("OPEN_REGISTRY","False") + elif key =="APPROVAL_RBT": + return os.environ.get("APPROVAL_RBT","ON") else: return os.environ.get(key,"") diff --git a/user/user.py b/user/user.py index c85119c..b083f0d 100755 --- a/user/user.py +++ b/user/user.py @@ -591,7 +591,11 @@ if __name__ == '__main__': G_applicationmgr = beansapplicationmgr.ApplicationMgr() approvalrbt = beansapplicationmgr.ApprovalRobot() - approvalrbt.start() + if(env.getenv("APPROVAL_RBT") == "ON"): + approvalrbt .start() + logger.info("ApprovalRobot is started.") + else: + logger.info("ApprovalRobot is not started.") # server = http.server.HTTPServer((masterip, masterport), DockletHttpHandler) logger.info("starting user server")