diff --git a/changes/issue-8002-inform-user-override-agent-options-validation b/changes/issue-8002-inform-user-override-agent-options-validation new file mode 100644 index 000000000..fc1dbb3fe --- /dev/null +++ b/changes/issue-8002-inform-user-override-agent-options-validation @@ -0,0 +1 @@ +- When submitting invalid agent options, inform user how to override agent options using fleetctl force flag diff --git a/frontend/pages/admin/AppSettingsPage/components/OrgSettingsForm/OrgSettingsForm.tsx b/frontend/pages/admin/AppSettingsPage/components/OrgSettingsForm/OrgSettingsForm.tsx index a6415a4da..f518ffbc5 100644 --- a/frontend/pages/admin/AppSettingsPage/components/OrgSettingsForm/OrgSettingsForm.tsx +++ b/frontend/pages/admin/AppSettingsPage/components/OrgSettingsForm/OrgSettingsForm.tsx @@ -82,9 +82,24 @@ const OrgSettingsForm = ({ "Could not connect to SMTP server. Please try again." ); } else if (response?.data.errors) { + const agentOptionsInvalid = + response.data.errors[0].reason.includes( + "unsupported key provided" + ) || + response.data.errors[0].reason.includes("invalid value type"); + renderFlash( "error", - `Could not update settings. ${response.data.errors[0].reason}` + <> + Could not update settings. {response.data.errors[0].reason} + {agentOptionsInvalid && ( + <> +
+ If you’re not using the latest osquery, use the fleetctl + apply --force command to override validation. + + )} + ); } }) diff --git a/frontend/pages/admin/TeamManagementPage/TeamDetailsWrapper/AgentOptionsPage/AgentOptionsPage.tsx b/frontend/pages/admin/TeamManagementPage/TeamDetailsWrapper/AgentOptionsPage/AgentOptionsPage.tsx index 14e8733b4..492b67be4 100644 --- a/frontend/pages/admin/TeamManagementPage/TeamDetailsWrapper/AgentOptionsPage/AgentOptionsPage.tsx +++ b/frontend/pages/admin/TeamManagementPage/TeamDetailsWrapper/AgentOptionsPage/AgentOptionsPage.tsx @@ -109,9 +109,24 @@ const AgentOptionsPage = ({ }) .catch((response: { data: IApiError }) => { console.error(response); + + const agentOptionsInvalid = + response.data.errors[0].reason.includes("unsupported key provided") || + response.data.errors[0].reason.includes("invalid value type"); + return renderFlash( "error", - `Could not update ${teamName} team agent options. ${response.data.errors[0].reason}` + <> + Could not update {teamName} team agent options.{" "} + {response.data.errors[0].reason} + {agentOptionsInvalid && ( + <> +
+ If you’re not using the latest osquery, use the fleetctl apply + --force command to override validation. + + )} + ); }) .finally(() => {