Alexander Todorov
0af072c77e
Silence pocketlint bad-preconf-access warnings
2018-06-11 16:54:58 -07:00
Martin Pitt
176b12dd8c
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
2018-06-11 16:54:58 -07:00
Martin Pitt
da3616db72
Fix wrong function name in api/v0/recipes/freeze error messages
2018-06-11 16:54:58 -07:00
Brian C. Lane
3e5c0707bb
Redirect yum's logging to yum.log
2018-06-11 16:54:58 -07:00
Brian C. Lane
a44e499eee
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.
2018-06-11 16:54:58 -07:00
Brian C. Lane
cf42e1a480
Fix error string when there is a problem listing projects
2018-06-11 16:54:58 -07:00
Brian C. Lane
efd15aaad7
Add --releasever option to lorax-composer
...
If it isn't set the releasever value will use yum and the system / to
find the releasever.
2018-06-11 16:54:58 -07:00
Brian C. Lane
bae551b7ab
Add filtering and glob support to /modules/list route
2018-06-11 16:54:58 -07:00
Brian C. Lane
6b4bf92e7f
Add /recipes/freeze route and tests.
2018-06-11 16:54:58 -07:00
Brian C. Lane
b8212358bc
Add /recipes/depsolve route and test
2018-06-11 16:54:58 -07:00
Brian C. Lane
a85d0ced8b
Add /projects and /modules API tests
2018-06-11 16:54:58 -07:00
Brian C. Lane
164232ba4d
Modify pylorax.api.config.configure so it can also be used for tests.
2018-06-11 16:54:58 -07:00
Brian C. Lane
ad5ab71551
Move ComposerConfig into pylorax.api.config module
2018-06-11 16:54:58 -07:00
Brian C. Lane
8fee86a5db
Catch ProjectsError and return an error 400 with a message.
2018-06-11 16:54:58 -07:00
Brian C. Lane
a1e7e4831d
Catch Yum errors in the projects functions
2018-06-11 16:54:58 -07:00
Brian C. Lane
23d90ec066
Add /modules/list and /modules/info routes
2018-06-11 16:54:58 -07:00
Brian C. Lane
8635a59ac7
Add modules functions and update function documentation
2018-06-11 16:54:58 -07:00
Brian C. Lane
c3d495fe53
Add /projects/depsolve route
2018-06-11 16:54:58 -07:00
Brian C. Lane
99140b98b9
Add /projects/info route
...
Elements that have no match in yum (metadata) are set to empty dicts.
2018-06-11 16:54:58 -07:00
Brian C. Lane
0819e97646
Add /projects/list route
2018-06-11 16:54:58 -07:00
Brian C. Lane
105679d79d
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.
2018-06-11 16:54:58 -07:00
Brian C. Lane
569ce1d3dc
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.
2018-06-11 16:54:58 -07:00
Brian C. Lane
5d6c236af6
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'
2018-06-11 16:54:58 -07:00
Brian C. Lane
1d53d00532
Add limit/offset to recipes/list
2018-06-11 16:54:58 -07:00
Brian C. Lane
2cd4fcfd88
Add error message for offset/limit type errors
2018-06-11 16:54:58 -07:00
Brian C. Lane
9ca9bfe46f
Add error logging to api/v0.py
...
These will end up in the /var/log/lorax-composer/composer.log
2018-06-11 16:54:58 -07:00
Brian C. Lane
d701120d90
Add /recipes/diff route and tests
2018-06-11 16:54:57 -07:00
Brian C. Lane
052a8ba991
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.
2018-06-11 16:54:57 -07:00
Brian C. Lane
a76e95dcb5
Add POST /recipes/tag/ route and tests
2018-06-11 16:54:57 -07:00
Brian C. Lane
7f1adf120c
Add tag_recipe_commit helper function
...
And change tests to use it so that both it and tag_file_commit are used.
2018-06-11 16:54:57 -07:00
Brian C. Lane
3f4140d5d3
Add POST /recipes/undo route and tests
2018-06-11 16:54:57 -07:00
Brian C. Lane
639d325a0c
Change read_recipe_commit to use the recipe name
...
Callers really shouldn't need to know the details of the filenames, so
change it to convert it internally.
2018-06-11 16:54:57 -07:00
Brian C. Lane
ab6decec0b
Add revert_recipe function
...
And adjust the tests to use it so that it covers both revert_recipe and
revert_file.
2018-06-11 16:54:57 -07:00
Brian C. Lane
c294b7747d
Add DELETE /recipes/delete/<recipe_name> route and tests
...
Also add numbering to the tests so that they are executed in the
expected order.
2018-06-11 16:54:57 -07:00
Brian C. Lane
c937e69d3b
Add delete_recipe helper function and test
...
Use delete_recipe in the test so that both it and delete_file are
covered.
2018-06-11 16:54:57 -07:00
Brian C. Lane
6e453e70dc
Add DELETE /recipes/workspace/<recipe_name> route and tests
...
This will delete the workspace copy of the recipe.
2018-06-11 16:54:57 -07:00
Brian C. Lane
72b4c4fe28
Add POST /recipes/workspace route
...
Also fix use of workspace in /recipes/info (was using filename instead
of recipe name and logic for changed was backwards).
2018-06-11 16:54:57 -07:00
Brian C. Lane
711cdf53b3
Add /recipes/new route and tests
...
This handles json data when the mime type is "application/json" and toml
recipes when it is "text/x-toml"
2018-06-11 16:54:57 -07:00
Brian C. Lane
7b5115d19c
Split recipe_from_toml into recipe_from_dict helper.
...
This will be useful for creating Recipe objects from json created dicts.
2018-06-11 16:54:57 -07:00
Brian C. Lane
3c75711b30
Fix the recipe version bumping
...
Recipe should have its version bumped based on the version from the
previous commit, and not be bumped on the first commit. Fix the code and
the tests.
2018-06-11 16:54:57 -07:00
Brian C. Lane
02db2afb2b
Add /recipes/changes route with tests.
2018-06-11 16:54:57 -07:00
Brian C. Lane
1e7335a506
Add /recipes/info route and tests
2018-06-11 16:54:57 -07:00
Brian C. Lane
b7f651a631
Add workspace module and tests
...
This handles the recipe workspace, which is a temporary location to
store recipes before committing them to git. It will be used by the
/recipes/ API.
2018-06-11 16:54:57 -07:00
Brian C. Lane
b6fb22133c
Add /recipes/list route and tests
...
Includes adding a lock for access to the git repo from the API.
2018-06-11 16:54:57 -07:00
Brian C. Lane
90a8798f4c
Move the git repo into a subdirectory
...
And fix the import of recipes (needs to have full path passed in).
2018-06-11 16:54:57 -07:00
Brian C. Lane
596f06d5c0
Fix list_commits sort order.
...
It appears that with libgit2 v0.24.6 reverse causes it to list them
newest first. In 0.25.1 it lists them oldest first. On both versions
just using SortMode.TIME gives the desired result of oldest first.
2018-06-11 16:54:57 -07:00
Brian C. Lane
bfc9c6913f
Add pylorax.api.recipes code for handling the Recipe's Git repository
2018-06-11 16:54:57 -07:00
Alexander Todorov
2cd4f73177
Don't do wildcard imports
2018-06-11 16:54:57 -07:00
Alexander Todorov
e9e6e5701e
Misc pylint fixes that are reported usually once
2018-06-11 16:54:57 -07:00
Alexander Todorov
bf9ed50d51
Fix dangerous-default value warnings
...
when default value is list or dict the default arguments are
instantiated as objects at the time of definition. This is significant
(exposing visible semantics) when the object is mutable. There’s no way
of re-binding that default argument name in the function’s closure. When
function is executed multiple times with its default value the value
will change between executions, possibly leading to strange side effects.
For more information see:
http://satran.in/2012/01/12/python-dangerous-default-value-as-argument.html
2018-06-11 16:54:57 -07:00