Refactor onboarding script
Description
Click to expand
Who
- Required by: @sntshk
- Initial Developer: @teddylnk1
- Assistant: @dagiopia
How
- Filter out the common commands and processes required to onboard Ubuntu, Debian, Raspbian and Kali OSs including the x86-64 and ARM64 architectures and have a common section where processes shared by these operating systems and architectures will remain the same while the differences such as the address of the APT sources will be per OS and arch basis.
What
- Onboarding script needs heavy refactoring especially the install function which contains redundant commands based on conditions of OS or arch. There is very little different between the OSs and archs since they're all debian based, they use the same package manager and largely have the same commands. The Script needs to be compressed.
- The python script (main.py) also uses extremely redundant code and line by line editing of configuration files to customize to the onboarded machine.
- The JOB_NAME.txt file is overkill for registering selected network and device hostname. The metadata.json file should serve all configuration storage purposes.
- The remove function is too destructive. First, it shouldn't rely on two files named
start.log
andend.log
to decide what to uninstall and what to keep. It's very error prone. In addition, the remove function should prompt the user whether they would like to remove installed dependencies or not for each dependency that's going to be removed.
Why
- Since onboarding is going to be done by the device management app and since that app is going to use the script for the time being, it's best to simplify it as much as possible and as fast as possible for the onboarding functionality implementation within the device mangement app is clear and efficient.
When
- As soon as possible since the goal is to make implementation of the onboarding aspect of the device management app easy which has already started.
Acceptance Criteria
Click to expand
- Code review by @sntshk , @teddylnk1 and @dagiopia
- Functional testing by the dev team
Work Breakdown Structure (WBS)
Task | Description | Duration | Status | Comment |
---|---|---|---|---|
A | Compress the onboarding.sh script by joining all common processes | 8 Hrs | Doing | |
B | Compress main.py by using a better method of creating the metadata.json, client.json and adapter-definition.json | 16 Hrs | To Do | |
C | Improve configuration storage and abandon JOB_NAME.txt | 4 Hrs | To Do | |
D | Improve remove function by prompting the user before uninstalling other software and by relying on a differently formatted manifest file rather than the start.log and end.log files |
x Hrs | To Do | Should we still do it? |
Edited by Santosh Kumar