Skip to content

Commit

Permalink
Remove tmpfiles after running the command
Browse files Browse the repository at this point in the history
Remove the tmpfiles once the runner has executed
the command.
  • Loading branch information
mmartinv committed Nov 14, 2023
1 parent 598af46 commit 5acd723
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions osbuild/util/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def tmpfiles():
subprocess.run(["systemd-tmpfiles", "--create"], check=False)


def remove_tmpfiles():
subprocess.run(["systemd-tmpfiles", "--clean", "--remove"], check=False)


def nsswitch():
# the default behavior is fine, but using nss-resolve does not
# necessarily work in a non-booted container, so make sure that
Expand Down
2 changes: 2 additions & 0 deletions runners/org.osbuild.centos9
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ if __name__ == "__main__":
runners.nsswitch()

r = subprocess.run(sys.argv[1:], check=False)

runners.remove_tmpfiles()
if created_machine_id:
runners.remove_machine_id()

Expand Down
2 changes: 2 additions & 0 deletions runners/org.osbuild.fedora30
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ if __name__ == "__main__":
runners.nsswitch()

r = subprocess.run(sys.argv[1:], check=False)

runners.remove_tmpfiles()
if created_machine_id:
runners.remove_machine_id()

Expand Down
3 changes: 3 additions & 0 deletions runners/org.osbuild.fedora38
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ if __name__ == "__main__":
runners.sequoia()

r = subprocess.run(sys.argv[1:], check=False)

runners.remove_tmpfiles()
if created_machine_id:
runners.remove_machine_id()

sys.exit(r.returncode)
3 changes: 3 additions & 0 deletions runners/org.osbuild.rhel81
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ if __name__ == "__main__":
runners.python_alternatives()

r = subprocess.run(sys.argv[1:], check=False)

runners.remove_tmpfiles()
if created_machine_id:
runners.remove_machine_id()

sys.exit(r.returncode)
1 change: 1 addition & 0 deletions runners/org.osbuild.rhel82
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ if __name__ == "__main__":

r = subprocess.run(sys.argv[1:], env=env, check=False)

runners.remove_tmpfiles()
if created_machine_id:
runners.remove_machine_id()

Expand Down

0 comments on commit 5acd723

Please sign in to comment.