Commit Graph

1921 Commits

Author SHA1 Message Date
Chris Lumens
8a2a43be99 Return a JSON error instead of a 404 on certain malformed URLs.
This handles the case where a route is requested, but without a required
parameter.  So, /blueprints/info is requested instead of
/blueprints/info/http-server.  It accomplishes this via a decorator, so
a lot of these route-related functions now have quite a few decorators
attached to them.

Typo'd URLs (/blueprints/nfo for instance) will still return a 404.  I
think this is a reasonable thing to do.

(cherry picked from commit 5daf2d416a)
2018-08-06 16:57:49 -07:00
Chris Lumens
76f714eab5 Return an error if /modules/info doesn't return anything.
Unfortunately, this isn't very useful if /modules/info is provided with
multiple modules.  yum doesn't traceback when doPackageLists is given
something that doesn't exist.  It just returns an empty list.  If
/modules/info is given just one module and yum gives us an empty list,
it's easy to say what happened.  If /modules/info is given several
modules and just one does not exist, we will not be able to detect that.

Fixing this would require doing more yum operations, which is likely to
slow things down and isn't the direction I want to be going.

(cherry picked from commit 8e948e4a4d)
2018-08-06 16:57:40 -07:00
Chris Lumens
ea7b22a8f5 Update documentation (#409).
(cherry picked from commit 6193a7c9d8)
2018-08-06 16:57:34 -07:00
Chris Lumens
022734ab01 Use constants instead of strings (#409).
(cherry picked from commit fdf4d63f3b)
2018-08-06 16:57:26 -07:00
Chris Lumens
495dcd13ec Write timestamps when important events happen during the compose (#409).
Right now, this is when the compose is queued up, when it is started by
anaconda, and when it is finished (whether that's success or not).

(cherry picked from commit 3ba9d53b8b)
2018-08-06 16:57:19 -07:00
Chris Lumens
e42b797295 Return multiple timestamps in API results (#409).
If one of the timestamps isn't present (for instance, the finished
timestamp for a job that is still running), null is returned.

(cherry picked from commit 17c40ef271)
2018-08-06 16:57:13 -07:00
Chris Lumens
ab76c6170e Add a new timestamp.py file to the API directory (#409).
This is responsible for writing out a new times.toml file, containing
important timestamps in the life of a compose.  This seems a little more
reliable than attempting to infer things from the filesystem, especially
in light of the fact that we can't ever really know when a file was
created.

(cherry picked from commit b59d59b124)
2018-08-06 16:57:07 -07:00
Brian C. Lane
ae19bc7343 Use the first enabled system repo for the test
(cherry picked from commit 3fd5e50c80)
2018-08-06 16:56:49 -07:00
Brian C. Lane
aec0e09caa Show more details when the system repo delete test fails
Works fine for me locally, but not in Travis for some reason so let's
get more info.

(cherry picked from commit 26df083bd4)
2018-08-06 16:56:03 -07:00
Brian C. Lane
18b03936c2 Add composer-cli function tests
These depend on there being a freshly installed lorax-composer API
server running, if there is no /run/weldr/api.socket they will be
skipped.

(cherry picked from commit 7700ae3135)
2018-08-06 16:53:56 -07:00
Brian C. Lane
2ce3752f90 Add a test library
This adds empty __init__.py to tests so that a lib.py library of helper
functions can be imported from the tests.

Add captured_output to use with composer-cli tests to capture stdout/err
output from the functions.

(cherry picked from commit eeae331ba0)
2018-08-06 16:53:48 -07:00
Brian C. Lane
0c19c3304e composer-cli: Add support for Group to blueprints diff
(cherry picked from commit 2edd7a995b)
2018-08-06 16:53:39 -07:00
Brian C. Lane
08fb780bb9 Update status.py to use new handle_api_result
Use the new function to properly handle error responses for all the
commands.

(cherry picked from commit 642f117d54)
2018-08-06 16:53:07 -07:00
Brian C. Lane
db587afb16 Update sources.py to use new handle_api_result
Use the new function to properly handle error responses for all the
commands.

(cherry picked from commit 3205e47a13)
2018-08-06 16:53:02 -07:00
Brian C. Lane
f0dd50fbae Update projects.py to use new handle_api_result
Use the new function to properly handle error responses for all the
commands.

(cherry picked from commit 77767cd93a)
2018-08-06 16:52:56 -07:00
Brian C. Lane
42ad6ad0cc Update modules.py to use new handle_api_result
Use the new function to properly handle error responses for all the
commands.

(cherry picked from commit b55b86d0b3)
2018-08-06 16:52:51 -07:00
Brian C. Lane
4e3044de20 Update compose.py to use new handle_api_result
Use the new function to properly handle error responses for all the
commands.

(cherry picked from commit 760aeb61a7)
2018-08-06 16:52:43 -07:00
Brian C. Lane
b40c3b2ce3 Update blueprints.py to use new handle_api_result
Use the new function to properly handle error responses for all the
commands.

(cherry picked from commit c1c5536ec8)
2018-08-06 16:52:37 -07:00
Brian C. Lane
08c2965fab Modify handle_api_result so it can be used in more places
Some results have errors and no status, others have status and errors.
Update the function to return the final rc to exit with, and a bool
indicating whether or not to continue processing the other fields.

Add a bunch of tests for the new function to make sure I have the logic
correct.

(cherry picked from commit 35fa067219)
2018-08-06 16:52:28 -07:00
Chris Lumens
2d5f434b12 Fix help output on the compose subcommand.
(cherry picked from commit a3572c9fdd)
2018-07-26 10:43:01 -04:00
Chris Lumens
2251c540c8 Add timestamps to "compose-cli compose status" output.
(cherry picked from commit 7bcb61849d)
2018-07-26 10:42:57 -04:00
Chris Lumens
01582e227d And then add real output to the status command.
(cherry picked from commit eb0939d967)
2018-07-26 10:42:08 -04:00
Chris Lumens
80e2e8e6db Add the beginnings of a new status subcommand.
(cherry picked from commit 9eafc60fa0)
2018-07-26 10:42:04 -04:00
Chris Lumens
bf95a3310b Document that you shouldn't run lorax-composer twice.
(cherry picked from commit 052828047c)
2018-07-26 10:41:56 -04:00
Chris Lumens
86d836897b Add PIDFile to the .service file.
This will cause systemd to delete the lock file when the service
terminates.  This does not do anything if lorax-composer is started on
the command line, however.

(cherry picked from commit e37eae55b8)
2018-07-26 10:41:43 -04:00
Brian C. Lane
18521cec1a composer-cli: Fix non-zero epoch in projets info
The json value is an int, so convert it to a str.
2018-07-25 11:35:03 -07:00
Brian C. Lane
066276ed65 Automatic commit of package [lorax] release [29.10-1].
Created by command:

/usr/bin/tito tag
2018-07-20 15:51:50 -07:00
Brian C. Lane
8b271aa917 New lorax documentation - 29.10 2018-07-20 15:51:06 -07:00
Brian C. Lane
0ff9a674ca Add dnf.transaction to list of modules for sphinx to ignore 2018-07-20 15:48:18 -07:00
Brian C. Lane
b1dd22afa6 Log and exit on metadata update errors at startup
A bad system repo can cause lorax-composer to fail to start. Instead of
a traceback log the error and exit.

(note that the exit still results in an OSError traceback due to part of
it running as root, this needs to be addressed in another commit).
2018-07-18 16:09:03 -07:00
Brian C. Lane
83680d92b0 Check /projects responses for null values.
Some values can be null/None so check for that instead of crashing.

(cherry picked from commit f916e41d00)
2018-07-18 16:01:18 -07:00
Brian C. Lane
816f1658db Clarify error message from /source/new
(cherry picked from commit b20aa4609c)
2018-07-18 16:01:06 -07:00
Brian C. Lane
231a8ed4b2 Update samba and rsync versions for tests 2018-07-18 15:58:48 -07:00
Chris Lumens
fbda20b8b7 Support loading groups from the kickstart template files.
(cherry picked from commit c8d2045f89)
2018-07-18 15:38:40 -07:00
Chris Lumens
e151c8399d Add group-based tests.
(cherry picked from commit ab0655d5a9)
2018-07-18 15:38:40 -07:00
Chris Lumens
8c4804eb15 Include groups in depsolving.
This adds a new argument to projects_depsolve and
projects_depsolve_with_size that contains the group list, unfortunately.
I would have prefered adding a function that just returns a list of all
the contents of a group and then add that to what was being passed into
projects_depsolve.  However, there does not appear to be any good way to
do that in yum aside from a lot of grubbing around in the comps object,
which I am unwilling to do.

(cherry picked from commit 5fe4b47072)
2018-07-18 14:36:28 -07:00
Chris Lumens
76d376fe18 Add support for groups to blueprints.
Nothing is currently being done with this information, but it will be
soon.

(cherry picked from commit 0f69d2084c)
2018-07-18 13:48:25 -07:00
Chris Lumens
bb8fdcb854 Add help output to each subcommand.
This is the same as the output at the top level, just trimmed down to
only the options for a single subcommand.  It's trigged by providing
"help" or "--help" as a subcommand option.

(cherry picked from commit 954f330ace)
2018-07-18 11:58:56 -07:00
Chris Lumens
eba5658a71 Split the help output into its own module.
This means I can reuse it for help output for individual subcommands.

(cherry picked from commit 70e4211ad1)
2018-07-18 11:57:45 -07:00
Chris Lumens
3c6478e179 If the help subcommand is given, print the help output.
This isn't a real subcommand like the others.  The option processing
just intercepts it and prints the output.  Given that we're subcommand
based, it makes sense to support this in addition to --help.

(cherry picked from commit 3743d6d208)
2018-07-18 11:49:16 -07:00
Brian C. Lane
460a277d4e Check the compose templates at startup
Depsolve the packages included in the templates and report any errors
using the /api/status 'msgs' field. This should help narrow down
problems with package sources not being setup correctly.
2018-07-13 10:18:07 -07:00
Brian C. Lane
9e41052992 Fix a couple typos in lorax-composer docs.
The description of blueprint versions was wrong, now it is
correct.
2018-06-29 14:15:54 -07:00
Brian C. Lane
0eb823ee94 Automatic commit of package [lorax] release [29.9-1].
Created by command:

/usr/bin/tito tag
2018-06-27 16:15:34 -07:00
Adam Williamson
4a3f9e12aa DNF 3: progress callback constants moved to dnf.transaction
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-06-27 16:12:25 -07:00
Brian C. Lane
f38f5cc168 Include example blueprints in the rpm
This also sets ownership of /var/lib/lorax/composer/ to root:weldr to
allow missing directories to be created at runtime.
2018-06-27 15:58:27 -07:00
Brian C. Lane
7adc5162fb Make sure /run/weldr has correct ownership and permissions
Normally tmpfiles.d will handle this at boot time, but if you install
lorax-composer without rebooting it was ending up with root:root
ownership instead of root:weldr
2018-06-27 15:54:31 -07:00
Brian C. Lane
779153a1cf Automatic commit of package [lorax] release [29.8-1].
Created by command:

/usr/bin/tito tag
2018-06-22 09:22:13 -07:00
Sophia Fondell
378099cc10 Fixing bug where test did not try to import pylorax.version to check for version but automatically just checked for 'devel' causing test to fail when it should not have 2018-06-22 09:14:04 -07:00
Brian C. Lane
56926baaec Add the ability to enable DNF plugins for lorax
Pass --dnfplugin='*' to enable all of them.
Pass --dnfplugin='plugin-name' to enable one fo them. You can use it
multiple times to enable multiple plugins. Globs work as well.
2018-06-22 09:07:01 -07:00
Brian C. Lane
86c4ef5f45 Allow more than 1 bash build in tests
It is perfectly valid to have more than one build of a package, eg. one
in the release repo and one in the updates repo.
2018-06-21 16:09:47 -07:00