Commit Graph

1431 Commits

Author SHA1 Message Date
Brian C. Lane
c74582a647 Change compress to use communicate instead of wait
Also move default_image_name into imgutils so it can be used in other
places.

When running from lorax-composer the wait() call wasn't waiting until
the tar was finished. I think this is due to gevent monkey-patching
something. Using communicate() solves this problem.
2018-01-23 13:34:28 -08:00
Brian C. Lane
8ff851c6f5 Automatic commit of package [lorax] release [19.7.6-1].
Created by command:

/usr/bin/tito tag
2018-01-15 14:19:29 -08:00
Brian C. Lane
6a5ff22e61 Add documentation for the API routes.
Use Sphinx on a CentOS7/RHEL7 system to generate the docs with 'make docs'
2018-01-15 14:14:35 -08:00
Brian C. Lane
33c5d0ce4a Switch the API to use a Unix Domain Socket
This drops support for the TCP port and switches to using a socket at
/var/run/weldr/api.socket

Also add the start of some docs for lorax-composer.

--host and --port argument have been removed.

--group sets the group name to use for access to the socket and its
parent directory. Defaults to 'weldr'

--socket sets the full path to the socket to create. Defaults to
'/var/run/weldr/api.socket'
2018-01-02 14:01:56 -08:00
Brian C. Lane
3c18a63f76 Add support for other branches to the routes
Passing ?branch=<branch-name> will use the specified branch instead of
master.

The new branch will not exist until a /recipes/new?branch=new-branch
POST is made. At that time the branch will be created based on the
current master branch and the new commit will be added to it.
2018-01-02 13:49:09 -08:00
Alexander Todorov
89251d0906 Silence pocketlint bad-preconf-access warnings 2017-12-21 22:20:46 +02:00
Alexander Todorov
70f6bc3bcf Properly report coverage
- use same version of coverage.py as is inside the container b/c
  data format has changed between versions
- use `coverage combine' with a .coveragerc mapping to adjust for
  differences in file paths between the container and Travis
2017-12-19 22:48:14 +02:00
Alexander Todorov
e9aa137218 Enable testing in Travis CI using Docker container 2017-12-18 10:49:58 +02:00
Martin Pitt
c58b367b6a Fix depsolving empty recipes
- Fix `projects_depsolve()` to not consider a successful empty response
   (rc == 0) as an error.
 - Fix recipe_from_dict() to default modules and packages to empty lists
   instead of `None`, to avoid a Python-ism in the API for consumers and
   stay compatible to the bdcs API.

Fixes #290
2017-12-12 09:23:06 -08:00
Martin Pitt
32c00c75b3 Fix wrong function name in api/v0/recipes/freeze error messages 2017-12-12 09:23:06 -08:00
Martin Pitt
a6b96c2419 Fix project tests for non-Central time zones
When running tests somewhere else than Central Time, `test_api_time()`
fails like

    AssertionError: '1985-10-27T02:00:00' != '1985-10-26T21:00:00'

`test_yaps_to_project_info()` fails in a similar way.

Pin the time zone to UTC for this test and adjust timestamps to UTC.
2017-12-12 09:23:06 -08:00
Brian C. Lane
b21511c1cb Automatic commit of package [lorax] release [19.7.5-1].
Created by command:

/usr/bin/tito tag
2017-11-28 16:38:50 -08:00
Brian C. Lane
5cec7e02c4 Redirect yum's logging to yum.log 2017-11-28 16:35:49 -08:00
Brian C. Lane
527c5d43a5 Close the rpmdb after every API operation.
rpm blocks all of the signals until closeRpmDB() is called.
We need to call it after all of the API calls.
2017-11-28 16:35:49 -08:00
Brian C. Lane
d5a45c420d Fix error string when there is a problem listing projects 2017-11-28 16:34:02 -08:00
Brian C. Lane
93f4170ac5 Add --releasever option to lorax-composer
If it isn't set the releasever value will use yum and the system / to
find the releasever.
2017-11-27 11:15:46 -08:00
Brian C. Lane
d1e61fd490 Automatic commit of package [lorax] release [19.7.4-1].
Created by command:

/usr/bin/tito tag
2017-11-22 16:43:28 -08:00
Brian C. Lane
33f7124ca7 Fix wrong name for /etc/composer.conf 2017-11-22 16:40:47 -08:00
Brian C. Lane
eaa282d223 Automatic commit of package [lorax] release [19.7.3-1].
Created by command:

/usr/bin/tito tag
2017-11-22 16:17:21 -08:00
Brian C. Lane
a914253102 Add filtering and glob support to /modules/list route 2017-11-22 15:31:21 -08:00
Brian C. Lane
53d6be4703 Add /recipes/freeze route and tests. 2017-11-22 14:46:43 -08:00
Brian C. Lane
4f15fa895b Add /recipes/depsolve route and test 2017-11-22 13:50:02 -08:00
Brian C. Lane
2b43152407 Add /projects and /modules API tests 2017-11-22 10:29:33 -08:00
Brian C. Lane
fd337adafb Modify pylorax.api.config.configure so it can also be used for tests. 2017-11-22 09:45:27 -08:00
Brian C. Lane
c57043af9e Add tests for projects module functions 2017-11-21 16:52:02 -08:00
Brian C. Lane
d5e9a30406 Move ComposerConfig into pylorax.api.config module 2017-11-21 16:06:44 -08:00
Brian C. Lane
ed31e81c45 Catch ProjectsError and return an error 400 with a message. 2017-11-21 13:38:56 -08:00
Brian C. Lane
3cba128082 Catch Yum errors in the projects functions 2017-11-21 12:18:15 -08:00
Brian C. Lane
daf18d0467 Add /modules/list and /modules/info routes 2017-11-21 11:10:26 -08:00
Brian C. Lane
1424a5b769 Add modules functions and update function documentation 2017-11-21 11:09:18 -08:00
Brian C. Lane
4c459c4bf4 Add /projects/depsolve route 2017-11-20 16:50:07 -08:00
Brian C. Lane
a0d6551a3b Add /projects/info route
Elements that have no match in yum (metadata) are set to empty dicts.
2017-11-20 15:32:42 -08:00
Brian C. Lane
2013d73c53 Add /projects/list route 2017-11-20 13:46:43 -08:00
Brian C. Lane
b8f27e7610 Add /api/v0/test route
Returns a simple string to indicate that the API server is running.

/api/v0/status should be used instead, it provides more detailed info in
JSON format.
2017-11-20 10:15:44 -08:00
Brian C. Lane
82da7d2510 Add support for yum to lorax-composer
This includes a new configuration file at /etc/lorax/composer.conf with
built-in defaults. It also adds a YUMLOCK server config object so that
request handlers can access the yum base object without interfering
with each other.
2017-11-20 10:15:44 -08:00
Brian C. Lane
60131a2fd4 Add lorax requires to lorax-composer package. 2017-11-17 09:59:01 -08:00
Brian C. Lane
7720a1794d Add /api/docs to serve up the documentation
This requires that the docs be at /usr/share/doc/lorax-*/html/ or if
running from the source tree, at ./docs/html/

They can be re-created by running 'make docs'
2017-11-16 18:08:51 -08:00
Brian C. Lane
1d583fae7b Add basic documentation generation with Sphinx
Docs are included with the rpm, so the .spec needs a number of packages
as BuildRequires in order for Sphinx to run.
2017-11-16 17:20:33 -08:00
Brian C. Lane
42453e4fe8 Automatic commit of package [lorax] release [19.7.2-1].
Created by command:

/usr/bin/tito tag
2017-11-16 13:32:45 -08:00
Brian C. Lane
c6849ee0d9 Add limit/offset to recipes/list 2017-11-15 16:46:13 -08:00
Brian C. Lane
ee9f7f5201 Add error message for offset/limit type errors 2017-11-15 16:46:13 -08:00
Brian C. Lane
52234a34d5 Add error logging to api/v0.py
These will end up in the /var/log/lorax-composer/composer.log
2017-11-15 16:46:13 -08:00
Brian C. Lane
8027b6382b Fix server request logging.
And switch the other logs to append instead of overwrite on each run.
2017-11-15 16:46:13 -08:00
Brian C. Lane
aede0fadce Update lorax.spec for lorax-composer
Create a lorax-composer subpackage, with the pylorax/api code, systemd
service and runtime requirements in it.
2017-11-15 16:30:50 -08:00
Brian C. Lane
0f68345d2e setup.py: Add pylorax.api module to install, and systemd service
lorax-composer.service will be installed by default, but not enabled.
It stores recipes at /var/lib/lorax-composer/recipes/
2017-11-15 09:58:08 -08:00
Brian C. Lane
b27fc6deb8 lorax-composer: Drop unneeded parameters and create missing directories
The log directory (and parents) will be created if they are missing.
An empty recipe directory will be created if it doesn't exist.
2017-11-15 09:56:52 -08:00
Brian C. Lane
8d8dc3cb1f Add /recipes/diff route and tests 2017-11-14 17:01:35 -08:00
Brian C. Lane
a56ca875ae Add recipe_diff function and helpers.
This takes a pair of Recipe objects and returns a list of diff dicts
that include what was changed between the two recipes.
2017-11-14 16:16:48 -08:00
Brian C. Lane
f8b64ce34d Add POST /recipes/tag/ route and tests 2017-11-13 16:48:56 -08:00
Brian C. Lane
baf8d7c467 Add tag_recipe_commit helper function
And change tests to use it so that both it and tag_file_commit are used.
2017-11-13 16:48:56 -08:00