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

[APP-7026] Handle rfkill, no-wifi-device cases #44

Merged
merged 1 commit into from
Nov 20, 2024
Merged

[APP-7026] Handle rfkill, no-wifi-device cases #44

merged 1 commit into from
Nov 20, 2024

Conversation

Otterverse
Copy link
Member

This fixes two cases... the first, in the bug, is when the wifi is blocked by rfkill (aka, "airplane mode".) This has recently (past week) become the default for new Raspberry Pi image installs unless the user specifically adds a wifi network during the image creation process.

The second case is for devices that have no wifi adapters at all. Previously, results were undefined, and provisioning would continue trying to execute, scan, start hotspots, etc. even if that wasn't possible. Now the lack of wifi hardware causes provisioning to self-disable until the next restart of agent.

@@ -4,7 +4,7 @@ go 1.23.1

require (
github.com/Masterminds/semver/v3 v3.3.0
github.com/Otterverse/gonetworkmanager/v2 v2.2.0
github.com/Otterverse/gonetworkmanager/v2 v2.2.1
Copy link
Member Author

Choose a reason for hiding this comment

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

Small patch over there to add GetPropertyRadioFlags()


timeoutCtx, cancel := context.WithTimeout(ctx, time.Second*10)
defer cancel()
for {
Copy link
Member Author

Choose a reason for hiding this comment

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

Without this loop the first scan fails and throws an error, as it takes a couple seconds for the radio to power on.

@@ -332,12 +332,3 @@ func ConvertAttributes[T any](attributes *structpb.Struct) (*T, error) {

return newConfig, nil
}

func Sleep(ctx context.Context, timeout time.Duration) bool {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is just drive-by cleanup. Nothing uses this anymore.

@@ -124,6 +124,18 @@ func (w *Provisioning) getNM() (gnm.NetworkManager, error) {
return nil, nmErr
}

flags, err := nm.GetPropertyRadioFlags()
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

👍

@Otterverse Otterverse merged commit 6a29e3d into main Nov 20, 2024
1 check passed
@Otterverse Otterverse deleted the rfkill branch November 20, 2024 20:51
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.

2 participants