Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port ceph-brag to Python 3 (+ small fixes) #10064

Merged
merged 7 commits into from Jul 4, 2016
Merged

Port ceph-brag to Python 3 (+ small fixes) #10064

merged 7 commits into from Jul 4, 2016

Conversation

oprypin
Copy link
Contributor

@oprypin oprypin commented Jun 30, 2016

Compatibility with Python 2.6+ is kept.

Testing done:

set -o errexit
#cd src

./vstart.sh -d -n -x

for v in 2 3; do
    virtualenv --no-site-packages -p python$v venv$v
    . venv$v/bin/activate

    pip install pecan sqlalchemy requests cython

    pushd pybind/rados
        python setup.py install
    popd

    pushd brag/server
        python setup.py develop
        pecan serve config.py &
        server_pid=$!

        python setup.py test
# test_units (ceph_brag.tests.test_units.TestUnits) ... ok
# test_1_get_invalid_url_format (ceph_brag.tests.test_functional.TestRootController) ... ok
# test_2_put (ceph_brag.tests.test_functional.TestRootController) ... ok
# test_3_put_invalid_json (ceph_brag.tests.test_functional.TestRootController) ... ok
# test_4_put_invalid_entries_1 (ceph_brag.tests.test_functional.TestRootController) ... ok
# test_5_put_incomplete_json (ceph_brag.tests.test_functional.TestRootController) ... ok
# test_6_get (ceph_brag.tests.test_functional.TestRootController) ... ok
# test_7_get_invalid_uuid (ceph_brag.tests.test_functional.TestRootController) ... ok
# test_8_get_invalid_version (ceph_brag.tests.test_functional.TestRootController) ... ok
# test_91_delete_wrong_uuid (ceph_brag.tests.test_functional.TestRootController) ... ok
# test_92_delete (ceph_brag.tests.test_functional.TestRootController) ... ok
# test_9_delete_invalid_parameters (ceph_brag.tests.test_functional.TestRootController) ... ok
#
# ----------------------------------------------------------------------
# Ran 12 tests in 0.723s
#
# OK
    popd

    PATH=".:$PATH" brag/client/ceph-brag update-metadata --name=ceph --organization=organization --email=example@example.org --description=description --url=http://localhost:8080
    PATH=".:$PATH" brag/client/ceph-brag publish

    curl http://localhost:8080/
    echo
# [{"email": "example@example.org", "cluster_creation_date": "2016-06-30 16:02:21.857864", "cluster_name": "ceph", "num_versions": 1, "organization": "organization", "uuid": "242a16cb-c181-4a55-917a-94e9f9fd8db0"}]

    kill $server_pid

    deactivate
    rm -rf venv$v
done

The two commits related to JSON fields were required for the tests to run properly, even on Python 2.x.

This pull request does not depend on other pending changes related to Python 3 compatibility, because rados.pyx binding works fine already, and the ceph subprocess is ran using default Python.

Signed-off-by: Oleh Prypin <oleh@pryp.in>
It is an implementation detail that `is` happens to behave the same as `==` for low integers

Signed-off-by: Oleh Prypin <oleh@pryp.in>
Signed-off-by: Oleh Prypin <oleh@pryp.in>
Signed-off-by: Oleh Prypin <oleh@pryp.in>
Signed-off-by: Oleh Prypin <oleh@pryp.in>
Signed-off-by: Oleh Prypin <oleh@pryp.in>
@tchaikov tchaikov self-assigned this Jul 1, 2016
@tchaikov
Copy link
Contributor

tchaikov commented Jul 1, 2016

will test it locally.

@tchaikov
Copy link
Contributor

tchaikov commented Jul 4, 2016

also tested locally.

@tchaikov tchaikov merged commit b6a1e50 into ceph:master Jul 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants