flyingcircusio / batou

batou is a universal, fractal deployment utility using Python.
https://batou.readthedocs.org
Other
47 stars 12 forks source link

Unmanagement ideas #364

Open ctheune opened 1 year ago

ctheune commented 1 year ago

We talked about the potential to improve the "unmanagement" story by allowing components to storing "uninstall receipts" and execute any uninstall receipts that are not "claimed" by a component during a run.

I think we don't have an issue for this yet, so here it is!

Also, I just stumbled over this issue that might be benefit from unmanagement: https://yt.flyingcircus.io/issue/FC-30068/symlink-and-cleanup-no-working-as-expected

ctheune commented 1 year ago

There's also another instance where unmanagement would have reduced the complexity of a change massively: https://gitlab.flyingcircus.io/flyingcircus/fc.directory.deployment/-/merge_requests/65

PhilTaken commented 1 year ago

A similar approach for files might be temporary states, where intermediate files are stored in a temp directory. Archives for example, where you only require the contents of the archive, not the archive itself, could be downloaded to a temporary location, unpacked there and subsequently deleted without requiring the user to manage the download location or the deletion of the archive manually.

In python pseudo-code this might look like

with S3Download(...) as archive:
    extract(archive, inplace=True)
    copy(f"{archive}/README.txt", f"{workdir}/README.txt")

# the archive is being deleted right after the copy or exists only in `/tmp`

I am not sure how well that would fit the batou configure-verify-update model though, maybe a wrapper component like

self += TempDir(S3Download(...))
self.temp_archive = self._
...

could work better?