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

Create task for initial device provisioning #13102

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

AlexVelezLl
Copy link
Member

Summary

  • Create task for initial device provisioning

Note: Welcome modal for LOD and on my own devices not appearing is not a regression from this PR, and its probably related to the same cause as #13071

References

Closes #12753

Reviewer guidance

Play with the setup wizard and check that the device is successfully provisioned for all its variants

@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... APP: Device Re: Device App (content import/export, facility-syncing, user permissions, etc.) APP: Learn Re: Learn App (content, quizzes, lessons, etc.) APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) DEV: frontend labels Feb 21, 2025
Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

Let's leave the task API untouched for now, this close to release!

throw new Error('Device provisioning task not found');
}
if (task.status === TaskStatuses.COMPLETED) {
const facilityId = task.result.facility_id;
Copy link
Member

Choose a reason for hiding this comment

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

Add this to the extra_metadata instead, rather than updating the API endpoint to return result.

@@ -100,6 +100,7 @@ def _job_to_response(self, job):
"args": job.args,
"kwargs": job.kwargs,
"extra_metadata": job.extra_metadata,
"result": job.result,
Copy link
Member

Choose a reason for hiding this comment

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

Let's not add this, and just utilize extra_metadata instead.

provision_device(**provisioning_data)

schedule_ping() # Trigger telemetry pingback after we've provisioned

Copy link
Member

Choose a reason for hiding this comment

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

job = get_current_job()
if job:
    job.update_metadata(facility_id=facility.id)

self.client.get(initialize_url)
data = self._default_provision_data()
del data["superuser"]
data.update({"auth_token": "test"})
Copy link
Member Author

Choose a reason for hiding this comment

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

@rtibbles with the new task implementation, I am not handling this case. Should we do it?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we want to make sure that after the task is run, the osuser is properly assigned.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@AlexVelezLl
Copy link
Member Author

Thanks @rtibbles! I have updated the PR using the extra_metadata instead. I have also removed the old api endpoint.

@pcenov
Copy link
Member

pcenov commented Feb 25, 2025

Hi @AlexVelezLl, when testing the setup flows between 2 Ubuntu VMs, everything is working correctly.
However when I tried with an Android device then I noticed that basically nothing is working:

  1. Setting up the device through 'On my own' is not functioning as I'm getting a Type error: Cannot read properties of undefined (reading 'username')
onmyown.webm

Logs: onmyownlogs.zip and on-my-own-logcat.txt

  1. Setting up the device as a Learn-only is also not working, getting the following error: Type error: Cannot read properties of undefined (reading 'response')

lod-logs.zip
lod-logcat.txt

  1. I'm getting the same error for the Full device setup as well.

Here are the Ubuntu server logs, in case you need those too: server-logs.zip

@rtibbles rtibbles self-assigned this Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Device Re: Device App (content import/export, facility-syncing, user permissions, etc.) APP: Learn Re: Learn App (content, quizzes, lessons, etc.) APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) DEV: backend Python, databases, networking, filesystem... DEV: frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle initial device provisioning in an async task rather than a synchronous API request
3 participants