diff options
| -rw-r--r-- | cloudinit/distros/bsd.py | 9 | ||||
| -rw-r--r-- | cloudinit/distros/freebsd.py | 1 | 
2 files changed, 8 insertions, 2 deletions
| diff --git a/cloudinit/distros/bsd.py b/cloudinit/distros/bsd.py index e9b84edc..c58f897c 100644 --- a/cloudinit/distros/bsd.py +++ b/cloudinit/distros/bsd.py @@ -18,6 +18,9 @@ class BSD(distros.Distro):      group_add_cmd_prefix = []      pkg_cmd_install_prefix = []      pkg_cmd_remove_prefix = [] +    # There is no need to update the package cache on NetBSD and OpenBSD +    # TODO neither freebsd nor netbsd handles a command 'upgrade' +    pkg_cmd_update_prefix = None      def __init__(self, name, cfg, paths):          super().__init__(name, cfg, paths) @@ -86,12 +89,14 @@ class BSD(distros.Distro):          if pkgs is None:              pkgs = [] -        # TODO neither freebsd nor netbsd handles a command 'upgrade' -        # provided by cloudinit/config/cc_package_update_upgrade_install.py          if command == 'install':              cmd = self.pkg_cmd_install_prefix          elif command == 'remove':              cmd = self.pkg_cmd_remove_prefix +        elif command == 'update': +            if not self.pkg_cmd_update_prefix: +                return +            cmd = self.pkg_cmd_update_prefix          if args and isinstance(args, str):              cmd.append(args) diff --git a/cloudinit/distros/freebsd.py b/cloudinit/distros/freebsd.py index a775ae51..71a6195b 100644 --- a/cloudinit/distros/freebsd.py +++ b/cloudinit/distros/freebsd.py @@ -24,6 +24,7 @@ class Distro(cloudinit.distros.bsd.BSD):      group_add_cmd_prefix = ['pw', 'group', 'add']      pkg_cmd_install_prefix = ["pkg", "install"]      pkg_cmd_remove_prefix = ["pkg", "remove"] +    pkg_cmd_update_prefix = ["pkg", "update"]      def _select_hostname(self, hostname, fqdn):          # Should be FQDN if available. See rc.conf(5) in FreeBSD | 
