@@ -12,7 +12,6 @@ import (
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/fleetdm/fleet/v4/orbit/pkg/profiles"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
@@ -47,12 +46,11 @@ Please contact your IT admin [here]({{ .ContactURL }}).
|
||||
// swiftDialog.
|
||||
type baseDialog struct {
|
||||
path string
|
||||
fleetURL string
|
||||
interruptCh chan struct{}
|
||||
}
|
||||
|
||||
func newBaseDialog(path, fleetURL string) *baseDialog {
|
||||
return &baseDialog{path: path, fleetURL: fleetURL, interruptCh: make(chan struct{})}
|
||||
func newBaseDialog(path string) *baseDialog {
|
||||
return &baseDialog{path: path, interruptCh: make(chan struct{})}
|
||||
}
|
||||
|
||||
func (b *baseDialog) CanRun() bool {
|
||||
@@ -61,17 +59,7 @@ func (b *baseDialog) CanRun() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// we perform this check locally on the client too to avoid showing the
|
||||
// dialog if the client has already migrated but the Fleet server
|
||||
// doesn't know about this state yet.
|
||||
enrolled, err := profiles.IsEnrolledIntoMatchingURL(b.fleetURL)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("fetching enrollment status to show swiftDialog")
|
||||
return false
|
||||
}
|
||||
|
||||
// only run the dialog if the host is not enrolled into Fleet
|
||||
return !enrolled
|
||||
return true
|
||||
}
|
||||
|
||||
// Exit sends the interrupt signal to try and stop the current swiftDialog
|
||||
@@ -139,10 +127,10 @@ func (b *baseDialog) render(flags ...string) (chan swiftDialogExitCode, chan err
|
||||
return exitCodeCh, errCh
|
||||
}
|
||||
|
||||
func NewMDMMigrator(path, fleetURL string, frequency time.Duration, handler MDMMigratorHandler) MDMMigrator {
|
||||
func NewMDMMigrator(path string, frequency time.Duration, handler MDMMigratorHandler) MDMMigrator {
|
||||
return &swiftDialogMDMMigrator{
|
||||
handler: handler,
|
||||
baseDialog: newBaseDialog(path, fleetURL),
|
||||
baseDialog: newBaseDialog(path),
|
||||
frequency: frequency,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ package useraction
|
||||
|
||||
import "time"
|
||||
|
||||
func NewMDMMigrator(path, fleetURL string, frequency time.Duration, handler MDMMigratorHandler) MDMMigrator {
|
||||
func NewMDMMigrator(path string, frequency time.Duration, handler MDMMigratorHandler) MDMMigrator {
|
||||
return &NoopMDMMigrator{}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user