V1 -> V2:
* Removed the enable/disable from docs/API.md and src/kimchi/API.json
* fixed wrong URI on test_rest.py
* PEP8 compatibility
* Updated repositories.py to make consistent with docs/API.md
* Raised correct exceptions
* Changed model/host.py and mockmodel.py to generate repo_id if not provided
* Changed mockmodel.py to declare MockRepositories class
V1:
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 | 77 ++++++
src/kimchi/API.json | 59 +++++
src/kimchi/Makefile.am | 1 +
src/kimchi/control/host.py | 21 ++
src/kimchi/mockmodel.py | 140 +++++++++++
src/kimchi/model/host.py | 56 ++++-
src/kimchi/repositories.py | 590 +++++++++++++++++++++++++++++++++++++++++++++
tests/test_model.py | 100 ++++++++
tests/test_rest.py | 33 +++
10 files changed, 1077 insertions(+), 1 deletion(-)
create mode 100644 src/kimchi/repositories.py
--
1.8.3.1