Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MDM migration flow with offline dialog #21274

Merged
merged 23 commits into from
Aug 13, 2024

Conversation

gillespi314
Copy link
Contributor

@gillespi314 gillespi314 commented Aug 13, 2024

Replaces #21209 (because the commit history got all messed up by a bad rebase attempt)

Copy link
Contributor

@roperzh roperzh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, left some comments that can be fixed in a follow up

@@ -60,6 +61,10 @@ func setupRunners() {
}

func main() {
// FIXME: we need to do a better job of graceful shutdown, releasing resources, stopping
// tickers, etc. (https://github.com/fleetdm/fleet/issues/21256)
ctx, cancel := context.WithCancel(context.Background())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit and a question:

  1. Is this meant to be used as a general purpose context? if yes ctx makes sense, if no, could we rename it?
  2. Should we rename cancel now that's called way down below?

@@ -57,7 +57,7 @@ func (rw *ReadWriter) RemoveFile() error {
}

func (rw *ReadWriter) GetMigrationType() (string, error) {
data, err := rw.read()
data, err := rw.read() // TODO: confirm error handling with jahziel, what about other errors?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sanity check: have you folks decided here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is referring to this function previously swallowing all errors that
weren'tErrNotExist. I updated it in one of my PRs to return the error correctly.

select {
case <-ctx.Done():
log.Debug().Msg("dialog context canceled")
// TODO: do we care about this? anything we need to clean up?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

baseDialog has a method Exit() that's supposed to send a signal to kill swiftDialog, should we call it here?

Comment on lines +811 to +816
if !m.props.DisableTakeover {
flags = append(flags,
"--blurscreen",
"--ontop",
)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: those are handled by the inner baseDialog, correct? so technically not required here? only asking because it was a tiny bit confused and had to go back to the other definition

Copy link

codecov bot commented Aug 13, 2024

Codecov Report

Attention: Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.

Please upload report for BASE (feat-mdm-migration-updates@6664822). Learn more about missing BASE report.

Files Patch % Lines
orbit/pkg/migration/readwriter.go 0.00% 9 Missing ⚠️
orbit/pkg/useraction/mdm_migration_notdarwin.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                      @@
##             feat-mdm-migration-updates   #21274   +/-   ##
=============================================================
  Coverage                              ?   54.10%           
=============================================================
  Files                                 ?     1458           
  Lines                                 ?   137833           
  Branches                              ?     3349           
=============================================================
  Hits                                  ?    74577           
  Misses                                ?    57198           
  Partials                              ?     6058           
Flag Coverage Δ
backend 54.21% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -192,6 +194,46 @@ func main() {
migrateMDMItem.Hide()
}

// TODO: we can probably extract this into a function that sets up both the migrator and the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this worth doing now? I'd say yes but not too big a deal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jahzielv, do you want to give that a try as follow up in the feature branch?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@@ -581,3 +598,222 @@ func (m *swiftDialogMDMMigrator) MigrationInProgress() (bool, error) {
func (m *swiftDialogMDMMigrator) MarkMigrationCompleted() error {
return m.mrw.RemoveFile()
}

// StartMDMMigrationOfflineWatcher starts a watcher running on a 3-minute loop that checks if the
// device goes offline in the process of migrating to Fleet's MDM and offline. If so, it shows a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo I think?

Suggested change
// device goes offline in the process of migrating to Fleet's MDM and offline. If so, it shows a
// device goes offline in the process of migrating to Fleet's MDM and is offline. If so, it shows a


log.Debug().Msgf("offline dialog, device is unmanaged, migration type %s", mt)

// TODO: Maybe check show profiles and skip showing the dialog if the device is managed?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alas, this will have to wait for another day as profiles show requires root :'(

@gillespi314 gillespi314 merged commit 73658dd into feat-mdm-migration-updates Aug 13, 2024
53 of 57 checks passed
@gillespi314 gillespi314 deleted the mdm-migration-offline-dialog branch August 13, 2024 17:59
@gillespi314
Copy link
Contributor Author

Lint and other comments will be addressed separately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants