[Kimchi-devel] [PATCH 02/10] bug fix: Reorganize repository information
Aline Manera
alinefm at linux.vnet.ibm.com
Tue Mar 18 17:04:07 UTC 2014
From: Aline Manera <alinefm at br.ibm.com>
There are some specific repository data according to its type.
'deb' repositories have dist and componenets and that information does
not make sense for a 'yum' repository.
The same way a 'yum' repository has name, mirrorlist, gpgcheck,
gpgkey that only make sense for this type of repo.
Signed-off-by: Aline Manera <alinefm at br.ibm.com>
---
docs/API.md | 78 +++++++++++++------------------
src/kimchi/API.json | 111 ++++++++++++++++++++++++++++----------------
src/kimchi/control/host.py | 3 +-
3 files changed, 104 insertions(+), 88 deletions(-)
diff --git a/docs/API.md b/docs/API.md
index 147511d..8d6682b 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -848,19 +848,16 @@ Contains the information for a specific package to be updated.
* **GET**: Retrieve a summarized list of all repositories available
* **POST**: Add a new repository
- * repo_id *(optional)*: Unique repository name for each repository,
-one word.
* baseurl: URL to the repodata directory when "is_mirror" is false.
Otherwise, it can be URL to the mirror system for YUM. Can be an
http://, ftp:// or file:// URL.
- * is_mirror *(optional)*: Set the given URI of baseurl as a mirror
-list, instead of use baseurl in repository configuration.
- * url_args *(optional)*: Arguments to be passed to baseurl, like the
-list of APT repositories provided by the same baseurl.
- * gpgkey *(optional)*: URL pointing to the ASCII-armored GPG key
-file for the repository. This option is used if yum needs a public key
-to verify a package and the required key hasn't been imported into the
-RPM database.
+ * repo_id *(optional)*: Unique YUM repository ID
+ * config: A dictionary that contains specific data according to repository
+ type.
+ * mirrorlist *(optional)*: Specifies a URL to a file containing a
+ list of baseurls for YUM repository
+ * dist: Distribution to DEB repository
+ * comps *(optional)*: List of components to DEB repository
### Resource: Repository
@@ -870,47 +867,38 @@ RPM database.
* **GET**: Retrieve the full description of a Repository
* repo_id: Unique repository name for each repository, one word.
- * repo_name: Human-readable string describing the repository.
* baseurl: URL to the repodata directory when "is_mirror" is false.
Otherwise, it can be URL to the mirror system for YUM. Can be an
http://, ftp:// or file:// URL.
- * is_mirror: Set the given URI of baseurl as a mirror list, instead
-of use baseurl in repository configuration.
- * url_args: Arguments to be passed to baseurl, like the list of APT
-repositories provided by the same baseurl.
- * enabled: Indicates if repository should be included as a package
-source:
- * false: Do not include the repository.
- * true: Include the repository.
- * gpgcheck: Indicates if a GPG signature check on the packages gotten
-from repository should be performed:
- * false: Do not check GPG signature
- * true: Check GPG signature
- * gpgkey: URL pointing to the ASCII-armored GPG key file for the
-repository. This option is used if yum needs a public key to verify a package
-and the required key hasn't been imported into the RPM database.
+ * enabled: True, when repository is enabled; False, otherwise
+ * config: A dictionary that contains specific data according to repository
+ type.
+ * repo_name: Human-readable string describing the YUM repository.
+ * mirrorlist: Specifies a URL to a file containing a list of baseurls
+ for YUM repository
+ * gpgcheck: True, to enable GPG signature verification; False, otherwise.
+ * gpgkey: URL pointing to the ASCII-armored GPG key file for the YUM
+ repository.
+ * dist: Distribution to DEB repository
+ * comps: List of components to DEB repository
+
* **DELETE**: Remove the Repository
* **POST**: *See Repository Actions*
* **PUT**: update the parameters of existing Repository
- * repo_id *(otional)*: Unique repository name for each repository,
-one word.
- * repo_name *(otional)*: Human-readable string describing the
-repository.
- * baseurl *(optional)*: URL to the repodata directory when
-"is_mirror" is false. Otherwise, it can be URL to the mirror system for
-YUM. Can be an http://, ftp:// or file:// URL.
- * is_mirror *(optional)*: Set the given URI of baseurl as a mirror
-list, instead of use baseurl in repository configuration.
- * url_args *(optional)*: Arguments to be passed to baseurl, like the
-list of APT repositories provided by the same baseurl.
- * gpgcheck *(optional)*: Indicates if a GPG signature check on the
-packages gotten from repository should be performed:
- * false: Do not check GPG signature
- * true: Check GPG signature
- * gpgkey *(optional)*: URL pointing to the ASCII-armored GPG key
-file for the repository. This option is used if yum needs a public key
-to verify a package and the required key hasn't been imported into the
-RPM database.
+ * repo_id: Unique repository name for each repository, one word.
+ * baseurl: URL to the repodata directory when "is_mirror" is false.
+Otherwise, it can be URL to the mirror system for YUM. Can be an
+http://, ftp:// or file:// URL.
+ * config: A dictionary that contains specific data according to repository
+ type.
+ * repo_name: Human-readable string describing the YUM repository.
+ * mirrorlist: Specifies a URL to a file containing a list of baseurls
+ for YUM repository
+ * gpgcheck: True, to enable GPG signature verification; False, otherwise.
+ * gpgkey: URL pointing to the ASCII-armored GPG key file for the YUM
+ repository.
+ * dist: Distribution to DEB repository
+ * comps: List of components to DEB repository
**Actions (POST):**
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index 6e932ed..cf89ce4 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -522,7 +522,7 @@
"type": "object",
"properties": {
"repo_id": {
- "description": "Unique repository name for each repository, one word.",
+ "description": "Repository ID used for YUM repository.",
"type": "string",
"error": "KCHREPOS0001E"
},
@@ -532,19 +532,33 @@
"required": true,
"error": "KCHREPOS0002E"
},
- "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",
- "error": "KCHREPOS0003E"
- },
- "gpgkey": {
- "description": "URL pointing to the ASCII-armored GPG key file for the repository.",
- "type": "string",
- "error": "KCHREPOS0004E"
+ "config": {
+ "description": "Dictionary containing repository configuration",
+ "type": "object",
+ "error": "KCHREPOS0003E",
+ "properties": {
+ "dist": {
+ "description": "Distribution to DEB repository",
+ "type": "string",
+ "error": "KCHREPOS0004E"
+ },
+ "comps": {
+ "description": "List of components to DEB repository",
+ "type": "array",
+ "error": "KCHREPOS0005E",
+ "uniqueItems": true,
+ "items": {
+ "description": "Component name",
+ "type": "string",
+ "error": "KCHREPOS0006E"
+ }
+ },
+ "mirrorlist": {
+ "description": "URL to a file containing a list of baseurls",
+ "type": "string",
+ "error": "KCHREPOS0007E"
+ }
+ }
}
},
"additionalProperties": false,
@@ -553,38 +567,53 @@
"repository_update": {
"type": "object",
"properties": {
- "repo_id": {
- "description": "Unique repository name for each repository, one word.",
- "type": "string",
- "error": "KCHREPOS0001E"
- },
- "repo_name": {
- "description": "Human-readable string describing the repository.",
- "type": "string",
- "error": "KCHREPOS0005E"
- },
"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",
"error": "KCHREPOS0002E"
},
- "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",
- "error": "KCHREPOS0003E"
- },
- "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",
- "error": "KCHREPOS0004E"
+ "config": {
+ "description": "Dictionary containing repository configuration",
+ "type": "object",
+ "error": "KCHREPOS0003E",
+ "properties": {
+ "dist": {
+ "description": "Distribution to DEB repository",
+ "type": "string",
+ "error": "KCHREPOS0004E"
+ },
+ "comps": {
+ "description": "List of components to DEB repository",
+ "type": "array",
+ "error": "KCHREPOS0005E",
+ "uniqueItems": true,
+ "items": {
+ "description": "Component name",
+ "type": "string",
+ "error": "KCHREPOS0006E"
+ }
+ },
+ "repo_name": {
+ "description": "Human-readable string describing the YUM repository.",
+ "type": "string",
+ "error": "KCHREPOS0008E"
+ },
+ "mirrorlist": {
+ "description": "URL to a file containing a list of baseurls for YUM repository",
+ "type": "string",
+ "error": "KCHREPOS0007E"
+ },
+ "gpgcheck": {
+ "description": "Indicates if a GPG signature check on the packages gotten from repository should be performed.",
+ "type": "boolean",
+ "error": "KCHREPOS0009E"
+ },
+ "gpgkey": {
+ "description": "URL pointing to the ASCII-armored GPG key file for the repository.",
+ "type": "string",
+ "error": "KCHREPOS0010E"
+ }
+ }
}
},
"additionalProperties": false,
diff --git a/src/kimchi/control/host.py b/src/kimchi/control/host.py
index edcc0ad..cfc24bd 100644
--- a/src/kimchi/control/host.py
+++ b/src/kimchi/control/host.py
@@ -113,8 +113,7 @@ class Repositories(Collection):
class Repository(Resource):
def __init__(self, model, id):
super(Repository, self).__init__(model, id)
- self.update_params = ["repo_id", "repo_name", "baseurl", "is_mirror",
- "url_args", "gpgcheck", "gpgkey"]
+ self.update_params = ["config", "baseurl"]
self.uri_fmt = "/host/repositories/%s"
self.enable = self.generate_action_handler('enable')
self.disable = self.generate_action_handler('disable')
--
1.7.10.4
More information about the Kimchi-devel
mailing list