Add /projects/depsolve route
This commit is contained in:
parent
a0d6551a3b
commit
4c459c4bf4
@ -73,6 +73,15 @@ def yaps_to_project_info(yaps):
|
||||
"builds": [build]}
|
||||
|
||||
|
||||
def tm_to_dep(tm):
|
||||
"""Extract the info from a TransactionMember object"""
|
||||
return {"name": tm.name,
|
||||
"epoch": tm.epoch,
|
||||
"version": tm.version,
|
||||
"release": tm.release,
|
||||
"arch": tm.arch}
|
||||
|
||||
|
||||
def projects_list(yb):
|
||||
"""Return a list of projects
|
||||
|
||||
@ -113,7 +122,16 @@ def projects_depsolve(yb, project_names):
|
||||
:returns: ...
|
||||
:rtype: ...
|
||||
"""
|
||||
pass
|
||||
# TODO - Catch yum tracebacks here
|
||||
|
||||
# This resets the transaction
|
||||
yb.closeRpmDB()
|
||||
for p in project_names:
|
||||
yb.install(pattern=p)
|
||||
(rc, msg) = yb.buildTransaction()
|
||||
# If rc isn't 2 something went wrong, raise and error
|
||||
yb.tsInfo.makelists()
|
||||
return sorted(map(tm_to_dep, yb.tsInfo.installed + yb.tsInfo.depinstalled), key=lambda p: p["name"].lower())
|
||||
|
||||
|
||||
def modules_list(yb):
|
||||
|
@ -24,7 +24,7 @@ from pykickstart.parser import KickstartParser
|
||||
from pykickstart.version import makeVersion, RHEL7
|
||||
|
||||
from pylorax.api.crossdomain import crossdomain
|
||||
from pylorax.api.projects import projects_list, projects_info
|
||||
from pylorax.api.projects import projects_list, projects_info, projects_depsolve
|
||||
from pylorax.api.recipes import list_branch_files, read_recipe_commit, recipe_filename, list_commits
|
||||
from pylorax.api.recipes import recipe_from_dict, recipe_from_toml, commit_recipe, delete_recipe, revert_recipe
|
||||
from pylorax.api.recipes import tag_recipe_commit, recipe_diff
|
||||
@ -305,3 +305,12 @@ def v0_api(api):
|
||||
projects = projects_info(api.config["YUMLOCK"].yb, project_names.split(","))
|
||||
|
||||
return jsonify(projects=projects)
|
||||
|
||||
@api.route("/api/v0/projects/depsolve/<project_names>")
|
||||
@crossdomain(origin="*")
|
||||
def v0_projects_depsolve(project_names):
|
||||
"""Return detailed information about the listed projects"""
|
||||
with api.config["YUMLOCK"].lock:
|
||||
deps = projects_depsolve(api.config["YUMLOCK"].yb, project_names.split(","))
|
||||
|
||||
return jsonify(projects=deps)
|
||||
|
Loading…
Reference in New Issue
Block a user