Change ownership of the output directory immediately

Otherwise if there is an error creating result.json or if the Run
command failed it will remain owned by root.root and cannot be deleted
via the API.

Closes #204
This commit is contained in:
Brian C. Lane 2020-01-23 09:37:11 -08:00 committed by Ondřej Budai
parent 679c8c40cd
commit c054015440

View file

@ -119,6 +119,13 @@ func (job *Job) Run() (*store.Image, error, []error) {
continue
}
// Make sure the directory ownership is correct, even if there are errors later
err = runCommand("chown", "_osbuild-composer:_osbuild-composer", options.Location)
if err != nil {
r = append(r, err)
continue
}
jobFile, err := os.Create(options.Location + "/result.json")
if err != nil {
r = append(r, err)