
WIP: This V1 supports only YUM. APT will come in V2 due to finish tests. This patch set provides support to host's repositories management operations. At this point, an agnostic class is providing support to backend and REST API operations. In addition, YUM (for RHEL, Fedora, SLES and OpenSuse) and APT (for Debian and Ubuntu) specific classes are provided to support the operation os each software update system. To test the backend execute the following commands: $ cd tests $ sudo ./run_tests.sh test_model.ModelTests.test_repository_create $ sudo ./run_tests.sh test_model.ModelTests.test_repository_update $ sudo ./run_tests.sh test_model.ModelTests.test_repository_disable_enable To test the REST API, execute the following commands (all them are agnostic of the host's distro): 1) Get list of all repositories enabled in the host: $ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/ -X GET 2) Create a new repository: $ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/ -X POST -d' { "repo_id": "fedora-fake", "baseurl": "http://www.fedora.org", "gpgkey": "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-fake-19" } ' 3) Get information from a specific repository: $ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake 4) Update a specific repository: $ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake -X PUT -d' { "repo_id":"fedora-fake", "repo_name":"Fedora 19 FAKEs", "baseurl": "http://www.fedora.org/downloads" } ' 5) Disable a specific repository: $ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake/disable -X POST -d '' 6) Enable a specific repository: $ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake/enable -X POST -d '' 7) Delete a specific repository: $ curl -u <USER> -H 'Content-type: application/json' -H 'Accept: application/json' http://localhost:8000/host/repositories/fedora-fake -X DELETE Paulo Vital (5): Host's repositories management: Update API.md Host's repositories management: Update REST API Host's repositories management: Update backend. Host's repositories management: Update Makefile Host's repositories management: Update test-cases. Makefile.am | 1 + docs/API.md | 80 +++++++++ src/kimchi/API.json | 63 +++++++ src/kimchi/Makefile.am | 1 + src/kimchi/control/host.py | 21 +++ src/kimchi/mockmodel.py | 34 ++++ src/kimchi/model/host.py | 50 +++++- src/kimchi/repositories.py | 418 +++++++++++++++++++++++++++++++++++++++++++++ tests/test_model.py | 99 +++++++++++ tests/test_rest.py | 32 ++++ 10 files changed, 798 insertions(+), 1 deletion(-) create mode 100644 src/kimchi/repositories.py -- 1.8.3.1