Skip to content

Commit

Permalink
distro: add FreeBSD code path for eject
Browse files Browse the repository at this point in the history
OpenBSD, NetBSD, and Dragonfly all have an eject(1), so they should be
covered in the default code path.

FreeBSD however, does not have eject in base. It's an (unmaintained)
port. In base, we do however, have camcontrol(8) and cdcontrol(1), both
of which have an eject subcommand.

Let's use camcontrol(8) here.

Sponsored by: The FreeBSD Foundation
  • Loading branch information
igalic committed Feb 1, 2024
1 parent ae38732 commit 53d82a4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cloudinit/distros/freebsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,7 @@ def build_dhclient_cmd(
return [path, "-l", lease_file, "-p", pid_file] + (
["-c", config_file, interface] if config_file else [interface]
)

@staticmethod
def eject_media(device: str) -> None:
subp.subp(["camcontrol", "eject", device])

0 comments on commit 53d82a4

Please sign in to comment.