sysroot: Reject attempts to pin the staged deployment

From https://github.com/projectatomic/rpm-ostree/pull/1434#discussion_r198936674

To support it we'd have to actually write it to disk, which...let's
not try that right now.

Closes: #1660
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2018-06-29 01:52:30 +00:00
1 parent bab3b2bd4c
commit 7ead3c1aa8
2 files changed
+9 -1

No files matched your search

+5 -1
View File
@@ -1894,7 +1894,8 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self,
* for e.g. older versions of libostree unaware of pinning to GC the deployment.
*
* This function does nothing and returns successfully if the deployment
* is already in the desired pinning state.
* is already in the desired pinning state. It is an error to try to pin
* the staged deployment (as it's not in the bootloader entries).
*
* Since: 2018.3
*/
@@ -1908,6 +1909,9 @@ ostree_sysroot_deployment_set_pinned (OstreeSysroot *self,
if (is_pinned == current_pin)
return TRUE;
if (ostree_deployment_is_staged (deployment))
return glnx_throw (error, "Cannot pin staged deployment");
g_autoptr(OstreeDeployment) deployment_clone = ostree_deployment_clone (deployment);
GKeyFile *origin_clone = ostree_deployment_get_origin (deployment_clone);