cloudapi: Add ability to skip uploading and save image locally
During development it can be very useful to store the results locally
instead of uploading to a remote system. This implements a development
only option to help with that.
To use it you need to add OSBUILD_LOCALSAVE to the server's environment.
This can be done by editing /usr/lib/systemd/system/osbuild-composer.service
and adding:
Environment="OSBUILD_LOCALSAVE=1"
You can then use an 'upload_options' object to skip trying to upload to
the default service for the type of image, eg:
"image_requests": [
{
"architecture": "x86_64",
"image_type": "guest-image",
"upload_options": {
"local_save": true
},
...
}]
The results will be saved to /var/lib/osbuild-composer/artifacts/UUID/
using the default filename for the image type.
If local_save is used without OSBUILD_LOCALSAVE being set it will return
an error with id=36 saying 'local_save is not enabled'.
This commit is contained in:
parent
98c7a06545
commit
139bf4dec2
4 changed files with 195 additions and 128 deletions
|
|
@ -46,6 +46,7 @@ const (
|
|||
ErrorInvalidImageFromComposeId ServiceErrorCode = 33
|
||||
ErrorImageNotFound ServiceErrorCode = 34
|
||||
ErrorInvalidCustomization ServiceErrorCode = 35
|
||||
ErrorLocalSaveNotEnabled ServiceErrorCode = 36
|
||||
|
||||
// Internal errors, these are bugs
|
||||
ErrorFailedToInitializeBlueprint ServiceErrorCode = 1000
|
||||
|
|
@ -123,6 +124,7 @@ func getServiceErrors() serviceErrors {
|
|||
serviceError{ErrorInvalidImageFromComposeId, http.StatusBadRequest, "Invalid format for image id"},
|
||||
serviceError{ErrorImageNotFound, http.StatusBadRequest, "Image with given id not found"},
|
||||
serviceError{ErrorInvalidCustomization, http.StatusBadRequest, "Invalid image customization"},
|
||||
serviceError{ErrorLocalSaveNotEnabled, http.StatusBadRequest, "local_save is not enabled"},
|
||||
|
||||
serviceError{ErrorFailedToInitializeBlueprint, http.StatusInternalServerError, "Failed to initialize blueprint"},
|
||||
serviceError{ErrorFailedToGenerateManifestSeed, http.StatusInternalServerError, "Failed to generate manifest seed"},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue