docs: def upgrade(reboot=False, at_time=None):
      '''
      Upgrade the kernel and optionally reboot the system.
  
      reboot : False
          Request a reboot if a new kernel is available.
  
      at_time : immediate
          Schedule the reboot at some point in the future. This argument
          is ignored if ``reboot=False``. See
          :py:func:`~salt.modules.system.reboot` for more details
          on this argument.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' kernelpkg.upgrade
          salt '*' kernelpkg.upgrade reboot=True at_time=1
  
      .. note::
          An immediate reboot often shuts down the system before the minion has a
          chance to return, resulting in errors. A minimal delay (1 minute) is
          useful to ensure the result is delivered to the master.
      '''
      result = __salt__['pkg.upgrade'](name=_package_name())
      _needs_reboot = needs_reboot()
  
      ret = {
          'upgrades': result,
          'active': active(),
          'latest_installed': latest_installed(),
          'reboot_requested': reboot,
          'reboot_required': _needs_reboot
      }
  
      if reboot and _needs_reboot:
          log.warning('Rebooting system due to kernel upgrade')
          __salt__['system.reboot'](at_time=at_time)
  
      return ret