Updated host_software_installs table.

This commit is contained in:
Victor Lyuboslavsky
2024-09-06 09:49:27 -05:00
parent ea10d43e93
commit 54840414a2
19 changed files with 210 additions and 112 deletions
+1 -1
View File
@@ -415,7 +415,7 @@ func (svc *Service) InstallSoftwareTitle(ctx context.Context, hostID uint, softw
if err != nil {
return ctxerr.Wrapf(ctx, err, "getting last install data for host %d and installer %d", host.ID, installer.InstallerID)
}
if lastInstallRequest != nil && lastInstallRequest.Status != nil && *lastInstallRequest.Status == fleet.SoftwareInstallerPending {
if lastInstallRequest != nil && lastInstallRequest.Status != nil && *lastInstallRequest.Status == fleet.SoftwareInstallPending {
return &fleet.BadRequestError{
Message: "Couldn't install software. Host has a pending install request.",
InternalErr: ctxerr.WrapWithData(
@@ -6,8 +6,10 @@ export const INSTALL_DETAILS_STATUS_ICONS: Record<
IconNames
> = {
pending: "pending-outline",
pending_install: "pending-outline",
installed: "success-outline",
failed: "error-outline",
failed_install: "error-outline",
} as const;
const INSTALL_DETAILS_STATUS_PREDICATES: Record<
@@ -15,20 +17,22 @@ const INSTALL_DETAILS_STATUS_PREDICATES: Record<
string
> = {
pending: "is installing or will install",
pending_install: "is installing or will install",
installed: "installed",
failed: "failed to install",
failed_install: "failed to install",
} as const;
export const getInstallDetailsStatusPredicate = (
status: string | undefined
) => {
if (!status) {
return INSTALL_DETAILS_STATUS_PREDICATES.pending;
return INSTALL_DETAILS_STATUS_PREDICATES.pending_install;
}
return (
INSTALL_DETAILS_STATUS_PREDICATES[
status.toLowerCase() as SoftwareInstallStatus
] || INSTALL_DETAILS_STATUS_PREDICATES.pending
] || INSTALL_DETAILS_STATUS_PREDICATES.pending_install
);
};
+6
View File
@@ -196,8 +196,10 @@ export const formatSoftwareType = ({
*/
export const SOFTWARE_INSTALL_STATUSES = [
"failed",
"failed_install",
"installed",
"pending",
"pending_install",
] as const;
/*
@@ -284,8 +286,10 @@ export type IDeviceSoftware = IHostSoftware;
const INSTALL_STATUS_PREDICATES: Record<SoftwareInstallStatus, string> = {
failed: "failed to install",
failed_install: "failed to install",
installed: "installed",
pending: "told Fleet to install",
pending_install: "told Fleet to install",
} as const;
export const getInstallStatusPredicate = (status: string | undefined) => {
@@ -300,8 +304,10 @@ export const getInstallStatusPredicate = (status: string | undefined) => {
export const INSTALL_STATUS_ICONS: Record<SoftwareInstallStatus, IconNames> = {
pending: "pending-outline",
pending_install: "pending-outline",
installed: "success-outline",
failed: "error-outline",
failed_install: "error-outline",
} as const;
type IHostSoftwarePackageWithLastInstall = IHostSoftwarePackage & {
@@ -108,6 +108,11 @@ const STATUS_DISPLAY_OPTIONS: Record<
iconName: "pending-outline",
tooltip: "Fleet is installing or will install when the host comes online.",
},
pending_install: {
displayName: "Pending",
iconName: "pending-outline",
tooltip: "Fleet will install software when these hosts come online.",
},
failed: {
displayName: "Failed",
iconName: "error",
@@ -119,6 +124,11 @@ const STATUS_DISPLAY_OPTIONS: Record<
</>
),
},
failed_install: {
displayName: "Failed",
iconName: "error",
tooltip: "Fleet failed to install software on these hosts.",
},
};
interface IPackageStatusCountProps {
@@ -45,6 +45,11 @@ export const INSTALL_STATUS_DISPLAY_OPTIONS: Record<
tooltip: () =>
"Fleet is installing or will install when the host comes online.",
},
pending_install: {
iconName: "pending-outline",
displayText: "Pending",
tooltip: () => "Fleet will install software when the host comes online.",
},
failed: {
iconName: "error",
displayText: "Failed",
@@ -56,6 +61,16 @@ export const INSTALL_STATUS_DISPLAY_OPTIONS: Record<
</>
),
},
failed_install: {
iconName: "error",
displayText: "Failed",
tooltip: ({ lastInstalledAt: lastInstall }) => (
<>
Fleet failed to install software ({dateAgo(lastInstall as string)} ago).
Select <b>Actions &gt; Software details</b> to see more.
</>
),
},
avaiableForInstall: {
iconName: "install",
displayText: "Available for install",
@@ -33,6 +33,11 @@ const STATUS_CONFIG: Record<SoftwareInstallStatus, IStatusDisplayConfig> = {
displayText: "Pending",
tooltip: () => "Fleet is installing software.",
},
pending_install: {
iconName: "pending-outline",
displayText: "Install in progress...",
tooltip: () => "Software installation in progress...",
},
failed: {
iconName: "error",
displayText: "Failed",
@@ -44,6 +49,17 @@ const STATUS_CONFIG: Record<SoftwareInstallStatus, IStatusDisplayConfig> = {
</>
),
},
failed_install: {
iconName: "error",
displayText: "Failed",
tooltip: ({ lastInstalledAt = "" }) => (
<>
Software failed to install
{lastInstalledAt ? ` (${dateAgo(lastInstalledAt)})` : ""}. Select{" "}
<b>Retry</b> to install again, or contact your IT department.
</>
),
},
};
interface IInstallerInfoProps {
+3 -3
View File
@@ -404,9 +404,9 @@ WHERE
"installed_software_type": fleet.ActivityTypeInstalledSoftware{}.ActivityName(),
"installed_app_store_app_type": fleet.ActivityInstalledAppStoreApp{}.ActivityName(),
"max_wait_time": seconds,
"software_status_failed": string(fleet.SoftwareInstallerFailed),
"software_status_installed": string(fleet.SoftwareInstallerInstalled),
"software_status_pending": string(fleet.SoftwareInstallerPending),
"software_status_failed": string(fleet.SoftwareInstallFailed),
"software_status_installed": string(fleet.SoftwareInstalled),
"software_status_pending": string(fleet.SoftwareInstallPending),
})
if err != nil {
return nil, nil, ctxerr.Wrap(ctx, err, "build list query from named args")
@@ -16,9 +16,10 @@ func Up_20240903155740(tx *sql.Tx) error {
if _, err := tx.Exec(`
ALTER TABLE software_installers
ADD COLUMN package_ids TEXT COLLATE utf8mb4_unicode_ci NOT NULL,
ADD COLUMN uninstall_script_content_id int unsigned NOT NULL
ADD COLUMN uninstall_script_content_id int unsigned NOT NULL,
MODIFY COLUMN uploaded_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)
`); err != nil {
return fmt.Errorf("failed to add package_ids to software_installers: %w", err)
return fmt.Errorf("failed to alter software_installers: %w", err)
}
txx := sqlx.Tx{Tx: tx, Mapper: reflectx.NewMapperFunc("db", sqlx.NameMapper)}
@@ -40,7 +41,7 @@ ADD COLUMN uninstall_script_content_id int unsigned NOT NULL
}
if _, err := tx.Exec(`UPDATE software_installers SET uninstall_script_content_id = ? WHERE platform IN ('windows')`,
windowsScriptID); err != nil {
return fmt.Errorf("failed to update software installers: %w", err)
return fmt.Errorf("failed to update windows software installers: %w", err)
}
// Add foreign key
@@ -53,6 +54,47 @@ ADD CONSTRAINT fk_uninstall_script_content_id
return fmt.Errorf("failed to add foreign key to software_installers: %w", err)
}
if _, err := tx.Exec(`
ALTER TABLE host_software_installs
ADD COLUMN uninstall_script_output TEXT COLLATE utf8mb4_unicode_ci,
ADD COLUMN uninstall_script_exit_code INT DEFAULT NULL,
ADD COLUMN uninstall TINYINT UNSIGNED NOT NULL DEFAULT 0,
ADD COLUMN status VARCHAR(31) GENERATED ALWAYS AS (
CASE
WHEN removed = 1 THEN NULL
WHEN post_install_script_exit_code IS NOT NULL AND
post_install_script_exit_code = 0 THEN 'installed'
WHEN post_install_script_exit_code IS NOT NULL AND
post_install_script_exit_code != 0 THEN 'failed_install'
WHEN install_script_exit_code IS NOT NULL AND
install_script_exit_code = 0 THEN 'installed'
WHEN install_script_exit_code IS NOT NULL AND
install_script_exit_code != 0 THEN 'failed_install'
WHEN pre_install_query_output IS NOT NULL AND
pre_install_query_output = '' THEN 'failed_install'
WHEN host_id IS NOT NULL AND uninstall = 0 THEN 'pending_install'
WHEN uninstall_script_exit_code IS NOT NULL AND
uninstall_script_exit_code != 0 THEN 'failed_uninstall'
WHEN host_id IS NOT NULL AND uninstall = 1 THEN 'pending_uninstall'
ELSE NULL -- not installed from Fleet installer or successfully uninstalled
END
) STORED NULL,
MODIFY COLUMN created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
MODIFY COLUMN updated_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
MODIFY COLUMN host_deleted_at TIMESTAMP(6) NULL DEFAULT NULL
`); err != nil {
return fmt.Errorf("failed to alter host_software_installs: %w", err)
}
return nil
}
+8 -7
View File
@@ -2218,9 +2218,11 @@ AND EXISTS (SELECT 1 FROM software s JOIN software_cve scve ON scve.software_id
hs.host_id = :host_id AND
s.title_id = st.id
) OR `
status := fmt.Sprintf(`COALESCE(%s, %s)`, "hsi.status", vppAppHostStatusNamedQuery("hvsi", "ncr", ""))
if opts.OnlyAvailableForInstall {
// Get software that has a package/VPP installer but was not installed with Fleet
softwareIsInstalledOnHostClause = ` status IS NULL AND (si.id IS NOT NULL OR vat.adam_id IS NOT NULL) AND ` + softwareIsInstalledOnHostClause
softwareIsInstalledOnHostClause = fmt.Sprintf(` %s IS NULL AND (si.id IS NOT NULL OR vat.adam_id IS NOT NULL) AND %s`, status,
softwareIsInstalledOnHostClause)
}
// this statement lists only the software that is reported as installed on
@@ -2240,7 +2242,7 @@ AND EXISTS (SELECT 1 FROM software s JOIN software_cve scve ON scve.software_id
COALESCE(hsi.created_at, hvsi.created_at) as last_install_installed_at,
COALESCE(hsi.execution_id, hvsi.command_uuid) as last_install_install_uuid,
-- get either the softare installer status or the vpp app status
COALESCE(%s, %s) as status
%s as status
FROM
software_titles st
LEFT OUTER JOIN
@@ -2276,8 +2278,7 @@ AND EXISTS (SELECT 1 FROM software s JOIN software_cve scve ON scve.software_id
( %s hsi.host_id IS NOT NULL OR hvsi.host_id IS NOT NULL )
%s
%s
`, softwareInstallerHostStatusNamedQuery("hsi", ""), vppAppHostStatusNamedQuery("hvsi", "ncr", ""),
softwareIsInstalledOnHostClause, onlySelfServiceClause, onlyVulnerableClause)
`, status, softwareIsInstalledOnHostClause, onlySelfServiceClause, onlyVulnerableClause)
// this statement lists only the software that has never been installed nor
// attempted to be installed on the host, but that is available to be
@@ -2369,9 +2370,9 @@ AND EXISTS (SELECT 1 FROM software s JOIN software_cve scve ON scve.software_id
namedArgs := map[string]any{
"host_id": host.ID,
"host_platform": host.FleetPlatform(),
"software_status_failed": fleet.SoftwareInstallerFailed,
"software_status_pending": fleet.SoftwareInstallerPending,
"software_status_installed": fleet.SoftwareInstallerInstalled,
"software_status_failed": fleet.SoftwareInstallFailed,
"software_status_pending": fleet.SoftwareInstallPending,
"software_status_installed": fleet.SoftwareInstalled,
"mdm_status_acknowledged": fleet.MDMAppleStatusAcknowledged,
"mdm_status_error": fleet.MDMAppleStatusError,
"mdm_status_format_error": fleet.MDMAppleStatusCommandFormatError,
+15 -15
View File
@@ -388,9 +388,9 @@ WHERE
stmt, args, err := sqlx.Named(query, map[string]any{
"execution_id": resultsUUID,
"software_status_failed": fleet.SoftwareInstallerFailed,
"software_status_pending": fleet.SoftwareInstallerPending,
"software_status_installed": fleet.SoftwareInstallerInstalled,
"software_status_failed": fleet.SoftwareInstallFailed,
"software_status_pending": fleet.SoftwareInstallPending,
"software_status_installed": fleet.SoftwareInstalled,
})
if err != nil {
return nil, ctxerr.Wrap(ctx, err, "build named query for get software install results")
@@ -437,9 +437,9 @@ WHERE
query, args, err := sqlx.Named(stmt, map[string]interface{}{
"installer_id": installerID,
"software_status_pending": fleet.SoftwareInstallerPending,
"software_status_failed": fleet.SoftwareInstallerFailed,
"software_status_installed": fleet.SoftwareInstallerInstalled,
"software_status_pending": fleet.SoftwareInstallPending,
"software_status_failed": fleet.SoftwareInstallFailed,
"software_status_installed": fleet.SoftwareInstalled,
})
if err != nil {
return nil, ctxerr.Wrap(ctx, err, "get summary host software installs: named query")
@@ -478,9 +478,9 @@ WHERE
"status": status,
"adam_id": appID.AdamID,
"platform": appID.Platform,
"software_status_installed": fleet.SoftwareInstallerInstalled,
"software_status_failed": fleet.SoftwareInstallerFailed,
"software_status_pending": fleet.SoftwareInstallerPending,
"software_status_installed": fleet.SoftwareInstalled,
"software_status_failed": fleet.SoftwareInstallFailed,
"software_status_pending": fleet.SoftwareInstallPending,
"mdm_status_acknowledged": fleet.MDMAppleStatusAcknowledged,
"mdm_status_error": fleet.MDMAppleStatusError,
"mdm_status_format_error": fleet.MDMAppleStatusCommandFormatError,
@@ -510,9 +510,9 @@ WHERE
return sqlx.Named(stmt, map[string]interface{}{
"status": status,
"installer_id": installerID,
"software_status_installed": fleet.SoftwareInstallerInstalled,
"software_status_failed": fleet.SoftwareInstallerFailed,
"software_status_pending": fleet.SoftwareInstallerPending,
"software_status_installed": fleet.SoftwareInstalled,
"software_status_failed": fleet.SoftwareInstallFailed,
"software_status_pending": fleet.SoftwareInstallPending,
})
}
@@ -533,9 +533,9 @@ func (ds *Datastore) GetHostLastInstallData(ctx context.Context, hostID, install
stmt, args, err := sqlx.Named(stmt, map[string]interface{}{
"host_id": hostID,
"installer_id": installerID,
"software_status_installed": fleet.SoftwareInstallerInstalled,
"software_status_failed": fleet.SoftwareInstallerFailed,
"software_status_pending": fleet.SoftwareInstallerPending,
"software_status_installed": fleet.SoftwareInstalled,
"software_status_failed": fleet.SoftwareInstallFailed,
"software_status_pending": fleet.SoftwareInstallPending,
})
if err != nil {
return nil, ctxerr.Wrap(ctx, err, "build named query to get host last install data")
@@ -228,7 +228,7 @@ func testSoftwareInstallRequests(t *testing.T, ds *Datastore) {
userTeamFilter := fleet.TeamFilter{
User: &fleet.User{GlobalRole: ptr.String("admin")},
}
expectStatus := fleet.SoftwareInstallerPending
expectStatus := fleet.SoftwareInstallPending
hosts, err := ds.ListHosts(ctx, userTeamFilter, fleet.HostListOptions{
ListOptions: fleet.ListOptions{PerPage: 100},
SoftwareTitleIDFilter: installerMeta.TitleID,
@@ -271,27 +271,27 @@ func testGetSoftwareInstallResult(t *testing.T, ds *Datastore) {
}{
{
name: "pending install",
expectedStatus: fleet.SoftwareInstallerPending,
expectedStatus: fleet.SoftwareInstallPending,
postInstallScriptOutput: ptr.String("post install output"),
installScriptOutput: ptr.String("install output"),
},
{
name: "failing install post install script",
expectedStatus: fleet.SoftwareInstallerFailed,
expectedStatus: fleet.SoftwareInstallFailed,
postInstallScriptEC: ptr.Int(1),
postInstallScriptOutput: ptr.String("post install output"),
installScriptOutput: ptr.String("install output"),
},
{
name: "failing install install script",
expectedStatus: fleet.SoftwareInstallerFailed,
expectedStatus: fleet.SoftwareInstallFailed,
installScriptEC: ptr.Int(1),
postInstallScriptOutput: ptr.String("post install output"),
installScriptOutput: ptr.String("install output"),
},
{
name: "failing install pre install query",
expectedStatus: fleet.SoftwareInstallerFailed,
expectedStatus: fleet.SoftwareInstallFailed,
preInstallQueryOutput: ptr.String(""),
postInstallScriptOutput: ptr.String("post install output"),
installScriptOutput: ptr.String("install output"),
@@ -792,7 +792,7 @@ func testGetHostLastInstallData(t *testing.T, ds *Datastore) {
require.NotNil(t, host1LastInstall)
require.Equal(t, installUUID1, host1LastInstall.ExecutionID)
require.NotNil(t, host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallerPending, *host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallPending, *host1LastInstall.Status)
// Set result of last installation.
err = ds.SetHostSoftwareInstallResult(ctx, &fleet.HostSoftwareInstallResultPayload{
@@ -809,7 +809,7 @@ func testGetHostLastInstallData(t *testing.T, ds *Datastore) {
require.NotNil(t, host1LastInstall)
require.Equal(t, installUUID1, host1LastInstall.ExecutionID)
require.NotNil(t, host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallerInstalled, *host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstalled, *host1LastInstall.Status)
// Install installer2.pkg on host1.
installUUID2, err := ds.InsertSoftwareInstallRequest(ctx, host1.ID, softwareInstallerID2, false)
@@ -822,14 +822,14 @@ func testGetHostLastInstallData(t *testing.T, ds *Datastore) {
require.NotNil(t, host1LastInstall)
require.Equal(t, installUUID1, host1LastInstall.ExecutionID)
require.NotNil(t, host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallerInstalled, *host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstalled, *host1LastInstall.Status)
// Last installation for installer2.pkg should be "pending".
host1LastInstall, err = ds.GetHostLastInstallData(ctx, host1.ID, softwareInstallerID2)
require.NoError(t, err)
require.NotNil(t, host1LastInstall)
require.Equal(t, installUUID2, host1LastInstall.ExecutionID)
require.NotNil(t, host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallerPending, *host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallPending, *host1LastInstall.Status)
// Perform another installation of installer1.pkg.
installUUID3, err := ds.InsertSoftwareInstallRequest(ctx, host1.ID, softwareInstallerID1, false)
@@ -842,7 +842,7 @@ func testGetHostLastInstallData(t *testing.T, ds *Datastore) {
require.NotNil(t, host1LastInstall)
require.Equal(t, installUUID3, host1LastInstall.ExecutionID)
require.NotNil(t, host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallerPending, *host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallPending, *host1LastInstall.Status)
// Set result of last installer1.pkg installation.
err = ds.SetHostSoftwareInstallResult(ctx, &fleet.HostSoftwareInstallResultPayload{
@@ -859,7 +859,7 @@ func testGetHostLastInstallData(t *testing.T, ds *Datastore) {
require.NotNil(t, host1LastInstall)
require.Equal(t, installUUID3, host1LastInstall.ExecutionID)
require.NotNil(t, host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallerFailed, *host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallFailed, *host1LastInstall.Status)
// No installations on host2.
host2LastInstall, err := ds.GetHostLastInstallData(ctx, host2.ID, softwareInstallerID1)
+12 -12
View File
@@ -3541,7 +3541,7 @@ func testListHostSoftware(t *testing.T, ds *Datastore) {
expected[byNSV[b].Name+byNSV[b].Source] = fleet.HostSoftwareWithInstaller{
Name: "b",
Source: "apps",
Status: expectStatus(fleet.SoftwareInstallerPending),
Status: expectStatus(fleet.SoftwareInstallPending),
SoftwarePackage: &fleet.SoftwarePackageOrApp{Name: "installer-0.pkg", Version: "v0.0.0", SelfService: ptr.Bool(true), LastInstall: &fleet.HostSoftwareInstall{InstallUUID: "uuid1"}},
InstalledVersions: []*fleet.HostSoftwareInstalledVersion{
{Version: byNSV[b].Version, Vulnerabilities: []string{vulns[3].CVE}, InstalledPaths: []string{installPaths[2]}},
@@ -3550,7 +3550,7 @@ func testListHostSoftware(t *testing.T, ds *Datastore) {
i0 := fleet.HostSoftwareWithInstaller{
Name: "i0",
Source: "apps",
Status: expectStatus(fleet.SoftwareInstallerInstalled),
Status: expectStatus(fleet.SoftwareInstalled),
SoftwarePackage: &fleet.SoftwarePackageOrApp{Name: "installer-1.pkg", Version: "v1.0.0", SelfService: ptr.Bool(true), LastInstall: &fleet.HostSoftwareInstall{InstallUUID: "uuid2"}},
}
expected[i0.Name+i0.Source] = i0
@@ -3558,7 +3558,7 @@ func testListHostSoftware(t *testing.T, ds *Datastore) {
i1 := fleet.HostSoftwareWithInstaller{
Name: "i1",
Source: "apps",
Status: expectStatus(fleet.SoftwareInstallerFailed),
Status: expectStatus(fleet.SoftwareInstallFailed),
SoftwarePackage: &fleet.SoftwarePackageOrApp{Name: "installer-2.pkg", Version: "v2.0.0", SelfService: ptr.Bool(false), LastInstall: &fleet.HostSoftwareInstall{InstallUUID: "uuid3"}},
}
expected[i1.Name+i1.Source] = i1
@@ -3642,7 +3642,7 @@ func testListHostSoftware(t *testing.T, ds *Datastore) {
expected[byNSV[b].Name+byNSV[b].Source] = fleet.HostSoftwareWithInstaller{
Name: "b",
Source: "apps",
Status: expectStatus(fleet.SoftwareInstallerFailed),
Status: expectStatus(fleet.SoftwareInstallFailed),
SoftwarePackage: &fleet.SoftwarePackageOrApp{Name: "installer-0.pkg", Version: "v0.0.0", SelfService: ptr.Bool(true), LastInstall: &fleet.HostSoftwareInstall{InstallUUID: "uuid1"}},
InstalledVersions: []*fleet.HostSoftwareInstalledVersion{
{Version: byNSV[b].Version, Vulnerabilities: []string{vulns[3].CVE}, InstalledPaths: []string{installPaths[2]}},
@@ -3651,7 +3651,7 @@ func testListHostSoftware(t *testing.T, ds *Datastore) {
expected[i1.Name+i1.Source] = fleet.HostSoftwareWithInstaller{
Name: "i1",
Source: "apps",
Status: expectStatus(fleet.SoftwareInstallerPending),
Status: expectStatus(fleet.SoftwareInstallPending),
SoftwarePackage: &fleet.SoftwarePackageOrApp{Name: "installer-2.pkg", Version: "v2.0.0", SelfService: ptr.Bool(false), LastInstall: &fleet.HostSoftwareInstall{InstallUUID: "uuid4"}},
}
expectedAvailableOnly[byNSV[b].Name+byNSV[b].Source] = expected[byNSV[b].Name+byNSV[b].Source]
@@ -3775,13 +3775,13 @@ func testListHostSoftware(t *testing.T, ds *Datastore) {
expected["vpp1apps"] = fleet.HostSoftwareWithInstaller{
Name: "vpp1",
Source: "apps",
Status: expectStatus(fleet.SoftwareInstallerInstalled),
Status: expectStatus(fleet.SoftwareInstalled),
AppStoreApp: &fleet.SoftwarePackageOrApp{AppStoreID: vpp1, SelfService: ptr.Bool(false), LastInstall: &fleet.HostSoftwareInstall{CommandUUID: vpp1CmdUUID}},
}
expected["vpp2apps"] = fleet.HostSoftwareWithInstaller{
Name: "vpp2",
Source: "apps",
Status: expectStatus(fleet.SoftwareInstallerPending),
Status: expectStatus(fleet.SoftwareInstallPending),
AppStoreApp: &fleet.SoftwarePackageOrApp{AppStoreID: vpp2, SelfService: ptr.Bool(false), LastInstall: &fleet.HostSoftwareInstall{CommandUUID: vpp2bCmdUUID}},
}
@@ -3826,7 +3826,7 @@ func testListHostSoftware(t *testing.T, ds *Datastore) {
"vpp1apps": {
Name: "vpp1",
Source: "apps",
Status: expectStatus(fleet.SoftwareInstallerPending),
Status: expectStatus(fleet.SoftwareInstallPending),
AppStoreApp: &fleet.SoftwarePackageOrApp{AppStoreID: vpp1, SelfService: ptr.Bool(false), LastInstall: &fleet.HostSoftwareInstall{CommandUUID: vpp1TmCmdUUID}},
},
}, sw, true)
@@ -3847,13 +3847,13 @@ func testListHostSoftware(t *testing.T, ds *Datastore) {
"i1apps": {
Name: "i1",
Source: "apps",
Status: expectStatus(fleet.SoftwareInstallerPending),
Status: expectStatus(fleet.SoftwareInstallPending),
SoftwarePackage: &fleet.SoftwarePackageOrApp{Name: "installer-2.pkg", Version: "v2.0.0", SelfService: ptr.Bool(false), LastInstall: &fleet.HostSoftwareInstall{InstallUUID: otherHostI1UUID}},
},
"i2apps": {
Name: "i2",
Source: "apps",
Status: expectStatus(fleet.SoftwareInstallerPending),
Status: expectStatus(fleet.SoftwareInstallPending),
SoftwarePackage: &fleet.SoftwarePackageOrApp{Name: "installer-3.pkg", Version: "v3.0.0", SelfService: ptr.Bool(false), LastInstall: &fleet.HostSoftwareInstall{InstallUUID: otherHostI2UUID}},
},
}
@@ -4204,13 +4204,13 @@ func testListIOSHostSoftware(t *testing.T, ds *Datastore) {
expected["vpp1ios_apps"] = fleet.HostSoftwareWithInstaller{
Name: "vpp1",
Source: "ios_apps",
Status: expectStatus(fleet.SoftwareInstallerInstalled),
Status: expectStatus(fleet.SoftwareInstalled),
AppStoreApp: &fleet.SoftwarePackageOrApp{AppStoreID: vpp1, SelfService: ptr.Bool(false), LastInstall: &fleet.HostSoftwareInstall{CommandUUID: vpp1CmdUUID}},
}
expected["vpp2ios_apps"] = fleet.HostSoftwareWithInstaller{
Name: "vpp2",
Source: "ios_apps",
Status: expectStatus(fleet.SoftwareInstallerPending),
Status: expectStatus(fleet.SoftwareInstallPending),
AppStoreApp: &fleet.SoftwarePackageOrApp{AppStoreID: vpp2, SelfService: ptr.Bool(false), LastInstall: &fleet.HostSoftwareInstall{CommandUUID: vpp2bCmdUUID}},
}
+8 -8
View File
@@ -100,9 +100,9 @@ WHERE
"mdm_status_acknowledged": fleet.MDMAppleStatusAcknowledged,
"mdm_status_error": fleet.MDMAppleStatusError,
"mdm_status_format_error": fleet.MDMAppleStatusCommandFormatError,
"software_status_pending": fleet.SoftwareInstallerPending,
"software_status_failed": fleet.SoftwareInstallerFailed,
"software_status_installed": fleet.SoftwareInstallerInstalled,
"software_status_pending": fleet.SoftwareInstallPending,
"software_status_failed": fleet.SoftwareInstallFailed,
"software_status_installed": fleet.SoftwareInstalled,
})
if err != nil {
return nil, ctxerr.Wrap(ctx, err, "get summary host vpp installs: named query")
@@ -518,8 +518,8 @@ WHERE
listStmt, args, err := sqlx.Named(stmt, map[string]any{
"command_uuid": commandResults.CommandUUID,
"software_status_failed": string(fleet.SoftwareInstallerFailed),
"software_status_installed": string(fleet.SoftwareInstallerInstalled),
"software_status_failed": string(fleet.SoftwareInstallFailed),
"software_status_installed": string(fleet.SoftwareInstalled),
})
if err != nil {
return nil, nil, ctxerr.Wrap(ctx, err, "build list query from named args")
@@ -546,14 +546,14 @@ WHERE
var status string
switch commandResults.Status {
case fleet.MDMAppleStatusAcknowledged:
status = string(fleet.SoftwareInstallerInstalled)
status = string(fleet.SoftwareInstalled)
case fleet.MDMAppleStatusCommandFormatError:
case fleet.MDMAppleStatusError:
status = string(fleet.SoftwareInstallerFailed)
status = string(fleet.SoftwareInstallFailed)
default:
// This case shouldn't happen (we should only be doing this check if the command is in a
// "terminal" state, but adding it so we have a default
status = string(fleet.SoftwareInstallerPending)
status = string(fleet.SoftwareInstallPending)
}
act := &fleet.ActivityInstalledAppStoreApp{
+17 -13
View File
@@ -125,17 +125,21 @@ type SoftwareInstallerStatusSummary struct {
type SoftwareInstallerStatus string
const (
SoftwareInstallerPending SoftwareInstallerStatus = "pending"
SoftwareInstallerFailed SoftwareInstallerStatus = "failed"
SoftwareInstallerInstalled SoftwareInstallerStatus = "installed"
SoftwareInstallPending SoftwareInstallerStatus = "pending_install"
SoftwareInstallFailed SoftwareInstallerStatus = "failed_install"
SoftwareInstalled SoftwareInstallerStatus = "installed"
SoftwareUninstallPending SoftwareInstallerStatus = "pending_uninstall"
SoftwareUninstallFailed SoftwareInstallerStatus = "failed_uninstall"
)
func (s SoftwareInstallerStatus) IsValid() bool {
switch s {
case
SoftwareInstallerFailed,
SoftwareInstallerInstalled,
SoftwareInstallerPending:
SoftwareUninstallPending,
SoftwareUninstallFailed,
SoftwareInstallFailed,
SoftwareInstalled,
SoftwareInstallPending:
return true
default:
return false
@@ -220,7 +224,7 @@ Rolled back successfully
// EnhanceOutputDetails is used to add extra boilerplate/information to the
// output fields so they're easier to consume by users.
func (h *HostSoftwareInstallerResult) EnhanceOutputDetails() {
if h.Status == SoftwareInstallerPending {
if h.Status == SoftwareInstallPending {
return
}
@@ -416,17 +420,17 @@ type HostSoftwareInstallResultPayload struct {
func (h *HostSoftwareInstallResultPayload) Status() SoftwareInstallerStatus {
switch {
case h.PostInstallScriptExitCode != nil && *h.PostInstallScriptExitCode == 0:
return SoftwareInstallerInstalled
return SoftwareInstalled
case h.PostInstallScriptExitCode != nil && *h.PostInstallScriptExitCode != 0:
return SoftwareInstallerFailed
return SoftwareInstallFailed
case h.InstallScriptExitCode != nil && *h.InstallScriptExitCode == 0:
return SoftwareInstallerInstalled
return SoftwareInstalled
case h.InstallScriptExitCode != nil && *h.InstallScriptExitCode != 0:
return SoftwareInstallerFailed
return SoftwareInstallFailed
case h.PreInstallConditionOutput != nil && *h.PreInstallConditionOutput == "":
return SoftwareInstallerFailed
return SoftwareInstallFailed
default:
return SoftwareInstallerPending
return SoftwareInstallPending
}
}
+9 -9
View File
@@ -89,7 +89,7 @@ func TestEnhanceOutputDetails(t *testing.T) {
{
name: "pending status",
initial: HostSoftwareInstallerResult{
Status: SoftwareInstallerPending,
Status: SoftwareInstallPending,
},
expectedPreInstallQueryOutput: nil,
expectedOutput: nil,
@@ -98,7 +98,7 @@ func TestEnhanceOutputDetails(t *testing.T) {
{
name: "non-pending status with empty PreInstallQueryOutput",
initial: HostSoftwareInstallerResult{
Status: SoftwareInstallerInstalled,
Status: SoftwareInstalled,
PreInstallQueryOutput: ptr.String(""),
},
expectedPreInstallQueryOutput: ptr.String(SoftwareInstallerQueryFailCopy),
@@ -108,7 +108,7 @@ func TestEnhanceOutputDetails(t *testing.T) {
{
name: "non-pending status with non-empty PreInstallQueryOutput",
initial: HostSoftwareInstallerResult{
Status: SoftwareInstallerInstalled,
Status: SoftwareInstalled,
PreInstallQueryOutput: ptr.String("Some output"),
},
expectedPreInstallQueryOutput: ptr.String(SoftwareInstallerQuerySuccessCopy),
@@ -118,7 +118,7 @@ func TestEnhanceOutputDetails(t *testing.T) {
{
name: "non-pending status with nil PreInstallQueryOutput",
initial: HostSoftwareInstallerResult{
Status: SoftwareInstallerInstalled,
Status: SoftwareInstalled,
},
expectedPreInstallQueryOutput: nil,
expectedOutput: nil,
@@ -127,7 +127,7 @@ func TestEnhanceOutputDetails(t *testing.T) {
{
name: "non-pending status with install scripts disabled",
initial: HostSoftwareInstallerResult{
Status: SoftwareInstallerInstalled,
Status: SoftwareInstalled,
InstallScriptExitCode: ptr.Int(-2),
Output: ptr.String(""),
},
@@ -138,7 +138,7 @@ func TestEnhanceOutputDetails(t *testing.T) {
{
name: "non-pending status with failed install script",
initial: HostSoftwareInstallerResult{
Status: SoftwareInstallerFailed,
Status: SoftwareInstallFailed,
InstallScriptExitCode: ptr.Int(1),
Output: ptr.String("Some install output"),
},
@@ -149,7 +149,7 @@ func TestEnhanceOutputDetails(t *testing.T) {
{
name: "non-pending status with successful install script",
initial: HostSoftwareInstallerResult{
Status: SoftwareInstallerInstalled,
Status: SoftwareInstalled,
InstallScriptExitCode: ptr.Int(0),
Output: ptr.String("Some install output"),
},
@@ -160,7 +160,7 @@ func TestEnhanceOutputDetails(t *testing.T) {
{
name: "non-pending status with successful post install script",
initial: HostSoftwareInstallerResult{
Status: SoftwareInstallerInstalled,
Status: SoftwareInstalled,
InstallScriptExitCode: ptr.Int(0),
Output: ptr.String("Some install output"),
PostInstallScriptExitCode: ptr.Int(0),
@@ -173,7 +173,7 @@ func TestEnhanceOutputDetails(t *testing.T) {
{
name: "non-pending status with failed post install script",
initial: HostSoftwareInstallerResult{
Status: SoftwareInstallerInstalled,
Status: SoftwareInstalled,
InstallScriptExitCode: ptr.Int(0),
Output: ptr.String("Some install output"),
PostInstallScriptExitCode: ptr.Int(1),
+18 -18
View File
@@ -9974,7 +9974,7 @@ func (s *integrationEnterpriseTestSuite) TestListHostSoftware() {
require.NotNil(t, getHostSw.Software[2].SoftwarePackage)
require.Equal(t, "ruby.deb", getHostSw.Software[2].SoftwarePackage.Name)
require.NotNil(t, getHostSw.Software[2].Status)
require.Equal(t, fleet.SoftwareInstallerPending, *getHostSw.Software[2].Status)
require.Equal(t, fleet.SoftwareInstallPending, *getHostSw.Software[2].Status)
require.NotNil(t, getHostSw.Software[2].SoftwarePackage.SelfService)
require.True(t, *getHostSw.Software[2].SoftwarePackage.SelfService)
@@ -9995,7 +9995,7 @@ func (s *integrationEnterpriseTestSuite) TestListHostSoftware() {
require.Equal(t, getDeviceSw.Software[2].Name, "ruby")
require.Len(t, getDeviceSw.Software[1].InstalledVersions, 2)
require.NotNil(t, getDeviceSw.Software[2].Status)
require.Equal(t, fleet.SoftwareInstallerPending, *getDeviceSw.Software[2].Status)
require.Equal(t, fleet.SoftwareInstallPending, *getDeviceSw.Software[2].Status)
require.NotNil(t, getDeviceSw.Software[2].SoftwarePackage)
require.Nil(t, getDeviceSw.Software[2].AppStoreApp)
require.NotNil(t, getDeviceSw.Software[2].SoftwarePackage.SelfService)
@@ -10852,7 +10852,7 @@ func (s *integrationEnterpriseTestSuite) TestSoftwareInstallerHostRequests() {
require.NotNil(t, getHostSoftwareResp.Software[0].SoftwarePackage)
require.NotNil(t, getHostSoftwareResp.Software[0].SoftwarePackage.LastInstall)
require.NotNil(t, getHostSoftwareResp.Software[0].Status)
require.Equal(t, fleet.SoftwareInstallerPending, *getHostSoftwareResp.Software[0].Status)
require.Equal(t, fleet.SoftwareInstallPending, *getHostSoftwareResp.Software[0].Status)
installUUID := getHostSoftwareResp.Software[0].SoftwarePackage.LastInstall.InstallUUID
gsirr := getSoftwareInstallResultsResponse{}
@@ -10861,7 +10861,7 @@ func (s *integrationEnterpriseTestSuite) TestSoftwareInstallerHostRequests() {
require.NotNil(t, gsirr.Results)
results := gsirr.Results
require.Equal(t, installUUID, results.InstallUUID)
require.Equal(t, fleet.SoftwareInstallerPending, results.Status)
require.Equal(t, fleet.SoftwareInstallPending, results.Status)
// create 3 more hosts, will have statuses installed, failed and one with two
// install requests - one failed and the latest install pending
@@ -11047,7 +11047,7 @@ func (s *integrationEnterpriseTestSuite) TestSoftwareInstallerHostRequests() {
require.NotNil(t, gsirr.Results)
results = gsirr.Results
require.Equal(t, installUUID, results.InstallUUID)
require.Equal(t, fleet.SoftwareInstallerPending, results.Status)
require.Equal(t, fleet.SoftwareInstallPending, results.Status)
}
func (s *integrationEnterpriseTestSuite) TestSelfServiceSoftwareInstall() {
@@ -11099,7 +11099,7 @@ func (s *integrationEnterpriseTestSuite) TestSelfServiceSoftwareInstall() {
require.Equal(t, host1.ID, details.HostID)
require.Equal(t, details.SoftwareTitle, payloadSS.Title)
require.True(t, details.SelfService)
require.EqualValues(t, fleet.SoftwareInstallerPending, details.Status)
require.EqualValues(t, fleet.SoftwareInstallPending, details.Status)
installID := details.InstallUUID
// record the installation results
@@ -11129,7 +11129,7 @@ func (s *integrationEnterpriseTestSuite) TestSelfServiceSoftwareInstall() {
require.Equal(t, host1.ID, details.HostID)
require.Equal(t, details.SoftwareTitle, payloadSS.Title)
require.True(t, details.SelfService)
require.EqualValues(t, fleet.SoftwareInstallerInstalled, details.Status)
require.EqualValues(t, fleet.SoftwareInstalled, details.Status)
}
func (s *integrationEnterpriseTestSuite) TestHostSoftwareInstallResult() {
@@ -11216,7 +11216,7 @@ func (s *integrationEnterpriseTestSuite) TestHostSoftwareInstallResult() {
checkResults(result{
HostID: host.ID,
InstallUUID: installUUIDs[0],
Status: fleet.SoftwareInstallerFailed,
Status: fleet.SoftwareInstallFailed,
PreInstallQueryOutput: ptr.String(fleet.SoftwareInstallerQuerySuccessCopy),
Output: ptr.String(fmt.Sprintf(fleet.SoftwareInstallerInstallFailCopy, "failed")),
})
@@ -11226,7 +11226,7 @@ func (s *integrationEnterpriseTestSuite) TestHostSoftwareInstallResult() {
SoftwareTitle: payload.Title,
SoftwarePackage: payload.Filename,
InstallUUID: installUUIDs[0],
Status: string(fleet.SoftwareInstallerFailed),
Status: string(fleet.SoftwareInstallFailed),
}
s.lastActivityMatches(wantAct.ActivityName(), string(jsonMustMarshal(t, wantAct)), 0)
@@ -11240,7 +11240,7 @@ func (s *integrationEnterpriseTestSuite) TestHostSoftwareInstallResult() {
checkResults(result{
HostID: host.ID,
InstallUUID: installUUIDs[1],
Status: fleet.SoftwareInstallerFailed,
Status: fleet.SoftwareInstallFailed,
PreInstallQueryOutput: ptr.String(fleet.SoftwareInstallerQueryFailCopy),
})
wantAct = fleet.ActivityTypeInstalledSoftware{
@@ -11249,7 +11249,7 @@ func (s *integrationEnterpriseTestSuite) TestHostSoftwareInstallResult() {
SoftwareTitle: payload2.Title,
SoftwarePackage: payload2.Filename,
InstallUUID: installUUIDs[1],
Status: string(fleet.SoftwareInstallerFailed),
Status: string(fleet.SoftwareInstallFailed),
}
s.lastActivityOfTypeMatches(wantAct.ActivityName(), string(jsonMustMarshal(t, wantAct)), 0)
@@ -11267,7 +11267,7 @@ func (s *integrationEnterpriseTestSuite) TestHostSoftwareInstallResult() {
checkResults(result{
HostID: host.ID,
InstallUUID: installUUIDs[2],
Status: fleet.SoftwareInstallerInstalled,
Status: fleet.SoftwareInstalled,
PreInstallQueryOutput: ptr.String(fleet.SoftwareInstallerQuerySuccessCopy),
Output: ptr.String(fmt.Sprintf(fleet.SoftwareInstallerInstallSuccessCopy, "success")),
PostInstallScriptOutput: ptr.String(fmt.Sprintf(fleet.SoftwareInstallerPostInstallSuccessCopy, "ok")),
@@ -11278,7 +11278,7 @@ func (s *integrationEnterpriseTestSuite) TestHostSoftwareInstallResult() {
SoftwareTitle: payload3.Title,
SoftwarePackage: payload3.Filename,
InstallUUID: installUUIDs[2],
Status: string(fleet.SoftwareInstallerInstalled),
Status: string(fleet.SoftwareInstalled),
}
lastActID := s.lastActivityOfTypeMatches(wantAct.ActivityName(), string(jsonMustMarshal(t, wantAct)), 0)
@@ -13128,7 +13128,7 @@ func (s *integrationEnterpriseTestSuite) TestPolicyAutomationsSoftwareInstallers
require.NotNil(t, host1LastInstall)
require.NotEmpty(t, host1LastInstall.ExecutionID)
require.NotNil(t, host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallerPending, *host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallPending, *host1LastInstall.Status)
prevExecutionID := host1LastInstall.ExecutionID
// Request a manual installation on the host for the same installer, which should fail.
@@ -13152,7 +13152,7 @@ func (s *integrationEnterpriseTestSuite) TestPolicyAutomationsSoftwareInstallers
require.NotNil(t, host1LastInstall)
require.Equal(t, prevExecutionID, host1LastInstall.ExecutionID)
require.NotNil(t, host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallerPending, *host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallPending, *host1LastInstall.Status)
// Submit same results but policy1Team1 now passes,
// and then submit again but policy1Team1 fails.
@@ -13181,7 +13181,7 @@ func (s *integrationEnterpriseTestSuite) TestPolicyAutomationsSoftwareInstallers
require.NotNil(t, host1LastInstall)
require.Equal(t, prevExecutionID, host1LastInstall.ExecutionID)
require.NotNil(t, host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallerPending, *host1LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallPending, *host1LastInstall.Status)
// host2Team1 is failing policy2Team1 and policy3Team1 policies.
distributedResp = submitDistributedQueryResultsResponse{}
@@ -13198,7 +13198,7 @@ func (s *integrationEnterpriseTestSuite) TestPolicyAutomationsSoftwareInstallers
require.NotNil(t, host2LastInstall)
require.NotEmpty(t, host2LastInstall.ExecutionID)
require.NotNil(t, host2LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallerPending, *host2LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallPending, *host2LastInstall.Status)
// Associate fleet-osquery.msi to policy4Team2.
mtplr = modifyTeamPolicyResponse{}
@@ -13222,7 +13222,7 @@ func (s *integrationEnterpriseTestSuite) TestPolicyAutomationsSoftwareInstallers
require.NotNil(t, host3LastInstall)
require.NotEmpty(t, host3LastInstall.ExecutionID)
require.NotNil(t, host3LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallerPending, *host3LastInstall.Status)
require.Equal(t, fleet.SoftwareInstallPending, *host3LastInstall.Status)
host3LastInstallDetails, err := s.ds.GetSoftwareInstallDetails(ctx, host3LastInstall.ExecutionID)
require.NoError(t, err)
// Even if fleet-osquery.msi was uploaded as Self-service, it was installed by Fleet, so
+8 -8
View File
@@ -10580,7 +10580,7 @@ func (s *integrationMDMTestSuite) TestVPPApps() {
errApp.Name,
errApp.AdamID,
failedCmdUUID,
fleet.SoftwareInstallerFailed,
fleet.SoftwareInstallFailed,
),
0,
)
@@ -10627,7 +10627,7 @@ func (s *integrationMDMTestSuite) TestVPPApps() {
addedApp.Name,
addedApp.AdamID,
cmdUUID,
fleet.SoftwareInstallerInstalled,
fleet.SoftwareInstalled,
),
0,
)
@@ -10646,12 +10646,12 @@ func (s *integrationMDMTestSuite) TestVPPApps() {
require.Empty(t, got1.AppStoreApp.Name) // Name is only present for installer packages
require.Equal(t, got1.AppStoreApp.Version, addedApp.LatestVersion)
require.NotNil(t, got1.Status)
require.Equal(t, *got1.Status, fleet.SoftwareInstallerInstalled)
require.Equal(t, *got1.Status, fleet.SoftwareInstalled)
require.Equal(t, got1.AppStoreApp.LastInstall.CommandUUID, cmdUUID)
require.NotNil(t, got1.AppStoreApp.LastInstall.InstalledAt)
require.Equal(t, got2.Name, "App 2")
require.NotNil(t, got2.Status)
require.Equal(t, *got2.Status, fleet.SoftwareInstallerFailed)
require.Equal(t, *got2.Status, fleet.SoftwareInstallFailed)
require.NotNil(t, got2.AppStoreApp)
require.Equal(t, got2.AppStoreApp.AppStoreID, errApp.AdamID)
require.Equal(t, got2.AppStoreApp.IconURL, ptr.String(errApp.IconURL))
@@ -10673,7 +10673,7 @@ func (s *integrationMDMTestSuite) TestVPPApps() {
require.Empty(t, got1.AppStoreApp.Name)
require.Equal(t, got1.AppStoreApp.Version, addedApp.LatestVersion)
require.NotNil(t, got1.Status)
require.Equal(t, *got1.Status, fleet.SoftwareInstallerInstalled)
require.Equal(t, *got1.Status, fleet.SoftwareInstalled)
require.Equal(t, got1.AppStoreApp.LastInstall.CommandUUID, cmdUUID)
require.NotNil(t, got1.AppStoreApp.LastInstall.InstalledAt)
@@ -10804,7 +10804,7 @@ func (s *integrationMDMTestSuite) TestVPPApps() {
app.Name,
app.AdamID,
cmdUUID,
fleet.SoftwareInstallerPending,
fleet.SoftwareInstallPending,
install.deviceToken != "",
),
string(*hostActivitiesResp.Activities[0].Details),
@@ -10832,7 +10832,7 @@ func (s *integrationMDMTestSuite) TestVPPApps() {
app.Name,
app.AdamID,
cmdUUID,
fleet.SoftwareInstallerInstalled,
fleet.SoftwareInstalled,
install.deviceToken != "",
),
0,
@@ -10852,7 +10852,7 @@ func (s *integrationMDMTestSuite) TestVPPApps() {
require.Equal(t, got1.AppStoreApp.IconURL, ptr.String(app.IconURL))
require.Empty(t, got1.AppStoreApp.Name) // Name is only present for installer packages
require.Equal(t, got1.AppStoreApp.Version, app.LatestVersion)
require.Equal(t, *got1.Status, fleet.SoftwareInstallerInstalled)
require.Equal(t, *got1.Status, fleet.SoftwareInstalled)
require.Equal(t, got1.AppStoreApp.LastInstall.CommandUUID, cmdUUID)
require.NotNil(t, got1.AppStoreApp.LastInstall.InstalledAt)
foundInstalledApp = true
+1 -1
View File
@@ -992,7 +992,7 @@ func (svc *Service) SaveHostSoftwareInstallResult(ctx context.Context, result *f
return ctxerr.Wrap(ctx, err, "save host software installation result")
}
if status := result.Status(); status != fleet.SoftwareInstallerPending {
if status := result.Status(); status != fleet.SoftwareInstallPending {
hsi, err := svc.ds.GetSoftwareInstallResults(ctx, result.InstallUUID)
if err != nil {
return ctxerr.Wrap(ctx, err, "get host software installation result information")
+1 -1
View File
@@ -1713,7 +1713,7 @@ func (svc *Service) processSoftwareForNewlyFailingPolicies(
}
// hostLastInstall.Status == nil can happen when a software is installed by Fleet and later removed.
if hostLastInstall != nil && hostLastInstall.Status != nil &&
*hostLastInstall.Status == fleet.SoftwareInstallerPending {
*hostLastInstall.Status == fleet.SoftwareInstallPending {
// There's a pending install for this host and installer,
// thus we do not queue another install request.
level.Debug(svc.logger).Log(