[Kimchi-devel] [PATCH 2/5] Host's repositories management: Update REST API
Aline Manera
alinefm at linux.vnet.ibm.com
Mon Feb 10 18:13:20 UTC 2014
On 02/10/2014 11:46 AM, Paulo Vital wrote:
> Define Repositories collection and Repository resource according to API.md
> Update API.json
> Activate auth support to new collection
>
> Signed-off-by: Paulo Vital <pvital at linux.vnet.ibm.com>
> ---
> src/kimchi/API.json | 63 ++++++++++++++++++++++++++++++++++++++++++++++
> src/kimchi/control/host.py | 21 ++++++++++++++++
> 2 files changed, 84 insertions(+)
>
> diff --git a/src/kimchi/API.json b/src/kimchi/API.json
> index 08c77c5..db9216c 100644
> --- a/src/kimchi/API.json
> +++ b/src/kimchi/API.json
> @@ -359,6 +359,69 @@
> "graphics": { "$ref": "#/kimchitype/graphics" }
> },
> "additionalProperties": false
> + },
> + "repository_create": {
> + "type": "object",
> + "properties": {
> + "repo_id": {
> + "description": "Unique repository name for each repository, one word.",
> + "type": "string"
> + },
> + "baseurl": {
> + "description": "URL to the directory where the repodata directory of a repository is located. Can be an http://, ftp:// or file:// URL.",
> + "type": "string",
> + "required": true
> + },
> + "is_mirror": {
> + "description": "Set the given URI of baseurl as a mirror list",
> + "type": "boolean"
> + },
> + "url_args": {
> + "description": "Arguments to be passed to baseurl, like the list of APT repositories provided by the same baseurl.",
> + "type": "string"
> + },
> + "gpgkey": {
> + "description": "URL pointing to the ASCII-armored GPG key file for the repository.",
> + "type": "string"
> + }
> + }
> + },
> + "repository_update": {
> + "type": "object",
> + "properties": {
> + "repo_id": {
> + "description": "Unique repository name for each repository, one word.",
> + "type": "string"
> + },
> + "repo_name": {
> + "description": "Human-readable string describing the repository.",
> + "type": "string"
> + },
> + "baseurl": {
> + "description": "URL to the directory where the repodata directory of a repository is located. Can be an http://, ftp:// or file:// URL.",
> + "type": "string"
> + },
> + "is_mirror": {
> + "description": "Set the given URI of baseurl as a mirror list",
> + "type": "boolean"
> + },
> + "url_args": {
> + "description": "Arguments to be passed to baseurl, like the list of APT repositories provided by the same baseurl.",
> + "type": "string"
> + },
> + "enabled": {
> + "description": "Indicates if repository should be included as a package source, or not.",
> + "type": "boolean"
> + },
It will be update through actions enable/disable instead of PUT method.
> + "gpgcheck": {
> + "description": "Indicates if a GPG signature check on the packages gotten from repository should be performed.",
> + "type": "boolean"
> + },
> + "gpgkey": {
> + "description": "URL pointing to the ASCII-armored GPG key file for the repository.",
> + "type": "string"
> + }
> + }
> }
> }
> }
> diff --git a/src/kimchi/control/host.py b/src/kimchi/control/host.py
> index 053c822..12c998e 100644
> --- a/src/kimchi/control/host.py
> +++ b/src/kimchi/control/host.py
> @@ -36,6 +36,7 @@ class Host(Resource):
> self.shutdown = self.generate_action_handler('shutdown')
> self.stats = HostStats(self.model)
> self.partitions = Partitions(self.model)
> + self.repositories = Repositories(self.model)
>
> @property
> def data(self):
> @@ -61,3 +62,23 @@ class Partition(Resource):
> @property
> def data(self):
> return self.info
> +
> +
> +class Repositories(Collection):
> + def __init__(self, model):
> + super(Repositories, self).__init__(model)
> + self.resource = Repository
> +
> +
> +class Repository(Resource):
> + def __init__(self, model, id):
> + super(Repository, self).__init__(model, id)
> + self.update_params = ["repo_id", "repo_name", "baseurl", "mirrors",
> + "url_args", "enabled", "gpgcheck", "gpgkey"]
> + self.uri_fmt = "/host/repositories/%s"
> + self.enable = self.generate_action_handler('enable')
> + self.disable = self.generate_action_handler('disable')
> +
> + @property
> + def data(self):
> + return self.info
More information about the Kimchi-devel
mailing list