Skip to content

Commit

Permalink
Merge pull request #210 from flyingcircusio/FC-42677-fix-multiple-dep…
Browse files Browse the repository at this point in the history
…loymenttrash

[FC-42677] file: add `file_name` attribute to `DeploymentTrash`
  • Loading branch information
frlan authored Dec 27, 2024
2 parents 588b2b7 + 149c873 commit 9875eec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Allow to configure the name of the `.nix` file created by `batou_ext.file.DeploymentTrash`.
6 changes: 5 additions & 1 deletion src/batou_ext/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class SymlinkAndCleanup(batou.component.Component):
systemd_read_max_iops = 100
systemd_write_max_iops = 100
trashdir = None
trash_config_file_name = batou.component.Attribute(str, default="trash.nix")

## DEPRECATED, do not use
use_systemd_run_async_cleanup = False
Expand All @@ -58,6 +59,7 @@ def configure(self):
read_iops_limit=self.systemd_read_max_iops,
write_iops_limit=self.systemd_write_max_iops,
trashdir=self.trashdir,
file_name=self.trash_config_file_name,
)
self.trash = self._

Expand Down Expand Up @@ -170,6 +172,8 @@ def update(self):
```
"""

file_name = batou.component.Attribute(str, default="trash.nix")

read_iops_limit = 100
write_iops_limit = 100

Expand All @@ -181,7 +185,7 @@ def configure(self):

self += batou.lib.file.File(self.trashdir, ensure="directory")
self += batou.lib.file.File(
"/etc/local/nixos/trash.nix",
f"/etc/local/nixos/{self.file_name}",
content=dedent(
"""\
{
Expand Down

0 comments on commit 9875eec

Please sign in to comment.