diff --git a/cmd/installer/subcommands/installer/command.go b/cmd/installer/subcommands/installer/command.go index 2a8b4d7efed69..3cb901b3ecb19 100644 --- a/cmd/installer/subcommands/installer/command.go +++ b/cmd/installer/subcommands/installer/command.go @@ -31,7 +31,7 @@ const ( // Commands returns the installer subcommands. func Commands(_ *command.GlobalParams) []*cobra.Command { - return []*cobra.Command{bootstrapCommand(), installCommand(), removeCommand(), installExperimentCommand(), removeExperimentCommand(), promoteExperimentCommand(), garbageCollectCommand(), purgeCommand()} + return []*cobra.Command{bootstrapCommand(), installCommand(), removeCommand(), installExperimentCommand(), removeExperimentCommand(), promoteExperimentCommand(), garbageCollectCommand(), purgeCommand(), isInstalledCommand()} } type cmd struct { @@ -312,7 +312,7 @@ const ( ReturnCodeIsInstalledFalse = 10 ) -func isInstalled() *cobra.Command { +func isInstalledCommand() *cobra.Command { cmd := &cobra.Command{ Use: "is-installed ", Short: "Check if a package is installed", diff --git a/pkg/fleet/daemon/daemon_test.go b/pkg/fleet/daemon/daemon_test.go index 3b45b185dbec3..9183cb4381f99 100644 --- a/pkg/fleet/daemon/daemon_test.go +++ b/pkg/fleet/daemon/daemon_test.go @@ -28,7 +28,7 @@ type testPackageManager struct { } func (m *testPackageManager) IsInstalled(ctx context.Context, pkg string) (bool, error) { - args := m.Called(pkg) + args := m.Called(ctx, pkg) return args.Bool(0), args.Error(1) } diff --git a/pkg/fleet/internal/exec/installer_exec.go b/pkg/fleet/internal/exec/installer_exec.go index 7e3e0030a454b..f12595b6e3547 100644 --- a/pkg/fleet/internal/exec/installer_exec.go +++ b/pkg/fleet/internal/exec/installer_exec.go @@ -121,6 +121,7 @@ func (i *InstallerExec) GarbageCollect(ctx context.Context) (err error) { return cmd.Run() } +// IsInstalled checks if a package is installed. func (i *InstallerExec) IsInstalled(ctx context.Context, pkg string) (_ bool, err error) { cmd := i.newInstallerCmd(ctx, "is-installed", pkg) defer func() { cmd.span.Finish(tracer.WithError(err)) }()