mirror of
https://github.com/ceph/ceph
synced 2025-01-18 17:12:29 +00:00
Merge pull request #15646 from tchaikov/wip-20258
pybind/mgr/restful: use list to pass hooks to create a `Pecan` instance Reviewed-by: Boris Ranto <branto@redhat.com>
This commit is contained in:
commit
3ddbfcd435
@ -1,6 +1,3 @@
|
||||
# ubuntu trusty has old requests. xenial is okay, but we can't blacklist
|
||||
# just trusty, so:
|
||||
os_type: centos
|
||||
roles:
|
||||
- [mon.a, mgr.x, osd.0, osd.1, osd.2, mds.a, client.a]
|
||||
tasks:
|
||||
|
@ -19,6 +19,7 @@ if len(sys.argv) < 3:
|
||||
|
||||
addr = sys.argv[1]
|
||||
auth = ('admin', sys.argv[2])
|
||||
headers = {'Content-type': 'application/json'}
|
||||
|
||||
request = None
|
||||
|
||||
@ -26,6 +27,7 @@ request = None
|
||||
request = requests.post(
|
||||
addr + '/pool?wait=yes',
|
||||
data=json.dumps({'name': 'supertestfriends', 'pg_num': 128}),
|
||||
headers=headers,
|
||||
verify=False,
|
||||
auth=auth)
|
||||
print(request.text)
|
||||
@ -82,6 +84,7 @@ for method, endpoint, args in screenplay:
|
||||
request = getattr(requests, method)(
|
||||
url,
|
||||
data=json.dumps(args),
|
||||
headers=headers,
|
||||
verify=False,
|
||||
auth=auth)
|
||||
print(request.text)
|
||||
|
@ -34,7 +34,11 @@ class PoolId(RestController):
|
||||
"""
|
||||
Modify the information for the pool id
|
||||
"""
|
||||
args = request.json
|
||||
try:
|
||||
args = request.json
|
||||
except ValueError:
|
||||
response.status = 400
|
||||
return {'message': 'Bad request: malformed JSON or wrong Content-Type'}
|
||||
|
||||
# Get the pool info for its name
|
||||
pool = module.instance.get_pool_by_id(self.pool_id)
|
||||
|
@ -285,7 +285,7 @@ class Module(MgrModule):
|
||||
port=server_port,
|
||||
app=make_app(
|
||||
root='restful.api.Root',
|
||||
hooks = lambda: [ErrorHook()],
|
||||
hooks = [ErrorHook()], # use a callable if pecan >= 0.3.2
|
||||
),
|
||||
ssl_context=(cert_fname, pkey_fname),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user