trivial: in the not enough information case show an URL

This commit is contained in:
Mario Limonciello 2022-08-29 12:22:50 -05:00 committed by Mario Limonciello
parent a44fc42cf6
commit a56b5b2d36
3 changed files with 28 additions and 10 deletions

View File

@ -140,6 +140,16 @@ A safe baseline for security should be HSI-1. If your system isn't at least meet
The command line tool `fwupdmgr security` included with fwupd 1.8.4 or later will make individual recommendations on what you can do for individual test failures. GUI tools built against `libfwupd` 1.8.4 or later may also make these recommendation as well.
<a id="not-enough-info"></a>
## [Not enough information](#not-enough-info)
HSI calculations require that the SOC, firmware, and kernel provide enough data to the fwupd daemon about the state of the system. If any HSI test that runs on the system declares it's *missing data* then the client will show a message like this:
**Not enough data was provided to make an HSI calculation.**
The HSI level will also be set to `INVALID` indicating this.
<a id="tests"></a>
## [Tests included in fwupd](#tests)

View File

@ -2927,16 +2927,20 @@ fu_util_security(FuUtilPrivate *priv, gchar **values, GError **error)
items = fu_security_attrs_get_all(attrs);
for (guint j = 0; j < items->len; j++) {
FwupdSecurityAttr *attr = g_ptr_array_index(items, j);
g_autofree gchar *err_str = NULL;
if (!fwupd_security_attr_has_flag(attr, FWUPD_SECURITY_ATTR_FLAG_MISSING_DATA))
continue;
if (priv->flags & FWUPD_INSTALL_FLAG_FORCE)
continue;
g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"Not enough data was provided to make an HSI calculation. "
"To ignore this warning, use --force.");
err_str = g_strdup_printf(
"\n%s\n » %s\n%s",
/* TRANSLATORS: error message to tell someone they can't use this feature */
_("Not enough data was provided to make an HSI calculation."),
"https://fwupd.github.io/hsi.html#not-enough-info",
/* TRANSLATORS: message to tell someone how to ignore error */
_("To ignore this warning, use --force"));
g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, err_str);
return FALSE;
}

View File

@ -3456,16 +3456,20 @@ fu_util_security(FuUtilPrivate *priv, gchar **values, GError **error)
for (guint j = 0; j < attrs->len; j++) {
FwupdSecurityAttr *attr = g_ptr_array_index(attrs, j);
g_autofree gchar *err_str = NULL;
if (!fwupd_security_attr_has_flag(attr, FWUPD_SECURITY_ATTR_FLAG_MISSING_DATA))
continue;
if (priv->flags & FWUPD_INSTALL_FLAG_FORCE)
continue;
g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"Not enough data was provided to make an HSI calculation. "
"To ignore this warning, use --force");
err_str = g_strdup_printf(
"\n%s\n » %s\n%s",
/* TRANSLATORS: error message to tell someone they can't use this feature */
_("Not enough data was provided to make an HSI calculation."),
"https://fwupd.github.io/hsi.html#not-enough-info",
/* TRANSLATORS: message to tell someone how to ignore error */
_("To ignore this warning, use --force"));
g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, err_str);
return FALSE;
}