2018-05-16 20:15:10 +00:00
<!DOCTYPE html>
<!-- [if IE 8]><html class="no - js lt - ie9" lang="en" > <![endif] -->
<!-- [if gt IE 8]><! --> < html class = "no-js" lang = "en" > <!-- <![endif] -->
< head >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
2018-07-20 23:27:17 +00:00
< title > pylorax.api.v0 — Lorax 28.14.2 documentation< / title >
2018-05-16 20:15:10 +00:00
< link rel = "stylesheet" href = "../../../_static/css/theme.css" type = "text/css" / >
< link rel = "stylesheet" href = "../../../_static/pygments.css" type = "text/css" / >
< link rel = "index" title = "Index" href = "../../../genindex.html" / >
< link rel = "search" title = "Search" href = "../../../search.html" / >
< script src = "../../../_static/js/modernizr.min.js" > < / script >
< / head >
< body class = "wy-body-for-nav" >
< div class = "wy-grid-for-nav" >
< nav data-toggle = "wy-nav-shift" class = "wy-nav-side" >
< div class = "wy-side-scroll" >
< div class = "wy-side-nav-search" >
< a href = "../../../index.html" class = "icon icon-home" > Lorax
< / a >
< div class = "version" >
2018-07-20 23:27:17 +00:00
28.14.2
2018-05-16 20:15:10 +00:00
< / div >
< div role = "search" >
< form id = "rtd-search-form" class = "wy-form" action = "../../../search.html" method = "get" >
< input type = "text" name = "q" placeholder = "Search docs" / >
< input type = "hidden" name = "check_keywords" value = "yes" / >
< input type = "hidden" name = "area" value = "default" / >
< / form >
< / div >
< / div >
< div class = "wy-menu wy-menu-vertical" data-spy = "affix" role = "navigation" aria-label = "main navigation" >
< ul >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../intro.html" > Introduction to Lorax< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../intro.html#before-lorax" > Before Lorax< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../lorax.html" > Lorax< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../livemedia-creator.html" > livemedia-creator< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../lorax-composer.html" > lorax-composer< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../composer-cli.html" > composer-cli< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../product-images.html" > Product and Updates Images< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../modules.html" > pylorax< / a > < / li >
< / ul >
< / div >
< / div >
< / nav >
< section data-toggle = "wy-nav-shift" class = "wy-nav-content-wrap" >
< nav class = "wy-nav-top" aria-label = "top navigation" >
< i data-toggle = "wy-nav-top" class = "fa fa-bars" > < / i >
< a href = "../../../index.html" > Lorax< / a >
< / nav >
< div class = "wy-nav-content" >
< div class = "rst-content" >
< div role = "navigation" aria-label = "breadcrumbs navigation" >
< ul class = "wy-breadcrumbs" >
< li > < a href = "../../../index.html" > Docs< / a > » < / li >
< li > < a href = "../../index.html" > Module code< / a > » < / li >
< li > < a href = "../../pylorax.html" > pylorax< / a > » < / li >
< li > pylorax.api.v0< / li >
< li class = "wy-breadcrumbs-aside" >
< / li >
< / ul >
< hr / >
< / div >
< div role = "main" class = "document" itemscope = "itemscope" itemtype = "http://schema.org/Article" >
< div itemprop = "articleBody" >
< h1 > Source code for pylorax.api.v0< / h1 > < div class = "highlight" > < pre >
< span > < / span > < span class = "c1" > #< / span >
< span class = "c1" > # Copyright (C) 2017-2018 Red Hat, Inc.< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # This program is free software; you can redistribute it and/or modify< / span >
< span class = "c1" > # it under the terms of the GNU General Public License as published by< / span >
< span class = "c1" > # the Free Software Foundation; either version 2 of the License, or< / span >
< span class = "c1" > # (at your option) any later version.< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # This program is distributed in the hope that it will be useful,< / span >
< span class = "c1" > # but WITHOUT ANY WARRANTY; without even the implied warranty of< / span >
< span class = "c1" > # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the< / span >
< span class = "c1" > # GNU General Public License for more details.< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # You should have received a copy of the GNU General Public License< / span >
< span class = "c1" > # along with this program. If not, see < http://www.gnu.org/licenses/> .< / span >
< span class = "c1" > #< / span >
< span class = "sd" > " " " Setup v0 of the API server< / span >
< span class = "sd" > v0_api() must be called to setup the API routes for Flask< / span >
< span class = "sd" > Status Responses< / span >
< span class = "sd" > ----------------< / span >
< span class = "sd" > Some requests only return a status/error response.< / span >
< span class = "sd" > The response will be a status response with `status` set to true, or an< / span >
< span class = "sd" > error response with it set to false and an error message included.< / span >
< span class = "sd" > Example response::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " status" : true< / span >
< span class = "sd" > }< / span >
< span class = "sd" > Error response::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " errors" : [" ggit-error: Failed to remove entry. File isn' t in the tree - jboss.toml (-1)" ]< / span >
< span class = "sd" > " status" : false< / span >
< span class = "sd" > }< / span >
< span class = "sd" > API Routes< / span >
< span class = "sd" > ----------< / span >
< span class = "sd" > All of the blueprints routes support the optional `branch` argument. If it is not< / span >
< span class = "sd" > used then the API will use the `master` branch for blueprints. If you want to create< / span >
< span class = "sd" > a new branch use the `new` or `workspace` routes with ?branch=< branch-name> to< / span >
< span class = "sd" > store the new blueprint on the new branch.< / span >
< span class = "sd" > `/api/v0/blueprints/list`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > List the available blueprints::< / span >
< span class = "sd" > { " limit" : 20,< / span >
< span class = "sd" > " offset" : 0,< / span >
< span class = "sd" > " blueprints" : [< / span >
< span class = "sd" > " atlas" ,< / span >
< span class = "sd" > " development" ,< / span >
< span class = "sd" > " glusterfs" ,< / span >
< span class = "sd" > " http-server" ,< / span >
< span class = "sd" > " jboss" ,< / span >
< span class = "sd" > " kubernetes" ],< / span >
< span class = "sd" > " total" : 6 }< / span >
< span class = "sd" > `/api/v0/blueprints/info/< blueprint_names> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return the JSON representation of the blueprint. This includes 3 top level< / span >
< span class = "sd" > objects. `changes` which lists whether or not the workspace is different from< / span >
< span class = "sd" > the most recent commit. `blueprints` which lists the JSON representation of the< / span >
< span class = "sd" > blueprint, and `errors` which will list any errors, like non-existant blueprints.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " changes" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " changed" : false,< / span >
< span class = "sd" > " name" : " glusterfs" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " errors" : [],< / span >
< span class = "sd" > " blueprints" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " description" : " An example GlusterFS server with samba" ,< / span >
< span class = "sd" > " modules" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " name" : " glusterfs" ,< / span >
< span class = "sd" > " version" : " 3.7.*" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " name" : " glusterfs-cli" ,< / span >
< span class = "sd" > " version" : " 3.7.*" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " name" : " glusterfs" ,< / span >
< span class = "sd" > " packages" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " name" : " 2ping" ,< / span >
< span class = "sd" > " version" : " 3.2.1" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " name" : " samba" ,< / span >
< span class = "sd" > " version" : " 4.2.*" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " version" : " 0.0.6" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > Error example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " changes" : [],< / span >
< span class = "sd" > " errors" : [" ggit-error: the path ' missing.toml' does not exist in the given tree (-3)" ]< / span >
< span class = "sd" > " blueprints" : []< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/blueprints/changes/< blueprint_names> [?offset=0& limit=20]`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return the commits to a blueprint. By default it returns the first 20 commits, this< / span >
< span class = "sd" > can be changed by passing `offset` and/or `limit`. The response will include the< / span >
< span class = "sd" > commit hash, summary, timestamp, and optionally the revision number. The commit< / span >
< span class = "sd" > hash can be passed to `/api/v0/blueprints/diff/` to retrieve the exact changes.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " errors" : [],< / span >
< span class = "sd" > " limit" : 20,< / span >
< span class = "sd" > " offset" : 0,< / span >
< span class = "sd" > " blueprints" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " changes" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " commit" : " e083921a7ed1cf2eec91ad12b9ad1e70ef3470be" ,< / span >
< span class = "sd" > " message" : " blueprint glusterfs, version 0.0.6 saved." ,< / span >
< span class = "sd" > " revision" : null,< / span >
< span class = "sd" > " timestamp" : " 2017-11-23T00:18:13Z" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " commit" : " cee5f4c20fc33ea4d54bfecf56f4ad41ad15f4f3" ,< / span >
< span class = "sd" > " message" : " blueprint glusterfs, version 0.0.5 saved." ,< / span >
< span class = "sd" > " revision" : null,< / span >
< span class = "sd" > " timestamp" : " 2017-11-11T01:00:28Z" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " commit" : " 29b492f26ed35d80800b536623bafc51e2f0eff2" ,< / span >
< span class = "sd" > " message" : " blueprint glusterfs, version 0.0.4 saved." ,< / span >
< span class = "sd" > " revision" : null,< / span >
< span class = "sd" > " timestamp" : " 2017-11-11T00:28:30Z" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " commit" : " 03374adbf080fe34f5c6c29f2e49cc2b86958bf2" ,< / span >
< span class = "sd" > " message" : " blueprint glusterfs, version 0.0.3 saved." ,< / span >
< span class = "sd" > " revision" : null,< / span >
< span class = "sd" > " timestamp" : " 2017-11-10T23:15:52Z" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " commit" : " 0e08ecbb708675bfabc82952599a1712a843779d" ,< / span >
< span class = "sd" > " message" : " blueprint glusterfs, version 0.0.2 saved." ,< / span >
< span class = "sd" > " revision" : null,< / span >
< span class = "sd" > " timestamp" : " 2017-11-10T23:14:56Z" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " commit" : " 3e11eb87a63d289662cba4b1804a0947a6843379" ,< / span >
< span class = "sd" > " message" : " blueprint glusterfs, version 0.0.1 saved." ,< / span >
< span class = "sd" > " revision" : null,< / span >
< span class = "sd" > " timestamp" : " 2017-11-08T00:02:47Z" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " name" : " glusterfs" ,< / span >
< span class = "sd" > " total" : 6< / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > POST `/api/v0/blueprints/new`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Create a new blueprint, or update an existing blueprint. This supports both JSON and TOML< / span >
< span class = "sd" > for the blueprint format. The blueprint should be in the body of the request with the< / span >
< span class = "sd" > `Content-Type` header set to either `application/json` or `text/x-toml`.< / span >
< span class = "sd" > The response will be a status response with `status` set to true, or an< / span >
< span class = "sd" > error response with it set to false and an error message included.< / span >
< span class = "sd" > DELETE `/api/v0/blueprints/delete/< blueprint_name> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Delete a blueprint. The blueprint is deleted from the branch, and will no longer< / span >
< span class = "sd" > be listed by the `list` route. A blueprint can be undeleted using the `undo` route< / span >
< span class = "sd" > to revert to a previous commit.< / span >
< span class = "sd" > The response will be a status response with `status` set to true, or an< / span >
< span class = "sd" > error response with it set to false and an error message included.< / span >
< span class = "sd" > POST `/api/v0/blueprints/workspace`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Write a blueprint to the temporary workspace. This works exactly the same as `new` except< / span >
< span class = "sd" > that it does not create a commit. JSON and TOML bodies are supported.< / span >
< span class = "sd" > The workspace is meant to be used as a temporary blueprint storage for clients.< / span >
< span class = "sd" > It will be read by the `info` and `diff` routes if it is different from the< / span >
< span class = "sd" > most recent commit.< / span >
< span class = "sd" > The response will be a status response with `status` set to true, or an< / span >
< span class = "sd" > error response with it set to false and an error message included.< / span >
< span class = "sd" > DELETE `/api/v0/blueprints/workspace/< blueprint_name> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Remove the temporary workspace copy of a blueprint. The `info` route will now< / span >
< span class = "sd" > return the most recent commit of the blueprint. Any changes that were in the< / span >
< span class = "sd" > workspace will be lost.< / span >
< span class = "sd" > The response will be a status response with `status` set to true, or an< / span >
< span class = "sd" > error response with it set to false and an error message included.< / span >
< span class = "sd" > POST `/api/v0/blueprints/undo/< blueprint_name> /< commit> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > This will revert the blueprint to a previous commit. The commit hash from the `changes`< / span >
< span class = "sd" > route can be used in this request.< / span >
< span class = "sd" > The response will be a status response with `status` set to true, or an< / span >
< span class = "sd" > error response with it set to false and an error message included.< / span >
< span class = "sd" > POST `/api/v0/blueprints/tag/< blueprint_name> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Tag a blueprint as a new release. This uses git tags with a special format.< / span >
< span class = "sd" > `refs/tags/< branch> /< filename> /r< revision> `. Only the most recent blueprint commit< / span >
< span class = "sd" > can be tagged. Revisions start at 1 and increment for each new tag< / span >
< span class = "sd" > (per-blueprint). If the commit has already been tagged it will return false.< / span >
< span class = "sd" > The response will be a status response with `status` set to true, or an< / span >
< span class = "sd" > error response with it set to false and an error message included.< / span >
< span class = "sd" > `/api/v0/blueprints/diff/< blueprint_name> /< from_commit> /< to_commit> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return the differences between two commits, or the workspace. The commit hash< / span >
< span class = "sd" > from the `changes` response can be used here, or several special strings:< / span >
< span class = "sd" > - NEWEST will select the newest git commit. This works for `from_commit` or `to_commit`< / span >
< span class = "sd" > - WORKSPACE will select the workspace copy. This can only be used in `to_commit`< / span >
< span class = "sd" > eg. `/api/v0/blueprints/diff/glusterfs/NEWEST/WORKSPACE` will return the differences< / span >
< span class = "sd" > between the most recent git commit and the contents of the workspace.< / span >
< span class = "sd" > Each entry in the response' s diff object contains the old blueprint value and the new one.< / span >
< span class = "sd" > If old is null and new is set, then it was added.< / span >
< span class = "sd" > If new is null and old is set, then it was removed.< / span >
< span class = "sd" > If both are set, then it was changed.< / span >
< span class = "sd" > The old/new entries will have the name of the blueprint field that was changed. This< / span >
< span class = "sd" > can be one of: Name, Description, Version, Module, or Package.< / span >
< span class = "sd" > The contents for these will be the old/new values for them.< / span >
< span class = "sd" > In the example below the version was changed and the ping package was added.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " diff" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " new" : {< / span >
< span class = "sd" > " Version" : " 0.0.6" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > " old" : {< / span >
< span class = "sd" > " Version" : " 0.0.5" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " new" : {< / span >
< span class = "sd" > " Package" : {< / span >
< span class = "sd" > " name" : " ping" ,< / span >
< span class = "sd" > " version" : " 3.2.1" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > },< / span >
< span class = "sd" > " old" : null< / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/blueprints/freeze/< blueprint_names> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return a JSON representation of the blueprint with the package and module versions set< / span >
< span class = "sd" > to the exact versions chosen by depsolving the blueprint.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " errors" : [],< / span >
< span class = "sd" > " blueprints" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " blueprint" : {< / span >
< span class = "sd" > " description" : " An example GlusterFS server with samba" ,< / span >
< span class = "sd" > " modules" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " name" : " glusterfs" ,< / span >
< span class = "sd" > " version" : " 3.8.4-18.4.el7.x86_64" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " name" : " glusterfs-cli" ,< / span >
< span class = "sd" > " version" : " 3.8.4-18.4.el7.x86_64" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " name" : " glusterfs" ,< / span >
< span class = "sd" > " packages" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " name" : " ping" ,< / span >
< span class = "sd" > " version" : " 2:3.2.1-2.el7.noarch" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " name" : " samba" ,< / span >
< span class = "sd" > " version" : " 4.6.2-8.el7.x86_64" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " version" : " 0.0.6" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/blueprints/depsolve/< blueprint_names> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Depsolve the blueprint using yum, return the blueprint used, and the NEVRAs of the packages< / span >
< span class = "sd" > chosen to satisfy the blueprint' s requirements. The response will include a list of results,< / span >
< span class = "sd" > with the full dependency list in `dependencies`, the NEVRAs for the blueprint' s direct modules< / span >
< span class = "sd" > and packages in `modules`, and any error will be in `errors`.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " errors" : [],< / span >
< span class = "sd" > " blueprints" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " dependencies" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " arch" : " noarch" ,< / span >
< span class = "sd" > " epoch" : " 0" ,< / span >
< span class = "sd" > " name" : " 2ping" ,< / span >
< span class = "sd" > " release" : " 2.el7" ,< / span >
< span class = "sd" > " version" : " 3.2.1" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " arch" : " x86_64" ,< / span >
< span class = "sd" > " epoch" : " 0" ,< / span >
< span class = "sd" > " name" : " acl" ,< / span >
< span class = "sd" > " release" : " 12.el7" ,< / span >
< span class = "sd" > " version" : " 2.2.51" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " arch" : " x86_64" ,< / span >
< span class = "sd" > " epoch" : " 0" ,< / span >
< span class = "sd" > " name" : " audit-libs" ,< / span >
< span class = "sd" > " release" : " 3.el7" ,< / span >
< span class = "sd" > " version" : " 2.7.6" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " arch" : " x86_64" ,< / span >
< span class = "sd" > " epoch" : " 0" ,< / span >
< span class = "sd" > " name" : " avahi-libs" ,< / span >
< span class = "sd" > " release" : " 17.el7" ,< / span >
< span class = "sd" > " version" : " 0.6.31" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > ...< / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " modules" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " arch" : " noarch" ,< / span >
< span class = "sd" > " epoch" : " 0" ,< / span >
< span class = "sd" > " name" : " 2ping" ,< / span >
< span class = "sd" > " release" : " 2.el7" ,< / span >
< span class = "sd" > " version" : " 3.2.1" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " arch" : " x86_64" ,< / span >
< span class = "sd" > " epoch" : " 0" ,< / span >
< span class = "sd" > " name" : " glusterfs" ,< / span >
< span class = "sd" > " release" : " 18.4.el7" ,< / span >
< span class = "sd" > " version" : " 3.8.4" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > ...< / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " blueprint" : {< / span >
< span class = "sd" > " description" : " An example GlusterFS server with samba" ,< / span >
< span class = "sd" > " modules" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " name" : " glusterfs" ,< / span >
< span class = "sd" > " version" : " 3.7.*" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > ...< / span >
< span class = "sd" > }< / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/projects/list[?offset=0& limit=20]`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > List all of the available projects. By default this returns the first 20 items,< / span >
< span class = "sd" > but this can be changed by setting the `offset` and `limit` arguments.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " limit" : 20,< / span >
< span class = "sd" > " offset" : 0,< / span >
< span class = "sd" > " projects" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " description" : " 0 A.D. (pronounced \" zero ey-dee\" ) is a ..." ,< / span >
< span class = "sd" > " homepage" : " http://play0ad.com" ,< / span >
< span class = "sd" > " name" : " 0ad" ,< / span >
< span class = "sd" > " summary" : " Cross-Platform RTS Game of Ancient Warfare" ,< / span >
< span class = "sd" > " upstream_vcs" : " UPSTREAM_VCS" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > ...< / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " total" : 21770< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/projects/info/< project_names> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return information about the comma-separated list of projects. It includes the description< / span >
< span class = "sd" > of the package along with the list of available builds.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " projects" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " builds" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " arch" : " x86_64" ,< / span >
< span class = "sd" > " build_config_ref" : " BUILD_CONFIG_REF" ,< / span >
< span class = "sd" > " build_env_ref" : " BUILD_ENV_REF" ,< / span >
< span class = "sd" > " build_time" : " 2017-03-01T08:39:23" ,< / span >
< span class = "sd" > " changelog" : " - restore incremental backups correctly, files ..." ,< / span >
< span class = "sd" > " epoch" : " 2" ,< / span >
< span class = "sd" > " metadata" : {},< / span >
< span class = "sd" > " release" : " 32.el7" ,< / span >
< span class = "sd" > " source" : {< / span >
< span class = "sd" > " license" : " GPLv3+" ,< / span >
< span class = "sd" > " metadata" : {},< / span >
< span class = "sd" > " source_ref" : " SOURCE_REF" ,< / span >
< span class = "sd" > " version" : " 1.26" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > }< / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " description" : " The GNU tar program saves many ..." ,< / span >
< span class = "sd" > " homepage" : " http://www.gnu.org/software/tar/" ,< / span >
< span class = "sd" > " name" : " tar" ,< / span >
< span class = "sd" > " summary" : " A GNU file archiving program" ,< / span >
< span class = "sd" > " upstream_vcs" : " UPSTREAM_VCS" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/projects/depsolve/< project_names> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Depsolve the comma-separated list of projects and return the list of NEVRAs needed< / span >
< span class = "sd" > to satisfy the request.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " projects" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " arch" : " noarch" ,< / span >
< span class = "sd" > " epoch" : " 0" ,< / span >
< span class = "sd" > " name" : " basesystem" ,< / span >
< span class = "sd" > " release" : " 7.el7" ,< / span >
< span class = "sd" > " version" : " 10.0" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " arch" : " x86_64" ,< / span >
< span class = "sd" > " epoch" : " 0" ,< / span >
< span class = "sd" > " name" : " bash" ,< / span >
< span class = "sd" > " release" : " 28.el7" ,< / span >
< span class = "sd" > " version" : " 4.2.46" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " arch" : " x86_64" ,< / span >
< span class = "sd" > " epoch" : " 0" ,< / span >
< span class = "sd" > " name" : " filesystem" ,< / span >
< span class = "sd" > " release" : " 21.el7" ,< / span >
< span class = "sd" > " version" : " 3.2" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > ...< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
2018-06-04 23:50:39 +00:00
< span class = "sd" > `/api/v0/projects/source/list`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return the list of repositories used for depsolving and installing packages.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " sources" : [< / span >
< span class = "sd" > " fedora" ,< / span >
< span class = "sd" > " fedora-cisco-openh264" ,< / span >
< span class = "sd" > " fedora-updates-testing" ,< / span >
< span class = "sd" > " fedora-updates" < / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/projects/source/info/< source-names> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return information about the comma-separated list of source names. Or all of the< / span >
< span class = "sd" > sources if ' *' is passed. Note that general globbing is not supported, only ' *' .< / span >
< span class = "sd" > immutable system sources will have the " system" field set to true. User added sources< / span >
< span class = "sd" > will have it set to false. System sources cannot be changed or deleted.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " errors" : [],< / span >
< span class = "sd" > " sources" : {< / span >
< span class = "sd" > " fedora" : {< / span >
< span class = "sd" > " check_gpg" : true,< / span >
< span class = "sd" > " check_ssl" : true,< / span >
< span class = "sd" > " gpgkey_urls" : [< / span >
< span class = "sd" > " file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-x86_64" < / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " name" : " fedora" ,< / span >
< span class = "sd" > " proxy" : " http://proxy.brianlane.com:8123" ,< / span >
< span class = "sd" > " system" : true,< / span >
< span class = "sd" > " type" : " yum-metalink" ,< / span >
< span class = "sd" > " url" : " https://mirrors.fedoraproject.org/metalink?repo=fedora-28& arch=x86_64" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > }< / span >
< span class = "sd" > }< / span >
< span class = "sd" > POST `/api/v0/projects/source/new`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Add (or change) a source for use when depsolving blueprints and composing images.< / span >
< span class = "sd" > The ``proxy`` and ``gpgkey_urls`` entries are optional. All of the others are required. The supported< / span >
< span class = "sd" > types for the urls are:< / span >
< span class = "sd" > * ``yum-baseurl`` is a URL to a yum repository.< / span >
< span class = "sd" > * ``yum-mirrorlist`` is a URL for a mirrorlist.< / span >
< span class = "sd" > * ``yum-metalink`` is a URL for a metalink.< / span >
< span class = "sd" > If ``check_ssl`` is true the https certificates must be valid. If they are self-signed you can either set< / span >
< span class = "sd" > this to false, or add your Certificate Authority to the host system.< / span >
< span class = "sd" > If ``check_gpg`` is true the GPG key must either be installed on the host system, or ``gpgkey_urls``< / span >
< span class = "sd" > should point to it.< / span >
< span class = "sd" > You can edit an existing source (other than system sources), by doing a POST< / span >
< span class = "sd" > of the new version of the source. It will overwrite the previous one.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " name" : " custom-source-1" ,< / span >
< span class = "sd" > " url" : " https://url/path/to/repository/" ,< / span >
< span class = "sd" > " type" : " yum-baseurl" ,< / span >
< span class = "sd" > " check_ssl" : true,< / span >
< span class = "sd" > " check_gpg" : true,< / span >
< span class = "sd" > " gpgkey_urls" : [< / span >
< span class = "sd" > " https://url/path/to/gpg-key" < / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > DELETE `/api/v0/projects/source/delete/< source-name> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Delete a user added source. This will fail if a system source is passed to< / span >
< span class = "sd" > it.< / span >
< span class = "sd" > The response will be a status response with `status` set to true, or an< / span >
< span class = "sd" > error response with it set to false and an error message included.< / span >
2018-05-16 20:15:10 +00:00
< span class = "sd" > `/api/v0/modules/list[?offset=0& limit=20]`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return a list of all of the available modules. This includes the name and the< / span >
< span class = "sd" > group_type, which is always " rpm" for lorax-composer. By default this returns< / span >
< span class = "sd" > the first 20 items. This can be changed by setting the `offset` and `limit`< / span >
< span class = "sd" > arguments.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " limit" : 20,< / span >
< span class = "sd" > " modules" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " group_type" : " rpm" ,< / span >
< span class = "sd" > " name" : " 0ad" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " group_type" : " rpm" ,< / span >
< span class = "sd" > " name" : " 0ad-data" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " group_type" : " rpm" ,< / span >
< span class = "sd" > " name" : " 0install" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " group_type" : " rpm" ,< / span >
< span class = "sd" > " name" : " 2048-cli" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > ...< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > " total" : 21770< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/modules/list/< module_names> [?offset=0& limit=20]`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return the list of comma-separated modules. Output is the same as `/modules/list`< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " limit" : 20,< / span >
< span class = "sd" > " modules" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " group_type" : " rpm" ,< / span >
< span class = "sd" > " name" : " tar" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " offset" : 0,< / span >
< span class = "sd" > " total" : 1< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/modules/info/< module_names> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return the module' s dependencies, and the information about the module.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " modules" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " dependencies" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " arch" : " noarch" ,< / span >
< span class = "sd" > " epoch" : " 0" ,< / span >
< span class = "sd" > " name" : " basesystem" ,< / span >
< span class = "sd" > " release" : " 7.el7" ,< / span >
< span class = "sd" > " version" : " 10.0" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " arch" : " x86_64" ,< / span >
< span class = "sd" > " epoch" : " 0" ,< / span >
< span class = "sd" > " name" : " bash" ,< / span >
< span class = "sd" > " release" : " 28.el7" ,< / span >
< span class = "sd" > " version" : " 4.2.46" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > ...< / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " description" : " The GNU tar program saves ..." ,< / span >
< span class = "sd" > " homepage" : " http://www.gnu.org/software/tar/" ,< / span >
< span class = "sd" > " name" : " tar" ,< / span >
< span class = "sd" > " summary" : " A GNU file archiving program" ,< / span >
< span class = "sd" > " upstream_vcs" : " UPSTREAM_VCS" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > POST `/api/v0/compose`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Start a compose. The content type should be ' application/json' and the body of the POST< / span >
< span class = "sd" > should look like this::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " blueprint_name" : " http-server" ,< / span >
< span class = "sd" > " compose_type" : " tar" ,< / span >
< span class = "sd" > " branch" : " master" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > Pass it the name of the blueprint, the type of output (from ' /api/v0/compose/types' ), and the< / span >
< span class = "sd" > blueprint branch to use. ' branch' is optional and will default to master. It will create a new< / span >
< span class = "sd" > build and add it to the queue. It returns the build uuid and a status if it succeeds::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " build_id" : " e6fa6db4-9c81-4b70-870f-a697ca405cdf" ,< / span >
< span class = "sd" > " status" : true< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/compose/types`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Returns the list of supported output types that are valid for use with ' POST /api/v0/compose' < / span >
< span class = "sd" > {< / span >
< span class = "sd" > " types" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " enabled" : true,< / span >
< span class = "sd" > " name" : " tar" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/compose/queue`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return the status of the build queue. It includes information about the builds waiting,< / span >
< span class = "sd" > and the build that is running.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " new" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " id" : " 45502a6d-06e8-48a5-a215-2b4174b3614b" ,< / span >
< span class = "sd" > " blueprint" : " glusterfs" ,< / span >
< span class = "sd" > " queue_status" : " WAITING" ,< / span >
< span class = "sd" > " timestamp" : 1517362647.4570868,< / span >
< span class = "sd" > " version" : " 0.0.6" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " id" : " 6d292bd0-bec7-4825-8d7d-41ef9c3e4b73" ,< / span >
< span class = "sd" > " blueprint" : " kubernetes" ,< / span >
< span class = "sd" > " queue_status" : " WAITING" ,< / span >
< span class = "sd" > " timestamp" : 1517362659.0034983,< / span >
< span class = "sd" > " version" : " 0.0.1" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ],< / span >
< span class = "sd" > " run" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " id" : " 745712b2-96db-44c0-8014-fe925c35e795" ,< / span >
< span class = "sd" > " blueprint" : " glusterfs" ,< / span >
< span class = "sd" > " queue_status" : " RUNNING" ,< / span >
< span class = "sd" > " timestamp" : 1517362633.7965999,< / span >
< span class = "sd" > " version" : " 0.0.6" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/compose/finished`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return the details on all of the finished composes on the system.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " finished" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " id" : " 70b84195-9817-4b8a-af92-45e380f39894" ,< / span >
< span class = "sd" > " blueprint" : " glusterfs" ,< / span >
< span class = "sd" > " queue_status" : " FINISHED" ,< / span >
< span class = "sd" > " timestamp" : 1517351003.8210032,< / span >
< span class = "sd" > " version" : " 0.0.6" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " id" : " e695affd-397f-4af9-9022-add2636e7459" ,< / span >
< span class = "sd" > " blueprint" : " glusterfs" ,< / span >
< span class = "sd" > " queue_status" : " FINISHED" ,< / span >
< span class = "sd" > " timestamp" : 1517362289.7193348,< / span >
< span class = "sd" > " version" : " 0.0.6" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/compose/failed`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return the details on all of the failed composes on the system.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " failed" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " id" : " 8c8435ef-d6bd-4c68-9bf1-a2ef832e6b1a" ,< / span >
< span class = "sd" > " blueprint" : " http-server" ,< / span >
< span class = "sd" > " queue_status" : " FAILED" ,< / span >
< span class = "sd" > " timestamp" : 1517523249.9301329,< / span >
< span class = "sd" > " version" : " 0.0.2" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/compose/status/< uuids> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Return the details for each of the comma-separated list of uuids.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " uuids" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " id" : " 8c8435ef-d6bd-4c68-9bf1-a2ef832e6b1a" ,< / span >
< span class = "sd" > " blueprint" : " http-server" ,< / span >
< span class = "sd" > " queue_status" : " FINISHED" ,< / span >
< span class = "sd" > " timestamp" : 1517523644.2384307,< / span >
< span class = "sd" > " version" : " 0.0.2" < / span >
< span class = "sd" > },< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " id" : " 45502a6d-06e8-48a5-a215-2b4174b3614b" ,< / span >
< span class = "sd" > " blueprint" : " glusterfs" ,< / span >
< span class = "sd" > " queue_status" : " FINISHED" ,< / span >
< span class = "sd" > " timestamp" : 1517363442.188399,< / span >
< span class = "sd" > " version" : " 0.0.6" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > DELETE `/api/v0/blueprints/cancel/< uuid> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Cancel the build, if it is not finished, and delete the results. It will return a< / span >
< span class = "sd" > status of True if it is successful.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " status" : true,< / span >
< span class = "sd" > " uuid" : " 03397f8d-acff-4cdb-bd31-f629b7a948f5" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > DELETE `/api/v0/compose/delete/< uuids> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Delete the list of comma-separated uuids from the compose results.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " errors" : [],< / span >
< span class = "sd" > " uuids" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " status" : true,< / span >
< span class = "sd" > " uuid" : " ae1bf7e3-7f16-4c9f-b36e-3726a1093fd0" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/compose/info/< uuid> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Get detailed information about the compose. The returned JSON string will< / span >
< span class = "sd" > contain the following information:< / span >
< span class = "sd" > * id - The uuid of the comoposition< / span >
< span class = "sd" > * config - containing the configuration settings used to run Anaconda< / span >
< span class = "sd" > * blueprint - The depsolved blueprint used to generate the kickstart< / span >
< span class = "sd" > * commit - The (local) git commit hash for the blueprint used< / span >
< span class = "sd" > * deps - The NEVRA of all of the dependencies used in the composition< / span >
< span class = "sd" > * compose_type - The type of output generated (tar, iso, etc.)< / span >
< span class = "sd" > * queue_status - The final status of the composition (FINISHED or FAILED)< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " commit" : " 7078e521a54b12eae31c3fd028680da7a0815a4d" ,< / span >
< span class = "sd" > " compose_type" : " tar" ,< / span >
< span class = "sd" > " config" : {< / span >
< span class = "sd" > " anaconda_args" : " " ,< / span >
< span class = "sd" > " armplatform" : " " ,< / span >
< span class = "sd" > " compress_args" : [],< / span >
< span class = "sd" > " compression" : " xz" ,< / span >
< span class = "sd" > " image_name" : " root.tar.xz" ,< / span >
< span class = "sd" > ...< / span >
< span class = "sd" > },< / span >
< span class = "sd" > " deps" : {< / span >
< span class = "sd" > " packages" : [< / span >
< span class = "sd" > {< / span >
< span class = "sd" > " arch" : " x86_64" ,< / span >
< span class = "sd" > " epoch" : " 0" ,< / span >
< span class = "sd" > " name" : " acl" ,< / span >
< span class = "sd" > " release" : " 14.el7" ,< / span >
< span class = "sd" > " version" : " 2.2.51" < / span >
< span class = "sd" > }< / span >
< span class = "sd" > ]< / span >
< span class = "sd" > },< / span >
< span class = "sd" > " id" : " c30b7d80-523b-4a23-ad52-61b799739ce8" ,< / span >
< span class = "sd" > " queue_status" : " FINISHED" ,< / span >
< span class = "sd" > " blueprint" : {< / span >
< span class = "sd" > " description" : " An example kubernetes master" ,< / span >
< span class = "sd" > ...< / span >
< span class = "sd" > }< / span >
< span class = "sd" > }< / span >
< span class = "sd" > `/api/v0/compose/metadata/< uuid> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Returns a .tar of the metadata used for the build. This includes all the< / span >
< span class = "sd" > information needed to reproduce the build, including the final kickstart< / span >
< span class = "sd" > populated with repository and package NEVRA.< / span >
< span class = "sd" > The mime type is set to ' application/x-tar' and the filename is set to< / span >
< span class = "sd" > UUID-metadata.tar< / span >
< span class = "sd" > The .tar is uncompressed, but is not large.< / span >
< span class = "sd" > `/api/v0/compose/results/< uuid> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Returns a .tar of the metadata, logs, and output image of the build. This< / span >
< span class = "sd" > includes all the information needed to reproduce the build, including the< / span >
< span class = "sd" > final kickstart populated with repository and package NEVRA. The output image< / span >
< span class = "sd" > is already in compressed form so the returned tar is not compressed.< / span >
< span class = "sd" > The mime type is set to ' application/x-tar' and the filename is set to< / span >
< span class = "sd" > UUID.tar< / span >
< span class = "sd" > `/api/v0/compose/logs/< uuid> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Returns a .tar of the anaconda build logs. The tar is not compressed, but is< / span >
< span class = "sd" > not large.< / span >
< span class = "sd" > The mime type is set to ' application/x-tar' and the filename is set to< / span >
< span class = "sd" > UUID-logs.tar< / span >
< span class = "sd" > `/api/v0/compose/image/< uuid> `< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Returns the output image from the build. The filename is set to the filename< / span >
< span class = "sd" > from the build with the UUID as a prefix. eg. UUID-root.tar.xz or UUID-boot.iso.< / span >
< span class = "sd" > `/api/v0/compose/log/< uuid> [?size=kbytes]`< / span >
< span class = "sd" > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^< / span >
< span class = "sd" > Returns the end of the anaconda.log. The size parameter is optional and defaults to 1Mbytes< / span >
< span class = "sd" > if it is not included. The returned data is raw text from the end of the logfile, starting on< / span >
< span class = "sd" > a line boundry.< / span >
< span class = "sd" > Example::< / span >
< span class = "sd" > 12:59:24,222 INFO anaconda: Running Thread: AnaConfigurationThread (140629395244800)< / span >
< span class = "sd" > 12:59:24,223 INFO anaconda: Configuring installed system< / span >
< span class = "sd" > 12:59:24,912 INFO anaconda: Configuring installed system< / span >
< span class = "sd" > 12:59:24,912 INFO anaconda: Creating users< / span >
< span class = "sd" > 12:59:24,913 INFO anaconda: Clearing libuser.conf at /tmp/libuser.Dyy8Gj< / span >
< span class = "sd" > 12:59:25,154 INFO anaconda: Creating users< / span >
< span class = "sd" > 12:59:25,155 INFO anaconda: Configuring addons< / span >
< span class = "sd" > 12:59:25,155 INFO anaconda: Configuring addons< / span >
< span class = "sd" > 12:59:25,155 INFO anaconda: Generating initramfs< / span >
< span class = "sd" > 12:59:49,467 INFO anaconda: Generating initramfs< / span >
< span class = "sd" > 12:59:49,467 INFO anaconda: Running post-installation scripts< / span >
< span class = "sd" > 12:59:49,467 INFO anaconda: Running kickstart %%post script(s)< / span >
< span class = "sd" > 12:59:50,782 INFO anaconda: All kickstart %%post script(s) have been run< / span >
< span class = "sd" > 12:59:50,782 INFO anaconda: Running post-installation scripts< / span >
< span class = "sd" > 12:59:50,784 INFO anaconda: Thread Done: AnaConfigurationThread (140629395244800)< / span >
< span class = "sd" > " " " < / span >
< span class = "kn" > import< / span > < span class = "nn" > logging< / span >
< span class = "n" > log< / span > < span class = "o" > =< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > getLogger< / span > < span class = "p" > (< / span > < span class = "s2" > " lorax-composer" < / span > < span class = "p" > )< / span >
< span class = "kn" > import< / span > < span class = "nn" > os< / span >
< span class = "kn" > from< / span > < span class = "nn" > flask< / span > < span class = "k" > import< / span > < span class = "n" > jsonify< / span > < span class = "p" > ,< / span > < span class = "n" > request< / span > < span class = "p" > ,< / span > < span class = "n" > Response< / span > < span class = "p" > ,< / span > < span class = "n" > send_file< / span >
2018-06-04 23:50:39 +00:00
< span class = "kn" > import< / span > < span class = "nn" > pytoml< / span > < span class = "k" > as< / span > < span class = "nn" > toml< / span >
2018-05-16 20:15:10 +00:00
2018-06-04 23:50:39 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.sysutils< / span > < span class = "k" > import< / span > < span class = "n" > joinpaths< / span >
2018-05-16 20:15:10 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.compose< / span > < span class = "k" > import< / span > < span class = "n" > start_build< / span > < span class = "p" > ,< / span > < span class = "n" > compose_types< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.crossdomain< / span > < span class = "k" > import< / span > < span class = "n" > crossdomain< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.projects< / span > < span class = "k" > import< / span > < span class = "n" > projects_list< / span > < span class = "p" > ,< / span > < span class = "n" > projects_info< / span > < span class = "p" > ,< / span > < span class = "n" > projects_depsolve< / span >
2018-06-04 23:50:39 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.projects< / span > < span class = "k" > import< / span > < span class = "n" > modules_list< / span > < span class = "p" > ,< / span > < span class = "n" > modules_info< / span > < span class = "p" > ,< / span > < span class = "n" > ProjectsError< / span > < span class = "p" > ,< / span > < span class = "n" > repo_to_source< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.projects< / span > < span class = "k" > import< / span > < span class = "n" > get_repo_sources< / span > < span class = "p" > ,< / span > < span class = "n" > delete_repo_source< / span > < span class = "p" > ,< / span > < span class = "n" > source_to_repo< / span > < span class = "p" > ,< / span > < span class = "n" > dnf_repo_to_file_repo< / span >
2018-05-16 20:15:10 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.queue< / span > < span class = "k" > import< / span > < span class = "n" > queue_status< / span > < span class = "p" > ,< / span > < span class = "n" > build_status< / span > < span class = "p" > ,< / span > < span class = "n" > uuid_delete< / span > < span class = "p" > ,< / span > < span class = "n" > uuid_status< / span > < span class = "p" > ,< / span > < span class = "n" > uuid_info< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.queue< / span > < span class = "k" > import< / span > < span class = "n" > uuid_tar< / span > < span class = "p" > ,< / span > < span class = "n" > uuid_image< / span > < span class = "p" > ,< / span > < span class = "n" > uuid_cancel< / span > < span class = "p" > ,< / span > < span class = "n" > uuid_log< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.recipes< / span > < span class = "k" > import< / span > < span class = "n" > list_branch_files< / span > < span class = "p" > ,< / span > < span class = "n" > read_recipe_commit< / span > < span class = "p" > ,< / span > < span class = "n" > recipe_filename< / span > < span class = "p" > ,< / span > < span class = "n" > list_commits< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.recipes< / span > < span class = "k" > import< / span > < span class = "n" > recipe_from_dict< / span > < span class = "p" > ,< / span > < span class = "n" > recipe_from_toml< / span > < span class = "p" > ,< / span > < span class = "n" > commit_recipe< / span > < span class = "p" > ,< / span > < span class = "n" > delete_recipe< / span > < span class = "p" > ,< / span > < span class = "n" > revert_recipe< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.recipes< / span > < span class = "k" > import< / span > < span class = "n" > tag_recipe_commit< / span > < span class = "p" > ,< / span > < span class = "n" > recipe_diff< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.api.workspace< / span > < span class = "k" > import< / span > < span class = "n" > workspace_read< / span > < span class = "p" > ,< / span > < span class = "n" > workspace_write< / span > < span class = "p" > ,< / span > < span class = "n" > workspace_delete< / span >
< span class = "c1" > # The API functions don' t actually get called by any code here< / span >
< span class = "c1" > # pylint: disable=unused-variable< / span >
< div class = "viewcode-block" id = "take_limits" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.v0.take_limits" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > take_limits< / span > < span class = "p" > (< / span > < span class = "n" > iterable< / span > < span class = "p" > ,< / span > < span class = "n" > offset< / span > < span class = "p" > ,< / span > < span class = "n" > limit< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Apply offset and limit to an iterable object< / span >
< span class = "sd" > :param iterable: The object to limit< / span >
< span class = "sd" > :type iterable: iter< / span >
< span class = "sd" > :param offset: The number of items to skip< / span >
< span class = "sd" > :type offset: int< / span >
< span class = "sd" > :param limit: The total number of items to return< / span >
< span class = "sd" > :type limit: int< / span >
< span class = "sd" > :returns: A subset of the iterable< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > return< / span > < span class = "n" > iterable< / span > < span class = "p" > [< / span > < span class = "n" > offset< / span > < span class = "p" > :][:< / span > < span class = "n" > limit< / span > < span class = "p" > ]< / span > < / div >
< div class = "viewcode-block" id = "v0_api" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.v0.v0_api" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > v0_api< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "p" > ):< / span >
< span class = "c1" > # Note that Sphinx will not generate documentations for any of these.< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/blueprints/list" < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_blueprints_list< / span > < span class = "p" > ():< / span >
< span class = "sd" > " " " List the available blueprints on a branch." " " < / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ,< / span > < span class = "s2" > " master" < / span > < span class = "p" > )< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "n" > limit< / span > < span class = "o" > =< / span > < span class = "nb" > int< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " limit" < / span > < span class = "p" > ,< / span > < span class = "s2" > " 20" < / span > < span class = "p" > ))< / span >
< span class = "n" > offset< / span > < span class = "o" > =< / span > < span class = "nb" > int< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " offset" < / span > < span class = "p" > ,< / span > < span class = "s2" > " 0" < / span > < span class = "p" > ))< / span >
< span class = "k" > except< / span > < span class = "ne" > ValueError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > blueprints< / span > < span class = "o" > =< / span > < span class = "n" > take_limits< / span > < span class = "p" > ([< / span > < span class = "n" > f< / span > < span class = "p" > [:< / span > < span class = "o" > -< / span > < span class = "mi" > 5< / span > < span class = "p" > ]< / span > < span class = "k" > for< / span > < span class = "n" > f< / span > < span class = "ow" > in< / span > < span class = "n" > list_branch_files< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > )],< / span > < span class = "n" > offset< / span > < span class = "p" > ,< / span > < span class = "n" > limit< / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > blueprints< / span > < span class = "o" > =< / span > < span class = "n" > blueprints< / span > < span class = "p" > ,< / span > < span class = "n" > limit< / span > < span class = "o" > =< / span > < span class = "n" > limit< / span > < span class = "p" > ,< / span > < span class = "n" > offset< / span > < span class = "o" > =< / span > < span class = "n" > offset< / span > < span class = "p" > ,< / span > < span class = "n" > total< / span > < span class = "o" > =< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "n" > blueprints< / span > < span class = "p" > ))< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/blueprints/info/< blueprint_names> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_blueprints_info< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_names< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the contents of the blueprint, or a list of blueprints" " " < / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ,< / span > < span class = "s2" > " master" < / span > < span class = "p" > )< / span >
< span class = "n" > out_fmt< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " format" < / span > < span class = "p" > ,< / span > < span class = "s2" > " json" < / span > < span class = "p" > )< / span >
< span class = "n" > blueprints< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "n" > changes< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > for< / span > < span class = "n" > blueprint_name< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "n" > n< / span > < span class = "o" > .< / span > < span class = "n" > strip< / span > < span class = "p" > ()< / span > < span class = "k" > for< / span > < span class = "n" > n< / span > < span class = "ow" > in< / span > < span class = "n" > blueprint_names< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s2" > " ," < / span > < span class = "p" > )]:< / span >
< span class = "n" > exceptions< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "c1" > # Get the workspace version (if it exists)< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > ws_blueprint< / span > < span class = "o" > =< / span > < span class = "n" > workspace_read< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > ws_blueprint< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span >
< span class = "n" > exceptions< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_info) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "c1" > # Get the git version (if it exists)< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > git_blueprint< / span > < span class = "o" > =< / span > < span class = "n" > read_recipe_commit< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > git_blueprint< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span >
< span class = "n" > exceptions< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_info) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > ws_blueprint< / span > < span class = "ow" > and< / span > < span class = "ow" > not< / span > < span class = "n" > git_blueprint< / span > < span class = "p" > :< / span >
< span class = "c1" > # Neither blueprint, return an error< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > : < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "s2" > " , " < / span > < span class = "o" > .< / span > < span class = "n" > join< / span > < span class = "p" > (< / span > < span class = "n" > exceptions< / span > < span class = "p" > )))< / span >
< span class = "k" > elif< / span > < span class = "n" > ws_blueprint< / span > < span class = "ow" > and< / span > < span class = "ow" > not< / span > < span class = "n" > git_blueprint< / span > < span class = "p" > :< / span >
< span class = "c1" > # No git blueprint, return the workspace blueprint< / span >
< span class = "n" > changes< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > ({< / span > < span class = "s2" > " name" < / span > < span class = "p" > :< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "s2" > " changed" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > })< / span >
< span class = "n" > blueprints< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "n" > ws_blueprint< / span > < span class = "p" > )< / span >
< span class = "k" > elif< / span > < span class = "ow" > not< / span > < span class = "n" > ws_blueprint< / span > < span class = "ow" > and< / span > < span class = "n" > git_blueprint< / span > < span class = "p" > :< / span >
< span class = "c1" > # No workspace blueprint, no change, return the git blueprint< / span >
< span class = "n" > changes< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > ({< / span > < span class = "s2" > " name" < / span > < span class = "p" > :< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "s2" > " changed" < / span > < span class = "p" > :< / span > < span class = "kc" > False< / span > < span class = "p" > })< / span >
< span class = "n" > blueprints< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "n" > git_blueprint< / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "c1" > # Both exist, maybe changed, return the workspace blueprint< / span >
< span class = "n" > changes< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > ({< / span > < span class = "s2" > " name" < / span > < span class = "p" > :< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "s2" > " changed" < / span > < span class = "p" > :< / span > < span class = "n" > ws_blueprint< / span > < span class = "o" > !=< / span > < span class = "n" > git_blueprint< / span > < span class = "p" > })< / span >
< span class = "n" > blueprints< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "n" > ws_blueprint< / span > < span class = "p" > )< / span >
< span class = "c1" > # Sort all the results by case-insensitive blueprint name< / span >
< span class = "n" > changes< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "n" > changes< / span > < span class = "p" > ,< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "k" > lambda< / span > < span class = "n" > c< / span > < span class = "p" > :< / span > < span class = "n" > c< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ())< / span >
< span class = "n" > blueprints< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "n" > blueprints< / span > < span class = "p" > ,< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "k" > lambda< / span > < span class = "n" > r< / span > < span class = "p" > :< / span > < span class = "n" > r< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ())< / span >
< span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "n" > errors< / span > < span class = "p" > ,< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "k" > lambda< / span > < span class = "n" > e< / span > < span class = "p" > :< / span > < span class = "n" > e< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ())< / span >
< span class = "k" > if< / span > < span class = "n" > out_fmt< / span > < span class = "o" > ==< / span > < span class = "s2" > " toml" < / span > < span class = "p" > :< / span >
< span class = "c1" > # With TOML output we just want to dump the raw blueprint, skipping the rest.< / span >
< span class = "k" > return< / span > < span class = "s2" > " < / span > < span class = "se" > \n\n< / span > < span class = "s2" > " < / span > < span class = "o" > .< / span > < span class = "n" > join< / span > < span class = "p" > ([< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > toml< / span > < span class = "p" > ()< / span > < span class = "k" > for< / span > < span class = "n" > r< / span > < span class = "ow" > in< / span > < span class = "n" > blueprints< / span > < span class = "p" > ])< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > changes< / span > < span class = "o" > =< / span > < span class = "n" > changes< / span > < span class = "p" > ,< / span > < span class = "n" > blueprints< / span > < span class = "o" > =< / span > < span class = "n" > blueprints< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "n" > errors< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/blueprints/changes/< blueprint_names> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_blueprints_changes< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_names< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the changes to a blueprint or list of blueprints" " " < / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ,< / span > < span class = "s2" > " master" < / span > < span class = "p" > )< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "n" > limit< / span > < span class = "o" > =< / span > < span class = "nb" > int< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " limit" < / span > < span class = "p" > ,< / span > < span class = "s2" > " 20" < / span > < span class = "p" > ))< / span >
< span class = "n" > offset< / span > < span class = "o" > =< / span > < span class = "nb" > int< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " offset" < / span > < span class = "p" > ,< / span > < span class = "s2" > " 0" < / span > < span class = "p" > ))< / span >
< span class = "k" > except< / span > < span class = "ne" > ValueError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "n" > blueprints< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > for< / span > < span class = "n" > blueprint_name< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "n" > n< / span > < span class = "o" > .< / span > < span class = "n" > strip< / span > < span class = "p" > ()< / span > < span class = "k" > for< / span > < span class = "n" > n< / span > < span class = "ow" > in< / span > < span class = "n" > blueprint_names< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s2" > " ," < / span > < span class = "p" > )]:< / span >
< span class = "n" > filename< / span > < span class = "o" > =< / span > < span class = "n" > recipe_filename< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > commits< / span > < span class = "o" > =< / span > < span class = "n" > take_limits< / span > < span class = "p" > (< / span > < span class = "n" > list_commits< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > filename< / span > < span class = "p" > ),< / span > < span class = "n" > offset< / span > < span class = "p" > ,< / span > < span class = "n" > limit< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > : < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )))< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_changes) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > blueprints< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > ({< / span > < span class = "s2" > " name" < / span > < span class = "p" > :< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "s2" > " changes" < / span > < span class = "p" > :< / span > < span class = "n" > commits< / span > < span class = "p" > ,< / span > < span class = "s2" > " total" < / span > < span class = "p" > :< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "n" > commits< / span > < span class = "p" > )})< / span >
< span class = "n" > blueprints< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "n" > blueprints< / span > < span class = "p" > ,< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "k" > lambda< / span > < span class = "n" > r< / span > < span class = "p" > :< / span > < span class = "n" > r< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ())< / span >
< span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "n" > errors< / span > < span class = "p" > ,< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "k" > lambda< / span > < span class = "n" > e< / span > < span class = "p" > :< / span > < span class = "n" > e< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ())< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > blueprints< / span > < span class = "o" > =< / span > < span class = "n" > blueprints< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "n" > errors< / span > < span class = "p" > ,< / span > < span class = "n" > offset< / span > < span class = "o" > =< / span > < span class = "n" > offset< / span > < span class = "p" > ,< / span > < span class = "n" > limit< / span > < span class = "o" > =< / span > < span class = "n" > limit< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/blueprints/new" < / span > < span class = "p" > ,< / span > < span class = "n" > methods< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " POST" < / span > < span class = "p" > ])< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_blueprints_new< / span > < span class = "p" > ():< / span >
< span class = "sd" > " " " Commit a new blueprint" " " < / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ,< / span > < span class = "s2" > " master" < / span > < span class = "p" > )< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > headers< / span > < span class = "p" > [< / span > < span class = "s1" > ' Content-Type' < / span > < span class = "p" > ]< / span > < span class = "o" > ==< / span > < span class = "s2" > " text/x-toml" < / span > < span class = "p" > :< / span >
< span class = "n" > blueprint< / span > < span class = "o" > =< / span > < span class = "n" > recipe_from_toml< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > data< / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > blueprint< / span > < span class = "o" > =< / span > < span class = "n" > recipe_from_dict< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > get_json< / span > < span class = "p" > (< / span > < span class = "n" > cache< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ))< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > commit_recipe< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint< / span > < span class = "p" > )< / span >
< span class = "c1" > # Read the blueprint with new version and write it to the workspace< / span >
< span class = "n" > blueprint< / span > < span class = "o" > =< / span > < span class = "n" > read_recipe_commit< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ])< / span >
< span class = "n" > workspace_write< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_new) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/blueprints/delete/< blueprint_name> " < / span > < span class = "p" > ,< / span > < span class = "n" > methods< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " DELETE" < / span > < span class = "p" > ])< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_blueprints_delete< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Delete a blueprint from git" " " < / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ,< / span > < span class = "s2" > " master" < / span > < span class = "p" > )< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > delete_recipe< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_delete) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/blueprints/workspace" < / span > < span class = "p" > ,< / span > < span class = "n" > methods< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " POST" < / span > < span class = "p" > ])< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_blueprints_workspace< / span > < span class = "p" > ():< / span >
< span class = "sd" > " " " Write a blueprint to the workspace" " " < / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ,< / span > < span class = "s2" > " master" < / span > < span class = "p" > )< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > headers< / span > < span class = "p" > [< / span > < span class = "s1" > ' Content-Type' < / span > < span class = "p" > ]< / span > < span class = "o" > ==< / span > < span class = "s2" > " text/x-toml" < / span > < span class = "p" > :< / span >
< span class = "n" > blueprint< / span > < span class = "o" > =< / span > < span class = "n" > recipe_from_toml< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > data< / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > blueprint< / span > < span class = "o" > =< / span > < span class = "n" > recipe_from_dict< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > get_json< / span > < span class = "p" > (< / span > < span class = "n" > cache< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ))< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > workspace_write< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_workspace) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/blueprints/workspace/< blueprint_name> " < / span > < span class = "p" > ,< / span > < span class = "n" > methods< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " DELETE" < / span > < span class = "p" > ])< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_blueprints_delete_workspace< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Delete a blueprint from the workspace" " " < / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ,< / span > < span class = "s2" > " master" < / span > < span class = "p" > )< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > workspace_delete< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_delete_workspace) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > error< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/blueprints/undo/< blueprint_name> /< commit> " < / span > < span class = "p" > ,< / span > < span class = "n" > methods< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " POST" < / span > < span class = "p" > ])< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_blueprints_undo< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "n" > commit< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Undo changes to a blueprint by reverting to a previous commit." " " < / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ,< / span > < span class = "s2" > " master" < / span > < span class = "p" > )< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > revert_recipe< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "n" > commit< / span > < span class = "p" > )< / span >
< span class = "c1" > # Read the new recipe and write it to the workspace< / span >
< span class = "n" > blueprint< / span > < span class = "o" > =< / span > < span class = "n" > read_recipe_commit< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "n" > workspace_write< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_undo) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/blueprints/tag/< blueprint_name> " < / span > < span class = "p" > ,< / span > < span class = "n" > methods< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " POST" < / span > < span class = "p" > ])< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_blueprints_tag< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Tag a blueprint' s latest blueprint commit as a ' revision' " " " < / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ,< / span > < span class = "s2" > " master" < / span > < span class = "p" > )< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > tag_recipe_commit< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_tag) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/blueprints/diff/< blueprint_name> /< from_commit> /< to_commit> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_blueprints_diff< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "n" > from_commit< / span > < span class = "p" > ,< / span > < span class = "n" > to_commit< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the differences between two commits of a blueprint" " " < / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ,< / span > < span class = "s2" > " master" < / span > < span class = "p" > )< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > from_commit< / span > < span class = "o" > ==< / span > < span class = "s2" > " NEWEST" < / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > old_blueprint< / span > < span class = "o" > =< / span > < span class = "n" > read_recipe_commit< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > old_blueprint< / span > < span class = "o" > =< / span > < span class = "n" > read_recipe_commit< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "n" > from_commit< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_diff) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > to_commit< / span > < span class = "o" > ==< / span > < span class = "s2" > " WORKSPACE" < / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > new_blueprint< / span > < span class = "o" > =< / span > < span class = "n" > workspace_read< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "c1" > # If there is no workspace, use the newest commit instead< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > new_blueprint< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > new_blueprint< / span > < span class = "o" > =< / span > < span class = "n" > read_recipe_commit< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > elif< / span > < span class = "n" > to_commit< / span > < span class = "o" > ==< / span > < span class = "s2" > " NEWEST" < / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > new_blueprint< / span > < span class = "o" > =< / span > < span class = "n" > read_recipe_commit< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > new_blueprint< / span > < span class = "o" > =< / span > < span class = "n" > read_recipe_commit< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "n" > to_commit< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_diff) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "n" > diff< / span > < span class = "o" > =< / span > < span class = "n" > recipe_diff< / span > < span class = "p" > (< / span > < span class = "n" > old_blueprint< / span > < span class = "p" > ,< / span > < span class = "n" > new_blueprint< / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > diff< / span > < span class = "o" > =< / span > < span class = "n" > diff< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/blueprints/freeze/< blueprint_names> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_blueprints_freeze< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_names< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the blueprint with the exact modules and packages selected by depsolve" " " < / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ,< / span > < span class = "s2" > " master" < / span > < span class = "p" > )< / span >
< span class = "n" > out_fmt< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " format" < / span > < span class = "p" > ,< / span > < span class = "s2" > " json" < / span > < span class = "p" > )< / span >
< span class = "n" > blueprints< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > for< / span > < span class = "n" > blueprint_name< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "n" > n< / span > < span class = "o" > .< / span > < span class = "n" > strip< / span > < span class = "p" > ()< / span > < span class = "k" > for< / span > < span class = "n" > n< / span > < span class = "ow" > in< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_names< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s2" > " ," < / span > < span class = "p" > ),< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "k" > lambda< / span > < span class = "n" > n< / span > < span class = "p" > :< / span > < span class = "n" > n< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ())]:< / span >
< span class = "c1" > # get the blueprint< / span >
< span class = "c1" > # Get the workspace version (if it exists)< / span >
< span class = "n" > blueprint< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > blueprint< / span > < span class = "o" > =< / span > < span class = "n" > workspace_read< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "p" > :< / span >
< span class = "k" > pass< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > blueprint< / span > < span class = "p" > :< / span >
< span class = "c1" > # No workspace version, get the git version (if it exists)< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > blueprint< / span > < span class = "o" > =< / span > < span class = "n" > read_recipe_commit< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > : < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )))< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_freeze) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "c1" > # No blueprint found, skip it.< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > blueprint< / span > < span class = "p" > :< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > : blueprint_not_found" < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ))< / span >
< span class = "k" > continue< / span >
< span class = "c1" > # Combine modules and packages and depsolve the list< / span >
< span class = "c1" > # TODO include the version/glob in the depsolving< / span >
2018-06-04 23:50:39 +00:00
< span class = "n" > module_nver< / span > < span class = "o" > =< / span > < span class = "n" > blueprint< / span > < span class = "o" > .< / span > < span class = "n" > module_nver< / span >
< span class = "n" > package_nver< / span > < span class = "o" > =< / span > < span class = "n" > blueprint< / span > < span class = "o" > .< / span > < span class = "n" > package_nver< / span >
< span class = "n" > projects< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "nb" > set< / span > < span class = "p" > (< / span > < span class = "n" > module_nver< / span > < span class = "o" > +< / span > < span class = "n" > package_nver< / span > < span class = "p" > ),< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "k" > lambda< / span > < span class = "n" > p< / span > < span class = "p" > :< / span > < span class = "n" > p< / span > < span class = "p" > [< / span > < span class = "mi" > 0< / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ())< / span >
2018-05-16 20:15:10 +00:00
< span class = "n" > deps< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
2018-07-20 23:27:17 +00:00
< span class = "n" > deps< / span > < span class = "o" > =< / span > < span class = "n" > projects_depsolve< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > projects< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint< / span > < span class = "o" > .< / span > < span class = "n" > group_names< / span > < span class = "p" > )< / span >
2018-05-16 20:15:10 +00:00
< span class = "k" > except< / span > < span class = "n" > ProjectsError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > : < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )))< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_freeze) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "n" > blueprints< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > ({< / span > < span class = "s2" > " blueprint" < / span > < span class = "p" > :< / span > < span class = "n" > blueprint< / span > < span class = "o" > .< / span > < span class = "n" > freeze< / span > < span class = "p" > (< / span > < span class = "n" > deps< / span > < span class = "p" > )})< / span >
< span class = "k" > if< / span > < span class = "n" > out_fmt< / span > < span class = "o" > ==< / span > < span class = "s2" > " toml" < / span > < span class = "p" > :< / span >
< span class = "c1" > # With TOML output we just want to dump the raw blueprint, skipping the rest.< / span >
< span class = "k" > return< / span > < span class = "s2" > " < / span > < span class = "se" > \n\n< / span > < span class = "s2" > " < / span > < span class = "o" > .< / span > < span class = "n" > join< / span > < span class = "p" > ([< / span > < span class = "n" > e< / span > < span class = "p" > [< / span > < span class = "s2" > " blueprint" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > toml< / span > < span class = "p" > ()< / span > < span class = "k" > for< / span > < span class = "n" > e< / span > < span class = "ow" > in< / span > < span class = "n" > blueprints< / span > < span class = "p" > ])< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > blueprints< / span > < span class = "o" > =< / span > < span class = "n" > blueprints< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "n" > errors< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/blueprints/depsolve/< blueprint_names> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_blueprints_depsolve< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_names< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the dependencies for a blueprint" " " < / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ,< / span > < span class = "s2" > " master" < / span > < span class = "p" > )< / span >
< span class = "n" > blueprints< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > for< / span > < span class = "n" > blueprint_name< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "n" > n< / span > < span class = "o" > .< / span > < span class = "n" > strip< / span > < span class = "p" > ()< / span > < span class = "k" > for< / span > < span class = "n" > n< / span > < span class = "ow" > in< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_names< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s2" > " ," < / span > < span class = "p" > ),< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "k" > lambda< / span > < span class = "n" > n< / span > < span class = "p" > :< / span > < span class = "n" > n< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ())]:< / span >
< span class = "c1" > # get the blueprint< / span >
< span class = "c1" > # Get the workspace version (if it exists)< / span >
< span class = "n" > blueprint< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > blueprint< / span > < span class = "o" > =< / span > < span class = "n" > workspace_read< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "p" > :< / span >
< span class = "k" > pass< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > blueprint< / span > < span class = "p" > :< / span >
< span class = "c1" > # No workspace version, get the git version (if it exists)< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > blueprint< / span > < span class = "o" > =< / span > < span class = "n" > read_recipe_commit< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > : < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )))< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_depsolve) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "c1" > # No blueprint found, skip it.< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > blueprint< / span > < span class = "p" > :< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > : blueprint not found" < / span > < span class = "o" > %< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > )< / span >
< span class = "k" > continue< / span >
< span class = "c1" > # Combine modules and packages and depsolve the list< / span >
< span class = "c1" > # TODO include the version/glob in the depsolving< / span >
2018-06-04 23:50:39 +00:00
< span class = "n" > module_nver< / span > < span class = "o" > =< / span > < span class = "n" > blueprint< / span > < span class = "o" > .< / span > < span class = "n" > module_nver< / span >
< span class = "n" > package_nver< / span > < span class = "o" > =< / span > < span class = "n" > blueprint< / span > < span class = "o" > .< / span > < span class = "n" > package_nver< / span >
< span class = "n" > projects< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "nb" > set< / span > < span class = "p" > (< / span > < span class = "n" > module_nver< / span > < span class = "o" > +< / span > < span class = "n" > package_nver< / span > < span class = "p" > ),< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "k" > lambda< / span > < span class = "n" > p< / span > < span class = "p" > :< / span > < span class = "n" > p< / span > < span class = "p" > [< / span > < span class = "mi" > 0< / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ())< / span >
2018-05-16 20:15:10 +00:00
< span class = "n" > deps< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
2018-07-20 23:27:17 +00:00
< span class = "n" > deps< / span > < span class = "o" > =< / span > < span class = "n" > projects_depsolve< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > projects< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint< / span > < span class = "o" > .< / span > < span class = "n" > group_names< / span > < span class = "p" > )< / span >
2018-05-16 20:15:10 +00:00
< span class = "k" > except< / span > < span class = "n" > ProjectsError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > : < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )))< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_blueprints_depsolve) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "c1" > # Get the NEVRA' s of the modules and projects, add as " modules" < / span >
< span class = "n" > modules< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > for< / span > < span class = "n" > dep< / span > < span class = "ow" > in< / span > < span class = "n" > deps< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > dep< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]< / span > < span class = "ow" > in< / span > < span class = "n" > projects< / span > < span class = "p" > :< / span >
< span class = "n" > modules< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "n" > dep< / span > < span class = "p" > )< / span >
< span class = "n" > modules< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "n" > modules< / span > < span class = "p" > ,< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "k" > lambda< / span > < span class = "n" > m< / span > < span class = "p" > :< / span > < span class = "n" > m< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ())< / span >
< span class = "n" > blueprints< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > ({< / span > < span class = "s2" > " blueprint" < / span > < span class = "p" > :< / span > < span class = "n" > blueprint< / span > < span class = "p" > ,< / span > < span class = "s2" > " dependencies" < / span > < span class = "p" > :< / span > < span class = "n" > deps< / span > < span class = "p" > ,< / span > < span class = "s2" > " modules" < / span > < span class = "p" > :< / span > < span class = "n" > modules< / span > < span class = "p" > })< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > blueprints< / span > < span class = "o" > =< / span > < span class = "n" > blueprints< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "n" > errors< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/projects/list" < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_projects_list< / span > < span class = "p" > ():< / span >
< span class = "sd" > " " " List all of the available projects/packages" " " < / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "n" > limit< / span > < span class = "o" > =< / span > < span class = "nb" > int< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " limit" < / span > < span class = "p" > ,< / span > < span class = "s2" > " 20" < / span > < span class = "p" > ))< / span >
< span class = "n" > offset< / span > < span class = "o" > =< / span > < span class = "nb" > int< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " offset" < / span > < span class = "p" > ,< / span > < span class = "s2" > " 0" < / span > < span class = "p" > ))< / span >
< span class = "k" > except< / span > < span class = "ne" > ValueError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > available< / span > < span class = "o" > =< / span > < span class = "n" > projects_list< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "n" > ProjectsError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_projects_list) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "n" > projects< / span > < span class = "o" > =< / span > < span class = "n" > take_limits< / span > < span class = "p" > (< / span > < span class = "n" > available< / span > < span class = "p" > ,< / span > < span class = "n" > offset< / span > < span class = "p" > ,< / span > < span class = "n" > limit< / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > projects< / span > < span class = "o" > =< / span > < span class = "n" > projects< / span > < span class = "p" > ,< / span > < span class = "n" > offset< / span > < span class = "o" > =< / span > < span class = "n" > offset< / span > < span class = "p" > ,< / span > < span class = "n" > limit< / span > < span class = "o" > =< / span > < span class = "n" > limit< / span > < span class = "p" > ,< / span > < span class = "n" > total< / span > < span class = "o" > =< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "n" > available< / span > < span class = "p" > ))< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/projects/info/< project_names> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_projects_info< / span > < span class = "p" > (< / span > < span class = "n" > project_names< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return detailed information about the listed projects" " " < / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > projects< / span > < span class = "o" > =< / span > < span class = "n" > projects_info< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > project_names< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s2" > " ," < / span > < span class = "p" > ))< / span >
< span class = "k" > except< / span > < span class = "n" > ProjectsError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_projects_info) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > projects< / span > < span class = "o" > =< / span > < span class = "n" > projects< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/projects/depsolve/< project_names> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_projects_depsolve< / span > < span class = "p" > (< / span > < span class = "n" > project_names< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return detailed information about the listed projects" " " < / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
2018-07-20 23:27:17 +00:00
< span class = "n" > deps< / span > < span class = "o" > =< / span > < span class = "n" > projects_depsolve< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "p" > [(< / span > < span class = "n" > n< / span > < span class = "p" > ,< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span > < span class = "k" > for< / span > < span class = "n" > n< / span > < span class = "ow" > in< / span > < span class = "n" > project_names< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s2" > " ," < / span > < span class = "p" > )],< / span > < span class = "p" > [])< / span >
2018-05-16 20:15:10 +00:00
< span class = "k" > except< / span > < span class = "n" > ProjectsError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_projects_depsolve) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > projects< / span > < span class = "o" > =< / span > < span class = "n" > deps< / span > < span class = "p" > )< / span >
2018-06-04 23:50:39 +00:00
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/projects/source/list" < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_projects_source_list< / span > < span class = "p" > ():< / span >
< span class = "sd" > " " " Return the list of source names" " " < / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > repos< / span > < span class = "o" > =< / span > < span class = "nb" > list< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "o" > .< / span > < span class = "n" > iter_enabled< / span > < span class = "p" > ())< / span >
< span class = "n" > sources< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > ([< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > id< / span > < span class = "k" > for< / span > < span class = "n" > r< / span > < span class = "ow" > in< / span > < span class = "n" > repos< / span > < span class = "p" > ])< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > sources< / span > < span class = "o" > =< / span > < span class = "n" > sources< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/projects/source/info/< source_names> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_projects_source_info< / span > < span class = "p" > (< / span > < span class = "n" > source_names< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return detailed info about the list of sources" " " < / span >
< span class = "n" > out_fmt< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " format" < / span > < span class = "p" > ,< / span > < span class = "s2" > " json" < / span > < span class = "p" > )< / span >
< span class = "c1" > # Return info on all of the sources< / span >
< span class = "k" > if< / span > < span class = "n" > source_names< / span > < span class = "o" > ==< / span > < span class = "s2" > " *" < / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > source_names< / span > < span class = "o" > =< / span > < span class = "s2" > " ," < / span > < span class = "o" > .< / span > < span class = "n" > join< / span > < span class = "p" > (< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > id< / span > < span class = "k" > for< / span > < span class = "n" > r< / span > < span class = "ow" > in< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "o" > .< / span > < span class = "n" > iter_enabled< / span > < span class = "p" > ())< / span >
< span class = "n" > sources< / span > < span class = "o" > =< / span > < span class = "p" > {}< / span >
< span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "n" > system_sources< / span > < span class = "o" > =< / span > < span class = "n" > get_repo_sources< / span > < span class = "p" > (< / span > < span class = "s2" > " /etc/yum.repos.d/*.repo" < / span > < span class = "p" > )< / span >
< span class = "k" > for< / span > < span class = "n" > source< / span > < span class = "ow" > in< / span > < span class = "n" > source_names< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s2" > " ," < / span > < span class = "p" > ):< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > repo< / span > < span class = "o" > =< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "n" > source< / span > < span class = "p" > ,< / span > < span class = "kc" > None< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > repo< / span > < span class = "p" > :< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > is not a valid source" < / span > < span class = "o" > %< / span > < span class = "n" > source< / span > < span class = "p" > )< / span >
< span class = "k" > continue< / span >
< span class = "n" > sources< / span > < span class = "p" > [< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > id< / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "n" > repo_to_source< / span > < span class = "p" > (< / span > < span class = "n" > repo< / span > < span class = "p" > ,< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > id< / span > < span class = "ow" > in< / span > < span class = "n" > system_sources< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > out_fmt< / span > < span class = "o" > ==< / span > < span class = "s2" > " toml" < / span > < span class = "ow" > and< / span > < span class = "ow" > not< / span > < span class = "n" > errors< / span > < span class = "p" > :< / span >
< span class = "c1" > # With TOML output we just want to dump the raw sources, skipping the errors< / span >
< span class = "k" > return< / span > < span class = "n" > toml< / span > < span class = "o" > .< / span > < span class = "n" > dumps< / span > < span class = "p" > (< / span > < span class = "n" > sources< / span > < span class = "p" > )< / span >
< span class = "k" > elif< / span > < span class = "n" > out_fmt< / span > < span class = "o" > ==< / span > < span class = "s2" > " toml" < / span > < span class = "ow" > and< / span > < span class = "n" > errors< / span > < span class = "p" > :< / span >
< span class = "c1" > # TOML requested, but there was an error< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "n" > errors< / span > < span class = "p" > ),< / span > < span class = "mi" > 400< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > sources< / span > < span class = "o" > =< / span > < span class = "n" > sources< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "n" > errors< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/projects/source/new" < / span > < span class = "p" > ,< / span > < span class = "n" > methods< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " POST" < / span > < span class = "p" > ])< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_projects_source_new< / span > < span class = "p" > ():< / span >
< span class = "sd" > " " " Add a new package source. Or change an existing one" " " < / span >
< span class = "k" > if< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > headers< / span > < span class = "p" > [< / span > < span class = "s1" > ' Content-Type' < / span > < span class = "p" > ]< / span > < span class = "o" > ==< / span > < span class = "s2" > " text/x-toml" < / span > < span class = "p" > :< / span >
< span class = "n" > source< / span > < span class = "o" > =< / span > < span class = "n" > toml< / span > < span class = "o" > .< / span > < span class = "n" > loads< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > data< / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > source< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > get_json< / span > < span class = "p" > (< / span > < span class = "n" > cache< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "n" > system_sources< / span > < span class = "o" > =< / span > < span class = "n" > get_repo_sources< / span > < span class = "p" > (< / span > < span class = "s2" > " /etc/yum.repos.d/*.repo" < / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > source< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]< / span > < span class = "ow" > in< / span > < span class = "n" > system_sources< / span > < span class = "p" > :< / span >
2018-07-20 23:27:17 +00:00
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > is a system source, it cannot be changed." < / span > < span class = "o" > %< / span > < span class = "n" > source< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]]),< / span > < span class = "mi" > 400< / span >
2018-06-04 23:50:39 +00:00
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "c1" > # Remove it from the RepoDict (NOTE that this isn' t explicitly supported by the DNF API)< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > dbo< / span > < span class = "o" > =< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span >
< span class = "c1" > # If this repo already exists, delete it and replace it with the new one< / span >
< span class = "n" > repos< / span > < span class = "o" > =< / span > < span class = "nb" > list< / span > < span class = "p" > (< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > id< / span > < span class = "k" > for< / span > < span class = "n" > r< / span > < span class = "ow" > in< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "o" > .< / span > < span class = "n" > iter_enabled< / span > < span class = "p" > ())< / span >
< span class = "k" > if< / span > < span class = "n" > source< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]< / span > < span class = "ow" > in< / span > < span class = "n" > repos< / span > < span class = "p" > :< / span >
< span class = "k" > del< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "p" > [< / span > < span class = "n" > source< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]]< / span >
< span class = "n" > repo< / span > < span class = "o" > =< / span > < span class = "n" > source_to_repo< / span > < span class = "p" > (< / span > < span class = "n" > source< / span > < span class = "p" > ,< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span > < span class = "p" > )< / span >
< span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "o" > .< / span > < span class = "n" > add< / span > < span class = "p" > (< / span > < span class = "n" > repo< / span > < span class = "p" > )< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " Updating repository metadata after adding < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > source< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ])< / span >
< span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > fill_sack< / span > < span class = "p" > (< / span > < span class = "n" > load_system_repo< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > read_comps< / span > < span class = "p" > ()< / span >
< span class = "c1" > # Write the new repo to disk, replacing any existing ones< / span >
< span class = "n" > repo_dir< / span > < span class = "o" > =< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " composer" < / span > < span class = "p" > ,< / span > < span class = "s2" > " repo_dir" < / span > < span class = "p" > )< / span >
< span class = "c1" > # Remove any previous sources with this name, ignore it if it isn' t found< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "n" > delete_repo_source< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > repo_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " *.repo" < / span > < span class = "p" > ),< / span > < span class = "n" > source< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ])< / span >
< span class = "k" > except< / span > < span class = "n" > ProjectsError< / span > < span class = "p" > :< / span >
< span class = "k" > pass< / span >
< span class = "c1" > # Make sure the source name can' t contain a path traversal by taking the basename< / span >
< span class = "n" > source_path< / span > < span class = "o" > =< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > repo_dir< / span > < span class = "p" > ,< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > basename< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > .repo" < / span > < span class = "o" > %< / span > < span class = "n" > source< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]))< / span >
< span class = "k" > with< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > source_path< / span > < span class = "p" > ,< / span > < span class = "s2" > " w" < / span > < span class = "p" > )< / span > < span class = "k" > as< / span > < span class = "n" > f< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "n" > dnf_repo_to_file_repo< / span > < span class = "p" > (< / span > < span class = "n" > repo< / span > < span class = "p" > ))< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_projects_source_add) adding < / span > < span class = "si" > %s< / span > < span class = "s2" > failed: < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > source< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ],< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "c1" > # Cleanup the mess, if loading it failed we don' t want to leave it in memory< / span >
< span class = "n" > repos< / span > < span class = "o" > =< / span > < span class = "nb" > list< / span > < span class = "p" > (< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > id< / span > < span class = "k" > for< / span > < span class = "n" > r< / span > < span class = "ow" > in< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "o" > .< / span > < span class = "n" > iter_enabled< / span > < span class = "p" > ())< / span >
< span class = "k" > if< / span > < span class = "n" > source< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]< / span > < span class = "ow" > in< / span > < span class = "n" > repos< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > dbo< / span > < span class = "o" > =< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span >
< span class = "k" > del< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "p" > [< / span > < span class = "n" > source< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ]]< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " Updating repository metadata after adding < / span > < span class = "si" > %s< / span > < span class = "s2" > failed" < / span > < span class = "p" > ,< / span > < span class = "n" > source< / span > < span class = "p" > [< / span > < span class = "s2" > " name" < / span > < span class = "p" > ])< / span >
< span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > fill_sack< / span > < span class = "p" > (< / span > < span class = "n" > load_system_repo< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > read_comps< / span > < span class = "p" > ()< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/projects/source/delete/< source_name> " < / span > < span class = "p" > ,< / span > < span class = "n" > methods< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " DELETE" < / span > < span class = "p" > ])< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_projects_source_delete< / span > < span class = "p" > (< / span > < span class = "n" > source_name< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Delete the named source and return a status response" " " < / span >
< span class = "n" > system_sources< / span > < span class = "o" > =< / span > < span class = "n" > get_repo_sources< / span > < span class = "p" > (< / span > < span class = "s2" > " /etc/yum.repos.d/*.repo" < / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > source_name< / span > < span class = "ow" > in< / span > < span class = "n" > system_sources< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > is a system source, it cannot be deleted." < / span > < span class = "o" > %< / span > < span class = "n" > source_name< / span > < span class = "p" > ]),< / span > < span class = "mi" > 400< / span >
< span class = "n" > share_dir< / span > < span class = "o" > =< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " composer" < / span > < span class = "p" > ,< / span > < span class = "s2" > " repo_dir" < / span > < span class = "p" > )< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "c1" > # Remove the file entry for the source< / span >
< span class = "n" > delete_repo_source< / span > < span class = "p" > (< / span > < span class = "n" > joinpaths< / span > < span class = "p" > (< / span > < span class = "n" > share_dir< / span > < span class = "p" > ,< / span > < span class = "s2" > " *.repo" < / span > < span class = "p" > ),< / span > < span class = "n" > source_name< / span > < span class = "p" > )< / span >
< span class = "c1" > # Remove it from the RepoDict (NOTE that this isn' t explicitly supported by the DNF API)< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > source_name< / span > < span class = "ow" > in< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "p" > :< / span >
< span class = "k" > del< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "p" > [< / span > < span class = "n" > source_name< / span > < span class = "p" > ]< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " Updating repository metadata after removing < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > source_name< / span > < span class = "p" > )< / span >
< span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > fill_sack< / span > < span class = "p" > (< / span > < span class = "n" > load_system_repo< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > read_comps< / span > < span class = "p" > ()< / span >
< span class = "k" > except< / span > < span class = "n" > ProjectsError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_projects_source_delete) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
2018-05-16 20:15:10 +00:00
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/modules/list" < / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/modules/list/< module_names> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_modules_list< / span > < span class = "p" > (< / span > < span class = "n" > module_names< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " List available modules, filtering by module_names" " " < / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "n" > limit< / span > < span class = "o" > =< / span > < span class = "nb" > int< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " limit" < / span > < span class = "p" > ,< / span > < span class = "s2" > " 20" < / span > < span class = "p" > ))< / span >
< span class = "n" > offset< / span > < span class = "o" > =< / span > < span class = "nb" > int< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " offset" < / span > < span class = "p" > ,< / span > < span class = "s2" > " 0" < / span > < span class = "p" > ))< / span >
< span class = "k" > except< / span > < span class = "ne" > ValueError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > if< / span > < span class = "n" > module_names< / span > < span class = "p" > :< / span >
< span class = "n" > module_names< / span > < span class = "o" > =< / span > < span class = "n" > module_names< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s2" > " ," < / span > < span class = "p" > )< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > available< / span > < span class = "o" > =< / span > < span class = "n" > modules_list< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > module_names< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "n" > ProjectsError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_modules_list) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "n" > modules< / span > < span class = "o" > =< / span > < span class = "n" > take_limits< / span > < span class = "p" > (< / span > < span class = "n" > available< / span > < span class = "p" > ,< / span > < span class = "n" > offset< / span > < span class = "p" > ,< / span > < span class = "n" > limit< / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > modules< / span > < span class = "o" > =< / span > < span class = "n" > modules< / span > < span class = "p" > ,< / span > < span class = "n" > offset< / span > < span class = "o" > =< / span > < span class = "n" > offset< / span > < span class = "p" > ,< / span > < span class = "n" > limit< / span > < span class = "o" > =< / span > < span class = "n" > limit< / span > < span class = "p" > ,< / span > < span class = "n" > total< / span > < span class = "o" > =< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "n" > available< / span > < span class = "p" > ))< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/modules/info/< module_names> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_modules_info< / span > < span class = "p" > (< / span > < span class = "n" > module_names< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return detailed information about the listed modules" " " < / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > with< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > lock< / span > < span class = "p" > :< / span >
< span class = "n" > modules< / span > < span class = "o" > =< / span > < span class = "n" > modules_info< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "p" > ,< / span > < span class = "n" > module_names< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s2" > " ," < / span > < span class = "p" > ))< / span >
< span class = "k" > except< / span > < span class = "n" > ProjectsError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " (v0_modules_info) < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > modules< / span > < span class = "o" > =< / span > < span class = "n" > modules< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose" < / span > < span class = "p" > ,< / span > < span class = "n" > methods< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " POST" < / span > < span class = "p" > ])< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_start< / span > < span class = "p" > ():< / span >
< span class = "sd" > " " " Start a compose< / span >
< span class = "sd" > The body of the post should have these fields:< / span >
< span class = "sd" > blueprint_name - The blueprint name from /blueprints/list/< / span >
< span class = "sd" > compose_type - The type of output to create, from /compose/types< / span >
< span class = "sd" > branch - Optional, defaults to master, selects the git branch to use for the blueprint.< / span >
< span class = "sd" > " " " < / span >
< span class = "c1" > # Passing ?test=1 will generate a fake FAILED compose.< / span >
< span class = "c1" > # Passing ?test=2 will generate a fake FINISHED compose.< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "n" > test_mode< / span > < span class = "o" > =< / span > < span class = "nb" > int< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " test" < / span > < span class = "p" > ,< / span > < span class = "s2" > " 0" < / span > < span class = "p" > ))< / span >
< span class = "k" > except< / span > < span class = "ne" > ValueError< / span > < span class = "p" > :< / span >
< span class = "n" > test_mode< / span > < span class = "o" > =< / span > < span class = "mi" > 0< / span >
< span class = "n" > compose< / span > < span class = "o" > =< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > get_json< / span > < span class = "p" > (< / span > < span class = "n" > cache< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > compose< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " Missing POST body" < / span > < span class = "p" > ]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > if< / span > < span class = "s2" > " blueprint_name" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > compose< / span > < span class = "p" > :< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " No ' blueprint_name' in the JSON request" < / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > blueprint_name< / span > < span class = "o" > =< / span > < span class = "n" > compose< / span > < span class = "p" > [< / span > < span class = "s2" > " blueprint_name" < / span > < span class = "p" > ]< / span >
< span class = "k" > if< / span > < span class = "s2" > " branch" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > compose< / span > < span class = "ow" > or< / span > < span class = "ow" > not< / span > < span class = "n" > compose< / span > < span class = "p" > [< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ]:< / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "s2" > " master" < / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > branch< / span > < span class = "o" > =< / span > < span class = "n" > compose< / span > < span class = "p" > [< / span > < span class = "s2" > " branch" < / span > < span class = "p" > ]< / span >
< span class = "k" > if< / span > < span class = "s2" > " compose_type" < / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "n" > compose< / span > < span class = "p" > :< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " No ' compose_type' in the JSON request" < / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > compose_type< / span > < span class = "o" > =< / span > < span class = "n" > compose< / span > < span class = "p" > [< / span > < span class = "s2" > " compose_type" < / span > < span class = "p" > ]< / span >
< span class = "k" > if< / span > < span class = "n" > errors< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "n" > errors< / span > < span class = "p" > ),< / span > < span class = "mi" > 400< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "n" > build_id< / span > < span class = "o" > =< / span > < span class = "n" > start_build< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " DNFLOCK" < / span > < span class = "p" > ],< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " GITLOCK" < / span > < span class = "p" > ],< / span >
< span class = "n" > branch< / span > < span class = "p" > ,< / span > < span class = "n" > blueprint_name< / span > < span class = "p" > ,< / span > < span class = "n" > compose_type< / span > < span class = "p" > ,< / span > < span class = "n" > test_mode< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span > < span class = "n" > build_id< / span > < span class = "o" > =< / span > < span class = "n" > build_id< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose/types" < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_types< / span > < span class = "p" > ():< / span >
< span class = "sd" > " " " Return the list of enabled output types< / span >
< span class = "sd" > (only enabled types are returned)< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > share_dir< / span > < span class = "o" > =< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " composer" < / span > < span class = "p" > ,< / span > < span class = "s2" > " share_dir" < / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > types< / span > < span class = "o" > =< / span > < span class = "p" > [{< / span > < span class = "s2" > " name" < / span > < span class = "p" > :< / span > < span class = "n" > k< / span > < span class = "p" > ,< / span > < span class = "s2" > " enabled" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > }< / span > < span class = "k" > for< / span > < span class = "n" > k< / span > < span class = "ow" > in< / span > < span class = "n" > compose_types< / span > < span class = "p" > (< / span > < span class = "n" > share_dir< / span > < span class = "p" > )])< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose/queue" < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_queue< / span > < span class = "p" > ():< / span >
< span class = "sd" > " " " Return the status of the new and running queues" " " < / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > queue_status< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ]))< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose/finished" < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_finished< / span > < span class = "p" > ():< / span >
< span class = "sd" > " " " Return the list of finished composes" " " < / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > finished< / span > < span class = "o" > =< / span > < span class = "n" > build_status< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "s2" > " FINISHED" < / span > < span class = "p" > ))< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose/failed" < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_failed< / span > < span class = "p" > ():< / span >
< span class = "sd" > " " " Return the list of failed composes" " " < / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > failed< / span > < span class = "o" > =< / span > < span class = "n" > build_status< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "s2" > " FAILED" < / span > < span class = "p" > ))< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose/status/< uuids> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_status< / span > < span class = "p" > (< / span > < span class = "n" > uuids< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the status of the listed uuids" " " < / span >
< span class = "n" > results< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > for< / span > < span class = "n" > uuid< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "n" > n< / span > < span class = "o" > .< / span > < span class = "n" > strip< / span > < span class = "p" > ()< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ()< / span > < span class = "k" > for< / span > < span class = "n" > n< / span > < span class = "ow" > in< / span > < span class = "n" > uuids< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s2" > " ," < / span > < span class = "p" > )]:< / span >
< span class = "n" > details< / span > < span class = "o" > =< / span > < span class = "n" > uuid_status< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > details< / span > < span class = "ow" > is< / span > < span class = "ow" > not< / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
< span class = "n" > results< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "n" > details< / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > uuids< / span > < span class = "o" > =< / span > < span class = "n" > results< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose/cancel/< uuid> " < / span > < span class = "p" > ,< / span > < span class = "n" > methods< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " DELETE" < / span > < span class = "p" > ])< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_cancel< / span > < span class = "p" > (< / span > < span class = "n" > uuid< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Cancel a running compose and delete its results directory" " " < / span >
< span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "n" > uuid_status< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > status< / span > < span class = "ow" > is< / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > is not a valid build uuid" < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > ]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > if< / span > < span class = "n" > status< / span > < span class = "p" > [< / span > < span class = "s2" > " queue_status" < / span > < span class = "p" > ]< / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "s2" > " WAITING" < / span > < span class = "p" > ,< / span > < span class = "s2" > " RUNNING" < / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " Build < / span > < span class = "si" > %s< / span > < span class = "s2" > is not in WAITING or RUNNING." < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > ])< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "n" > uuid_cancel< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > : < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > uuid< / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span > < span class = "n" > uuid< / span > < span class = "o" > =< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose/delete/< uuids> " < / span > < span class = "p" > ,< / span > < span class = "n" > methods< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " DELETE" < / span > < span class = "p" > ])< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_delete< / span > < span class = "p" > (< / span > < span class = "n" > uuids< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Delete the compose results for the listed uuids" " " < / span >
< span class = "n" > results< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > for< / span > < span class = "n" > uuid< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "n" > n< / span > < span class = "o" > .< / span > < span class = "n" > strip< / span > < span class = "p" > ()< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ()< / span > < span class = "k" > for< / span > < span class = "n" > n< / span > < span class = "ow" > in< / span > < span class = "n" > uuids< / span > < span class = "o" > .< / span > < span class = "n" > split< / span > < span class = "p" > (< / span > < span class = "s2" > " ," < / span > < span class = "p" > )]:< / span >
< span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "n" > uuid_status< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > status< / span > < span class = "ow" > is< / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > is not a valid build uuid" < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "k" > elif< / span > < span class = "n" > status< / span > < span class = "p" > [< / span > < span class = "s2" > " queue_status" < / span > < span class = "p" > ]< / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "s2" > " FINISHED" < / span > < span class = "p" > ,< / span > < span class = "s2" > " FAILED" < / span > < span class = "p" > ]:< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " Build < / span > < span class = "si" > %s< / span > < span class = "s2" > is not in FINISHED or FAILED." < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "n" > uuid_delete< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > errors< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > : < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > uuid< / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )))< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > results< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > ({< / span > < span class = "s2" > " uuid" < / span > < span class = "p" > :< / span > < span class = "n" > uuid< / span > < span class = "p" > ,< / span > < span class = "s2" > " status" < / span > < span class = "p" > :< / span > < span class = "kc" > True< / span > < span class = "p" > })< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > uuids< / span > < span class = "o" > =< / span > < span class = "n" > results< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "n" > errors< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose/info/< uuid> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_info< / span > < span class = "p" > (< / span > < span class = "n" > uuid< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return detailed info about a compose" " " < / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "n" > info< / span > < span class = "o" > =< / span > < span class = "n" > uuid_info< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > Exception< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "o" > **< / span > < span class = "n" > info< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose/metadata/< uuid> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_metadata< / span > < span class = "p" > (< / span > < span class = "n" > uuid< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return a tar of the metadata for the build" " " < / span >
< span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "n" > uuid_status< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > status< / span > < span class = "ow" > is< / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > is not a valid build uuid" < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > ]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > if< / span > < span class = "n" > status< / span > < span class = "p" > [< / span > < span class = "s2" > " queue_status" < / span > < span class = "p" > ]< / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "s2" > " FINISHED" < / span > < span class = "p" > ,< / span > < span class = "s2" > " FAILED" < / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " Build < / span > < span class = "si" > %s< / span > < span class = "s2" > not in FINISHED or FAILED state." < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > ]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > Response< / span > < span class = "p" > (< / span > < span class = "n" > uuid_tar< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > ,< / span > < span class = "n" > metadata< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span > < span class = "n" > image< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > logs< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ),< / span >
< span class = "n" > mimetype< / span > < span class = "o" > =< / span > < span class = "s2" > " application/x-tar" < / span > < span class = "p" > ,< / span >
< span class = "n" > headers< / span > < span class = "o" > =< / span > < span class = "p" > [(< / span > < span class = "s2" > " Content-Disposition" < / span > < span class = "p" > ,< / span > < span class = "s2" > " attachment; filename=< / span > < span class = "si" > %s< / span > < span class = "s2" > -metadata.tar;" < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > )],< / span >
< span class = "n" > direct_passthrough< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose/results/< uuid> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_results< / span > < span class = "p" > (< / span > < span class = "n" > uuid< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return a tar of the metadata and the results for the build" " " < / span >
< span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "n" > uuid_status< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > status< / span > < span class = "ow" > is< / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > is not a valid build uuid" < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > ]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > elif< / span > < span class = "n" > status< / span > < span class = "p" > [< / span > < span class = "s2" > " queue_status" < / span > < span class = "p" > ]< / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "s2" > " FINISHED" < / span > < span class = "p" > ,< / span > < span class = "s2" > " FAILED" < / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " Build < / span > < span class = "si" > %s< / span > < span class = "s2" > not in FINISHED or FAILED state." < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > ]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > Response< / span > < span class = "p" > (< / span > < span class = "n" > uuid_tar< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > ,< / span > < span class = "n" > metadata< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span > < span class = "n" > image< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span > < span class = "n" > logs< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > ),< / span >
< span class = "n" > mimetype< / span > < span class = "o" > =< / span > < span class = "s2" > " application/x-tar" < / span > < span class = "p" > ,< / span >
< span class = "n" > headers< / span > < span class = "o" > =< / span > < span class = "p" > [(< / span > < span class = "s2" > " Content-Disposition" < / span > < span class = "p" > ,< / span > < span class = "s2" > " attachment; filename=< / span > < span class = "si" > %s< / span > < span class = "s2" > .tar;" < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > )],< / span >
< span class = "n" > direct_passthrough< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose/logs/< uuid> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_logs< / span > < span class = "p" > (< / span > < span class = "n" > uuid< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return a tar of the metadata for the build" " " < / span >
< span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "n" > uuid_status< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > status< / span > < span class = "ow" > is< / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > is not a valid build uuid" < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > ]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > elif< / span > < span class = "n" > status< / span > < span class = "p" > [< / span > < span class = "s2" > " queue_status" < / span > < span class = "p" > ]< / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "s2" > " FINISHED" < / span > < span class = "p" > ,< / span > < span class = "s2" > " FAILED" < / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " Build < / span > < span class = "si" > %s< / span > < span class = "s2" > not in FINISHED or FAILED state." < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > ]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > Response< / span > < span class = "p" > (< / span > < span class = "n" > uuid_tar< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > ,< / span > < span class = "n" > metadata< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > image< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > logs< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > ),< / span >
< span class = "n" > mimetype< / span > < span class = "o" > =< / span > < span class = "s2" > " application/x-tar" < / span > < span class = "p" > ,< / span >
< span class = "n" > headers< / span > < span class = "o" > =< / span > < span class = "p" > [(< / span > < span class = "s2" > " Content-Disposition" < / span > < span class = "p" > ,< / span > < span class = "s2" > " attachment; filename=< / span > < span class = "si" > %s< / span > < span class = "s2" > -logs.tar;" < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > )],< / span >
< span class = "n" > direct_passthrough< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose/image/< uuid> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_image< / span > < span class = "p" > (< / span > < span class = "n" > uuid< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the output image for the build" " " < / span >
< span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "n" > uuid_status< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > status< / span > < span class = "ow" > is< / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > is not a valid build uuid" < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > ]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > elif< / span > < span class = "n" > status< / span > < span class = "p" > [< / span > < span class = "s2" > " queue_status" < / span > < span class = "p" > ]< / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "s2" > " FINISHED" < / span > < span class = "p" > ,< / span > < span class = "s2" > " FAILED" < / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " Build < / span > < span class = "si" > %s< / span > < span class = "s2" > not in FINISHED or FAILED state." < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > ]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > image_name< / span > < span class = "p" > ,< / span > < span class = "n" > image_path< / span > < span class = "o" > =< / span > < span class = "n" > uuid_image< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "c1" > # Make sure it really exists< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > exists< / span > < span class = "p" > (< / span > < span class = "n" > image_path< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " Build < / span > < span class = "si" > %s< / span > < span class = "s2" > is missing image file < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "p" > (< / span > < span class = "n" > uuid< / span > < span class = "p" > ,< / span > < span class = "n" > image_name< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "c1" > # Make the image name unique< / span >
< span class = "n" > image_name< / span > < span class = "o" > =< / span > < span class = "n" > uuid< / span > < span class = "o" > +< / span > < span class = "s2" > " -" < / span > < span class = "o" > +< / span > < span class = "n" > image_name< / span >
< span class = "c1" > # XXX - Will mime type guessing work for all our output?< / span >
< span class = "k" > return< / span > < span class = "n" > send_file< / span > < span class = "p" > (< / span > < span class = "n" > image_path< / span > < span class = "p" > ,< / span > < span class = "n" > as_attachment< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > ,< / span > < span class = "n" > attachment_filename< / span > < span class = "o" > =< / span > < span class = "n" > image_name< / span > < span class = "p" > ,< / span > < span class = "n" > add_etags< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "nd" > @api< / span > < span class = "o" > .< / span > < span class = "n" > route< / span > < span class = "p" > (< / span > < span class = "s2" > " /api/v0/compose/log/< uuid> " < / span > < span class = "p" > )< / span >
< span class = "nd" > @crossdomain< / span > < span class = "p" > (< / span > < span class = "n" > origin< / span > < span class = "o" > =< / span > < span class = "s2" > " *" < / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "nf" > v0_compose_log_tail< / span > < span class = "p" > (< / span > < span class = "n" > uuid< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Return the end of the main anaconda.log, defaults to 1Mbytes" " " < / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "n" > size< / span > < span class = "o" > =< / span > < span class = "nb" > int< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " size" < / span > < span class = "p" > ,< / span > < span class = "s2" > " 1024" < / span > < span class = "p" > ))< / span >
< span class = "k" > except< / span > < span class = "ne" > ValueError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span >
< span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "n" > uuid_status< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > status< / span > < span class = "ow" > is< / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " < / span > < span class = "si" > %s< / span > < span class = "s2" > is not a valid build uuid" < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > ]),< / span > < span class = "mi" > 400< / span >
< span class = "k" > elif< / span > < span class = "n" > status< / span > < span class = "p" > [< / span > < span class = "s2" > " queue_status" < / span > < span class = "p" > ]< / span > < span class = "o" > ==< / span > < span class = "s2" > " WAITING" < / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s2" > " Build < / span > < span class = "si" > %s< / span > < span class = "s2" > has not started yet. No logs to view" < / span > < span class = "o" > %< / span > < span class = "n" > uuid< / span > < span class = "p" > ])< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > Response< / span > < span class = "p" > (< / span > < span class = "n" > uuid_log< / span > < span class = "p" > (< / span > < span class = "n" > api< / span > < span class = "o" > .< / span > < span class = "n" > config< / span > < span class = "p" > [< / span > < span class = "s2" > " COMPOSER_CFG" < / span > < span class = "p" > ],< / span > < span class = "n" > uuid< / span > < span class = "p" > ,< / span > < span class = "n" > size< / span > < span class = "p" > ),< / span > < span class = "n" > direct_passthrough< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "k" > except< / span > < span class = "ne" > RuntimeError< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > jsonify< / span > < span class = "p" > (< / span > < span class = "n" > status< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > ,< / span > < span class = "n" > errors< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > )]),< / span > < span class = "mi" > 400< / span > < / div >
< / pre > < / div >
< / div >
< / div >
< footer >
< hr / >
< div role = "contentinfo" >
< p >
© Copyright 2018, Red Hat, Inc..
< / p >
< / div >
Built with < a href = "http://sphinx-doc.org/" > Sphinx< / a > using a < a href = "https://github.com/rtfd/sphinx_rtd_theme" > theme< / a > provided by < a href = "https://readthedocs.org" > Read the Docs< / a > .
< / footer >
< / div >
< / div >
< / section >
< / div >
< script type = "text/javascript" >
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
2018-07-20 23:27:17 +00:00
VERSION:'28.14.2',
2018-05-16 20:15:10 +00:00
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
< / script >
< script type = "text/javascript" src = "../../../_static/jquery.js" > < / script >
< script type = "text/javascript" src = "../../../_static/underscore.js" > < / script >
< script type = "text/javascript" src = "../../../_static/doctools.js" > < / script >
< script type = "text/javascript" src = "../../../_static/js/theme.js" > < / script >
< script type = "text/javascript" >
jQuery(function () {
2018-06-04 23:50:39 +00:00
SphinxRtdTheme.Navigation.enable(true);
2018-05-16 20:15:10 +00:00
});
< / script >
< / body >
< / html >