Commit Graph

2029 Commits

Author SHA1 Message Date
Chris Lumens
78ae380eb3 Don't sort error messages.
This should make it easier to return more complex error structures.  It
also doesn't appear to matter - tests still pass without changes.

(cherry picked from commit 4c3f93e329)
2018-08-09 16:48:57 -04:00
Chris Lumens
dbc4d08de4 Run as root/weldr by default.
We need to be root to read the certificates that give access to the
package repos.  Right now, the alternative seems to be changing
permissions on the certs themselves, which seems less good.  We're
running anaconda as root anyway.
2018-08-08 17:07:59 -07:00
Brian C. Lane
6612b3e0a8 Fix bash completion of compose info 2018-08-07 16:48:25 -07:00
Brian C. Lane
8b0c4a8465 Add + to the allowed API string character set 2018-08-07 16:48:25 -07:00
Brian C. Lane
f7c4c3f5d5 Add job_* timestamp support to compose status 2018-08-07 15:34:35 -07:00
Will Woods
10f2cde6bc Add etc/bash_completion.d/composer-cli
Here's a bash_completion file for composer-cli! It completes known
commands, subcommands, and flags, plus arguments to flags that take
arguments, and if you've got write access to the socket it'll also
autocomplete:

* source names for commands that need source names
* blueprint names for commands that take blueprint names
* compose uuids for commands that take compose uuids
  * intelligently only suggests appropriate uuids - e.g. only
    suggests uuids of running composes for "compose cancel"

NOTE: bash completion scripts are horrible and this is no exception.
Please forgive me.
2018-08-07 12:12:17 -07:00
Will Woods
e673fd5927 composer-cli: clean up "list" commands
This patch does two things:

1) Add "compose list", which lists compose UUIDs and other basic info,
2) Fix up "blueprints list", "modules list", "sources list", and
   "compose types" so their output is just a plain list of identifiers
2018-08-07 12:12:17 -07:00
Brian C. Lane
d72603229e Drop .decode from UTF8_TEST_STRING 2018-08-07 12:12:17 -07:00
Brian C. Lane
991091c287 Add input string checks to the branch and format arguments
Make sure no UTF8 characters are allowed and return an error if they
are.

Also includes tests to make sure the correct error is returned.

(cherry picked from commit 86d79cd8a6)
2018-08-07 12:12:17 -07:00
Brian C. Lane
8786c9764c Add a test for invalid characters in the API route
Currently the code is not UTF8 safe, so we need to return a clear error
when invalid characters are passed in.

This also adds tests for the routes to confirm that an error is
correctly returned.

(cherry picked from commit 74f5def3d4)
2018-08-07 12:12:17 -07:00
Brian C. Lane
03e339cbe5 Fix logging argument 2018-08-07 12:12:17 -07:00
Brian C. Lane
a2a0477424 Update get_system_repo for dnf
With dnf we iterate the repos and return their names, not the filenames
like we do with yum. Also make the list test more flexible.
2018-08-07 12:12:17 -07:00
Brian C. Lane
1d6d145854 Update ConfigParser usage for Py3
SafeConfigParser is now just ConfigParser
2018-08-07 12:12:17 -07:00
Brian C. Lane
28b6b8d296 Update StringIO use for Py3
It is imported from io now.
2018-08-07 12:12:17 -07:00
Brian C. Lane
7fbf71dbf2 Add a test for the pylorax.api.timestamp functions 2018-08-07 12:12:17 -07:00
Brian C. Lane
2b0efff9e4 Fix write_timestamp for py3
toml.dumps() returns a string for write() so .encode is not needed.
2018-08-07 12:12:17 -07:00
Chris Lumens
95462600fa 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-07 12:12:17 -07:00
Chris Lumens
191897d40e 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-07 12:12:17 -07:00
Chris Lumens
3e3598cd95 Update documentation (#409).
(cherry picked from commit 6193a7c9d8)
2018-08-07 12:12:17 -07:00
Chris Lumens
e4d06b587d Use constants instead of strings (#409).
(cherry picked from commit fdf4d63f3b)
2018-08-07 12:12:17 -07:00
Chris Lumens
83196b5f6f 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-07 12:12:17 -07:00
Chris Lumens
40ff8faad8 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-07 12:12:17 -07:00
Chris Lumens
099cdfcd03 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-07 12:12:17 -07:00
Brian C. Lane
824c84ae2f Use the first enabled system repo for the test
(cherry picked from commit 3fd5e50c80)
2018-08-07 12:12:17 -07:00
Brian C. Lane
2a04eb88ad 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-07 12:12:17 -07:00
Brian C. Lane
2283adcba7 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-07 12:12:17 -07:00
Brian C. Lane
e6845cc782 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-07 12:12:17 -07:00
Brian C. Lane
f791d5aff6 composer-cli: Add support for Group to blueprints diff
(cherry picked from commit 2edd7a995b)
2018-08-07 12:12:17 -07:00
Brian C. Lane
5af7ad6600 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-07 12:12:17 -07:00
Brian C. Lane
926d88a3bd 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-07 12:12:17 -07:00
Brian C. Lane
7e999cc9c6 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-07 12:12:17 -07:00
Brian C. Lane
ecefa18110 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-07 12:12:17 -07:00
Brian C. Lane
92f5860182 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-07 12:12:17 -07:00
Brian C. Lane
e21c53f507 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-07 12:12:17 -07:00
Brian C. Lane
85b2807a15 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-07 12:12:17 -07:00
Brian C. Lane
ac6f6f6a80 Automatic commit of package [lorax] release [28.14.3-1].
Created by command:

/usr/bin/tito tag
2018-07-30 08:32:33 -07:00
Brian C. Lane
619026ff3d Update to use only qemu-kvm
We only have qemu-kvm available, so use that. This also means that there
will not me any support for using qemu with arches that are different
from the host.
2018-07-27 15:10:22 -07:00
Chris Lumens
c3987cc4cb Fix help output on the compose subcommand.
(cherry picked from commit a3572c9fdd)
2018-07-26 14:53:57 -04:00
Chris Lumens
db98df8373 Add timestamps to "compose-cli compose status" output.
(cherry picked from commit 7bcb61849d)
2018-07-26 14:53:53 -04:00
Chris Lumens
5ff96bc627 And then add real output to the status command.
(cherry picked from commit eb0939d967)
2018-07-26 14:53:50 -04:00
Chris Lumens
c6efcd1fc2 Add the beginnings of a new status subcommand.
(cherry picked from commit 9eafc60fa0)
2018-07-26 14:53:47 -04:00
Brian C. Lane
4b8211a471 composer-cli: Fix non-zero epoch in projets info
The json value is an int, so convert it to a str.

(cherry picked from commit 18521cec1a)
2018-07-25 11:39:55 -07:00
Brian C. Lane
2f76700926 Adjust test_server and test blueprints so they depsolve 2018-07-24 14:53:04 -07:00
Brian C. Lane
fab8c0786d Automatic commit of package [lorax] release [28.14.2-1].
Created by command:

/usr/bin/tito tag
2018-07-20 16:27:40 -07:00
Brian C. Lane
22094b26b7 New lorax documentation - 28.14.2 2018-07-20 16:27:17 -07:00
Brian C. Lane
63cc38bfdd Add dnf.transaction to list of modules for sphinx to ignore
(cherry picked from commit 0ff9a674ca)
2018-07-20 16:26:36 -07:00
Chris Lumens
e00bb491a6 Document that you shouldn't run lorax-composer twice.
(cherry picked from commit 052828047c)
2018-07-20 16:14:23 -07:00
Chris Lumens
10e51ce2bd 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-20 16:14:23 -07:00
Radek Vykydal
9196f4b92a Don't activate default auto connections after switchroot
Resolves: rhbz#1555934

Add NetworkManager config file turning default auto connections off.
2018-07-20 09:15:44 -07:00
Brian C. Lane
1e4ac3eb5e Use system-logos in live-iso.ks 2018-07-19 12:00:05 -07:00