-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
@@ -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 |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
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.