From: Aline Manera <alinefm(a)br.ibm.com>
The backend already supports the repo_name as an optional parameter while
creating a new YUM repo but the jsonschema and docs are not consistent with that.
Fix it.
Also insert repo_name under "config" as it is YUM specific information.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
docs/API.md | 1 +
src/kimchi/API.json | 5 +++++
src/kimchi/i18n.py | 1 +
src/kimchi/mockmodel.py | 7 ++++---
src/kimchi/repositories.py | 2 +-
5 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/docs/API.md b/docs/API.md
index a380558..fed7f5e 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -854,6 +854,7 @@ http://, ftp:// or file:// URL.
* repo_id *(optional)*: Unique YUM repository ID
* config: A dictionary that contains specific data according to repository
type.
+ * repo_name *(optional)*: YUM Repository name
* mirrorlist *(optional)*: Specifies a URL to a file containing a
list of baseurls for YUM repository
* dist: Distribution to DEB repository
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index 9bde6a2..8ecd665 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -552,6 +552,11 @@
"error": "KCHREPOS0006E"
}
},
+ "repo_name": {
+ "description": "YUM repository name",
+ "type": "string",
+ "error": "KCHREPOS0023E"
+ },
"mirrorlist": {
"description": "URL to a file containing a
list of baseurls",
"type": "string",
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 1f84034..c084e21 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -248,4 +248,5 @@ messages = {
"KCHREPOS0020E": _("Could not enable repository %(repo_id)s."),
"KCHREPOS0021E": _("Could not disable repository %(repo_id)s."),
"KCHREPOS0022E": _("YUM Repository ID already exists"),
+ "KCHREPOS0023E": _("YUM Repository name must be a string"),
}
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index 01480f4..b272933 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -1135,13 +1135,14 @@ class MockRepositories(object):
def addRepository(self, params):
# Create and enable the repository
repo_id = params['repo_id']
+ config = params.get('config', {})
repo = {'repo_id': repo_id,
'baseurl': params.get('baseurl'),
'enabled': True,
- 'config': {'repo_name': params.get('repo_name',
repo_id),
- 'gpgkey': params.get('gpgkey', []),
+ 'config': {'repo_name': config.get('repo_name',
repo_id),
+ 'gpgkey': config.get('gpgkey', []),
'gpgcheck': True,
- 'mirrorlist': params.get('mirrorlist',
"")}
+ 'mirrorlist': config.get('mirrorlist',
"")}
}
self._repos[repo_id] = repo
diff --git a/src/kimchi/repositories.py b/src/kimchi/repositories.py
index 39dde12..93603e8 100644
--- a/src/kimchi/repositories.py
+++ b/src/kimchi/repositories.py
@@ -174,7 +174,7 @@ class YumRepo(object):
if repo_id in repos.repos.keys():
raise InvalidOperation("KCHREPOS0022E", {'repo_id':
repo_id})
- repo_name = params.get('repo_name', None)
+ repo_name = config.get('repo_name', None)
if repo_name is None:
repo_name = repo_id
--
1.7.10.4
Show replies by date
Reviewed-By: Ramon Medeiros <ramonn(a)br.ibm.com>
Applied. Thanks.
Regards,
Aline Manera