Skip to content

Commit

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

FreeBSD and Dragonfly however, do not have eject in base. Here, eject is
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 13, 2024
1 parent 7d605ea commit a344fc8
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 a344fc8

Please sign in to comment.