app/tree: Check upfront if repo is writable

Didn't hit this but this will be useful for a following commit which
delays committing to the final repo until the end.

Closes: #1658
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2018-11-02 13:26:28 -04:00 committed by Atomic Bot
parent 82ceef78ce
commit a2d67f658a

View File

@ -484,6 +484,10 @@ rpm_ostree_compose_context_new (const char *treefile_pathstr,
if (!self->repo)
return FALSE;
/* sanity check upfront we can even write to this repo; e.g. might be a mount */
if (!ostree_repo_is_writable (self->repo, error))
return glnx_prefix_error (error, "Cannot write to repository");
if (opt_workdir_tmpfs)
g_printerr ("note: --workdir-tmpfs is deprecated and will be ignored\n");