]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Updated client code to complete PUT and DELETE requests
authorBabu Shanmugam <anbu@enovance.com>
Tue, 11 Feb 2014 05:44:53 +0000 (05:44 +0000)
committerBabu Shanmugam <anbu@enovance.com>
Tue, 11 Feb 2014 05:44:53 +0000 (05:44 +0000)
README.md
client/ceph-brag
server/config.py

index 37468163b752e765021d7d9443fd95e94af5e4f0..f40ed3048f1e2cce54ee036b074e9da5a129e385 100644 (file)
--- a/README.md
+++ b/README.md
@@ -105,6 +105,7 @@ The ceph-brag server code is a python based web application.
 
 ### Prerequisites
 * [pecan](http://pecanpy.org) is the web framework that is used by this application.
+* [sqlalchemy](www.sqlalchemy.org) is the ORM that is used by this application
 
 ### How to deploy
 * [Common recipes to deploy](http://pecan.readthedocs.org/en/latest/deployment.html#common-recipes)
index e7398a895bafd01396c3199d8487577d0ffe1dcb..2829a6b6d75523be1257cd8ab900120f45ba162a 100755 (executable)
@@ -6,6 +6,7 @@ import re
 import json
 import sys
 import ast
+import requests
 
 CLUSTER_UUID_NAME='cluster-uuid'
 CLUSTER_OWNERSHIP_NAME='cluster-ownership'
@@ -224,8 +225,8 @@ def output_json():
   out['sysinfo'] = get_sysinfo(num_osds)
 
   owner = get_ownership_info()
-  if owner is not None:
-    url = owner.pop['url']
+  if owner is not None and 'url' in owner:
+    url = owner.pop('url')
     out['ownership'] = owner
 
   return json.dumps(out, indent=2, separators=(',', ': ')), url
@@ -289,7 +290,11 @@ def publish():
     print >> sys.stderr, "Cannot publish until a URL is set using update-metadata"
     return 1
 
-  #TODO: Execute the HTTP request
+  req = requests.put(url, data=data)
+  if req.status_code is not 201:
+    print >> sys.stderr, "Failed to publish, server responded with code " + str(req.status_code)
+    return 1
+
   return 0
 
 def unpublish():
@@ -311,8 +316,13 @@ def unpublish():
     return 1
 
   uuid = get_uuid()
+  
+  params = {'uuid':uuid}
+  req = requests.delete(url, params=params)
+  if req.status_code is not 200:
+    print >> sys.stderr, "Failed to unpublish, server responsed with code " + str(req.status_code)
+    return 1 
 
-  #TODO: Execute the HTTP request
   return 0
 
 def main():
index b6190da49fdd0106e448e00caac501d1434e6618..429a2ef24d4dedb0096dd38a852b500e157497f6 100644 (file)
@@ -8,8 +8,6 @@ server = {
 app = {
     'root': 'ceph_brag.controllers.root.RootController',
     'modules': ['ceph_brag'],
-    'static_root': '%(confdir)s/public',
-    'template_path': '%(confdir)s/ceph_brag/templates',
     'debug': True,
     'errors': {
         404: '/error/404',