Browse Source

python-cephclient: rewrite to use ceph-mgr restful plugin

Not using any of the existing python-cephclient package.
(it's a new package sharing the same name). Released
under Apache-2.0 license as part of StarlingX.

Additional commits:
- create session on first API request
- add missing osd_remove function
- add timeout when retrieving url and password
- sanitize osd ID input
- osd_crush_tree discards json output

Story: 2003605
Task: 28860

Depends-On: I31fb9aac89c44bbce24939197446caa987d395cb
Change-Id: I1952a12032bcd08d17786bd817d1e15ce36d5afd
Signed-off-by: Daniel Badea <daniel.badea@windriver.com>
changes/20/680920/1
Daniel Badea 3 years ago
parent
commit
ea0a829ab2
  1. 2
      ceph/python-cephclient/centos/build_srpm.data
  2. 65
      ceph/python-cephclient/centos/python-cephclient.spec
  3. 2
      ceph/python-cephclient/python-cephclient/.gitignore
  4. 202
      ceph/python-cephclient/python-cephclient/LICENSE
  5. 5
      ceph/python-cephclient/python-cephclient/cephclient/__init__.py
  6. 5790
      ceph/python-cephclient/python-cephclient/cephclient/client.py
  7. 100
      ceph/python-cephclient/python-cephclient/cephclient/exception.py
  8. 5
      ceph/python-cephclient/python-cephclient/cephclient/tests/__init__.py
  9. 268
      ceph/python-cephclient/python-cephclient/cephclient/wrapper.py
  10. 3
      ceph/python-cephclient/python-cephclient/requirements.txt
  11. 34
      ceph/python-cephclient/python-cephclient/setup.py
  12. 6
      ceph/python-cephclient/python-cephclient/test-requirements.txt
  13. 19
      ceph/python-cephclient/python-cephclient/tox.ini

2
ceph/python-cephclient/centos/build_srpm.data

@ -0,0 +1,2 @@
SRC_DIR="python-cephclient"
TIS_PATCH_VER=0

65
ceph/python-cephclient/centos/python-cephclient.spec

@ -0,0 +1,65 @@
Summary: Handle Ceph API calls and provide status updates via alarms
Name: python-cephclient
Version: 13.2.2.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: https://github.com/openstack/stx-integ/tree/master/ceph/python-cephclient/python-cephclient'
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python
BuildRequires: python2-pip
BuildRequires: python2-wheel
Requires: python
Requires: python-ipaddress
Requires: python2-six
Requires: python2-requests
Provides: python-cephclient
%description
A client library in Python for Ceph Mgr RESTful plugin providing REST API
access to the cluster over an SSL-secured connection. Python API is compatible
with the old Python Ceph client at
https://github.com/dmsimard/python-cephclient that no longer works in Ceph
mimic because Ceph REST API component was removed.
%define debug_package %{nil}
%prep
%autosetup -p 1 -n %{name}-%{version}
rm -rf .pytest_cache
rm -rf python_cephclient.egg-info
rm -f requirements.txt
%build
%{__python} setup.py build
%py2_build_wheel
%install
%{__python2} setup.py install --skip-build --root %{buildroot}
mkdir -p $RPM_BUILD_ROOT/wheels
install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%license LICENSE
%{python2_sitelib}/cephclient
%{python2_sitelib}/*.egg-info
%package wheels
Summary: %{name} wheels
%description wheels
Contains python wheels for %{name}
%files wheels
/wheels/*

2
ceph/python-cephclient/python-cephclient/.gitignore

@ -0,0 +1,2 @@
.pytest_cache
*.egg-info

202
ceph/python-cephclient/python-cephclient/LICENSE

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2019 Wind River Systems, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

5
ceph/python-cephclient/python-cephclient/cephclient/__init__.py

@ -0,0 +1,5 @@
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#

5790
ceph/python-cephclient/python-cephclient/cephclient/client.py

File diff suppressed because it is too large

100
ceph/python-cephclient/python-cephclient/cephclient/exception.py

@ -0,0 +1,100 @@
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
class CephClientException(Exception):
message = "generic ceph client exception"
def __init__(self, *args, **kwargs):
if "message" not in kwargs:
try:
message = self.message.format(*args, **kwargs)
except Exception: # noqa
message = '{}, args:{}, kwargs: {}'.format(
self.message, args, kwargs)
else:
message = kwargs["message"]
super(CephClientException, self).__init__(message)
class CephMonRestfulListKeysError(CephClientException):
message = "Failed to get ceph-mgr restful plugin keys. {}"
class CephMonRestfulJsonError(CephClientException):
message = "Failed to decode ceph-mgr restful plugin JSON response: {}"
class CephMonRestfulMissingUserCredentials(CephClientException):
message = "Failed to get ceph-mgr restful plugin credentials for user: {}"
class CephMgrDumpError(CephClientException):
message = "Failed to get ceph manager info. {}"
class CephMgrJsonError(CephClientException):
message = "Failed to decode ceph manager JSON response: {}"
class CephMgrMissingRestfulService(CephClientException):
message = "Missing restful service. Available services: {}"
class CephClientFormatNotSupported(CephClientException):
message = "Command '{prefix}' does not support request format '{format}'"
class CephClientResponseFormatNotImplemented(CephClientException):
message = ("Can't decode response. Support for '{format}' format "
"is not implemented. Response: {reason}")
class CephClientFunctionNotImplemented(CephClientException):
message = "Function '{name}' is not implemented"
class CephClientInvalidChoice(CephClientException):
message = ("Function '{function}' does not support option "
"{option}='{value}'. Supported values are: {supported}")
class CephClientTypeError(CephClientException):
message = ("Expecting option '{name}' of type {expected}. "
"Got {actual} instead")
class CephClientValueOutOfBounds(CephClientException):
message = ("Argument '{name}' should be within range: {min} .. {max} "
". Got value '{actual}' instead")
class CephClientInvalidPgid(CephClientException):
message = ("Argument '{name}' is not a valid Ceph PG id. Expected "
"n.xxx where n is an int > 0, xxx is a hex number > 0. "
"Got value '{actual}' instead")
class CephClientInvalidIPAddr(CephClientException):
message = ("Argument '{name}' should be a valid IPv4 or IPv6 address. "
"Got value '{actual}' instead")
class CephClientInvalidOsdIdValue(CephClientException):
message = ("Invalid OSD ID value '{osdid}'. Should start with 'osd.'")
class CephClientInvalidOsdIdType(CephClientException):
message = ("Invalid OSD ID type for '{osdid}'. "
"Expected integer or 'osd.NNN'")
class CephClientNoSuchUser(CephClientException):
message = ("No such user '{user}'.")
class CephClientIncorrectPassword(CephClientException):
message = ("Incorrect password for user '{user}'.")

5
ceph/python-cephclient/python-cephclient/cephclient/tests/__init__.py

@ -0,0 +1,5 @@
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#

268
ceph/python-cephclient/python-cephclient/cephclient/wrapper.py

@ -0,0 +1,268 @@
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import six
from cephclient.client import CephClient
from cephclient.exception import CephClientFunctionNotImplemented
from cephclient.exception import CephClientInvalidOsdIdValue
from cephclient.exception import CephClientTypeError
class CephWrapper(CephClient):
def __init__(self, endpoint=''):
super(CephWrapper, self).__init__()
def auth_import(self, body='json', timeout=None):
raise CephClientFunctionNotImplemented(name='auth_import')
def _sanitize_osdid_to_str(self, _id):
if isinstance(_id, six.string_types):
prefix = 'osd.'
if not _id.startswith(prefix):
try:
int(_id)
except ValueError:
raise CephClientInvalidOsdIdValue(
osdid=_id)
_id = prefix + _id
elif isinstance(_id, six.integer_types):
_id = 'osd.{}'.format(_id)
else:
raise CephClientInvalidOsdIdValue(
osdid=_id)
return _id
def _sanitize_osdid_to_int(self, _id):
if isinstance(_id, six.string_types):
prefix = 'osd.'
if _id.startswith(prefix):
_id = _id[len(prefix):]
try:
_id = int(_id)
except ValueError:
raise CephClientInvalidOsdIdValue(
osdid=_id)
elif not isinstance(_id, six.integer_types):
raise CephClientInvalidOsdIdValue(
osdid=_id)
return _id
def osd_create(self, uuid, body='json', timeout=None, params=None):
"""create new osd (with optional UUID and ID)
Notes:
1. osd create declares it accepts osd id as string but only works when
given an integer value; it automatically generates an ID otherwise
instead of using the one provided by 'osd create id=...'
2. old cephclient passes osd id through params dictionary
"""
kwargs = dict(uuid=uuid, body=body, timeout=timeout)
try:
kwargs['id'] = self._sanitize_osdid_to_int(params['id'])
except (KeyError, TypeError):
pass
return self._request('osd create', **kwargs)
def osd_rm(self, ids, body='json', timeout=None):
"""remove osd(s) <id> [<id>...], or use <any|all> to remove all osds """
if isinstance(ids, list):
ids = [self._sanitize_osdid_to_str(_id)
for _id in ids]
else:
ids = self._sanitize_osdid_to_str(ids)
return super(CephWrapper, self).osd_rm(
ids=ids, body=body, timeout=timeout)
def osd_remove(self, ids, body='json', timeout=None):
return self.osd_rm(ids, body=body, timeout=timeout)
def osd_down(self, ids, body='json', timeout=None):
"""set osd(s) <id> [<id>...] down, or use <any|all> to set all osds down """
if isinstance(ids, list):
ids = [self._sanitize_osdid_to_str(_id)
for _id in ids]
else:
ids = self._sanitize_osdid_to_str(ids)
return super(CephWrapper, self).osd_down(
ids=ids, body=body, timeout=timeout)
OSD_CRUSH_TREE_CONVERTED_FIELDS = [
'crush_weight', 'depth', 'id', 'name', 'type', 'type_id']
def _osd_crush_tree_convert_node(self, node):
return {k: node[k] for k in self.OSD_CRUSH_TREE_CONVERTED_FIELDS
if k in node}
def _osd_crush_tree_populate_tree(self, node, node_map):
children = node.get('children')
node = self._osd_crush_tree_convert_node(node)
if children:
node['items'] = []
for _id in children:
node['items'].append(
self._osd_crush_tree_populate_tree(
node_map[_id], node_map))
return node
def osd_crush_tree(self, shadow=None, body='json', timeout=None):
"""dump crush buckets and items in a tree view """
response, _body = super(CephWrapper, self).osd_crush_tree(
shadow=shadow, body=body, timeout=timeout)
trees = []
if response.ok and body == 'json' \
and 'output' in _body:
node_map = {}
root_nodes = []
for node in _body['output']:
node_map[node['id']] = node
if node['type'] == 'root':
root_nodes.append(node)
for root in root_nodes:
trees.append(
self._osd_crush_tree_populate_tree(
root, node_map))
_body['output'] = trees
return response, _body
def _osd_crush_rule_by_ruleset(self, ruleset, timeout=None):
response, _body = self.osd_crush_rule_dump(
body='json', timeout=timeout)
if not response.ok:
return response, _body
name = None
for rule in _body['output']:
if rule.get('ruleset') == ruleset:
name = rule.get('rule_name')
_body['output'] = dict(rule=name)
return response, _body
def _osd_crush_ruleset_by_rule(self, rule, timeout=None):
response, _body = self.osd_crush_rule_dump(
name=rule, body='json', timeout=timeout)
return response, _body
def osd_pool_create(self, pool, pg_num, pgp_num=None, pool_type=None,
erasure_code_profile=None, ruleset=None,
expected_num_objects=None, body='json', timeout=None):
"""create pool
Notes:
1. map 'ruleset' to 'rule' (assuming 1:1 correspondence)
"""
response, _body = self._osd_crush_rule_by_ruleset(ruleset)
if not response.ok:
return response, _body
rule = _body['output']['rule']
return super(CephWrapper, self).osd_pool_create(
pool, pg_num, pgp_num=pgp_num, pool_type=pool_type,
erasure_code_profile=erasure_code_profile, rule=rule,
expected_num_objects=expected_num_objects, body=body,
timeout=timeout)
def osd_get_pool_param(self, pool, var, body='json', timeout=None):
"""get pool parameter <var> """
if var == 'crush_ruleset':
response, _body = super(CephWrapper, self).osd_pool_get(
pool, 'crush_rule', body='json', timeout=timeout)
if response.ok:
rule = _body['output']['crush_rule']
del _body['output']['crush_rule']
response, _body = self._osd_crush_ruleset_by_rule(
rule, timeout=timeout)
if response.ok:
_body['output'] = dict(
crush_ruleset=_body['output']['ruleset'])
return response, _body
else:
return super(CephWrapper, self).osd_pool_get(
pool, var, body=body, timeout=timeout)
def osd_pool_set(self, pool, var, val, force=None,
body='json', timeout=None):
"""set pool parameter <var> to <val> """
return super(CephWrapper, self).osd_pool_set(
pool=pool, var=var, val=str(val),
force=force, body=body, timeout=timeout)
def osd_set_pool_param(self, pool, var, val, force=None,
body='json', timeout=None):
"""set pool parameter <var> to <val> """
if var == 'crush_ruleset':
var = 'crush_rule'
response, _body = self._osd_crush_rule_by_ruleset(
val, timeout=timeout)
if not response.ok:
return response, _body
val = _body['output']['rule']
return super(CephWrapper, self).osd_pool_set(
pool, var, str(val), force=None,
body=body, timeout=timeout)
def osd_get_pool_quota(self, pool, body='json', timeout=None):
"""obtain object or byte limits for pool """
return super(CephWrapper, self).osd_pool_get_quota(
pool, body=body, timeout=timeout)
def osd_set_pool_quota(self, pool, field, val, body='json', timeout=None):
"""set object or byte limit on pool """
return super(CephWrapper, self).osd_pool_set_quota(
pool, field, str(val), body=body, timeout=timeout)
def osd_pool_set_quota(self, pool, field, val,
body='json', timeout=None):
"""set object or byte limit on pool """
return super(CephWrapper, self).osd_pool_set_quota(
pool=pool, field=field, val=str(val),
body=body, timeout=timeout)
def _auth_convert_caps(self, caps):
if caps:
if not isinstance(caps, dict):
raise CephClientTypeError(
name='caps',
actual=type(caps),
expected=dict)
_caps = []
for key, value in list(caps.items()):
_caps.append(key)
_caps.append(value)
caps = _caps
return caps
def auth_add(self, entity, caps=None, body='json', timeout=None):
"""add auth info for <entity> from input file, or random key if no input is given, and/or any caps specified in the command """
caps = self._auth_convert_caps(caps)
return super(CephWrapper, self).auth_add(
entity, caps=caps, body=body, timeout=timeout)
def auth_caps(self, entity, caps, body='json', timeout=None):
"""update caps for <name> from caps specified in the command """
caps = self._auth_convert_caps(caps)
return super(CephWrapper, self).auth_caps(
entity, caps=caps, body=body, timeout=timeout)
def auth_get_or_create(self, entity, caps=None, body='json', timeout=None):
"""add auth info for <entity> from input file, or random key if no input given, and/or any caps specified in the command """
caps = self._auth_convert_caps(caps)
return super(CephWrapper, self).auth_get_or_create(
entity, caps, body=body, timeout=timeout)
def auth_get_or_create_key(self, entity, caps=None,
body='json', timeout=None):
"""get, or add, key for <name> from system/caps pairs specified in the command. If key already exists, any given caps must match the existing caps for that key. """
caps = self._auth_convert_caps(caps)
response, _body = super(CephWrapper, self).auth_get_or_create_key(
entity, caps, body=body, timeout=timeout)
if response.ok:
_body['output'] = _body['output']
return response, _body
def osd_set_key(self, key, sure=None, body='json', timeout=None):
"""set <key> """
return self.osd_set(key, sure=sure, body=body, timeout=timeout)

3
ceph/python-cephclient/python-cephclient/requirements.txt

@ -0,0 +1,3 @@
ipaddress
requests
six

34
ceph/python-cephclient/python-cephclient/setup.py

@ -0,0 +1,34 @@
#!/usr/bin/env python
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import setuptools
setuptools.setup(
name='python-cephclient',
packages=['cephclient'],
version='13.2.2.0',
url='https://github.com/openstack/stx-integ/tree/master/ceph/python-cephclient/python-cephclient', # noqa E501
author='Daniel Badea',
author_email='daniel.badea@windriver.com',
description=(
'A client library in Python for Ceph Mgr RESTful plugin '
'providing REST API access to the cluster over an SSL-secured '
'connection. Python API is compatible with the old Python '
'Ceph client at https://github.com/dmsimard/python-cephclient '
'that no longer works in Ceph mimic because Ceph REST API '
'component was removed.'),
license='Apache-2.0',
keywords='ceph rest api ceph-rest-api client library',
install_requires=['ipaddress', 'requests', 'six'],
classifiers=[
'License :: OSI Approved :: Apache Software License',
'Development Status :: 1 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Intended Audience :: Information Technology',
'Programming Language :: Python',
'Topic :: Utilities'
])

6
ceph/python-cephclient/python-cephclient/test-requirements.txt

@ -0,0 +1,6 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
flake8
pytest

19
ceph/python-cephclient/python-cephclient/tox.ini

@ -0,0 +1,19 @@
[tox]
envlist = py27,pep8
skipsdist = True
toxworkdir = /tmp/{env:USER}_ceph_manager_tox
[testenv]
setenv = VIRTUAL_ENV={envdir}
usedevelop = True
install_command = pip install --no-binary --upgrade --force-reinstall {opts} {packages}
deps = -r{toxinidir}/test-requirements.txt
commands = py.test {posargs}
whitelist_externals = bash
[testenv:pep8]
commands =
flake8 {posargs}
[flake8]
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build
Loading…
Cancel
Save