Hi Andreas,
I believe is not a problem of caps, I have tested using the same cap on mon
and I have the same problem, still looking into.

[client.python]

key = AQDORjxaYHG9JxAA0qiZC0Rmf3qulsO3P/bZgw==

caps mon = "allow r"



# ceph -n client.python --keyring ceph.client.python.keyring health

HEALTH_OK


but if I run the python script that contains a connect command to the
cluster.


# python health.py

Traceback (most recent call last):

  File "health.py", line 13, in <module>

    r.connect()

  File "/usr/lib/python2.7/dist-packages/rados.py", line 429, in connect

    raise make_ex(ret, "error connecting to the cluster")

rados.Error: error connecting to the cluster: errno EINVAL


********** PYTHON SCRIPT ************

#!/usr/bin/env python


import rados

import json


def get_cluster_health(r):

    cmd = {"prefix":"status", "format":"json"}

    ret, buf, errs = r.mon_command(json.dumps(cmd), b'', timeout=5)

    result = json.loads(buf)

    return result['health']['overall_status']


r = rados.Rados(conffile = '/etc/ceph/ceph.conf', conf = dict (keyring =
'/etc/ceph/ceph.client.python.keyring'))

r.connect()


print("{0}".format(get_cluster_health(r)))


if r is not None:

r.shutdown()

*************************************



On Thu, Dec 21, 2017 at 4:15 PM, Andreas Calminder <
[email protected]> wrote:

> Hi,
> I'm writing a small python script using librados to display cluster
> health, same info as ceph health detail show, it works fine but I rather
> not use the admin keyring for something like this. However I have no clue
> what kind of caps I should or can set, I was kind of hoping that mon allow
> r would do it, but that didn't work, and I'm unable to find any
> documentation that covers this. Any pointers would be appreciated.
>
> Thanks,
> Andreas
>
> _______________________________________________
> ceph-users mailing list
> [email protected]
> http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
>
>


-- 

ATTE. Alvaro Soto Escobar

----------------------------------------------------------
Great people talk about ideas,
average people talk about things,
small people talk ... about other people.
_______________________________________________
ceph-users mailing list
[email protected]
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

Reply via email to