From: Babu Shanmugam Date: Tue, 11 Feb 2014 05:44:53 +0000 (+0000) Subject: Updated client code to complete PUT and DELETE requests X-Git-Tag: v0.78~175^2~3^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f2f4eb5b699300f6653eac08d812adbdd7476412;p=ceph.git Updated client code to complete PUT and DELETE requests --- diff --git a/README.md b/README.md index 37468163b752..f40ed3048f1e 100644 --- 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) diff --git a/client/ceph-brag b/client/ceph-brag index e7398a895baf..2829a6b6d755 100755 --- a/client/ceph-brag +++ b/client/ceph-brag @@ -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(): diff --git a/server/config.py b/server/config.py index b6190da49fdd..429a2ef24d4d 100644 --- a/server/config.py +++ b/server/config.py @@ -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',