[Kimchi-devel] [PATCH] [WoK 2/4] reload API: control and model changes

dhbarboza82 at gmail.com dhbarboza82 at gmail.com
Mon Jan 16 19:04:27 UTC 2017


From: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>

- added a new action handler called 'reload' in control/config.py
- added a method 'reload' in model/config.py that calls
'cherrypy.engine.restart()'.

Signed-off-by: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
---
 src/wok/control/config.py | 4 +++-
 src/wok/model/config.py   | 7 ++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/wok/control/config.py b/src/wok/control/config.py
index 338306c..62218f9 100644
--- a/src/wok/control/config.py
+++ b/src/wok/control/config.py
@@ -1,7 +1,7 @@
 #
 # Project Wok
 #
-# Copyright IBM Corp, 2016
+# Copyright IBM Corp, 2016-2017
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -25,6 +25,8 @@ from wok.control.utils import UrlSubNode
 class Config(Resource):
     def __init__(self, model, id=None):
         super(Config, self).__init__(model, id)
+        self.uri_fmt = '/config/%s'
+        self.reload = self.generate_action_handler('reload')
 
     @property
     def data(self):
diff --git a/src/wok/model/config.py b/src/wok/model/config.py
index 7e8ae4f..57c5ad8 100644
--- a/src/wok/model/config.py
+++ b/src/wok/model/config.py
@@ -1,7 +1,7 @@
 #
 # Project Wok
 #
-# Copyright IBM Corp, 2016
+# Copyright IBM Corp, 2016-2017
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -17,6 +17,8 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
+import cherrypy
+
 from wok.config import config, get_version
 
 
@@ -30,3 +32,6 @@ class ConfigModel(object):
                 'auth': config.get('authentication', 'method'),
                 'server_root': config.get('server', 'server_root'),
                 'version': get_version()}
+
+    def reload(self, name):
+        cherrypy.engine.restart()
-- 
2.7.4



More information about the Kimchi-devel mailing list