| |
@@ -69,19 +69,10 @@
|
| |
query["context"] = context
|
| |
return query
|
| |
|
| |
- def _get_modules(self, name, stream, version=None, context=None, state="ready", strict=False):
|
| |
- """Query and return modules from MBS with specific info
|
| |
-
|
| |
- :param str name: module's name.
|
| |
- :param str stream: module's stream.
|
| |
- :kwarg str version: module's version. Optional.
|
| |
- :kwarg str context: module's context. Optional.
|
| |
- :kwarg str state: module's state. Defaults to ``ready``.
|
| |
- :kwarg bool strict: Normally this function returns None if no module can be
|
| |
- found. If strict=True, then an UnprocessableEntity is raised.
|
| |
- :return: final list of module_info which pass repoclosure
|
| |
- :rtype: list[dict]
|
| |
- :raises UnprocessableEntity: if no modules are found and ``strict`` is True.
|
| |
+ def get_modules(self, name, stream, version=None, context=None, state="ready", strict=False):
|
| |
+ """Query and return modules from MBS
|
| |
+
|
| |
+ Refer to :meth:`GenericResolver.get_modules` for details of arguments.
|
| |
"""
|
| |
query = self._query_from_nsvc(name, stream, version, context, state)
|
| |
query["page"] = 1
|
| |
@@ -113,9 +104,6 @@
|
| |
|
| |
return modules
|
| |
|
| |
- def _get_module(self, name, stream, version, context, state="ready", strict=False):
|
| |
- return self._get_modules(name, stream, version, context, state, strict)[0]
|
| |
-
|
| |
def get_module_modulemds(self, name, stream, version=None, context=None, strict=False):
|
| |
"""
|
| |
Gets the module modulemds from the resolver.
|
| |
@@ -135,7 +123,7 @@
|
| |
if local_modules:
|
| |
return [m.mmd() for m in local_modules]
|
| |
|
| |
- modules = self._get_modules(name, stream, version, context, strict=strict)
|
| |
+ modules = self.get_modules(name, stream, version, context, strict=strict)
|
| |
if not modules:
|
| |
return []
|
| |
|
| |
@@ -186,7 +174,7 @@
|
| |
continue
|
| |
|
| |
# Find the dep in the built modules in MBS
|
| |
- modules = self._get_modules(
|
| |
+ modules = self.get_modules(
|
| |
module_name, module_info['stream'], module_info['version'],
|
| |
module_info['context'], strict=True)
|
| |
|
| |
@@ -232,7 +220,7 @@
|
| |
if mmd:
|
| |
queried_mmd = mmd
|
| |
else:
|
| |
- queried_module = self._get_module(
|
| |
+ queried_module = self.get_module(
|
| |
name, stream, version, context, strict=strict)
|
| |
yaml = queried_module['modulemd']
|
| |
queried_mmd = self.extract_modulemd(yaml, strict=strict)
|
| |
@@ -255,7 +243,7 @@
|
| |
|
| |
if "context" not in details:
|
| |
details["context"] = models.DEFAULT_MODULE_CONTEXT
|
| |
- modules = self._get_modules(
|
| |
+ modules = self.get_modules(
|
| |
name, details['stream'], details['version'],
|
| |
details['context'], strict=True)
|
| |
for m in modules:
|
| |
For an issue I'm working on, I need to get koji_tag from the latest
platform module. For local build, MBSResolver is used to get module from
a local mbs database and remote MBS if local database does not have the
module. On the other hand, for a MBS service, it uses DBResolver to
query modules from connected database directly. So, my case mentioned
has to ensure platform module is queried from MBS service database
whatever current module is being built locally or in a MBS service.
This patch makes MBSResolver._get_modules public so that it can be
called dynamically based on resolver configuration. As a result, I can
get a platform module in this way,
MBSResolver._get_module is changed accordingly.
Signed-off-by: Chenxiong Qi cqi@redhat.com